protected void rptAction_ItemCommand(object source, RepeaterCommandEventArgs e) { List <TASK_STATUS> actionList = GetActionListFromGrid(); if (e.CommandArgument.ToString() == "ActionType") { Panel pnl = (Panel)e.Item.FindControl("pnlActionType"); if (pnl.Visible) { pnl.Visible = false; pnl = (Panel)e.Item.FindControl("pnlActionTypeSelect"); pnl.Visible = true; HiddenField hf = (HiddenField)e.Item.FindControl("hfActionType"); XLAT xlat = XLATList.Where(l => l.XLAT_GROUP == "ACTION_CATEGORY" && l.XLAT_CODE == hf.Value).FirstOrDefault(); if (xlat != null) { Label lb = (Label)e.Item.FindControl("lblActionType"); lb.Text = xlat.DESCRIPTION; } } else { pnl.Visible = true; pnl = (Panel)e.Item.FindControl("pnlActionTypeSelect"); pnl.Visible = false; } } if (e.CommandArgument.ToString() == "Delete") { int delId = e.Item.ItemIndex; TASK_STATUS action = actionList.ElementAt(delId); if (action != null) { if (action.TASK_ID > 0) // only delete existing actions { using (PSsqmEntities entities = new PSsqmEntities()) { entities.ExecuteStoreCommand("DELETE FROM TASK_STATUS WHERE TASK_ID = " + action.TASK_ID.ToString()); } } actionList.Remove(action); if (actionList.Count == 0) { actionList.Add(EHSIncidentMgr.CreateEmptyTask(ActionIncident.INCIDENT_ID, ((int)SysPriv.action).ToString(), 1, WebSiteCommon.LocalTime(DateTime.UtcNow, IncidentLocationTZ))); } } rptAction.DataSource = actionList; rptAction.DataBind(); decimal incidentId = (IsEditContext) ? IncidentId : NewIncidentId; } }
protected XLAT GetMenu(string menuGroup, string menuItem) { XLAT menu = menuXLATList.Where(l => l.XLAT_GROUP == menuGroup && l.XLAT_CODE == menuItem).FirstOrDefault(); if (menu == null) { menu = new XLAT(); menu.STATUS = ""; } return(menu); }
public static string GetXLATCode(List <XLAT> xlatList, string xlatGroup, string value) { string xlatCode = ""; XLAT xlat = xlatList.Where(l => l.XLAT_GROUP == xlatGroup && l.DESCRIPTION == value).FirstOrDefault(); if (xlat != null) { xlatCode = xlat.XLAT_CODE; } return(xlatCode); }
public void rptAction_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { int minRowsToValidate = 1; try { TASK_STATUS action = (TASK_STATUS)e.Item.DataItem; string addFields = SessionManager.GetUserSetting("EHS", "ACTION_ADD_FIELDS") == null ? "" : SessionManager.GetUserSetting("EHS", "ACTION_ADD_FIELDS").VALUE; //EHSSettings.Where(s => s.SETTING_CD == "ACTION_ADD_FIELDS").FirstOrDefault() == null ? "" : EHSSettings.Where(s => s.SETTING_CD == "ACTION_ADD_FIELDS").FirstOrDefault().VALUE; HiddenField hf; System.Web.UI.HtmlControls.HtmlTableRow tr; TextBox tbca = (TextBox)e.Item.FindControl("tbFinalAction"); RadDropDownList rddlp = (RadDropDownList)e.Item.FindControl("rddlActionPerson"); Label lb = (Label)e.Item.FindControl("lbItemSeq"); RadDatePicker sd = (RadDatePicker)e.Item.FindControl("rdpFinalStartDate"); sd = SQMBasePage.SetRadDateCulture(sd, ""); RadDatePicker cd = (RadDatePicker)e.Item.FindControl("rdpFinalCompleteDate"); cd = SQMBasePage.SetRadDateCulture(cd, ""); //CheckBox ic = (CheckBox)e.Item.FindControl("cbFinalIsComplete"); RadButton itmdel = (RadButton)e.Item.FindControl("btnItemDelete"); if (addFields.Contains("type")) { tr = (System.Web.UI.HtmlControls.HtmlTableRow)e.Item.FindControl("trActionType"); tr.Visible = true; hf = (HiddenField)e.Item.FindControl("hfActionType"); hf.Value = action.TASK_CATEGORY; RadGrid rgActionType = (RadGrid)e.Item.FindControl("rgActionTypeList"); BindActionTypeSelect(rgActionType, action); XLAT xlat = XLATList.Where(l => l.XLAT_GROUP == "ACTION_CATEGORY" && l.XLAT_CODE == action.TASK_CATEGORY).FirstOrDefault(); if (xlat != null) { lb = (Label)e.Item.FindControl("lblActionType"); lb.Text = xlat.DESCRIPTION; Image img = (Image)e.Item.FindControl("imgActionType"); switch (xlat.SORT_ORDER) { case 1: img.ImageUrl = "~/images/defaulticon/16x16/arrow-1-up.png"; break; case 2: img.ImageUrl = "~/images/defaulticon/16x16/arrow-1-up-right.png"; break; case 3: img.ImageUrl = "~/images/defaulticon/16x16/3D-plane.png"; break; case 4: img.ImageUrl = "~/images/defaulticon/16x16/arrow-1-down-right.png"; break; default: img.ImageUrl = "~/images/defaulticon/16x16/arrow-1-down.png"; break; } } } rddlp.Items.Add(new DropDownListItem("", "")); List <PERSON> personList = personList = EHSIncidentMgr.SelectIncidentPersonList(LocalIncident, true); foreach (PERSON p in personList) { string displayName = string.Format("{0}, {1} ({2})", p.LAST_NAME, p.FIRST_NAME, p.EMAIL); rddlp.Items.Add(new DropDownListItem(displayName, Convert.ToString(p.PERSON_ID))); } lb = (Label)e.Item.FindControl("lbItemSeq"); lb.Text = action.TASK_SEQ.ToString(); tbca.Text = action.DESCRIPTION; if (action.RESPONSIBLE_ID != null) { rddlp.SelectedValue = action.RESPONSIBLE_ID.ToString(); } if (action.DUE_DT.HasValue) { sd.SelectedDate = action.DUE_DT; } hf = (HiddenField)e.Item.FindControl("hfTaskStatus"); hf.Value = action.STATUS; hf = (HiddenField)e.Item.FindControl("hfTaskID"); hf.Value = action.TASK_ID.ToString(); hf = (HiddenField)e.Item.FindControl("hfRecordType"); hf.Value = action.RECORD_TYPE.ToString(); hf = (HiddenField)e.Item.FindControl("hfRecordID"); hf.Value = action.RECORD_ID.ToString(); hf = (HiddenField)e.Item.FindControl("hfTaskStep"); hf.Value = action.TASK_STEP; hf = (HiddenField)e.Item.FindControl("hfTaskType"); hf.Value = action.TASK_TYPE; hf = (HiddenField)e.Item.FindControl("hfDetail"); hf.Value = action.DETAIL; hf = (HiddenField)e.Item.FindControl("hfComments"); hf.Value = action.COMMENTS; hf = (HiddenField)e.Item.FindControl("hfVerification"); hf.Value = action.TASK_VERIFICATION; if (action.COMPLETE_DT.HasValue) { cd.SelectedDate = action.COMPLETE_DT; hf = (HiddenField)e.Item.FindControl("hfCompleteID"); if (action.COMPLETE_ID.HasValue) { hf.Value = action.COMPLETE_ID.ToString(); } } if (action.CREATE_DT.HasValue) { hf = (HiddenField)e.Item.FindControl("hfCreateDT"); DateTime dt = Convert.ToDateTime(action.CREATE_DT); hf.Value = dt.ToString("M/d/yyyy"); } if (addFields.Contains("comment")) { tr = (System.Web.UI.HtmlControls.HtmlTableRow)e.Item.FindControl("trComments"); tr.Visible = true; tbca = (TextBox)e.Item.FindControl("tbComments"); tbca.Text = action.COMMENTS; } if (addFields.Contains("verify")) { tr = (System.Web.UI.HtmlControls.HtmlTableRow)e.Item.FindControl("trVerification"); tr.Visible = true; tbca = (TextBox)e.Item.FindControl("tbVerification"); tbca.Text = action.TASK_VERIFICATION; } itmdel.Visible = PageMode == PageUseMode.ViewOnly ? false : EHSIncidentMgr.CanUpdateIncident(LocalIncident, IsEditContext, SysPriv.action, LocalIncident.INCFORM_LAST_STEP_COMPLETED); } catch { } } btnSave.Visible = btnAddFinal.Visible = PageMode == PageUseMode.ViewOnly ? false : EHSIncidentMgr.CanUpdateIncident(LocalIncident, IsEditContext, SysPriv.action, LocalIncident.INCFORM_LAST_STEP_COMPLETED); }