public void BindProblemCaseHeader(ProblemCase problemCase, bool showAll) { pnlProbCaseHdr.Visible = true; if (problemCase.ProbCase.PROBCASE_TYPE == "EHS") { lblCaseID.Text = hfLblCaseIDEHS.Value; } lblCaseID_out.Text = problemCase.CaseID; lblCaseType_out.Text = WebSiteCommon.GetXlatValue("incidentType", problemCase.ProbCase.PROBCASE_TYPE); lblCaseDesc_out.Text = problemCase.ProbCase.DESC_SHORT; // trProbCaseHdrRow2.Visible = showAll; if (showAll) { int progress = problemCase.CheckCaseStatus(); lblCreateDate_out.Text = SQMBasePage.FormatDate((DateTime)problemCase.ProbCase.CREATE_DT, "d", false); lblUpdateDate_out.Text = SQMBasePage.FormatDate((DateTime)problemCase.ProbCase.LAST_UPD_DT, "d", false); //lblCaseProgress_out.Text = progress.ToString(); if (problemCase.ProbCase.CLOSE_DT.HasValue) { lblCaseStatus_out.Text = WebSiteCommon.GetXlatValue("recordStatus", "C") + ": " + SQMBasePage.FormatDate((DateTime)problemCase.ProbCase.CLOSE_DT, "d", false); } else { lblCaseStatus_out.Text = WebSiteCommon.GetXlatValue("caseStep", (Math.Max((decimal)problemCase.ProbCase.PROGRESS, 1) - 1).ToString()); if (problemCase.ProbCase.STATUS == "I") { imgCaseStatus.ImageUrl = "/images/defaulticon/16x16/no.png"; imgCaseStatus.Visible = true; } } } }
public void gvDocs_OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString()))) { try { Label lbl = (Label)e.Row.Cells[0].FindControl("lblPosted"); HiddenField hf = (HiddenField)e.Row.Cells[0].FindControl("hfPostedBy"); lbl.Text = hf.Value; hf = (HiddenField)e.Row.Cells[0].FindControl("hfPostedDate"); lbl.Text = lbl.Text + " " + SQMBasePage.FormatDate(WebSiteCommon.LocalTime(Convert.ToDateTime(hf.Value), SessionManager.UserContext.TimeZoneID), "d", true); //WebSiteCommon.LocalTime(Convert.ToDateTime(hf.Value), SessionManager.UserContext.TimeZoneID).ToShortDateString(); hf = (HiddenField)e.Row.Cells[0].FindControl("hfDisplayArea"); lbl = (Label)e.Row.Cells[0].FindControl("lblDisplayArea"); lbl.Text = WebSiteCommon.GetXlatValue("docDisplayType", hf.Value); hf = (HiddenField)e.Row.Cells[0].FindControl("hfFileName"); string ext = hf.Value.Substring(hf.Value.LastIndexOf('.') + 1).ToLower(); if (!string.IsNullOrEmpty(ext)) { Image img = (Image)e.Row.Cells[0].FindControl("imgFileType"); img.ImageUrl = "~/images/filetype/icon_" + ext + ".gif"; } } catch { } } }
public void DisplayPlant(BUSINESS_ORG busOrg, PLANT plant) { pnlPlantHdr.Visible = true; lblPlantOrgName_out.Text = busOrg.ORG_NAME; if (plant != null) { lblPlantName_out.Text = plant.PLANT_NAME; lblLocCodePlant_out.Text = plant.DUNS_CODE; lblLocationType_out.Text = WebSiteCommon.GetXlatValue("locationType", plant.LOCATION_TYPE); } }
public void BindProfileSelectHdr(EHSProfile profile) { ToggleVisible(pnlProfileSelectHdr); if (profile == null) { lblLocCodePlant_out.Text = lblLocationType_out.Text = lblProfileUpdateBy_out.Text = lblProfileUpdate_out.Text = ""; } else { lblLocCodePlant_out.Text = profile.Plant.DUNS_CODE; lblLocationType_out.Text = WebSiteCommon.GetXlatValue("locationType", profile.Plant.LOCATION_TYPE); lblProfileUpdateBy_out.Text = profile.Profile.LAST_UPD_BY; lblProfileUpdate_out.Text = SQMBasePage.FormatDate((DateTime)profile.Profile.LAST_UPD_DT, "d", false); } }
public void gvOnProfileRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString()))) { try { Image img = (Image)e.Row.Cells[0].FindControl("imgHazardType"); HiddenField hf = (HiddenField)e.Row.Cells[0].FindControl("hfMetricCategory"); if (hf.Value == "EUTL") { e.Row.Cells[0].CssClass = e.Row.Cells[1].CssClass = "energyColor"; img.ImageUrl = "~/images/status/energy.png"; } else if (hf.Value == "PROD") { img.ImageUrl = "~/images/status/inputs.png"; img.ToolTip = WebSiteCommon.GetXlatValueLong("measureCategoryEHS", hf.Value); } else { e.Row.Cells[0].CssClass = e.Row.Cells[1].CssClass = "wasteColor"; hf = (HiddenField)e.Row.Cells[0].FindControl("hfMetricRegStatus"); if (hf.Value == "HZ") { img.ImageUrl = "~/images/status/hazardous.png"; } else { img.ImageUrl = "~/images/status/waste.png"; } img.ToolTip = WebSiteCommon.GetXlatValueLong("regulatoryStatus", hf.Value); hf = (HiddenField)e.Row.Cells[0].FindControl("hfDisposalCode"); if (!string.IsNullOrEmpty(hf.Value)) { img.ToolTip += (". " + disposalList.FirstOrDefault(l => l.UN_CODE == hf.Value).DESCRIPTION); } } // e.Row.Cells[0].Attributes.Add("Style", "background: wheat;"); LinkButton lnk = (LinkButton)e.Row.Cells[0].FindControl("lnkMetricCD"); LinkButton lnk2 = (LinkButton)e.Row.Cells[0].FindControl("lnkMetricName"); lnk.ToolTip = lnk2.ToolTip = WebSiteCommon.GetXlatValue("measureCategoryEHS", hf.Value); } catch { } } }
public void gvPartProcList_OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString()))) { System.Web.UI.WebControls.Label lbl = new Label(); try { lbl = (Label)e.Row.Cells[0].FindControl("lblPartProcType"); lbl.Text = WebSiteCommon.GetXlatValue("partProcess", lbl.Text); } catch { } } }
protected void rgCSTIssueList_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; HiddenField hf; Label lbl; try { QualityIncidentData data = (QualityIncidentData)e.Item.DataItem; if (data.Person != null) { lbl = (Label)e.Item.FindControl("lblReportedBy"); lbl.Text = SQMModelMgr.FormatPersonListItem(data.Person); } Image img = (Image)e.Item.FindControl("imgRespLocation"); if (data.PlantResponsible.PLANT_ID != data.Plant.PLANT_ID) { img.Visible = true; } else { img.Visible = false; } if (!string.IsNullOrEmpty(data.QIIssue.SEVERITY)) { lbl = (Label)e.Item.FindControl("lblSeverity"); lbl.Text = WebSiteCommon.GetXlatValue("incidentSeverity", data.QIIssue.SEVERITY); } if (rgCSTIssueList.MasterTableView.GetColumn("Attach").Visible&& data.AttachList != null) { lbl = (Label)e.Item.FindControl("lblAttach"); Ucl_Attach attch = (Ucl_Attach)Page.LoadControl("/Include/Ucl_Attach.ascx"); lbl.Parent.Controls.AddAt(lbl.Parent.Controls.IndexOf(lbl), attch); attch.BindListAttachment(data.AttachList, "1", 1); } } catch { } } }
public void rptPlantGrid_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { System.Web.UI.WebControls.Label lbl = new Label(); System.Web.UI.WebControls.HiddenField hfField = new HiddenField(); try { lbl = (Label)e.Item.FindControl("lblLocationType_out"); hfField = (HiddenField)e.Item.FindControl("hdnLocationType"); lbl.Text = WebSiteCommon.GetXlatValue("locationType", hfField.Value); } catch { } } }
public void rptCRList_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { try { IncidentCostReport rpt = (IncidentCostReport)e.Item.DataItem; LinkButton lnk = (LinkButton)e.Item.FindControl("lnkViewCRID"); lnk.Text = WebSiteCommon.FormatID(Convert.ToDecimal(lnk.CommandArgument), 6); Label lbl = (Label)e.Item.FindControl("lblCRCreateDT"); lbl.Text = SQMBasePage.FormatDate(Convert.ToDateTime(lbl.Text), "d", false); lbl = (Label)e.Item.FindControl("lblCRType"); lbl.Text = WebSiteCommon.GetXlatValue("issueResponsible", lbl.Text); Ucl_IncidentList uclIncidents = (Ucl_IncidentList)e.Item.FindControl("uclIncidents"); uclIncidents.BindQualityIssueList(rpt.IncidentList, false); } catch { } } }
public void gvPlantList_OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString()))) { System.Web.UI.WebControls.Label lbl = new Label(); System.Web.UI.WebControls.HiddenField hfField = new HiddenField(); try { lbl = (Label)e.Row.Cells[0].FindControl("lblLocationType_out"); hfField = (HiddenField)e.Row.Cells[0].FindControl("hfLocationType"); lbl.Text = WebSiteCommon.GetXlatValue("locationType", hfField.Value); lbl = (Label)e.Row.Cells[0].FindControl("lblStatus_out"); hfField = (HiddenField)e.Row.Cells[0].FindControl("hfStatus_out"); lbl.Text = WebSiteCommon.GetStatusString(hfField.Value); SETTINGS sets = SQMSettings.GetSetting("COMPANY", "PLANTUSER"); if (sets == null || sets.VALUE.ToUpper() != "N") { LinkButton lnk = (LinkButton)e.Row.Cells[0].FindControl("lnkView_out"); decimal plantID = Convert.ToDecimal(lnk.CommandArgument); HiddenField hf = (HiddenField)e.Row.Cells[0].FindControl("hfPlantCompanyID"); lnk.ToolTip = ""; foreach (PERSON person in UserList()) { if (person.ROLE > 1 && SQMModelMgr.PersonPlantAccess(person, plantID)) { lnk.ToolTip += (" " + person.FIRST_NAME + " " + person.LAST_NAME + ","); } } lnk.ToolTip = lnk.ToolTip.TrimEnd(','); } } catch { } } }
public void rptDocList_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { try { DOCUMENT doc = (DOCUMENT)e.Item.DataItem; Label lbl = (Label)e.Item.FindControl("lblPosted"); lbl.Text = doc.UPLOADED_BY; lbl.Text = lbl.Text + " " + SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)doc.UPLOADED_DT, SessionManager.UserContext.TimeZoneID), "d", true); //WebSiteCommon.LocalTime((DateTime)doc.UPLOADED_DT, SessionManager.UserContext.TimeZoneID).ToShortDateString(); lbl = (Label)e.Item.FindControl("lblDisplayArea"); lbl.Text = WebSiteCommon.GetXlatValue("docDisplayType", doc.DISPLAY_TYPE.ToString()); if (doc.RECORD_ID > 0) { lbl = (Label)e.Item.FindControl("lblDocReference"); if (doc.DOCUMENT_SCOPE == "BLI") { PLANT plant = SQMModelMgr.LookupPlant((decimal)doc.RECORD_ID); if (plant != null) { lbl.Text = plant.PLANT_NAME; } } } string ext = doc.FILE_NAME.Substring(doc.FILE_NAME.LastIndexOf('.') + 1).ToLower(); if (!string.IsNullOrEmpty(ext)) { Image img = (Image)e.Item.FindControl("imgFileType"); img.ImageUrl = "~/images/filetype/icon_" + ext + ".gif"; } } catch { } } }
public void rptCompanyList_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { COMPANY company = (COMPANY)e.Item.DataItem; CheckBox cb; try { cb = (CheckBox)e.Item.FindControl("cbCompanyIsSupplier"); cb.Checked = Convert.ToBoolean(company.IS_SUPPLIER); cb = (CheckBox)e.Item.FindControl("cbCompanyIsCustomer"); cb.Checked = Convert.ToBoolean(company.IS_CUSTOMER); Label lbl = (Label)e.Item.FindControl("lblStatusOut"); lbl.Text = WebSiteCommon.GetXlatValue("statusCode", company.STATUS); } catch { } } }
public void gvUploadedFiles_OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString()))) { try { HiddenField hfField = (HiddenField)e.Row.Cells[0].FindControl("hfDisplayArea"); Label lbl = (Label)e.Row.Cells[0].FindControl("lblDisplayArea"); lbl.Text = WebSiteCommon.GetXlatValue("docDisplayType", hfField.Value); hfField = (HiddenField)e.Row.Cells[0].FindControl("hfFileName"); string ext = hfField.Value.Substring(hfField.Value.LastIndexOf('.') + 1).ToLower(); if (!string.IsNullOrEmpty(ext)) { Image img = (Image)e.Row.Cells[0].FindControl("imgFileType"); img.ImageUrl = "~/images/filetype/icon_" + ext + ".gif"; } } catch { } } }
public void gvIssueList_OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString()))) { try { Label lbl; HiddenField hf = (HiddenField)e.Row.Cells[0].FindControl("hfIssueID"); LinkButton lnk = (LinkButton)e.Row.Cells[0].FindControl("lnkViewIssue_out"); lnk.Text = WebSiteCommon.FormatID(Convert.ToInt32(hf.Value), 6); lbl = (Label)e.Row.Cells[0].FindControl("lblDisposition_Out"); string tempDisposition = lbl.Text; lbl.Text = WebSiteCommon.GetXlatValue("NCDisposition", lbl.Text); lnk = (LinkButton)e.Row.Cells[0].FindControl("lnkIssueDate_Out"); lnk.Text = WebSiteCommon.LocalTime(Convert.ToDateTime(lnk.Text), SessionManager.UserContext.TimeZoneID).ToShortDateString(); lnk = (LinkButton)e.Row.Cells[0].FindControl("lnkIssueTask_out"); lnk.Text = WebSiteCommon.GetXlatValueLong("taskType", lnk.Text); TASK_STATUS task = new TASK_STATUS(); hf = (HiddenField)e.Row.Cells[0].FindControl("hfTaskStatus"); task.TASK_ID = Convert.ToDecimal(hf.Value); hf = (HiddenField)e.Row.Cells[0].FindControl("hfTaskDueDate"); task.DUE_DT = WebSiteCommon.LocalTime(Convert.ToDateTime(hf.Value), SessionManager.UserContext.TimeZoneID); Image img = (Image)e.Row.Cells[0].FindControl("imgTaskStatus"); TaskStatus status = TaskMgr.CalculateTaskStatus(task); img.ImageUrl = TaskMgr.TaskStatusImage(status); img.ToolTip = status.ToString(); } catch { } } }
public void gvList_OnMeasureRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString()))) { try { Label lbl = (Label)e.Row.Cells[0].FindControl("lblStatus_out"); HiddenField hf = (HiddenField)e.Row.Cells[0].FindControl("hfStatus_out"); lbl.Text = WebSiteCommon.GetStatusString(hf.Value); hf = (HiddenField)e.Row.Cells[0].FindControl("hfMeasureSubcat"); if (hf.Value != staticSubcat) { staticSubcat = hf.Value; lbl = (Label)e.Row.Cells[0].FindControl("lblMeasureSubcat"); lbl.Text = WebSiteCommon.GetXlatValue("measureSubCategory", hf.Value); e.Row.Cells[0].Style.Add("BORDER-TOP", "#787878 1px solid"); } hf = (HiddenField)e.Row.Cells[0].FindControl("hfMeasureUOM"); lbl = (Label)e.Row.Cells[0].FindControl("lblMeasureUOM_out"); UOM uom = SessionManager.UOMList.FirstOrDefault(l => l.UOM_ID == Convert.ToDecimal(hf.Value)); if (uom != null) { lbl.Text = uom.UOM_CD; } for (int n = 1; n <= e.Row.Cells.Count; n++) { e.Row.Cells[n].Style.Add("BORDER-TOP", "#787878 1px solid"); } } catch { } } }
protected void rgAuditList_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; HiddenField hf; Label lbl; EHSAuditData data = (EHSAuditData)e.Item.DataItem; lbl = (Label)e.Item.FindControl("lblAuditId"); lbl.Text = WebSiteCommon.FormatID(data.Audit.AUDIT_ID, 6); if (data.Audit.DESCRIPTION.Length > 120) { lbl = (Label)e.Item.FindControl("lblDescription"); lbl.Text = data.Audit.DESCRIPTION.Substring(0, 117) + "..."; } //lbl = (Label)e.Item.FindControl("lblDescription"); //lbl.Text = HttpUtility.HtmlEncode(lbl.Text); if (data.Person != null) { lbl = (Label)e.Item.FindControl("lblAuditBy"); lbl.Text = SQMModelMgr.FormatPersonListItem(data.Person); } lbl = (Label)e.Item.FindControl("lblAuditStatus"); if (data.Audit.CURRENT_STATUS == "C") { DateTime clsDate = (DateTime)data.Audit.CLOSE_DATE_DATA_COMPLETE; lbl.Text = WebSiteCommon.GetXlatValue("auditStatus", "C") + " " + SQMBasePage.FormatDate(clsDate, "d", false); } else { if (data.DaysToClose == 0) { DateTime tmp = ((DateTime)data.Audit.AUDIT_DT).AddDays(data.AuditType.DAYS_TO_COMPLETE); lbl.Text = WebSiteCommon.GetXlatValue("auditStatus", "X") + "<br/>(" + SQMBasePage.FormatDate(tmp, "d", false) + ")"; } else if (data.Audit.PERCENT_COMPLETE > 0) { lbl.Text = WebSiteCommon.GetXlatValue("auditStatus", "I") + "<br/>(" + data.DaysToClose + ")"; } else { lbl.Text = WebSiteCommon.GetXlatValue("auditStatus", "A") + "<br/>(" + data.DaysToClose + ")"; } } LinkButton lnk = (LinkButton)e.Item.FindControl("lbAuditId"); if (SessionManager.UserContext.Person.PERSON_ID == data.Person.PERSON_ID) { lnk.CommandArgument = data.Audit.AUDIT_ID.ToString() + "~" + data.Status; } else if (!data.Status.Equals("C")) { lnk.CommandArgument = data.Audit.AUDIT_ID.ToString() + "~D"; } else { lnk.CommandArgument = data.Audit.AUDIT_ID.ToString() + "~C"; } } }
public void gvOnProfileRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString()))) { try { CheckBox cb; Label lbl; Image img = (Image)e.Row.Cells[0].FindControl("imgHazardType"); HiddenField hf = (HiddenField)e.Row.Cells[0].FindControl("hfMetricPrompt"); if (!string.IsNullOrEmpty(hf.Value)) { lbl = (Label)e.Row.Cells[0].FindControl("lblMetricPrompt"); lbl.Visible = true; lbl.Text = "<br>" + hf.Value; } hf = (HiddenField)e.Row.Cells[0].FindControl("hfMetricCategory"); if (hf.Value == "ENGY" || hf.Value == "EUTL") { e.Row.Cells[0].CssClass = e.Row.Cells[1].CssClass = "energyColor"; img.ImageUrl = "~/images/status/energy.png"; } else if (hf.Value == "PROD" || hf.Value == "SAFE" || hf.Value == "FACT") { img.ImageUrl = "~/images/status/inputs.png"; img.ToolTip = WebSiteCommon.GetXlatValueLong("measureCategoryEHS", hf.Value); } else { e.Row.Cells[0].CssClass = e.Row.Cells[1].CssClass = "wasteColor"; hf = (HiddenField)e.Row.Cells[0].FindControl("hfMetricRegStatus"); if (hf.Value == "HZ") { img.ImageUrl = "~/images/status/hazardous.png"; } else { img.ImageUrl = "~/images/status/waste.png"; } img.ToolTip = WebSiteCommon.GetXlatValueLong("regulatoryStatus", hf.Value); hf = (HiddenField)e.Row.Cells[0].FindControl("hfDisposalCode"); if (!string.IsNullOrEmpty(hf.Value)) { img.ToolTip += (". " + SessionManager.DisposalCodeList.FirstOrDefault(l => l.UN_CODE == hf.Value).DESCRIPTION); } } // e.Row.Cells[0].Attributes.Add("Style", "background: wheat;"); hf = (HiddenField)e.Row.Cells[0].FindControl("hfMetricStatus"); if (hf.Value == "I") { img = (Image)e.Row.Cells[0].FindControl("imgStatus"); img.ImageUrl = "/images/defaulticon/16x16/no.png"; img.Visible = true; cb = (CheckBox)e.Row.Cells[0].FindControl("cbMetricRequired"); cb.Visible = false; } LinkButton lnk = (LinkButton)e.Row.Cells[0].FindControl("lnkMetricCD"); LinkButton lnk2 = (LinkButton)e.Row.Cells[0].FindControl("lnkMetricName"); lnk.ToolTip = lnk2.ToolTip = WebSiteCommon.GetXlatValue("measureCategoryEHS", hf.Value); cb = (CheckBox)e.Row.Cells[0].FindControl("cbMetricRequired"); hf = (HiddenField)e.Row.Cells[0].FindControl("hfMetricRequired"); if (!string.IsNullOrEmpty(hf.Value)) { try { cb.Checked = Convert.ToBoolean(hf.Value); } catch { } } lbl = (Label)e.Row.Cells[0].FindControl("lblInvoiceType"); hf = (HiddenField)e.Row.Cells[0].FindControl("hfMetricCategory"); if (hf.Value == "SAFE" || hf.Value == "PROD" || hf.Value == "FACT") { lbl.Text = ""; } else { if (lbl.Text == "True") { lbl.Text = WebSiteCommon.GetXlatValue("costType", "CREDIT", "short"); } else { lbl.Text = WebSiteCommon.GetXlatValue("costType", "COST", "short"); } } lbl = (Label)e.Row.Cells[0].FindControl("lblInvoiceUOM"); if (!string.IsNullOrEmpty(lbl.Text)) { decimal uomID = Convert.ToDecimal(lbl.Text); lbl.Text = SessionManager.UOMList.Where(l => l.UOM_ID == uomID).Select(u => u.UOM_NAME).FirstOrDefault().ToString(); } } catch { } } }
protected void btnProfileSave_Click(object sender, EventArgs e) { LocalProfile().Profile.DAY_DUE = Convert.ToInt32(ddlDayDue.SelectedValue); LocalProfile().Profile.REMINDER_DAYS = Convert.ToInt32(ddlWarningDays.SelectedValue); LocalProfile().Profile.APPROVER_ID = Convert.ToInt32(ddlFinalApprover.SelectedValue); LocalProfile().Profile.DISPLAY_OPTION = ddlDisplayOrder.SelectedIndex; if (LocalProfile().Profile.EHS_PROFILE_FACT != null) { LocalProfile().Profile.EHS_PROFILE_FACT.Clear(); } if (ddlNormFact.SelectedIndex > 0) { LocalProfile().Profile.EHS_PROFILE_FACT.Add(LocalProfile().AddFactor("norm", "", Convert.ToDecimal(ddlNormFact.SelectedValue))); LocalProfile().Profile.EHS_PROFILE_FACT.Add(LocalProfile().AddFactor("normCost", "", Convert.ToDecimal(ddlNormFact.SelectedValue))); } LocalProfile().Profile.UTIL_MONTH_SPAN = LocalProfile().Profile.WASTE_MONTH_SPAN = Convert.ToInt32(WebSiteCommon.GetXlatValue("invoiceSpan", "MINDATE")); if (EHSProfile.UpdateProfile(LocalProfile()) >= 0) { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alertResult('hfAlertSaveSuccess');", true); } BindProfile(LocalProfile()); }
public void rptProfileInput_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { try { EHS_PROFILE_INPUT input = (EHS_PROFILE_INPUT)e.Item.DataItem; EHS_PROFILE_MEASURE metric = LocalProfile().GetMeasure((decimal)input.PRMR_ID); Label lbl; LinkButton lnk; //TextBox tb; DropDownList ddl; // bool enabled = input.STATUS == "C" ? false : true; bool enabled = true; sharedCalendar.Visible = true; RadDatePicker dtp1 = (RadDatePicker)e.Item.FindControl("radDateFrom"); dtp1.SharedCalendar = sharedCalendar; dtp1.Enabled = enabled; dtp1.ShowPopupOnFocus = true; RadDatePicker dtp2 = (RadDatePicker)e.Item.FindControl("radDateTo"); dtp2.SharedCalendar = sharedCalendar; dtp2.Enabled = enabled; dtp2.ShowPopupOnFocus = true; SETTINGS sets = SQMSettings.GetSetting("EHS", "INPUTSPAN"); int inputspan = 0; int monthSpan1 = Convert.ToInt32(WebSiteCommon.GetXlatValue("invoiceSpan", "MINDATE")); int monthSpan2 = monthSpan1; if (sets != null && int.TryParse(sets.VALUE, out inputspan)) { monthSpan2 = monthSpan1 = inputspan; } dtp1.MinDate = LocalProfile().InputPeriod.PeriodDate.AddMonths(monthSpan1 * -1); dtp2.MinDate = LocalProfile().InputPeriod.PeriodDate.AddMonths(monthSpan2 * -1); if (inputspan > 0) { dtp1.MaxDate = dtp2.MaxDate = LocalProfile().InputPeriod.PeriodDate.AddMonths(inputspan); } else { dtp1.MaxDate = dtp2.MaxDate = LocalProfile().InputPeriod.PeriodDate.AddMonths(Convert.ToInt32(WebSiteCommon.GetXlatValue("invoiceSpan", "MAXDATE"))); } dtp1.Culture = System.Threading.Thread.CurrentThread.CurrentUICulture; if (input != null) { if (input.STATUS == "N") { dtp1.Focus(); } if (input.EFF_FROM_DT > DateTime.MinValue) { dtp1.SelectedDate = input.EFF_FROM_DT; } else { dtp1.FocusedDate = new DateTime(LocalProfile().InputPeriod.PeriodYear, LocalProfile().InputPeriod.PeriodMonth, 1); } } dtp2.Culture = System.Threading.Thread.CurrentThread.CurrentUICulture; if (input != null && input.EFF_TO_DT > DateTime.MinValue) { dtp2.SelectedDate = input.EFF_TO_DT; } else { dtp2.FocusedDate = new DateTime(LocalProfile().InputPeriod.PeriodYear, LocalProfile().InputPeriod.PeriodMonth, 1); } UOM uom = SessionManager.UOMList.FirstOrDefault(l => l.UOM_ID == input.UOM); if (uom != null) { lbl = (Label)e.Item.FindControl("lblMetricUOM"); lbl.Text = uom.UOM_CD; } lbl = (Label)e.Item.FindControl("lblMetricCurrency"); lbl.Text = metric.DEFAULT_CURRENCY_CODE; if (input != null) { lbl.Text = input.CURRENCY_CODE; } TextBox tbValue = (TextBox)e.Item.FindControl("tbMetricValue"); tbValue.Enabled = enabled; if (input != null && (dtp1.SelectedDate != null && dtp2.SelectedDate != null)) { //if (input != null && input.MEASURE_VALUE != null) tbValue.Text = SQMBasePage.FormatValue((decimal)input.MEASURE_VALUE, 2); } TextBox tbCost = (TextBox)e.Item.FindControl("tbMetricCost"); TextBox tbCredit = (TextBox)e.Item.FindControl("tbMetricCredit"); if ((bool)metric.NEG_VALUE_ALLOWED) { tbCredit.Visible = tbCredit.Enabled = enabled; tbCost.Enabled = false; } else { tbCredit.Visible = false; tbCost.Enabled = true; } if (input != null && input.MEASURE_COST.HasValue && input.MEASURE_COST < 0) { tbCredit.Text = SQMBasePage.FormatValue((decimal)input.MEASURE_COST * -1, 2); } if (input != null && input.MEASURE_COST.HasValue && input.MEASURE_COST >= 0) { tbCost.Text = SQMBasePage.FormatValue((decimal)input.MEASURE_COST, 2); } if (metric.EHS_MEASURE.MEASURE_CATEGORY == "PROD" || metric.EHS_MEASURE.MEASURE_CATEGORY == "SAFE" || metric.EHS_MEASURE.MEASURE_CATEGORY == "FACT") { dtp1.SelectedDate = new DateTime(LocalProfile().InputPeriod.PeriodYear, LocalProfile().InputPeriod.PeriodMonth, 1); dtp1.Enabled = false; dtp2.SelectedDate = new DateTime(LocalProfile().InputPeriod.PeriodYear, LocalProfile().InputPeriod.PeriodMonth, DateTime.DaysInMonth(LocalProfile().InputPeriod.PeriodYear, LocalProfile().InputPeriod.PeriodMonth)); dtp2.Enabled = false; tbCost.Visible = false; tbCredit.Visible = false; lbl = (Label)e.Item.FindControl("lblMetricCurrency"); lbl.Visible = false; } if (LocalProfile().GetMeasureExt(metric, DateTime.Now) != null && metric.EHS_PROFILE_MEASURE_EXT.VALUE_DEFAULT.HasValue) { tbValue.CssClass = "defaultText"; tbValue.ToolTip = hfDefaultValue.Value + metric.EHS_PROFILE_MEASURE_EXT.NOTE; tbValue.ReadOnly = metric.EHS_PROFILE_MEASURE_EXT.OVERRIDE_ALLOWED == true ? false : true; if (string.IsNullOrEmpty(tbValue.Text)) { tbValue.Text = SQMBasePage.FormatValue((decimal)metric.EHS_PROFILE_MEASURE_EXT.VALUE_DEFAULT, 2); } } if (LocalProfile().GetMeasureExt(metric, DateTime.Now) != null && metric.EHS_PROFILE_MEASURE_EXT.COST_DEFAULT.HasValue) { tbCost.CssClass = "defaultText"; tbCost.ToolTip = hfDefaultValue.Value + metric.EHS_PROFILE_MEASURE_EXT.NOTE; tbCost.ReadOnly = metric.EHS_PROFILE_MEASURE_EXT.OVERRIDE_ALLOWED == true ? false : true; if (string.IsNullOrEmpty(tbCost.Text)) { tbCost.Text = SQMBasePage.FormatValue((decimal)metric.EHS_PROFILE_MEASURE_EXT.COST_DEFAULT, 2); } } CheckBox cbDelete = (CheckBox)e.Item.FindControl("cbDelete"); //string cbId = "ctl00_ContentPlaceHolder_Body_rptProfilePeriod_ctl06_rptProfileInput_ctl01_cbDelete"; cbDelete.Attributes.Add("onClick", "CheckInputDelete('" + cbDelete.ClientID + "');"); if (input.STATUS == "A" || input.STATUS == "D") { cbDelete.Enabled = true; } if (input.STATUS == "D") { cbDelete.Checked = true; cbDelete.ToolTip = hfDeleteText.Value; hfNumDelete.Value = (Convert.ToInt32(hfNumDelete.Value) + 1).ToString(); } } catch (Exception ex) { ; } } }
protected void rgPreventativeList_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { HiddenField hf; Label lbl; string val = ""; EHSIncidentData data = (EHSIncidentData)e.Item.DataItem; lbl = (Label)e.Item.FindControl("lblIncidentId"); lbl.Text = WebSiteCommon.FormatID(data.Incident.INCIDENT_ID, 6); lbl = (Label)e.Item.FindControl("lblDescription"); lbl.Text = StringHtmlExtensions.TruncateHtml(data.Incident.DESCRIPTION, 100, "..."); lbl.Text = lbl.Text.Replace("<a href", "<a target=\"blank\" href"); if (data.Person != null) { lbl = (Label)e.Item.FindControl("lblReportedBy"); lbl.Text = SQMModelMgr.FormatPersonListItem(data.Person); } lbl = (Label)e.Item.FindControl("lblCategory"); lbl.Text = EHSIncidentMgr.SelectIncidentAnswer(data.Incident, (decimal)EHSQuestionId.InspectionCategory) + "<br/>" + EHSIncidentMgr.SelectIncidentAnswer(data.Incident, (decimal)EHSQuestionId.RecommendationType); lbl = (Label)e.Item.FindControl("lblIncStatus"); try { if (data.Status == "U") { lbl.Text = "Audited " + SQMBasePage.FormatDate((DateTime)data.Incident.CLOSE_DATE_DATA_COMPLETE, "d", false) + "<br/>(" + data.DaysToClose.ToString() + ")"; } else if (data.Status == "F") { lbl.Text = "Awaiting Funding " + SQMBasePage.FormatDate((DateTime)data.Incident.CLOSE_DATE_DATA_COMPLETE, "d", false) + "<br/>(" + data.DaysToClose.ToString() + ")"; } else if (data.Status == "C") { lbl.Text = "Closed " + SQMBasePage.FormatDate((DateTime)data.Incident.CLOSE_DATE, "d", false) + "<br/><strong>Not Audited</strong>"; } else { lbl.Text = WebSiteCommon.GetXlatValue("incidentStatus", data.Status) + "<br/>(" + data.DaysOpen + ")"; } } catch { ; } LinkButton lbEditReport = (LinkButton)e.Item.FindControl("lbEditReport"); lbEditReport.Visible = true; try { lbl = (Label)e.Item.FindControl("lblIncidentDT"); lbl.Text = SQMBasePage.FormatDate(data.Incident.INCIDENT_DT, "d", false); if ((val = data.EntryList.Where(l => l.INCIDENT_QUESTION_ID == 80).Select(l => l.ANSWER_VALUE).FirstOrDefault()) != null && !string.IsNullOrEmpty(val)) { val = val.Substring(0, val.IndexOf(' ')); DateTime parseDate; if (DateTime.TryParse(val, CultureInfo.GetCultureInfo("en-US"), DateTimeStyles.AssumeLocal, out parseDate)) { lbl.Text = parseDate.ToShortDateString(); } } } catch {} try { if ((val = data.EntryList.Where(l => l.INCIDENT_QUESTION_ID == 92).Select(l => l.ANSWER_VALUE).FirstOrDefault()) != null && !string.IsNullOrEmpty(val)) { val = val.Substring(0, val.IndexOf(' ')); DateTime parseDate; if (DateTime.TryParse(val, CultureInfo.GetCultureInfo("en-US"), DateTimeStyles.AssumeLocal, out parseDate)) { lbl = (Label)e.Item.FindControl("lblDueDT"); lbl.Text = parseDate.ToShortDateString(); } } } catch {; } if (data.RespPerson != null) { lbl = (Label)e.Item.FindControl("lblAssignedTo"); lbl.Text = SQMModelMgr.FormatPersonListItem(data.RespPerson); } if (rgPreventativeList.MasterTableView.GetColumn("Attach").Visible&& data.AttachList != null) { lbl = (Label)e.Item.FindControl("lblAttach"); Ucl_Attach attch = (Ucl_Attach)Page.LoadControl("/Include/Ucl_Attach.ascx"); lbl.Parent.Controls.AddAt(lbl.Parent.Controls.IndexOf(lbl), attch); attch.BindListAttachment(data.AttachList, "1", 1); } } }
protected void DisplayUser() { PERSON person = LocalPerson(); BusinessLocation businessLocation; SETTINGS sets = SQMSettings.GetSetting("COMPANY", "ESCALATEANYUSER"); SQM_ACCESS sysAccess = SQMModelMgr.LookupCredentials(entities, person.SSO_ID, "", false); divPageBody.Visible = true; ddlPlantSelect.ClearCheckedItems(); ddlCustPlantSelect.ClearCheckedItems(); DisplayErrorMessage(null); if (person == null || string.IsNullOrEmpty(person.STATUS)) // new user { winUserEdit.Title = hfAddUser.Value; businessLocation = new BusinessLocation(); businessLocation.Company = SessionManager.EffLocation.Company; SetStatusList("ddlUserStatus", "A", true); tbUserSSOID.Enabled = true; tbUserSSOID.Text = ""; tbUserSSOID.Focus(); } else { winUserEdit.Title = hfUpdateUser.Value; tbUserSSOID.Enabled = false; tbUserFirstName.Focus(); lblPlantAccess.Text = ""; if (person.PLANT_ID > 0) { ddlHRLocation.SelectedValue = person.PLANT_ID.ToString(); if (ddlPlantSelect.Items.FindItemByValue(person.PLANT_ID.ToString()) != null) { ddlPlantSelect.Items.FindItemByValue(person.PLANT_ID.ToString()).Checked = true; } } if (!string.IsNullOrEmpty(person.NEW_LOCATION_CD)) { RadComboBoxItem plantItem = null; string[] locs = person.NEW_LOCATION_CD.Split(','); foreach (string locid in locs) { if ((plantItem = ddlPlantSelect.Items.FindItemByValue(locid)) != null) { ddlPlantSelect.Items.FindItemByValue(locid).Checked = true; if (locs.Length > 2) { lblPlantAccess.Text += lblPlantAccess.Text.Length == 0 ? plantItem.Text : (", " + plantItem.Text); } } } } if (!string.IsNullOrEmpty(person.OLD_LOCATION_CD)) { string[] locs = person.OLD_LOCATION_CD.Split(','); foreach (string locid in locs) { if (ddlCustPlantSelect.Items.FindItemByValue(locid) != null) { ddlCustPlantSelect.Items.FindItemByValue(locid).Checked = true; } } } } // AW20131106 - do not want to be able to change a SSO ID once a person has been added if (!string.IsNullOrEmpty(person.SSO_ID.Trim())) { tbUserSSOID.Text = person.SSO_ID; } tbUserFirstName.Text = person.FIRST_NAME; tbUserLastName.Text = person.LAST_NAME; tbUserTitle.Text = person.JOB_TITLE; tbUserPhone.Text = person.PHONE; tbUserEmail.Text = person.EMAIL; SetStatusList("ddlUserStatus", person.STATUS, true); if (sysAccess != null && sysAccess.LAST_LOGON_DT.HasValue) { lblUserLoginDate_out.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)sysAccess.LAST_LOGON_DT, WebSiteCommon.GetXlatValue("timeZone", person.PREFERRED_TIMEZONE)), "g", true); } else { lblUserLoginDate_out.Text = ""; } lblUserLastUpdate.Text = person.LAST_UPD_BY + " " + SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)person.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "g", true); if (ddlUserLanguage.Items.FindByValue(person.PREFERRED_LANG_ID.ToString()) != null) { ddlUserLanguage.SelectedValue = person.PREFERRED_LANG_ID.ToString(); } if (ddlUserTimezone.Items.FindByValue(person.PREFERRED_TIMEZONE) != null) { ddlUserTimezone.SelectedValue = person.PREFERRED_TIMEZONE; } ddlUserRole.Items.Clear(); ddlUserRole.Items.AddRange(WebSiteCommon.PopulateRadListItems("userRole")); for (int i = ddlUserRole.Items.Count - 1; i >= 0; i--) { AccessMode roleMode = SessionManager.RoleAccessMode(Convert.ToInt32(ddlUserRole.Items[i].Value)); if (SessionManager.IsEffLocationPrimary() && roleMode == AccessMode.Partner) { ddlUserRole.Items.Remove(i); } if (!SessionManager.IsEffLocationPrimary() && roleMode != AccessMode.Partner) // restrict roles of non-primary company users { ddlUserRole.Items.Remove(i); } else if (UserContext.RoleAccess() < AccessMode.SA && roleMode > AccessMode.Admin) // only QAI admin may see or edit sys admin role { ddlUserRole.Items.Remove(i); } } string rolesDesc = ""; if (ddlUserRole.Items.FindItemByValue(person.ROLE.ToString()) != null) { ddlUserRole.SelectedValue = person.ROLE.ToString(); } if (sets == null || sets.VALUE.ToUpper() != "Y") // prompt for user escalation { cbUserRcvEscalation.Visible = true; if (person.RCV_ESCALATION.HasValue) { cbUserRcvEscalation.Checked = (bool)person.RCV_ESCALATION; } } else { cbUserRcvEscalation.Visible = false; // enable escalation for anyone cbUserRcvEscalation.Checked = true; } if (person.ROLE <= 100 || person.PERSON_ACCESS.Where(a => a.ACCESS_PROD == "SQM").Count() > 0) { ddlCustPlantSelect.Enabled = true; } else { ddlCustPlantSelect.Enabled = false; ddlCustPlantSelect.SelectedIndex = 0; } List <SysModule> sysmodList = SQMSettings.SystemModuleItems(); string prod = ""; RadComboBoxItem item = null; RadComboBoxItem itemSep = null; ddlModuleAccess.Items.Clear(); lblModuleAccess.Text = ""; foreach (SysModule sysmod in sysmodList.Where(l => l.prod != "CQM").ToList()) { if (string.IsNullOrEmpty(sysmod.mod)) { prod = sysmod.prod; itemSep = new RadComboBoxItem(((HiddenField)pnlUserEdit.FindControl("hf" + prod)).Value, prod); itemSep.IsSeparator = true; ddlModuleAccess.Items.Add(itemSep); } else { item = new RadComboBoxItem(sysmod.desc, sysmod.topic); ddlModuleAccess.Items.Add(item); if (GetSelectedUserRole() <= 100) { item.Checked = true; } else if ((sysmod.prod == "SQM" && person.PERSON_ACCESS.Where(a => a.ACCESS_TOPIC == "201").Count() > 0) || (sysmod.prod == "EHS" && person.PERSON_ACCESS.Where(a => a.ACCESS_TOPIC == "301").Count() > 0)) { item.Checked = true; } else if (person.PERSON_ACCESS.Where(a => a.ACCESS_TOPIC == sysmod.topic).Count() > 0) { item.Checked = true; } // exclusions if (!SessionManager.IsEffLocationPrimary()) // restrict module selections if not primary company user { if (sysmod.prod != "SQM") { itemSep.Enabled = item.Enabled = item.Checked = false; ddlModuleAccess.Height = 120; } } if (item.Checked) { lblModuleAccess.Text += lblModuleAccess.Text.Length == 0 ? item.Text : (", " + item.Text); } } } if (!SessionManager.IsEffLocationPrimary()) { ddlCustPlantSelect.Enabled = false; cbUserRcvEscalation.Visible = cbUserRcvEscalation.Checked = false; } string script = "function f(){OpenUserEditWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); }
static void PrepareEmail(TASK_STATUS task, PERSON recipient) { try { // Get task information //var taskList = (from t in entities.TASKLIST where t.TASKLIST_ID == task.TASKLIST_ID select t).FirstOrDefault(); TaskListRecordType recordType = (TaskListRecordType)task.RECORD_TYPE; string typeName = ""; string description = ""; if (recordType == TaskListRecordType.Incident) { typeName = "Incident"; description += (from i in entities.INCIDENT where i.INCIDENT_ID == task.RECORD_ID select i.ISSUE_TYPE + ": " + i.DESCRIPTION).FirstOrDefault(); var qiOccurrance = (from qi in entities.QI_OCCUR where qi.INCIDENT_ID == task.RECORD_ID select qi).FirstOrDefault(); string dispDetails = ""; if (qiOccurrance != null) { description += "<ul>"; if (qiOccurrance.PROBCASE_REQD == true) { description += "A problem case has been created for this incident.<br/>"; } if (!string.IsNullOrEmpty(qiOccurrance.DISPOSITION)) { dispDetails = (from dd in entities.QI_OCCUR_DISPOSITION where dd.DISPOSITION_ID == qiOccurrance.DISPOSITION select dd.TITLE + " - " + dd.DESCRIPTION).FirstOrDefault(); } if (!string.IsNullOrEmpty(dispDetails)) { description += "<li>Disposition: " + dispDetails + "</li>"; } description += "</ul>"; } } else if (recordType == TaskListRecordType.ProblemCase) { typeName = "Problem Case"; description += (from p in entities.PROB_CASE where p.PROBCASE_ID == task.RECORD_ID select p.DESC_SHORT + ": " + p.DESC_LONG).FirstOrDefault(); decimal stepId; if (decimal.TryParse(task.TASK_STEP, out stepId)) { var step = (from s in entities.PROB_CASE_STEP where s.STEP_ID == stepId select s).FirstOrDefault(); if (step != null) { description += "Step " + stepId + ": " + step.STEP_DESCRIPTION + "<br/><br/>"; } } } string url = "http://pssqm.luxinteractive.com/"; string body = ""; body += "The following " + typeName + " is still open:<br/><br/>"; body += description; body += "<br/><br/>"; body += "To update this " + typeName + ", please visit:<br/>"; body += "<a href=\"" + url + "\">" + url + "</a>"; body += "<br/><br/>Please Do Not Reply To This Message"; // AW20140129 string toEmail = recipient.EMAIL; string subject = WebSiteCommon.GetXlatValue("emailSettings", "companyName") + " Reminder Notification"; string bcc = ""; SQM.Website.WebSiteCommon.SendEmail(toEmail, subject, body, bcc); //SendEmail(recipient, body); } catch (Exception ex) { WriteLine("PrepareEmail Error: " + ex.ToString()); WriteLine("PrepareEmail Detailed Error: " + ex.InnerException.ToString()); } }
public UserContext Initialize(string SSOID, string pwd, bool activeOnly) { SQM.Website.PSsqmEntities ctx = new PSsqmEntities(); this.LoginStatus = LoginStatus.SSOUndefined; SQM_ACCESS access = SQMModelMgr.LookupCredentials(ctx, SSOID, pwd, true); if (access != null) { string key = SQMModelMgr.GetPasswordKey(); // AW - for now, we want to allow if the password = the password OR the encrypted password string password = WebSiteCommon.Decrypt(access.PASSWORD, key); //string encrypt = WebSiteCommon.Encrypt(pwd, key); //string ss = encrypt; /* * if ((string.IsNullOrEmpty(pwd) && (SSOID.ToLower() != "admin")) || (pwd != password && pwd != access.PASSWORD)) * this.LoginStatus = LoginStatus.PasswordMismatch; */ //if (!string.IsNullOrEmpty(access.PASSWORD) && (pwd != password && pwd != access.PASSWORD)) if (pwd != password && pwd != access.PASSWORD) { this.LoginStatus = LoginStatus.PasswordMismatch; } else if (activeOnly && access.STATUS == "I") { this.LoginStatus = LoginStatus.Inactive; } else if (access.STATUS == "L") { this.LoginStatus = LoginStatus.Locked; } else { if ((this.Person = SQMModelMgr.LookupPerson(ctx, 0, access.SSO_ID, false)) == null) { this.LoginStatus = LoginStatus.PersonUndefined; } else { this.LoginStatus = LoginStatus.Success; this.HRLocation = new BusinessLocation().Initialize(SQMModelMgr.LookupCompany((decimal)this.Person.COMPANY_ID), SQMModelMgr.LookupBusOrg((decimal)this.Person.BUS_ORG_ID), SQMModelMgr.LookupPlant((decimal)this.Person.PLANT_ID)); if (this.HRLocation.Company == null) { this.LoginStatus = LoginStatus.CompanyUndefined; } else { SessionManager.EffLocation = new BusinessLocation().Initialize(SQMModelMgr.LookupCompany((decimal)this.Person.COMPANY_ID), SQMModelMgr.LookupBusOrg((decimal)this.Person.BUS_ORG_ID), SQMModelMgr.LookupPlant((decimal)this.Person.PLANT_ID)); if (this.Person.PERSON_RESP.ALT_COMPANY_ID > 0) { this.WorkingLocation = new BusinessLocation().Initialize(SQMModelMgr.LookupCompany((decimal)this.Person.PERSON_RESP.ALT_COMPANY_ID), SQMModelMgr.LookupBusOrg((decimal)this.Person.PERSON_RESP.ALT_BUS_ORG_ID), SQMModelMgr.LookupPlant((decimal)this.Person.PERSON_RESP.ALT_PLANT_ID)); } else { this.WorkingLocation = new BusinessLocation(); this.WorkingLocation = SessionManager.EffLocation; } //this.WorkingLocation = new BusinessLocation().Initialize(SQMModelMgr.LookupCompany((decimal)this.Person.COMPANY_ID), SQMModelMgr.LookupBusOrg((decimal)this.Person.BUS_ORG_ID), SQMModelMgr.LookupPlant((decimal)this.Person.PLANT_ID)); this.PlantAccessList = new List <decimal>(); if (!string.IsNullOrEmpty(Person.NEW_LOCATION_CD)) { decimal plantID; string[] locs = Person.NEW_LOCATION_CD.Split(','); foreach (string locid in locs) { if (decimal.TryParse(locid, out plantID)) { this.PlantAccessList.Add(plantID); } } } access.LAST_LOGON_DT = WebSiteCommon.CurrentUTCTime(); int ctxstatus = 0; SQMModelMgr.UpdateCredentials(ctx, access, "", out ctxstatus); this.Credentials = access; this.TimeZoneID = WebSiteCommon.GetXlatValue("timeZone", this.Person.PREFERRED_TIMEZONE); this.DelegateList = new List <decimal>(); this.DelegateList = SQMModelMgr.SelectDelegateList(ctx, this.Person.PERSON_ID).Select(l => l.PERSON_ID).ToList(); this.EscalationAssignments = SQMModelMgr.SelectPersonEscalationList(ctx, this.Person.PERSON_ID); if (SessionManager.CreateSessionContext(this) == null) { this.LoginStatus = LoginStatus.SessionError; } this.InboxReviews = 0; this.TaskList = new List <TaskItem>(); } } } } return(this); }
protected void rgCaseList_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridHeaderItem) { GridHeaderItem gh = e.Item as GridHeaderItem; if (staticAppContext == "QI") { //gh.Cells[4].Text = ""; //gh.Cells[4].Visible = false; ; } else { ; } } if (e.Item is GridDataItem) { try { GridDataItem item = (GridDataItem)e.Item; HiddenField hf = (HiddenField)item["Reports"].FindControl("hfProblemCaseType"); LinkButton lbReportQi = (LinkButton)item["Reports"].FindControl("lbReport"); HyperLink hlReportEhs = (HyperLink)item["Reports"].FindControl("hlReport"); lbReportQi.Attributes.Add("CaseType", hf.Value); //lbReportQi.Visible = (hf.Value != "EHS"); lbReportQi.Visible = true; hlReportEhs.Visible = (hf.Value == "EHS"); ProblemCase probCase = (ProblemCase)e.Item.DataItem; Label lbl = (Label)e.Item.FindControl("lblCaseID"); lbl.Text = WebSiteCommon.FormatID(probCase.ProbCase.PROBCASE_ID, 6); LinkButton lnk = (LinkButton)e.Item.FindControl("lbCaseId"); lbl = (Label)e.Item.FindControl("lblIncidentID"); if (probCase.IncidentList != null && probCase.IncidentList.Count > 0) { lbl.Text = WebSiteCommon.FormatID(probCase.IncidentList[0].INCIDENT_ID, 6); } lbl = (Label)e.Item.FindControl("lblStatus"); if (probCase.ProbCase.CLOSE_DT.HasValue) { lbl.Text = WebSiteCommon.GetXlatValue("recordStatus", "C") + ": " + SQMBasePage.FormatDate((DateTime)probCase.ProbCase.CLOSE_DT, "d", false); } else { lbl.Text = WebSiteCommon.GetXlatValue("caseStep", (Math.Max((decimal)probCase.ProbCase.PROGRESS, 1) - 1).ToString()); hf = (HiddenField)e.Item.FindControl("hfStatus"); if (hf.Value == "I") { Image img = (Image)e.Item.FindControl("imgStatus"); img.ImageUrl = "/images/defaulticon/16x16/no.png"; img.Visible = true; } } } catch { } } }
protected void rgUserList_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { try { GridDataItem item = (GridDataItem)e.Item; PERSON user = (PERSON)e.Item.DataItem; if (user.STATUS == "I") { Image img = (Image)e.Item.FindControl("imgStatus"); img.ImageUrl = "/images/defaulticon/16x16/no.png"; img.Visible = true; } SETTINGS sets = SQMSettings.GetSetting("COMPANY", "PLANTUSER"); if (sets == null || sets.VALUE.ToUpper() != "N") { Label lbl = (Label)e.Item.FindControl("lblUserStatus"); lbl.Text = WebSiteCommon.GetXlatValue("statusCodeDelete", lbl.Text); lbl = (Label)e.Item.FindControl("lblUserRole"); if (user.JOBCODE != null) { lbl.Text = (user.JOBCODE_CD + " / " + user.JOBCODE.JOB_DESC); } //lbl.Text = WebSiteCommon.GetXlatValue("userRole", user.ROLE.ToString()); LinkButton lnk = (LinkButton)e.Item.FindControl("lnkHRLocation"); lnk.ToolTip = ""; PLANT plant = null; if ((plant = PlantList().Where(l => l.PLANT_ID == user.PLANT_ID).FirstOrDefault()) != null) { lnk.Text = plant.PLANT_NAME; } if (user.ROLE == 1 || user.ROLE == 100) { if ((plant = PlantList().Where(l => l.PLANT_ID == user.PLANT_ID).FirstOrDefault()) != null) { lnk.ToolTip = plant.PLANT_NAME + " ..."; } } else { string[] args = (user.PLANT_ID.ToString() + "," + user.NEW_LOCATION_CD).Split(','); foreach (string loc in args.Distinct().ToArray()) { if ((plant = PlantList().Where(l => l.PLANT_ID.ToString() == loc).FirstOrDefault()) != null) { lnk.ToolTip += (" " + plant.PLANT_NAME + ","); } } } lnk.ToolTip = lnk.ToolTip.TrimEnd(','); } } catch { ; } } }
protected void rgIncidentList_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; HiddenField hf; Label lbl; EHSIncidentData data = (EHSIncidentData)e.Item.DataItem; lbl = (Label)e.Item.FindControl("lblIncidentId"); lbl.Text = WebSiteCommon.FormatID(data.Incident.INCIDENT_ID, 6); if (data.Incident.DESCRIPTION.Length > 120) { lbl = (Label)e.Item.FindControl("lblDescription"); lbl.Text = data.Incident.DESCRIPTION.Substring(0, 117) + "..."; } lbl = (Label)e.Item.FindControl("lblDescription"); lbl.Text = HttpUtility.HtmlEncode(lbl.Text); if (data.Person != null) { lbl = (Label)e.Item.FindControl("lblReportedBy"); lbl.Text = SQMModelMgr.FormatPersonListItem(data.Person); } lbl = (Label)e.Item.FindControl("lblIncStatus"); if (data.Status == "C") { lbl.Text = WebSiteCommon.GetXlatValue("incidentStatus", "C") + " " + SQMBasePage.FormatDate((DateTime)data.Incident.CLOSE_DATE, "d", false) + "<br/>(" + data.DaysToClose.ToString() + ")"; } else if (data.Status == "C8") { lbl.Text = WebSiteCommon.GetXlatValue("incidentStatus", "C8") + " " + SQMBasePage.FormatDate((DateTime)data.Incident.CLOSE_DATE_8D, "d", false) + "<br/>(" + data.DaysToClose.ToString() + ")"; } else if (data.Status == "N") { lbl.Text = "<strong>" + WebSiteCommon.GetXlatValue("incidentStatus", "N") + "</strong>"; } else { lbl.Text = WebSiteCommon.GetXlatValue("incidentStatus", "A") + "<br/>(" + data.DaysOpen + ")"; } LinkButton lb8d = (LinkButton)e.Item.FindControl("lb8d"); LinkButton lbEditReport = (LinkButton)e.Item.FindControl("lbEditReport"); lb8d.Visible = lbEditReport.Visible = false; // mt - for AAM HyperLink hlReport = (HyperLink)e.Item.FindControl("hlReport"); hlReport.Visible = true; /* * INCIDENT_ANSWER entry = data.Incident.INCIDENT_ANSWER.Where(l => l.INCIDENT_QUESTION_ID == (decimal)EHSQuestionId.Create8D).FirstOrDefault(); * if (entry != null && entry.ANSWER_VALUE == "Yes") * { * if (UserContext.RoleAccess() > AccessMode.View) * lb8d.Visible = true; * else * lb8d.Visible = false; * * lbEditReport.Visible = false; * * var problemCaseId = EHSIncidentMgr.SelectProblemCaseIdByIncidentId(data.Incident.INCIDENT_ID); * if (problemCaseId > 0) * { * * hlReport.NavigateUrl = "/EHS/EHS_Alert_PDF.aspx?pcid=" + EncryptionManager.Encrypt(problemCaseId.ToString()); * * LinkButton lbReport = (LinkButton)e.Item.FindControl("lbReport"); * lbReport.Visible = true; * lbReport.CommandArgument = problemCaseId.ToString(); * lbReport.Attributes.Add("CaseType", data.Incident.INCIDENT_TYPE); * } * } * else * { * lb8d.Visible = false; * lbEditReport.Visible = true; * * hlReport.NavigateUrl = "/EHS/EHS_Alert_PDF.aspx?iid=" + EncryptionManager.Encrypt(data.Incident.INCIDENT_ID.ToString()); * } */ if (data.Incident.ISSUE_TYPE_ID == 10) // Prevention Verification { lbEditReport.Visible = false; } if (rgIncidentList.MasterTableView.GetColumn("Attach").Visible&& data.AttachList != null) { lbl = (Label)e.Item.FindControl("lblAttach"); Ucl_Attach attch = (Ucl_Attach)Page.LoadControl("/Include/Ucl_Attach.ascx"); lbl.Parent.Controls.AddAt(lbl.Parent.Controls.IndexOf(lbl), attch); attch.BindListAttachment(data.AttachList, "", 1); } } }
public void gvNotifyList_OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString()))) { RadComboBox rdl1, rdl2; System.Web.UI.WebControls.HiddenField hfField = new HiddenField(); try { HiddenField hf = (HiddenField)e.Row.Cells[0].FindControl("hfScope"); Label lbl = (Label)e.Row.Cells[0].FindControl("lblScope"); lbl.Text = WebSiteCommon.GetXlatValue("taskRecordType", hf.Value); lbl = (Label)e.Row.Cells[0].FindControl("lblScopeDesc"); lbl.Text = WebSiteCommon.GetXlatValueLong("taskRecordType", hf.Value); TaskRecordType scope = (TaskRecordType)Enum.Parse(typeof(TaskRecordType), hf.Value, true); if (scope == TaskRecordType.InternalQualityIncident || scope == TaskRecordType.CustomerQualityIncident || scope == TaskRecordType.SupplierQualityIncident || scope == TaskRecordType.HealthSafetyIncident || scope == TaskRecordType.PreventativeAction) { rdl1 = (RadComboBox)e.Row.Cells[0].FindControl("ddlNotify1"); hf = (HiddenField)e.Row.Cells[0].FindControl("hfNotify1"); if (scope == TaskRecordType.HealthSafetyIncident || scope == TaskRecordType.PreventativeAction) { SQMBasePage.SetPersonList(rdl1, SQMModelMgr.FilterPersonListByAppContext(staticPersonList, "EHS"), "", 20); } else { SQMBasePage.SetPersonList(rdl1, SQMModelMgr.FilterPersonListByAppContext(staticPersonList, "SQM"), "", 20); } SQMBasePage.DisplayControlValue(rdl1, hf.Value, PageUseMode.EditEnabled, ""); rdl1.Visible = true; rdl2 = (RadComboBox)e.Row.Cells[0].FindControl("ddlNotify2"); hf = (HiddenField)e.Row.Cells[0].FindControl("hfNotify2"); if (scope == TaskRecordType.HealthSafetyIncident || scope == TaskRecordType.PreventativeAction) { SQMBasePage.SetPersonList(rdl2, SQMModelMgr.FilterPersonListByAppContext(staticPersonList, "EHS"), "", 20); } else { SQMBasePage.SetPersonList(rdl2, SQMModelMgr.FilterPersonListByAppContext(staticPersonList, "SQM"), "", 20); } SQMBasePage.DisplayControlValue(rdl2, hf.Value, PageUseMode.EditEnabled, ""); rdl2.Visible = true; } if (scope == TaskRecordType.ProfileInput || scope == TaskRecordType.ProfileInputApproval || scope == TaskRecordType.HealthSafetyIncident || scope == TaskRecordType.PreventativeAction || scope == TaskRecordType.ProblemCase) { SETTINGS sets = SQMSettings.GetSetting("COMPANY", "ESCALATEANYUSER"); rdl1 = (RadComboBox)e.Row.Cells[0].FindControl("ddlEscalate1"); hf = (HiddenField)e.Row.Cells[0].FindControl("hfEscalate1"); SQMBasePage.SetPersonList(rdl1, staticPersonList.Where(l => l.RCV_ESCALATION == true || (sets != null && sets.VALUE.ToUpper() == "Y")).ToList(), "", 20); SQMBasePage.DisplayControlValue(rdl1, hf.Value, PageUseMode.EditEnabled, ""); rdl1.Visible = true; rdl2 = (RadComboBox)e.Row.Cells[0].FindControl("ddlEscalate2"); hf = (HiddenField)e.Row.Cells[0].FindControl("hfEscalate2"); SQMBasePage.SetPersonList(rdl2, staticPersonList.Where(l => l.RCV_ESCALATION == true || (sets != null && sets.VALUE.ToUpper() == "Y")).ToList(), "", 20); SQMBasePage.DisplayControlValue(rdl2, hf.Value, PageUseMode.EditEnabled, ""); rdl2.Visible = true; rdl1 = (RadComboBox)e.Row.Cells[0].FindControl("ddlEscalateDays1"); hf = (HiddenField)e.Row.Cells[0].FindControl("hfEscalateDays1"); rdl1.Items.Add(new RadComboBoxItem("", "")); rdl1.Items.AddRange(WebSiteCommon.PopulateComboBoxListNums(1, 14, rdl1.EmptyMessage)); SQMBasePage.DisplayControlValue(rdl1, hf.Value, PageUseMode.EditEnabled, ""); rdl1.Visible = true; rdl2 = (RadComboBox)e.Row.Cells[0].FindControl("ddlEscalateDays2"); hf = (HiddenField)e.Row.Cells[0].FindControl("hfEscalateDays2"); rdl2.Items.Add(new RadComboBoxItem("", "")); rdl2.Items.AddRange(WebSiteCommon.PopulateComboBoxListNums(1, 14, rdl2.EmptyMessage)); SQMBasePage.DisplayControlValue(rdl2, hf.Value, PageUseMode.EditEnabled, ""); rdl2.Visible = true; } } catch { } } }
private void uclCaseEdit_OnSaveClick(string cmdArg) { bool bNotify; CaseCtl().problemCase.UpdateStatus = CaseUpdateStatus.Success; switch (cmdArg) { case "0": CaseCtl().problemCase = uclCaseEdit.UpdateCase0(CaseCtl().problemCase); if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success) { CaseCtl().Update(); uclCaseEdit.BindCase0(); } break; case "1": CaseCtl().problemCase = uclCaseEdit.UpdateCase1(CaseCtl().problemCase, out bNotify); if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success) { CaseCtl().Update(); uclCaseEdit.BindCase1(bNotify); if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success && bNotify) { try { string appUrl = SQMSettings.SelectSettingByCode(entities, "MAIL", "TASK", "MailURL").VALUE; PERSON person = null; PLANT plant = SQMModelMgr.LookupPlant((decimal)CaseCtl().problemCase.IncidentList[0].DETECT_PLANT_ID); int emailStatus; bool bUpdateTasks = false; foreach (TASK_STATUS task in CaseCtl().problemCase.TeamTask.TaskList.Where(t => t.TASK_TYPE == "C" && t.TASK_SEQ == 0).ToList()) { if (task.RESPONSIBLE_ID.HasValue && (person = SQMModelMgr.LookupPerson((decimal)task.RESPONSIBLE_ID, "")) != null && !task.NOTIFY_DT.HasValue) { task.NOTIFY_DT = DateTime.UtcNow; List <TaskItem> taskList = new List <TaskItem>(); TaskItem taskItem = new TaskItem(); taskItem.RecordID = CaseCtl().problemCase.ProbCase.PROBCASE_ID; taskItem.RecordKey = CaseCtl().problemCase.ProbCase.PROBCASE_ID.ToString(); taskItem.RecordType = 21; taskItem.NotifyType = TaskNotification.Owner; taskItem.Taskstatus = TaskMgr.CalculateTaskStatus(task); taskItem.Detail = SQMModelMgr.FormatPersonListItem(person); taskItem.Description = WebSiteCommon.FormatID(CaseCtl().problemCase.ProbCase.PROBCASE_ID, 6) + " / " + WebSiteCommon.GetXlatValue("caseStep", task.TASK_STEP); taskItem.Plant = plant; taskItem.Task = task; // taskItem.Task = task; taskList.Add(taskItem); Thread thread = new Thread(() => TaskMgr.MailTaskList(taskList, person.EMAIL, "web")); thread.IsBackground = true; thread.Start(); bUpdateTasks = true; // if ((emailStatus = TaskMgr.MailTaskList(taskList, person.EMAIL, "web")) > 0) // bUpdateTasks = true; } } if (bUpdateTasks) { CaseCtl().Update(); // save task notify dates } } catch (Exception ex) { // SQMLogger.LogException(ex); } } } break; case "2": CaseCtl().problemCase = uclCaseEdit.UpdateCase2(CaseCtl().problemCase); if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success) { CaseCtl().Update(); uclCaseEdit.BindCase2(); } break; case "3": CaseCtl().problemCase = uclCaseEdit.UpdateCase3(CaseCtl().problemCase); if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success) { CaseCtl().Update(); uclCaseEdit.BindCase3(); } break; case "4": CaseCtl().problemCase = uclCaseEdit.UpdateCase4(CaseCtl().problemCase); if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success) { CaseCtl().Update(); uclCaseEdit.BindCase4(); } break; case "5": CaseCtl().problemCase = uclCaseEdit.UpdateCase5(CaseCtl().problemCase); if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success) { CaseCtl().Update(); uclCaseEdit.BindCase5(); } break; case "6": CaseCtl().problemCase = uclCaseEdit.UpdateCase6(CaseCtl().problemCase); if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success) { CaseCtl().Update(); uclCaseEdit.BindCase6(); } break; case "7": CaseCtl().problemCase = uclCaseEdit.UpdateCase7(CaseCtl().problemCase, true); if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success) { CaseCtl().Update(); uclCaseEdit.BindCase7(); } break; case "8": CaseCtl().problemCase = uclCaseEdit.UpdateCase8(CaseCtl().problemCase, out bNotify); CaseCtl().Update(); uclCaseEdit.BindCase8(bNotify); if (bNotify && CaseCtl().problemCase != null) { List <decimal?> teamList = new List <decimal?>(); teamList = CaseCtl().problemCase.TeamTask.TaskList.Where(l => l.TASK_TYPE == "C" && l.RESPONSIBLE_ID > 0).Select(l => l.RESPONSIBLE_ID).Distinct().ToList(); PERSON person = null; // string emailStatus; foreach (decimal?personID in teamList) { if ((person = SQMModelMgr.LookupPerson((decimal)personID, "")) != null) { Thread thread = new Thread(() => WebSiteCommon.SendEmail(person.EMAIL, CaseCtl().problemCase.ProbCase.PROB_CLOSE.MESSAGE_TITLE, CaseCtl().problemCase.ProbCase.PROB_CLOSE.MESSAGE, "")); thread.IsBackground = true; thread.Start(); } } } break; default: break; } if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success) { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alertResult('hfAlertSaveSuccess');", true); SetupPage(); } else { ErrorAlert(CaseCtl().problemCase.UpdateStatus); } }
public string GetFullAuditName(string typeCode) { return(WebSiteCommon.GetXlatValue("auditType", typeCode)); }
public string GetFullIncidentName(string typeCode) { return(WebSiteCommon.GetXlatValue("incidentType", typeCode)); }