or
public
JsonResult Scheduler_Create([DataSourceRequest] DataSourceRequest request, SchedulerModel model)
{
Calendar_Entry entry =
new
Calendar_Entry
{
ID=Guid.NewGuid(),
Description=model.Description,
End=model.End,
Begin=model.Start,
CreationTime=DateTime.UtcNow,
UpdateTime=DateTime.UtcNow,
Name=model.Title,
Calendar_ID=model.CalendarID
};
dbContext.Add(entry);
dbContext.SaveChanges();
model.ID = entry.ID;
return
Json(
new
[] { model }.ToDataSourceResult(request, ModelState));
}
@(Html.Kendo().Scheduler<
ViCRM.Models.SchedulerModel
>()
.Name("scheduler")
.Date(DateTime.UtcNow)
.StartTime(new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, 6, 0, 0))
.Height(750)
.Views(views =>
{
views.DayView();
views.WeekView(weekView => weekView.Selected(true));
views.MonthView();
views.AgendaView();
})
.Timezone("Etc/UTC")
.DataSource(d => d
.Model(m =>
{
m.Id(f => f.ID);
})
.Read("Scheduler_Read", "Calendar")
.Create("Scheduler_Create", "Calendar")
.Destroy("Scheduler_Delete", "Calendar")
.Update("Scheduler_Update", "Calendar")
)
.EventTemplateId("EventTemplate")
.Resources(res =>
{
res.Add(m => m.CalendarID).Title("Kalender").DataSource(ds => ds.Read("getCalendars", "Calendar")).DataValueField("Value").DataTextField("Text").DataColorField("Color");
)
01.
@
using
Kendo.Mvc.UI
02.
@model IEnumerable<Forms.Models.Pending>
03.
04.
05.
@{
06.
Layout =
"~/Views/Shared/_Layout.cshtml"
;
07.
}
08.
09.
<h2>Pending</h2>
10.
11.
@(Html.Kendo().Grid(Model)
12.
.Name(
"Grid"
)
13.
.Columns(columns =>
14.
{
15.
columns.Bound(p => p.Name).Groupable(
false
);
16.
columns.Bound(p => p.Number);
18.
columns.Bound(p => p.Status);
21.
columns.Bound(p => p.Analyst);
22.
})
23.
.Editable(editable => editable.Mode(GridEditMode.InCell))
24.
.Pageable()
25.
.Sortable()
26.
.DataSource(dataSource => dataSource
27.
.Ajax()
28.
.Model(model => model.Id(p => p.Id))
29.
.Read(
"Index"
,
"Home"
)
30.
.Update(
"Row_Edit"
,
"Home"
)
31.
)
32.
)
<!DOCTYPE html>
<
html
>
<
head
>
<
title
></
title
>
<
link
href
=
"@Url.Content("
~/Content/kendo/2013.2.716/kendo.common.min.css")"
rel
=
"stylesheet"
/>
<
link
href
=
"@Url.Content("
~/Content/kendo/2013.2.716/kendo.default.min.css")"
rel
=
"stylesheet"
/>
<
link
href
=
"@Url.Content("
~/Content/kendo/2013.2.716/kendo.mobile.flat.min.css")"
rel
=
"stylesheet"
/>
@*<
script
src
=
"~/Scripts/jquery-1.8.2.min.js"
></
script
>*@
<
script
src
=
"@Url.Content("
~/Scripts/kendo/2013.2.716/jquery.min.js")"></
script
>
<
script
src
=
"@Url.Content("
~/Scripts/kendo/2013.2.716/kendo.all.min.js")"></
script
>
<
script
src
=
"@Url.Content("
~/Scripts/kendo/2013.2.716/kendo.aspnetmvc.min.js")"></
script
>
</
head
>
<
body
>
@(Html.Kendo().MobileLayout()
.Name("frontlayout")
.Header(obj =>
Html.Kendo().MobileNavBar()
.Content(navbar =>
@<
text
>
@navbar.ViewTitle("")
</
text
>)
)
.Footer(obj =>
Html.Kendo().MobileTabStrip()
.Items(items =>
{
items.Add().Icon("action").Text("Logout").Url("index", "logout");
})
)
)
@(Html.Kendo().MobileLayout()
.Name("layout")
.Header(obj =>
Html.Kendo().MobileNavBar()
.Content(navbar =>
@<
text
>
@(Html.Kendo().MobileBackButton()
.Align(MobileButtonAlign.Left)
.HtmlAttributes(new { @class = "nav-button" })
.Url(Url.RouteUrl(new { controller = "home" }))
.Text("Back"))
@navbar.ViewTitle("")
</
text
>)
)
.Footer(obj =>
Html.Kendo().MobileTabStrip()
.Items(items =>
{
items.Add().Icon("action").Text("Logout").Url("index", "logout");
})
)
)
@(Html.Kendo().MobileApplication()
.ServerNavigation(false)
.Transition("fade")
.HideAddressBar(true)
.Skin("flat")
)
@RenderBody()
</
body
>
</
html
>
<!-- Style for custom status icon in list -->
<
style
>
.statusicon {
float: right;
margin-right: 50px;
margin-top: 5px;
display: inline-block;
border-width: 1px;
border-radius: 35px;
border-style: solid;
border-color: black;
width: 15px;
height: 1em;
}
.sl-hidden {
display: none;
visibility: hidden;
}
</
style
>
@model Stimline.Xplorer.Mobile.Models.UnitDetailsModel
@Scripts.Render("~/Scripts/jquery.signalR-1.1.2.js")
@Scripts.Render("~/signalr/hubs")
@Scripts.Render("~/Scripts/Stimline/connector.js")
@(Html.Kendo().MobileView()
.Name("unit-list")
.Layout("layout")
.Title("Units")
.Content(
@<
text
>
<
span
class
=
"sl-hidden"
id
=
"signalRconveyanceId"
>@Model.ViewUnitContract.ConveyanceId</
span
>
@ListViewHelper(this)
</
text
>
)
)
@helper ListViewHelper(WebViewPage page)
{
@(Html.Kendo().MobileListView().Name("unitlist").Style("inset").Type("group")
.Items(root =>
{
root.Add().Text("Unit Details").Items(items =>
{
items.Add().Content(@<
text
>
<
label
>
Unit
<
input
type
=
"text"
disabled
=
"disabled"
style
=
"color: black"
value
=
"@Model.ViewUnitContract.Name"
/>
</
label
>
<
li
style
=
"background-color: #@Model.StatusColor"
>
<
label
>
Status
<
input
type
=
"text"
disabled
=
"disabled"
value
=
"@Model.StatusMessage"
style
=
"color: ghostwhite;"
/>
</
label
>
</
li
>
</
text
>);
});
root.Add().Text("Detail information").Items(items =>
{
items.Add().Content(@<
text
>
<
label
>
Depth (m)
<
input
id
=
"signalRdepth"
type
=
"text"
disabled
=
"disabled"
style
=
"color: black"
value
=
"@Math.Round((decimal) Model.ViewUnitContract.CurrentRun.LatestWellLogEntry.Depth, 2)"
/>
</
label
>
<
li
data-icon
=
"recents"
>
<
label
>
Speed (m/min)
<
input
id
=
"signalRspeed"
type
=
"text"
disabled
=
"disabled"
style
=
"color: black"
value
=
"@Math.Round((decimal) Model.ViewUnitContract.CurrentRun.LatestWellLogEntry.Speed, 2)"
/>
</
label
>
</
li
>
<
li
data-icon
=
"recents"
>
<
label
>
Diff Speed (m/min)
<
input
id
=
"signalRdiffSpeed"
type
=
"text"
disabled
=
"disabled"
style
=
"color: black"
value
=
"@Math.Round((decimal) Model.ViewUnitContract.CurrentRun.LatestWellLogEntry.DiffSpeed, 2)"
/>
<!-- DiffSpeed -->
</
label
>
</
li
>
<
li
data-icon
=
"recents"
>
<
label
>
Weight (kg)
<
input
id
=
"signalRtension"
type
=
"text"
disabled
=
"disabled"
style
=
"color: black"
value
=
"@Math.Round((decimal) Model.ViewUnitContract.CurrentRun.LatestWellLogEntry.Tension, 2)"
/>
</
label
>
</
li
>
<
li
data-icon
=
"recents"
>
<
label
>
Diff Weight (kg)
<
input
id
=
"signalRdiffTension"
type
=
"text"
disabled
=
"disabled"
style
=
"color: black"
value
=
"@Math.Round((decimal) Model.ViewUnitContract.CurrentRun.LatestWellLogEntry.DiffTension, 2)"
/>
<!-- DiffTension -->
</
label
>
</
li
>
</
text
>);
});
root.Add().Text("Run Overview").Items(items =>
{
items.Add().Content(@<
text
>
<
label
>
Name
<
input
type
=
"text"
disabled
=
"disabled"
style
=
"color: black"
value
=
"@Model.ViewUnitContract.CurrentRun.Name"
/>
</
label
>
<
li
data-icon
=
"recents"
>
<
label
>
Start time
<
input
type
=
"text"
disabled
=
"disabled"
style
=
"color: black"
value
=
"@Model.ViewUnitContract.CurrentRun.StartTime"
/>
</
label
>
</
li
>
<
li
data-icon
=
"recents"
>
<
label
>
End time
<
input
type
=
"text"
disabled
=
"disabled"
style
=
"color: black"
value
=
"@Model.ViewUnitContract.CurrentRun.EndTime"
/>
</
label
>
</
li
>
</
text
>);
});
root.Add().Text("Project").Items(items =>
{
items.Add().Content(@<
text
>
<
label
>
Operation
<
input
type
=
"text"
disabled
=
"disabled"
style
=
"color: black"
value
=
"@Model.ViewUnitContract.CurrentRun.Operation.Description"
/>
</
label
>
<
li
>
<
label
>
Name
<
input
type
=
"text"
disabled
=
"disabled"
style
=
"color: black"
value
=
"@Model.ViewUnitContract.CurrentRun.Operation.ProjectContract.Name"
/>
</
label
>
</
li
>
</
text
>);
});
root.Add().Text("Well").Items(items =>
{
items.Add().Content(@<
text
>
<
label
>
Name
<
input
type
=
"text"
disabled
=
"disabled"
style
=
"color: black"
value
=
"@Model.ViewUnitContract.CurrentRun.Operation.WellContract.Name"
/>
</
label
>
<
li
>
<
label
>
Location
<
input
type
=
"text"
disabled
=
"disabled"
style
=
"color: black"
value
=
"@Model.ViewUnitContract.CurrentRun.Operation.WellContract.Location"
/>
</
label
>
</
li
>
</
text
>);
});
})
)
}
@(Html.Kendo().Grid<
NewAlta.DataCapture.DataModel.ParameterOverride
>()
.Name("test")
.Columns(columns =>
{
columns.Bound(p => p.CustomerId).Hidden();
columns.ForeignKey(p => p.EquipmentId, (System.Collections.IEnumerable)ViewData["equipments"], "EquipmentId", "Description").Title("Equipment").EditorTemplateName("CustomerEquipmentId");
columns.ForeignKey(p => p.ParameterId, (System.Collections.IEnumerable)ViewData["parameters"], "ParameterId", "ParameterName").Title("Parameter").EditorTemplateName("ParameterId");
columns.Bound(p => p.Limit1).Width(100);
columns.Bound(p => p.Limit2).Width(200);
columns.Bound(p => p.Limit3).Width(200);
columns.Bound(p => p.Limit4).Width(100);
columns.Command(p => p.Edit()).Width(80);
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.InLine))
.AutoBind(false)
// .Navigatable(builder => builder.Enabled(true))
.Events(events =>
{
events.Change("test");
events.Edit("test");
events.Save("test");
})
.Selectable(builder => builder.Mode(GridSelectionMode.Single))
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Events(e => e.Error("errorHandler"))
// omitted for brevity
<
script
type
=
"text/javascript"
>
function errorHandler(e) {
gridErrorHandler(e, "#test");
}
//The below function lies in some js include files.
function gridErrorHandler(args, gridId) {
if (args.errors) {
var message = "We have encountered following errors : \n <
ul
>";
$.each(args.errors, function (key, value) {
if ('errors' in value) {
$.each(value.errors, function () {
//alert(this);
if (this != "" && this != null)
message += "<
li
>" + this + "</
li
> \n ";
});
message += "</
ul
>";
}
});
var kgrid = $(gridId).data("kendoGrid");
kgrid.one('dataBinding', function (e) { //==> if we have only one grid in the view this works. for mutiple grids in view it does not trigger
e.preventDefault(); // cancel grid rebind if error occurs
});
showAlertWindow(message); //==> Some other function used to show kendo window with errror messages.
}
}
</
script
>
@(Html.Kendo().Grid(Model)
.Name("Grid")
.HtmlAttributes(new { style = "font-size:.85em;" })
.Columns(columns =>
{
columns.Bound(p => p.Id).Width(60);
columns.Bound(p => p.Title).Width(250);
columns.Bound(p => p.AssignedUser).Width(120);
})
.Pageable()
.Groupable()
.Sortable()
.Filterable(filterable => filterable
.Extra(false)
.Operators(operators => operators
.ForString(str => str.Clear()
.StartsWith("Starts with")
.Contains("Contains")
.IsEqualTo("Is equal to")
.IsNotEqualTo("Is not equal to")))
)
.Selectable(selectable => selectable
.Mode(GridSelectionMode.Single))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Get", "Grid", new {showAll = ViewBag.ShowAll}))
)
.Events(e => e.Change("onChanged").DataBound("onDataBound"))
)
public class Product
{
[Key]
[ScaffoldColumn(false)]
public int ProductId { get; set; }
public string Name { get; set; }
public int Number { get; set; }
public virtual ICollection<
PurchaseInvoiceDetail
> PurchaseInvoiceDetail { get; set; }
}
public class PurchaseInvoiceDetail
{
[Key]
public int PurchaseInvoiceDetailId { get; set; }
public int Number { get; set; }
public decimal PurchasePrice { get; set; }
//Navigation Properties
public int ProductId { get; set; }
public virtual Product Product { get; set; }
}
window.app =
new
kendo.mobile.Application(document.body, {
layout:
"mainLayout"
,
skin:
"flat"
,
hideAddressBar:
true
,
icon:
"Images/FileName.png"
,
title:
"App Name"
});