private void InitializeChildGridData(GridData gridData, string createAction, string updateAction, string deleteAction, int id, string name) { gridData.ToolBarOptions.DisplayXlsExport = true; gridData.DisplayColumns = new List <GridDisplayColumn>() { new GridDisplayColumn("Name", displayName: "Name", width: 30, editLayoutWidth: 100), new GridDisplayColumn("Description", displayName: "Description", width: 55, editLayoutWidth: 100), new GridDisplayColumn("StartDateTime", displayName: "Start Date", columnType: MVCxGridViewColumnType.DateEdit, width: 7, editLayoutWidth: 100, displayFormat: "g"), new GridDisplayColumn("EndDateTime", displayName: "End Date", columnType: MVCxGridViewColumnType.DateEdit, width: 7, editLayoutWidth: 100, displayFormat: "g"), new GridDisplayColumn("Code", displayName: "Code", width: 0, isVisible: false), new GridDisplayColumn("CreatedBy", displayName: "Created By", isReadOnly: true, width: 0, isVisible: false), new GridDisplayColumn("CreatedDateTime", displayName: "Date Created", columnType: MVCxGridViewColumnType.DateEdit, width: 0, isReadOnly: true, displayFormat: "g", isVisible: false), new GridDisplayColumn("UpdatedBy", displayName: "Updated By", width: 0, isReadOnly: true, isVisible: false), new GridDisplayColumn("UpdatedDateTime", displayName: "Date Updated", columnType: MVCxGridViewColumnType.DateEdit, width: 0, isReadOnly: true, displayFormat: "g", isVisible: false), new GridDisplayColumn("ParentHierarchyId", displayName: "Parent Hierarchy Id", width: 0, isVisible: false) }; gridData.Routes = new List <GridRoute>() { new GridRoute(GridRouteTypes.Add, new { Controller = gridData.Controller, Action = createAction }), new GridRoute(GridRouteTypes.Update, new { Controller = gridData.Controller, Action = updateAction }), new GridRoute(GridRouteTypes.Delete, new { Controller = gridData.Controller, Action = deleteAction }), }; gridData.LayoutColumns = new List <GridEditLayoutColumn>() { new GridEditLayoutColumn("Name", displayName: "Name"), new GridEditLayoutColumn("Description", displayName: "Description"), new GridEditLayoutColumn("StartDateTime", displayName: "Start Date"), new GridEditLayoutColumn("EndDateTime", displayName: "End Date"), new GridEditLayoutColumn("Code", displayName: "Code"), new GridEditLayoutColumn("ParentHierarchyId", displayName: "Parent Hierarchy Id", isVisible: false) }; gridData.FormLayout = new GridEditFormLayout(gridData.LayoutColumns , i => { i.HorizontalAlign = FormLayoutHorizontalAlign.Right; i.Width = System.Web.UI.WebControls.Unit.Percentage(100); }, columnCount: 2); gridData.RowInitializeEvent = (s, e) => { e.NewValues["ParentHierarchyId"] = id; gridData.DefaultNewRowInitializeFields(e); }; gridData.CallBackRoute = new { Controller = gridData.Controller, Action = gridData.Action, oapTypeId = id, oapTypeName = name }; }
private void InitializeSubChildTagGridData(GridData gridData, string createAction, string deleteAction, int id, string name) { gridData.ToolBarOptions.DisplayXlsExport = true; if (ViewData["ChecklistQuestionTags"] == null) { ViewData["ChecklistQuestionTags"] = GetQuestionTags(); } var oapChecklistQuestionTags = ViewData["ChecklistQuestionTags"] as ObservableCollection <OapChecklistQuestionTag>; var oapChecklistQuestionTagsCombo = new GridCombo("OapChecklistQuestionTags", oapChecklistQuestionTags); oapChecklistQuestionTagsCombo.DisplayColumnName = "Tag"; gridData.DisplayColumns = new List <GridDisplayColumn>() { new GridDisplayColumn("OapChecklistQuestionTagId", displayName: "Tag", columnType: MVCxGridViewColumnType.ComboBox, lookup: oapChecklistQuestionTagsCombo, width: 100, editLayoutWidth: 45), new GridDisplayColumn("OapChecklistQuestionId", displayName: "Question", width: 20, isVisible: false), }; gridData.Routes = new List <GridRoute>() { new GridRoute(GridRouteTypes.Add, new { Controller = GridData.Controller, Action = "CreateChecklistQuestionTagMap" }), //new GridRoute(GridRouteTypes.Update, new { Controller = GridData.Controller, Action = "UpdateChecklistQuestionTagMap" }), new GridRoute(GridRouteTypes.Delete, new { Controller = GridData.Controller, Action = "DeleteChecklistQuestionTagMap" }), }; gridData.LayoutColumns = new List <GridEditLayoutColumn>() { new GridEditLayoutColumn("OapChecklistQuestionTagId", displayName: "Tag"), new GridEditLayoutColumn("OapChecklistQuestionId", isVisible: false) }; gridData.FormLayout = new GridEditFormLayout( gridData.LayoutColumns , i => { i.HorizontalAlign = FormLayoutHorizontalAlign.Right; i.Width = System.Web.UI.WebControls.Unit.Percentage(100); } , columnCount: 1); gridData.RowInitializeEvent = (s, e) => { e.NewValues["OapChecklistQuestionId"] = id; gridData.DefaultNewRowInitializeFields(e); }; gridData.CallBackRoute = new { Controller = gridData.Controller, Action = gridData.Action, OapChecklistQuestionId = id, oapChecklistQuestionName = name }; }
protected virtual void InitializeRigChecklistGridData(HtmlHelper html, ViewContext viewContext, GridData gridData, string createAction, string updateAction, string deleteAction) { if (ViewData["Users"] == null) { ViewData["Users"] = CommonUtilities.GetUsers(PeopleClient); } var users = ViewData["Users"] as IEnumerable <Person>; var usersCombo = new GridCombo("Users", users); if (ViewData["Checklists"] == null) { ViewData["Checklists"] = GetChecklistData(true); } var locationLookup = OapUtilities.GetLookup <LocationModel>("Location"); var locations = new GridCombo("Location", locationLookup); if (ViewData["Checklists"] == null) { ViewData["Checklists"] = GetChecklistData(true); } var checklists = ViewData["Checklists"] as IEnumerable <OapChecklist>; var oapChecklistCombo = new GridCombo("OapChecklist", checklists); var lkpList = Ensco.Utilities.UtilitySystem.GetLookupList("Position"); if (lkpList == null) { lkpList = new LookupListModel <dynamic>(); lkpList.Items = new List <object>(); } var items = (lkpList.Items as List <object>)?.Cast <PositionModel>(); if (ViewData["Position"] == null) { ViewData["Position"] = items; } var positions = ViewData["Position"]; var positionsCombo = new GridCombo("PositionModel", positions); gridData.ToolBarOptions.DisplayXlsExport = true; gridData.DisplayColumns = new List <GridDisplayColumn>() { new GridDisplayColumn("Id", displayName: "Checklist Id", order: 10, columnAction: c => { c.FieldName = "Id"; c.Caption = Translate("Checklist Id"); c.Width = Unit.Percentage(5); c.CellStyle.HorizontalAlign = HorizontalAlign.Center; c.EditorProperties().HyperLink(hl => { Session["isChecklistIdClick"] = true; var url = Url.Action("List", gridData.EditController, new RouteValueDictionary(new { Id = "{0}" })); hl.NavigateUrlFormatString = HttpUtility.UrlDecode(url); hl.TextField = "RigChecklistUniqueId"; } ); }, editLayoutWidth: 100, isWidthAndHeightInPercentage: false), new GridDisplayColumn("Title", displayName: "Title", order: 20, width: 20, editLayoutWidth: 100), new GridDisplayColumn("Description", displayName: "Description", order: 30, width: 20, editLayoutWidth: 100, columnType: MVCxGridViewColumnType.Memo), new GridDisplayColumn("OapchecklistId", displayName: "Checklist Type", order: 40, columnType: MVCxGridViewColumnType.ComboBox, lookup: oapChecklistCombo, width: 20, editLayoutWidth: 100), new GridDisplayColumn("OwnerName", displayName: "Lead Assessor", order: 42, columnType: MVCxGridViewColumnType.TextBox, width: 12), new GridDisplayColumn("OwnerId", displayName: "Lead Assessor1", order: 45, columnType: MVCxGridViewColumnType.TextBox, width: 0, editLayoutWidth: 100, columnAction: CommonUtilities.GetPassportColumnAction(html, viewContext, "OwnerId", "Assessor", Translate("Lead Assessor"), users), isVisible: false), new GridDisplayColumn("PositionId", displayName: "Position", columnType: MVCxGridViewColumnType.ComboBox, lookup: positionsCombo, order: 50, width: 12, editLayoutWidth: 100), new GridDisplayColumn("ChecklistDateTime", displayName: "Checklist Date", order: 60, columnType: MVCxGridViewColumnType.DateEdit, width: 25, editLayoutWidth: 100, displayFormat: "g"), new GridDisplayColumn("Status", displayName: "Status", order: 65, width: 15, isReadOnly: true, editLayoutWidth: 100), new GridDisplayColumn("CreatedBy", displayName: "Created By", order: 997, isReadOnly: true, width: 0, isVisible: false), new GridDisplayColumn("CreatedDateTime", displayName: "Date Created", order: 998, columnType: MVCxGridViewColumnType.DateEdit, width: 0, isReadOnly: true, displayFormat: "g", isVisible: false), new GridDisplayColumn("UpdatedBy", displayName: "Updated By", order: 999, width: 0, isReadOnly: true, isVisible: false), new GridDisplayColumn("UpdatedDateTime", displayName: "Date Updated", order: 1000, columnType: MVCxGridViewColumnType.DateEdit, width: 0, isReadOnly: true, displayFormat: "g", isVisible: false), new GridDisplayColumn("RigChecklistUniqueId", displayName: "Checklist Id1", order: 1001, width: 0, isVisible: false), //new GridDisplayColumn("SiteId", displayName:"Site Id", order:1010, width:0, isVisible:false) }; gridData.Routes = new List <GridRoute>() { new GridRoute(GridRouteTypes.Add, new { Controller = gridData.Controller, Action = createAction }), new GridRoute(GridRouteTypes.Update, new { Controller = gridData.Controller, Action = updateAction }), new GridRoute(GridRouteTypes.Delete, new { Controller = gridData.Controller, Action = deleteAction }), }; gridData.LayoutColumns = new List <GridEditLayoutColumn>() { new GridEditLayoutColumn("Title", displayName: "Title", layoutAction: col => { col.Width = Unit.Percentage(100); col.ColumnSpan = 2; }), new GridEditLayoutColumn("Description", displayName: "Description", columnType: MVCxGridViewColumnType.Memo, layoutAction: col => { col.ColumnSpan = 2; col.Width = Unit.Percentage(100); }), new GridEditLayoutColumn("OapchecklistId", displayName: "Checklist Type"), new GridEditLayoutColumn("OwnerId", displayName: "Lead Assessor"), new GridEditLayoutColumn("ChecklistDateTime", displayName: "Date & Time", columnType: MVCxGridViewColumnType.DateEdit), new GridEditLayoutColumn("Status", displayName: "Status", isVisible: false), new GridEditLayoutColumn("RigChecklistUniqueId", isVisible: false), new GridEditLayoutColumn("SiteId", isVisible: false) }; gridData.FormLayout = new GridEditFormLayout( gridData.LayoutColumns , editMode: GridViewEditingMode.PopupEditForm , processLayout: i => { i.ShowUpdateButton = true; i.ShowCancelButton = true; i.HorizontalAlign = FormLayoutHorizontalAlign.Right; } , columnCount: 2 , emptyLayputItemCount: 3 ); gridData.RowInitializeEvent = (s, e) => { e.NewValues["OwnerId"] = UtilitySystem.CurrentUserId; e.NewValues["Status"] = "Open"; e.NewValues["ChecklistDateTime"] = DateTime.UtcNow; //e.NewValues["SiteId"] = UtilitySystem.Settings.ConfigSettings["SiteId"]; gridData.DefaultNewRowInitializeFields(e); }; }
protected virtual GridData InitializeChecklistFindingsGridData(HtmlHelper html) { var action = "DisplayFindings"; var gridData = new GridData(GridConstants.rigChecklistFindingGrid, BaseController, action, "Findings", "AddNewFinding", "Add Finding", "search findings", initializeCallBack: true, historicalRow: false, editController: "FindingsPage", key: "Id"); gridData.ToolBarOptions.DisplayXlsExport = true; if (!EnableSave()) { gridData.SetGridReadOnly(); } if (ViewData["FindingType"] == null) { ViewData["FindingType"] = CommonUtilities.GetFindingTypes(GetClient <FindingTypeClient>()); } if (ViewData["FindingSubType"] == null) { ViewData["FindingSubType"] = CommonUtilities.GetFindingSubTypes(GetClient <FindingSubTypeClient>()); } if (ViewData["Criticalities"] == null) { ViewData["Criticalities"] = CommonUtilities.GetCriticalities(GetClient <LookupClient>()); } var questions = (from q in Questions select q.OapChecklistQuestion).ToList(); var questionsCombo = new GridCombo("QuestionsCombo", Questions, keyColumnName: "Id", displayColumnName: "Question"); var findingTypes = ViewData["FindingType"] as IEnumerable <FindingType>; var findingTypeCombo = new GridCombo("FindingTypeCombo", findingTypes, selectedIndexChangedEvent: "findingTypeOnSelectedeChanged"); var findingSubTypes = ViewData["FindingSubType"] as IEnumerable <FindingSubType>; var criticalities = ViewData["Criticalities"] as IEnumerable <Criticality>; var criticalityCombo = new GridCombo("CriticalitiesCombo", criticalities); //dynamic lkpList = new List<object>(); //var capaItems = new List<CapaLookupModel>(); //if (Session["CapaId"] == null) //{ // lkpList = Ensco.Utilities.UtilitySystem.GetLookupList("Capa"); // lkpList.BoundFieldName = "CapaId"; // lkpList.DisplayField = "ActionRequired"; // Session["CapaId"] = lkpList; //} //else //{ // lkpList = Session["CapaId"]; //} //if (lkpList == null) //{ // lkpList = new LookupListModel<dynamic>(); // lkpList.Items = new List<object>(); //} //else //{ // capaItems.AddRange((lkpList.Items as List<object>)?.Cast<CapaLookupModel>()); //} var displayColumns = new List <GridDisplayColumn> { new GridDisplayColumn("RigChecklistFindingInternalId", order: 10, displayName: "Finding Id", isReadOnly: true, columnAction: c => { c.FieldName = "RigChecklistFindingInternalId"; c.Caption = Translate("Finding Id"); c.CellStyle.HorizontalAlign = HorizontalAlign.Center; c.SetDataItemTemplateContent(container => { html.DevExpress().HyperLink(hl => { var id = DataBinder.Eval(container.DataItem, "Id"); var internalId = DataBinder.Eval(container.DataItem, "RigChecklistFindingInternalId"); var url = Url.Action("List", gridData.EditController, new RouteValueDictionary(new { Id = id, checklistId = RigChecklist.Id })); hl.NavigateUrl = HttpUtility.UrlDecode(url); hl.Properties.Text = internalId.ToString(); } ).Render(); }); }, width: 30, editLayoutWidth: 100), new GridDisplayColumn("RigOapChecklistQuestionId", order: 20, displayName: Translate("Question"), width: 40, columnType: MVCxGridViewColumnType.ComboBox, editLayoutWidth: 100, lookup: questionsCombo), new GridDisplayColumn("FindingTypeId", order: 30, displayName: Translate("Finding Type"), width: 20, columnType: MVCxGridViewColumnType.ComboBox, editLayoutWidth: 100, lookup: findingTypeCombo), new GridDisplayColumn("FindingSubTypeId", order: 40, displayName: "Finding Sub Type", columnType: MVCxGridViewColumnType.ComboBox, editLayoutWidth: 100, columnAction: c => { c.Name = "FindingSubTypeId"; c.Caption = Translate("Finding Sub Type"); c.FieldName = "FindingSubTypeId"; c.Width = Unit.Percentage(20); c.EditorProperties().ComboBox(cb => { cb.CallbackRouteValues = new { Controller = BaseController, Action = "GetFindingSubTypes", TextField = "Name", ValueField = "Id" }; cb.TextField = "Name"; cb.ValueField = "Id"; cb.DataSource = findingSubTypes; cb.ClientSideEvents.BeginCallback = "findingSubTypeBeginCallback"; cb.ClientSideEvents.EndCallback = "findingSubTypeEndCallback"; cb.Width = Unit.Percentage(100); }); }), new GridDisplayColumn("CriticalityId", order: 50, displayName: "Criticality", width: 10, columnType: MVCxGridViewColumnType.ComboBox, editLayoutWidth: 100, lookup: criticalityCombo), new GridDisplayColumn("FindingDate", order: 60, displayName: "Finding Date", width: 20, columnType: MVCxGridViewColumnType.DateEdit, displayFormat: "g", editLayoutWidth: 100, isReadOnly: true), new GridDisplayColumn("IsRepeat", order: 70, displayName: "Repeat", columnType: MVCxGridViewColumnType.CheckBox, width: 20, editLayoutWidth: 100), new GridDisplayColumn("Status", order: 80, displayName: "Status", width: 25, columnType: MVCxGridViewColumnType.TextBox, editLayoutWidth: 100, isReadOnly: true), //new GridDisplayColumn( // "CapaId", order:90, displayName: "CAPA", // width: 30, columnType: MVCxGridViewColumnType.TextBox, editLayoutWidth:100,isVisible:false ), //columnAction: (column) => { // column.Name = "Capa"; // column.FieldName = "CapaId"; // column.Caption = Translate("CAPA"); // column.SetDataItemTemplateContent( cont => { // if (int.TryParse(DataBinder.Eval(cont.DataItem,"CapaId")?.ToString(),out int capaId)) // { // var capa = capaItems.FirstOrDefault(m => m.Id == capaId); // html.ViewContext.Writer.Write(capa?.Name); // } // }); // column.SetEditItemTemplateContent(cont => { // html.RenderAction("GridLookupPartial", "Common", new { Area = "Common", name = column.FieldName, lookup = "Capa", multi = false, selected = DataBinder.Eval(cont.DataItem,"CapaId"), displayField = "ActionRequired" }); // }); //}), new GridDisplayColumn("Reason", order: 100, displayName: "Description", width: 40, columnType: MVCxGridViewColumnType.TextBox, editLayoutWidth: 100, isVisible: false), new GridDisplayColumn("Id", order: 200, displayName: "Finding", width: 0, columnType: MVCxGridViewColumnType.TextBox, editLayoutWidth: 100, isVisible: false) }; gridData.DisplayColumns = displayColumns; gridData.Routes.Add(new GridRoute(GridRouteTypes.Add, new { Controller = BaseController, Action = "CreateFinding" })); gridData.Routes.Add(new GridRoute(GridRouteTypes.Update, new { Controller = BaseController, Action = "UpdateFinding" })); gridData.Routes.Add(new GridRoute(GridRouteTypes.Delete, new { Controller = BaseController, Action = "DeleteFinding" })); gridData.LayoutColumns = new List <GridEditLayoutColumn>() { new GridEditLayoutColumn("RigOapChecklistQuestionId", displayName: "Question"), new GridEditLayoutColumn("FindingDate", displayName: "Finding Date"), new GridEditLayoutColumn("FindingTypeId", displayName: "Finding Type"), new GridEditLayoutColumn("FindingSubTypeId", displayName: "Finding Sub Type"), new GridEditLayoutColumn("Criticality", displayName: "Criticality"), new GridEditLayoutColumn("Reason", displayName: "Description"), new GridEditLayoutColumn("Status", displayName: "Status"), //new GridEditLayoutColumn("CapaId", displayName:"CAPA"), new GridEditLayoutColumn("Id", displayName: "Id", isVisible: false) }; gridData.RowInitializeEvent = (s, e) => { e.NewValues["Id"] = Guid.Empty; e.NewValues["FindingDate"] = DateTime.UtcNow; e.NewValues["Status"] = "Open"; gridData.DefaultNewRowInitializeFields(e); }; gridData.FormLayout = new GridEditFormLayout( gridData.LayoutColumns , editMode: GridViewEditingMode.EditFormAndDisplayRow , processLayout: i => { i.ShowUpdateButton = true; i.ShowCancelButton = true; i.HorizontalAlign = FormLayoutHorizontalAlign.Right; i.Width = Unit.Percentage(100); } , columnCount: 2 , emptyLayputItemCount: 0 ); return(gridData); }
private void InitializeGridData(GridData gridData, string createAction, string updateAction, string deleteAction) { gridData.ToolBarOptions.DisplayXlsExport = true; if (ViewData["SystemGroup"] == null) { ViewData["SystemGroup"] = GetSystemGroups(); } var oapSystemGroups = ViewData["SystemGroup"] as ObservableCollection <OapSystemGroup>; var oapSystemGroupsCombo = new GridCombo("OapSystemGroup", oapSystemGroups); if (ViewData["System"] == null) { ViewData["System"] = GetSystems(); } var oapSystems = ViewData["System"] as ObservableCollection <OapSystem>; var oapSystemsCombo = new GridCombo("OapSystem", oapSystems); if (ViewData["SubSystem"] == null) { ViewData["SubSystem"] = GetSubSystems(); } var oapSubSystems = ViewData["SubSystem"] as ObservableCollection <OapSubSystem>; var oapSubSystemsCombo = new GridCombo("OapSubSystem", oapSubSystems); gridData.DisplayColumns = new List <GridDisplayColumn>() { new GridDisplayColumn("Id", displayName: "ID", width: 10, editLayoutWidth: 50), new GridDisplayColumn("OapChecklistGroupId", displayName: "Group Id", width: 20, editLayoutWidth: 50), new GridDisplayColumn("OapSystemGroupId", displayName: "System Group", width: 15, columnType: MVCxGridViewColumnType.ComboBox, lookup: oapSystemGroupsCombo, editLayoutWidth: 50), new GridDisplayColumn("OapSystemId", displayName: "System", width: 15, columnType: MVCxGridViewColumnType.ComboBox, lookup: oapSystemsCombo, editLayoutWidth: 50), new GridDisplayColumn("OapSubSystemId", displayName: "Sub System", width: 15, columnType: MVCxGridViewColumnType.ComboBox, lookup: oapSubSystemsCombo, editLayoutWidth: 50), new GridDisplayColumn("Order", displayName: "Order", width: 5, editLayoutWidth: 50), new GridDisplayColumn("Description", displayName: "Description", width: 25, editLayoutWidth: 50), new GridDisplayColumn("SafetyCritical", displayName: "SC", isReadOnly: true, columnType: MVCxGridViewColumnType.CheckBox, width: 10), new GridDisplayColumn("OperationalCritical", displayName: "OC", isReadOnly: true, columnType: MVCxGridViewColumnType.CheckBox, width: 10), new GridDisplayColumn("ClientCritical", displayName: "CC", isReadOnly: true, columnType: MVCxGridViewColumnType.CheckBox, width: 10), new GridDisplayColumn("EnvironmentalCritical", displayName: "EC", isReadOnly: true, columnType: MVCxGridViewColumnType.CheckBox, width: 10), new GridDisplayColumn("NonCritical", displayName: "NC", isReadOnly: true, columnType: MVCxGridViewColumnType.CheckBox, width: 10), new GridDisplayColumn("ACritical", displayName: "AC", isReadOnly: true, columnType: MVCxGridViewColumnType.CheckBox, width: 10), new GridDisplayColumn("ReferenceId", displayName: "Reference Id", isVisible: false, columnType: MVCxGridViewColumnType.TextBox) }; gridData.Routes = new List <GridRoute>() { new GridRoute(GridRouteTypes.Add, new { Controller = gridData.Controller, Action = createAction }), new GridRoute(GridRouteTypes.Update, new { Controller = gridData.Controller, Action = updateAction }), new GridRoute(GridRouteTypes.Delete, new { Controller = gridData.Controller, Action = deleteAction }), }; gridData.LayoutColumns = new List <GridEditLayoutColumn>() { new GridEditLayoutColumn("OapChecklistGroupId", displayName: "Group"), new GridEditLayoutColumn("OapSystemGroupId", displayName: "System Group"), new GridEditLayoutColumn("OapSystemId", displayName: "System"), new GridEditLayoutColumn("OapSubSystemId", displayName: "Sub System"), new GridEditLayoutColumn("Order", displayName: "Order"), new GridEditLayoutColumn("Description", displayName: "Description"), new GridEditLayoutColumn("ReferenceId", displayName: "Reference Id") }; gridData.FormLayout = new GridEditFormLayout(GridData.LayoutColumns , i => { i.HorizontalAlign = FormLayoutHorizontalAlign.Right; i.Width = System.Web.UI.WebControls.Unit.Percentage(100); }, 2 , editMode: GridViewEditingMode.EditFormAndDisplayRow); gridData.RowInitializeEvent = (s, e) => { e.NewValues["ReferenceId"] = 0; gridData.DefaultNewRowInitializeFields(e); }; }
private void InitializeSubChildRelatedQuestionGridData(GridData gridData, string createAction, string deleteAction, int id, string name) { gridData.ToolBarOptions.DisplayXlsExport = true; if (ViewData["Checklists"] == null) { ViewData["Checklists"] = GetOapChecklists(); } var oapChecklists = ViewData["Checklists"] as ObservableCollection <OapChecklist>; var oapChecklistCombo = new GridCombo("OapChecklist", oapChecklists); oapChecklistCombo.SelectedIndexChangedEvent = "OapChecklistOnSelectedChanged"; oapChecklistCombo.DisplayColumnName = "Name"; gridData.ButtonOptions.DisplayEditButton = false; if (ViewData["ChecklistQuestions"] == null) { ViewData["ChecklistQuestions"] = GetQuestions(); } var oapChecklistQuestions = ViewData["ChecklistQuestions"] as List <OapChecklistQuestion>; var oapChecklistQuestionsCombo = new GridCombo("oapChecklistQuestions", oapChecklistQuestions, "Id", "Question"); oapChecklistQuestionsCombo.CallbackRouteValues = new { Controller = "OapChecklistTopics", Action = "GetChecklistQuestions" }; oapChecklistQuestionsCombo.DisplayColumnName = "Question"; gridData.DisplayColumns = new List <GridDisplayColumn>() { new GridDisplayColumn("ChecklistId", displayName: "Checklist", columnType: MVCxGridViewColumnType.ComboBox, width: 25, lookup: oapChecklistCombo, editLayoutWidth: 100), new GridDisplayColumn("OapChecklistRelatedQuestionId", displayName: "Related Question", columnType: MVCxGridViewColumnType.ComboBox, editLayoutWidth: 100, columnAction: c => { c.Name = "OapChecklistRelatedQuestionId"; c.Caption = "Related Question"; c.FieldName = "OapChecklistRelatedQuestionId"; c.Width = Unit.Percentage(100); c.EditorProperties().ComboBox(cb => { cb.CallbackRouteValues = new { Controller = "OapChecklistTopics", Action = "GetChecklistQuestions", TextField = "Question", ValueField = "Id" }; cb.TextField = "Question"; cb.ValueField = "Id"; cb.DataSource = oapChecklistQuestions; cb.ClientSideEvents.BeginCallback = "OapChecklistQuestionsBeginCallback"; cb.ClientSideEvents.EndCallback = "OapChecklistQuestionsEndCallback"; cb.Width = Unit.Percentage(100); }); }), new GridDisplayColumn("OapChecklistQuestionId", displayName: "Question", isVisible: false) }; gridData.Routes = new List <GridRoute>() { new GridRoute(GridRouteTypes.Add, new { Controller = GridData.Controller, Action = "CreateChecklistQuestionRelatedQuestionMap" }), //new GridRoute(GridRouteTypes.Update, new { Controller = GridData.Controller, Action = "UpdateChecklistQuestionRelatedQuestionMap" }), new GridRoute(GridRouteTypes.Delete, new { Controller = GridData.Controller, Action = "DeleteChecklistQuestionRelatedQuestionMap" }), }; gridData.LayoutColumns = new List <GridEditLayoutColumn>() { new GridEditLayoutColumn("ChecklistId", displayName: "Checklist"), new GridEditLayoutColumn("OapChecklistRelatedQuestionId", displayName: "Related Question"), new GridEditLayoutColumn("OapChecklistQuestionId", isVisible: false) }; gridData.FormLayout = new GridEditFormLayout( gridData.LayoutColumns , processLayout: i => { i.HorizontalAlign = FormLayoutHorizontalAlign.Right; i.Width = Unit.Percentage(100); } , columnCount: 2); gridData.RowInitializeEvent = (s, e) => { e.NewValues["OapChecklistQuestionId"] = id; gridData.DefaultNewRowInitializeFields(e); }; gridData.CallBackRoute = new { Controller = gridData.Controller, Action = gridData.Action, OapChecklistQuestionId = id, oapChecklistQuestionName = name }; }
private void InitializeChildGridData(GridData gridData, string createAction, string updateAction, string deleteAction, int id, string name) { gridData.ToolBarOptions.DisplayXlsExport = true; if (ViewData["ChecklistQuestionDataType"] == null) { ViewData["ChecklistQuestionDataType"] = GetQuestionDataTypes(); } var oapChecklistQuestionDataTypes = ViewData["ChecklistQuestionDataType"] as ObservableCollection <OapChecklistQuestionDataType>; var oapChecklistQuestionDataTypeCombo = new GridCombo("oapChecklistQuestionDataTypes", oapChecklistQuestionDataTypes); if (ViewData["OapFrequency"] == null) { ViewData["OapFrequency"] = GetFrequencies(); } var oapFrequencies = ViewData["OapFrequency"] as ObservableCollection <OapFrequency>; var oapFrequencyCombo = new GridCombo("ChecklistOapFrequencies", oapFrequencies); var radioButtonDisplayTypeId = oapChecklistQuestionDataTypes?.FirstOrDefault(dt => dt.Code.Equals("RBL", StringComparison.InvariantCultureIgnoreCase)); dynamic spinEditProperties = new System.Dynamic.ExpandoObject(); spinEditProperties.NumberType = SpinEditNumberType.Float; gridData.DisplayColumns = new List <GridDisplayColumn>() { new GridDisplayColumn("Question", displayName: "Question", width: 15, editLayoutWidth: 100), new GridDisplayColumn("Description", displayName: "Sub Group Description", width: 15, editLayoutWidth: 100), new GridDisplayColumn("Help", displayName: "Help Text", width: 10), new GridDisplayColumn("Order", displayName: "Order", columnType: MVCxGridViewColumnType.SpinEdit, width: 5, editLayoutWidth: 100), new GridDisplayColumn("Weight", displayName: "Scoring Weight", columnType: MVCxGridViewColumnType.SpinEdit, width: 5, editLayoutWidth: 100, editorProperties: spinEditProperties), new GridDisplayColumn("Maximum", displayName: "Scoring Max", columnType: MVCxGridViewColumnType.SpinEdit, width: 5, editLayoutWidth: 100, editorProperties: spinEditProperties), new GridDisplayColumn("YesValue", displayName: "Yes Value", columnType: MVCxGridViewColumnType.SpinEdit, width: 5, editLayoutWidth: 100), new GridDisplayColumn("EditNoValue", displayName: "Edit No Value", columnType: MVCxGridViewColumnType.CheckBox, width: 5, editLayoutWidth: 100), new GridDisplayColumn("Randomize", displayName: "Randomize", columnType: MVCxGridViewColumnType.CheckBox, width: 5, editLayoutWidth: 100), new GridDisplayColumn("OapFrequencyId", displayName: "Frequency", columnType: MVCxGridViewColumnType.ComboBox, width: 5, editLayoutWidth: 100, lookup: oapFrequencyCombo), new GridDisplayColumn("OapChecklistQuestionDataTypeId", displayName: "Display Type", columnType: MVCxGridViewColumnType.ComboBox, width: 5, editLayoutWidth: 100, lookup: oapChecklistQuestionDataTypeCombo), new GridDisplayColumn("StartDateTime", displayName: "Start Date", columnType: MVCxGridViewColumnType.DateEdit, width: 7, editLayoutWidth: 100, displayFormat: "g"), new GridDisplayColumn("EndDateTime", displayName: "End Date", columnType: MVCxGridViewColumnType.DateEdit, width: 7, editLayoutWidth: 100, displayFormat: "g"), new GridDisplayColumn("CreatedBy", displayName: "Created By", isReadOnly: true, width: 0, isVisible: false), new GridDisplayColumn("CreatedDateTime", displayName: "Date Created", columnType: MVCxGridViewColumnType.DateEdit, width: 0, isReadOnly: true, displayFormat: "g", isVisible: false), new GridDisplayColumn("UpdatedBy", displayName: "Updated By", width: 0, isReadOnly: true, isVisible: false), new GridDisplayColumn("UpdatedDateTime", displayName: "Date Updated", columnType: MVCxGridViewColumnType.DateEdit, width: 0, isReadOnly: true, displayFormat: "g", isVisible: false), new GridDisplayColumn("OapChecklistTopicId", displayName: "Checklist Topic Id", width: 0, isVisible: false) }; gridData.Routes = new List <GridRoute>() { new GridRoute(GridRouteTypes.Add, new { Controller = GridData.Controller, Action = "CreateChecklistQuestion" }), new GridRoute(GridRouteTypes.Update, new { Controller = GridData.Controller, Action = "UpdateChecklistQuestion" }), new GridRoute(GridRouteTypes.Delete, new { Controller = GridData.Controller, Action = "DeleteChecklistQuestion" }), }; gridData.LayoutColumns = new List <GridEditLayoutColumn>() { new GridEditLayoutColumn("Question", displayName: "Question"), new GridEditLayoutColumn("Description", displayName: "Description"), new GridEditLayoutColumn("Order", displayName: "Order"), new GridEditLayoutColumn("Weight", displayName: "Scoring Weight"), new GridEditLayoutColumn("Maximum", displayName: "Scoring Max"), new GridEditLayoutColumn("YesValue", displayName: "Yes Value"), new GridEditLayoutColumn("EditNoValue", displayName: "Edit No Value"), new GridEditLayoutColumn("Randomize", displayName: "Randomize"), new GridEditLayoutColumn("OapFrequencyId", displayName: "Frequency"), new GridEditLayoutColumn("OapChecklistQuestionDataTypeId", displayName: "Display Type"), new GridEditLayoutColumn("StartDateTime", displayName: "Start Date"), new GridEditLayoutColumn("EndDateTime", displayName: "End Date"), new GridEditLayoutColumn("OapChecklistTopicId", displayName: "Checklist Group Id", isVisible: false) }; gridData.FormLayout = new GridEditFormLayout( gridData.LayoutColumns , i => { i.HorizontalAlign = FormLayoutHorizontalAlign.Right; i.Width = System.Web.UI.WebControls.Unit.Percentage(100); } , columnCount: 2 ); gridData.RowInitializeEvent = (s, e) => { e.NewValues["OapChecklistTopicId"] = id; e.NewValues["OapChecklistQuestionDataTypeId"] = radioButtonDisplayTypeId; gridData.DefaultNewRowInitializeFields(e); }; gridData.CallBackRoute = new { Controller = gridData.Controller, Action = gridData.Action, oapChecklistTopicId = id, oapChecklistTopicName = name }; }
protected virtual GridData InitializeChecklistFindingsGridData(HtmlHelper html) { var action = "DisplayFindings"; var gridData = new GridData(GridConstants.rigChecklistFindingGrid, BaseController, action, "Findings", "AddFinding", "Add Finding", "search findings", initializeCallBack: true, historicalRow: false, editController: "FindingsPage", key: "Id"); gridData.ToolBarOptions.DisplayXlsExport = true; if (EnableSave()) { gridData.SetGridReadOnly(); } //Finding Type dropdown if (ViewData["FindingType"] == null) { ViewData["FindingType"] = GetClient <FindingTypeClient>().GetAllAsync().Result?.Result?.Data; } var findingTypes = ViewData["FindingType"] as IEnumerable <FindingType>; var findingTypeCombo = new GridCombo("FindingTypeCombo", findingTypes, selectedIndexChangedEvent: "findingTypeOnSelectedeChanged"); //Finding Sub Type dropdown if (ViewData["FindingSubType"] == null) { ViewData["FindingSubType"] = GetClient <FindingSubTypeClient>().GetAllAsync().Result?.Result?.Data; } var findingSubTypes = ViewData["FindingSubType"] as IEnumerable <FindingSubType>; if (ViewData["Criticalities"] == null) { ViewData["Criticalities"] = GetClient <LookupClient>().GetAllCriticalityAsync().Result?.Result?.Data; } var criticalities = ViewData["Criticalities"] as IEnumerable <Criticality>; var criticalityCombo = new GridCombo("CriticalitiesCombo", criticalities); var questionsCombo = new GridCombo("QuestionsCombo", Questions, keyColumnName: "Id", displayColumnName: "OapChecklistQuestion.Question"); var displayColumns = new List <GridDisplayColumn> { new GridDisplayColumn("RigChecklistFindingInternalId", order: 10, displayName: "Finding Id", isReadOnly: true, columnAction: c => { c.FieldName = "RigChecklistFindingInternalId"; c.Caption = Translate("Finding Id"); c.CellStyle.HorizontalAlign = HorizontalAlign.Center; c.SetDataItemTemplateContent(container => { html.DevExpress().HyperLink(hl => { var id = DataBinder.Eval(container.DataItem, "Id"); var internalId = DataBinder.Eval(container.DataItem, "RigChecklistFindingInternalId"); var url = Url.Action("List", gridData.EditController, new RouteValueDictionary(new { Id = id, checklistId = Protocol.Id })); hl.NavigateUrl = HttpUtility.UrlDecode(url); hl.Properties.Text = internalId.ToString(); }).Render(); }); }, width: 30, editLayoutWidth: 100), new GridDisplayColumn("RigOapChecklistQuestionId", order: 20, displayName: Translate("Question"), width: 40, columnType: MVCxGridViewColumnType.ComboBox, editLayoutWidth: 100, lookup: questionsCombo), new GridDisplayColumn("FindingTypeId", order: 30, displayName: Translate("Finding Type"), width: 20, columnType: MVCxGridViewColumnType.ComboBox, editLayoutWidth: 100, lookup: findingTypeCombo), new GridDisplayColumn("FindingSubTypeId", order: 40, displayName: "Finding Sub Type", columnType: MVCxGridViewColumnType.ComboBox, editLayoutWidth: 100, columnAction: c => { c.Name = "FindingSubTypeId"; c.Caption = Translate("Finding Sub Type"); c.FieldName = "FindingSubTypeId"; c.Width = Unit.Percentage(20); c.EditorProperties().ComboBox(cb => { cb.CallbackRouteValues = new { Controller = BaseController, Action = "GetFindingSubTypes", TextField = "Name", ValueField = "Id" }; cb.TextField = "Name"; cb.ValueField = "Id"; cb.DataSource = findingSubTypes; cb.ClientSideEvents.BeginCallback = "findingSubTypeBeginCallback"; cb.ClientSideEvents.EndCallback = "findingSubTypeEndCallback"; cb.Width = Unit.Percentage(100); }); }), new GridDisplayColumn("CriticalityId", order: 50, displayName: "Criticality", width: 10, columnType: MVCxGridViewColumnType.ComboBox, editLayoutWidth: 100, lookup: criticalityCombo), new GridDisplayColumn("FindingDate", order: 60, displayName: "Finding Date", width: 20, columnType: MVCxGridViewColumnType.DateEdit, displayFormat: "g", editLayoutWidth: 100, isReadOnly: true), new GridDisplayColumn("IsRepeat", order: 70, displayName: "Repeat", columnType: MVCxGridViewColumnType.CheckBox, width: 20, editLayoutWidth: 100), new GridDisplayColumn("Status", order: 80, displayName: "Status", width: 25, columnType: MVCxGridViewColumnType.TextBox, editLayoutWidth: 100, isReadOnly: true), new GridDisplayColumn("Reason", order: 100, displayName: "Description", width: 40, columnType: MVCxGridViewColumnType.TextBox, editLayoutWidth: 100, isVisible: false), new GridDisplayColumn("Id", order: 200, displayName: "Finding", width: 0, columnType: MVCxGridViewColumnType.TextBox, editLayoutWidth: 100, isVisible: false) }; gridData.DisplayColumns = displayColumns; gridData.Routes.Add(new GridRoute(GridRouteTypes.Add, new { Controller = BaseController, Action = "CreateFinding" })); gridData.Routes.Add(new GridRoute(GridRouteTypes.Update, new { Controller = BaseController, Action = "UpdateFinding" })); gridData.Routes.Add(new GridRoute(GridRouteTypes.Delete, new { Controller = BaseController, Action = "DeleteFinding" })); gridData.LayoutColumns = new List <GridEditLayoutColumn>() { new GridEditLayoutColumn("RigOapChecklistQuestionId", displayName: "Question"), new GridEditLayoutColumn("FindingDate", displayName: "Finding Date"), new GridEditLayoutColumn("FindingTypeId", displayName: "Finding Type"), new GridEditLayoutColumn("FindingSubTypeId", displayName: "Finding Sub Type"), new GridEditLayoutColumn("Criticality", displayName: "Criticality"), new GridEditLayoutColumn("Reason", displayName: "Description"), new GridEditLayoutColumn("Status", displayName: "Status"), new GridEditLayoutColumn("Id", displayName: "Id", isVisible: false) }; gridData.RowInitializeEvent = (s, e) => { e.NewValues["Id"] = Guid.Empty; e.NewValues["FindingDate"] = DateTime.UtcNow; e.NewValues["Status"] = "Open"; gridData.DefaultNewRowInitializeFields(e); }; gridData.FormLayout = new GridEditFormLayout( gridData.LayoutColumns , editMode: GridViewEditingMode.EditFormAndDisplayRow , processLayout: i => { i.ShowUpdateButton = true; i.ShowCancelButton = true; i.HorizontalAlign = FormLayoutHorizontalAlign.Right; i.Width = Unit.Percentage(100); } , columnCount: 2 , emptyLayputItemCount: 0 ); return(gridData); }
private void InitializeChildGridData(GridData gridData, string createAction, string updateAction, string deleteAction, int id, string name) { gridData.ToolBarOptions.DisplayXlsExport = true; gridData.DisplayColumns = new List <GridDisplayColumn>() { new GridDisplayColumn("Name", displayName: "Sub Group Name", width: 15, editLayoutWidth: 100), new GridDisplayColumn("Description", displayName: "Sub Group Description", width: 20, editLayoutWidth: 100), new GridDisplayColumn("Order", displayName: "Order", columnType: MVCxGridViewColumnType.SpinEdit, width: 5, editLayoutWidth: 100, columnAction: c => { c.FieldName = "Order"; c.Caption = Translate("Order"); c.Width = Unit.Percentage(5); c.CellStyle.HorizontalAlign = HorizontalAlign.Left; }), new GridDisplayColumn("IsVisible", displayName: "Visible", columnType: MVCxGridViewColumnType.CheckBox, width: 5, editLayoutWidth: 100), new GridDisplayColumn("IsPlantMonitoring", displayName: "Plant Monitoring", columnType: MVCxGridViewColumnType.CheckBox, width: 10, editLayoutWidth: 100), new GridDisplayColumn("IsPlantMaintaining", displayName: "Plant Maintaining", columnType: MVCxGridViewColumnType.CheckBox, width: 10, editLayoutWidth: 100), new GridDisplayColumn("IsWorkInstructions", displayName: "Work Instructions", columnType: MVCxGridViewColumnType.CheckBox, width: 10, editLayoutWidth: 100), new GridDisplayColumn("IsThirdPartyActivities", displayName: "Third Party Activities", columnType: MVCxGridViewColumnType.CheckBox, width: 10, editLayoutWidth: 100), new GridDisplayColumn("StartDateTime", displayName: "Start Date", columnType: MVCxGridViewColumnType.DateEdit, width: 7, editLayoutWidth: 100, displayFormat: "g"), new GridDisplayColumn("EndDateTime", displayName: "End Date", columnType: MVCxGridViewColumnType.DateEdit, width: 7, editLayoutWidth: 100, displayFormat: "g"), new GridDisplayColumn("CreatedBy", displayName: "Created By", isReadOnly: true, width: 0, isVisible: false), new GridDisplayColumn("CreatedDateTime", displayName: "Date Created", columnType: MVCxGridViewColumnType.DateEdit, width: 0, isReadOnly: true, displayFormat: "g", isVisible: false), new GridDisplayColumn("UpdatedBy", displayName: "Updated By", width: 10, isReadOnly: true, isVisible: false), new GridDisplayColumn("UpdatedDateTime", displayName: "Date Updated", columnType: MVCxGridViewColumnType.DateEdit, width: 0, isReadOnly: true, displayFormat: "g", isVisible: false), new GridDisplayColumn("OapChecklistGroupId", displayName: "Checklist Group Id", width: 0, isVisible: false) }; gridData.Routes = new List <GridRoute>() { new GridRoute(GridRouteTypes.Add, new { Controller = GridData.Controller, Action = "CreateChecklistSubGroup" }), new GridRoute(GridRouteTypes.Update, new { Controller = GridData.Controller, Action = "UpdateChecklistSubGroup" }), new GridRoute(GridRouteTypes.Delete, new { Controller = GridData.Controller, Action = "DeleteChecklistSubGroup" }), }; gridData.LayoutColumns = new List <GridEditLayoutColumn>() { new GridEditLayoutColumn("Name", displayName: "Sub Group Name"), new GridEditLayoutColumn("Description", displayName: "Sub Group Description"), new GridEditLayoutColumn("Order", displayName: "Order"), new GridEditLayoutColumn("IsVisible", displayName: "Visible"), new GridEditLayoutColumn("IsPlantMonitoring", displayName: "Plant Monitoring"), new GridEditLayoutColumn("IsPlantMaintaining", displayName: "Plant Maintaining"), new GridEditLayoutColumn("IsWorkInstructions", displayName: "Work Instructions"), new GridEditLayoutColumn("IsThirdPartyActivities", displayName: "Third Party Activities"), new GridEditLayoutColumn("StartDateTime", displayName: "Start Date"), new GridEditLayoutColumn("EndDateTime", displayName: "End Date"), new GridEditLayoutColumn("OapChecklistGroupId", displayName: "Checklist Group Id", isVisible: false) }; gridData.FormLayout = new GridEditFormLayout( gridData.LayoutColumns , i => { i.HorizontalAlign = FormLayoutHorizontalAlign.Right; i.Width = System.Web.UI.WebControls.Unit.Percentage(100); } , columnCount: 2 ); gridData.RowInitializeEvent = (s, e) => { e.NewValues["OapChecklistGroupId"] = id; gridData.DefaultNewRowInitializeFields(e); }; gridData.CallBackRoute = new { Controller = gridData.Controller, Action = gridData.Action, oapChecklistGroupId = id, oapChecklistGroupName = name }; }