public int UpdateCausation(decimal incidentID) { int status = 0; using (PSsqmEntities ctx = new PSsqmEntities()) { status = ctx.ExecuteStoreCommand("DELETE FROM INCFORM_CAUSATION WHERE INCIDENT_ID = " + incidentID.ToString()); if (!string.IsNullOrEmpty(ddlCausation.SelectedValue)) { INCFORM_CAUSATION causation = new INCFORM_CAUSATION(); causation.INCIDENT_ID = incidentID; causation.CAUSEATION_CD = ddlCausation.SelectedValue; causation.TEAM_LIST = tbTeam.Text.Trim(); causation.LAST_UPD_BY = SessionManager.UserContext.UserName(); causation.LAST_UPD_DT = WebSiteCommon.LocalTime(DateTime.UtcNow, IncidentLocationTZ); ctx.AddToINCFORM_CAUSATION(causation); status = ctx.SaveChanges(); EHSIncidentMgr.UpdateIncidentStatus(incidentID, IncidentStepStatus.rootcauseComplete, WebSiteCommon.LocalTime(DateTime.UtcNow, IncidentLocationTZ)); } else { } } return(status); }
protected void lnkPlantView_Click(object sender, EventArgs e) { PLANT plant = (PLANT)SessionManager.EffLocation.Plant; TextBox tbPlantName = (TextBox)hfBase.FindControl("tbPlantName"); tbPlantName.Text = plant.PLANT_NAME; TextBox tbPlantDesc = (TextBox)hfBase.FindControl("tbPlantDesc"); tbPlantDesc.Text = plant.DISP_PLANT_NAME; TextBox tbPlantLocCode = (TextBox)hfBase.FindControl("tbPlantLocCode"); tbPlantLocCode.Text = plant.DUNS_CODE; cbTrackFinData.Checked = (bool)plant.TRACK_FIN_DATA; cbTrackEWData.Checked = (bool)plant.TRACK_EW_DATA; Label lblLastUpdate = (Label)hfBase.FindControl("lblPlantLastUpdate"); lblLastUpdate.Text = plant.LAST_UPD_BY; lblPlantLastUpdateDate.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)plant.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "d", false); // Label lblLastUpdateDate = (Label)hfBase.FindControl("lblPlantLastUpdateDate"); lblLastUpdateDate.Text = WebSiteCommon.LocalTime((DateTime)plant.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID).ToString(); LoadPlantSelects(plant); if (plant.ADDRESS != null) { ADDRESS address = plant.ADDRESS.FirstOrDefault(); if (address != null) { tbAddress1.Text = address.STREET1; tbAddress2.Text = address.STREET2; tbCity.Text = address.CITY; tbState.Text = address.STATE_PROV; tbPostal.Text = address.POSTAL_CODE; } } LocalOrg().EditObject = plant; }
private void SetupPage() { if (ddlIncidentSeverity2.Items.Count == 0) { ddlIncidentSeverity2.Items.AddRange(WebSiteCommon.PopulateRadListItems("incidentSeverity")); ddlIncidentSeverity2.Items.Insert(0, new RadComboBoxItem("", "")); ddlIncidentSeverity2.SelectedIndex = 0; ddlDisposition.Items.AddRange(WebSiteCommon.PopulateRadListItems("NCDisposition")); ddlDisposition.Items.Insert(0, new RadComboBoxItem("", "")); ddlDisposition.SelectedIndex = 0; ddlStatus.Items.AddRange(WebSiteCommon.PopulateRadListItems("recordStatus")); SQMBasePage.FillCurrencyDDL(ddlCurrency, "EUR", false); ddlCurrency.Items.Insert(0, new RadComboBoxItem("", "")); List <PART_ATTRIBUTE> attributeList = SQMModelMgr.SelectPartAttributeList("TYPE", "", false); ddlPartType.Items.Add(new RadComboBoxItem("", "")); foreach (PART_ATTRIBUTE pat in attributeList) { ddlPartType.Items.Add(new RadComboBoxItem(pat.ATTRIBUTE_VALUE, pat.ATTRIBUTE_CD)); } } radIssueDate.Culture = System.Threading.Thread.CurrentThread.CurrentUICulture; radIssueDate.MinDate = new DateTime(2001, 1, 1); radIssueDate.MaxDate = DateTime.UtcNow.AddDays(7); radIssueDate.SelectedDate = WebSiteCommon.LocalTime(DateTime.UtcNow, SessionManager.UserContext.TimeZoneID); radIssueDate.ShowPopupOnFocus = true; uclPartSearch1.Initialize("", false, false, false, IssueCtl().qualityIssue.IssueOccur.QS_ACTIVITY); }
static void UpdatePastDueAuditStatus() { string status = ""; // get a list of all audits that do not have a close date List <AUDIT> openAudits = EHSAuditMgr.SelectOpenAudits(0, null); foreach (AUDIT audit in openAudits) { AUDIT_TYPE type = EHSAuditMgr.SelectAuditTypeById(entities, audit.AUDIT_TYPE_ID); PLANT plant = SQMModelMgr.LookupPlant((decimal)audit.DETECT_PLANT_ID); DateTime closeDT = Convert.ToDateTime(audit.AUDIT_DT.AddDays(type.DAYS_TO_COMPLETE + 1)); // add one to the date and it will default to the next day at 00:00:00, which means midnight DateTime localTime = WebSiteCommon.LocalTime(DateTime.UtcNow, plant.LOCAL_TIMEZONE); if (closeDT.CompareTo(localTime) < 0) { // close the audit // valid status codes... A = active, C = complete, I = incomplete/in-process, E = Expired. We are closing audits that are past due, so Expired. try { status = audit.CURRENT_STATUS; if (status != "C") { status = "E"; } } catch { status = "E"; } EHSAuditMgr.CloseAudit(audit.AUDIT_ID, status, closeDT.AddDays(-1)); // now take the one day back off so that the close date sets correctly // now mark the Task as expired too! EHSAuditMgr.CreateOrUpdateTask(audit.AUDIT_ID, (decimal)audit.AUDIT_PERSON, 50, closeDT.AddDays(-1), status, 0); } } }
void InitializeForm() { lblStatusMsg.Visible = false; pnlContain.Visible = true; LocalIncident = EHSIncidentMgr.SelectIncidentById(new PSsqmEntities(), IncidentId); if (LocalIncident == null) { return; } PLANT plant = SQMModelMgr.LookupPlant(entities, (decimal)LocalIncident.DETECT_PLANT_ID, ""); if (plant != null) { IncidentLocationTZ = plant.LOCAL_TIMEZONE; } pnlContain.Visible = true; if (PageMode == PageUseMode.ViewOnly) { divTitle.Visible = true; lblFormTitle.Text = Resources.LocalizedText.InitialAction; } rptContain.DataSource = EHSIncidentMgr.GetContainmentList(IncidentId, WebSiteCommon.LocalTime(DateTime.UtcNow, IncidentLocationTZ), PageMode == PageUseMode.ViewOnly ? false : true); rptContain.DataBind(); pnlContain.Enabled = PageMode == PageUseMode.ViewOnly ? false : EHSIncidentMgr.CanUpdateIncident(LocalIncident, IsEditContext, SysPriv.originate, LocalIncident.INCFORM_LAST_STEP_COMPLETED); }
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 { } } }
protected void btnStatusSave_Click(object sender, EventArgs e) { Button btn = (Button)sender; if (btn == null || string.IsNullOrEmpty(btn.CommandArgument)) { return; } string[] cmd = btn.CommandArgument.Split('~'); // recordType, recordID, recordSubID, taskStep, taskType EHSAuditQuestion auditQuestion = EHSAuditMgr.SelectAuditQuestion(Convert.ToInt32(cmd[0]), Convert.ToDecimal(cmd[1])); if (auditQuestion != null) { auditQuestion.Status = ddlAnswerStatus.SelectedValue.ToString(); auditQuestion.ResolutionComment = tbResolutionComment.Text.ToString(); if (auditQuestion.Status.Equals("03")) { // update the complete date with the local date/time of the plant AUDIT audit = EHSAuditMgr.SelectAuditById(entities, auditQuestion.AuditId); PLANT plant = SQMModelMgr.LookupPlant((decimal)audit.DETECT_PLANT_ID); DateTime localTime = WebSiteCommon.LocalTime(DateTime.UtcNow, plant.LOCAL_TIMEZONE); auditQuestion.CompleteDate = localTime; } EHSAuditMgr.UpdateAnswer(auditQuestion); } UpdateTaskList("update"); }
public void DisplayCompany(COMPANY company) { pnlCompanyHdr.Visible = true; lblCompanyName_out.Text = company.COMPANY_NAME; lblUlDunsCode_out.Text = company.ULT_DUNS_CODE; lblCompanyStatus_out.Text = WebSiteCommon.GetStatusString(company.STATUS); lblCompanyUpdatedDate_out.Text = WebSiteCommon.LocalTime((DateTime)company.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID).ToString(); }
protected void lnkPlantView_Click(object sender, EventArgs e) { PLANT plant = (PLANT)SessionManager.EffLocation.Plant; TextBox tbPlantName = (TextBox)hfBase.FindControl("tbPlantName"); tbPlantName.Text = plant.PLANT_NAME; TextBox tbPlantDesc = (TextBox)hfBase.FindControl("tbPlantDesc"); tbPlantDesc.Text = plant.DISP_PLANT_NAME; TextBox tbPlantLocCode = (TextBox)hfBase.FindControl("tbPlantLocCode"); tbPlantLocCode.Text = plant.DUNS_CODE; TextBox tbAltPlantCode = (TextBox)hfBase.FindControl("tbAltPlantCode"); tbAltPlantCode.Text = plant.ALT_DUNS_CODE; cbTrackFinData.Checked = (bool)plant.TRACK_FIN_DATA; cbTrackEWData.Checked = (bool)plant.TRACK_EW_DATA; Label lblLastUpdate = (Label)hfBase.FindControl("lblPlantLastUpdate"); lblLastUpdate.Text = plant.LAST_UPD_BY; lblPlantLastUpdateDate.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)plant.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "d", false); // Label lblLastUpdateDate = (Label)hfBase.FindControl("lblPlantLastUpdateDate"); lblLastUpdateDate.Text = WebSiteCommon.LocalTime((DateTime)plant.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID).ToString(); LoadPlantSelects(plant); if (plant.ADDRESS != null) { ADDRESS address = plant.ADDRESS.FirstOrDefault(); if (address != null) { tbAddress1.Text = address.STREET1; tbAddress2.Text = address.STREET2; tbCity.Text = address.CITY; tbState.Text = address.STATE_PROV; tbPostal.Text = address.POSTAL_CODE; } } int[] recList = new int[5] { 30, 40, 45, 50, 90 }; PLANT_ACTIVE pa = null; List <PLANT_ACTIVE> plantActiveList = new List <PLANT_ACTIVE>(); foreach (int recType in recList) { PLANT_ACTIVE plantActive = new PLANT_ACTIVE(); plantActive.PLANT_ID = plant.PLANT_ID; plantActive.RECORD_TYPE = recType; plantActive.ENABLE_EMAIL = true; if ((pa = plant.PLANT_ACTIVE.Where(p => p.RECORD_TYPE == recType).FirstOrDefault()) != null) { plantActive.EFF_START_DATE = pa.EFF_START_DATE; plantActive.EFF_END_DATE = pa.EFF_END_DATE; plantActive.ENABLE_EMAIL = pa.ENABLE_EMAIL; plantActive.ENABLE_INACTIVE_HIST = pa.ENABLE_INACTIVE_HIST; } plantActiveList.Add(plantActive); } BindPlantActive(plantActiveList); LocalOrg().EditObject = plant; }
protected decimal CreateReAudit(decimal auditId) { decimal reauditId = 0; PSsqmEntities entities = new PSsqmEntities(); AUDIT oldAudit = EHSAuditMgr.SelectAuditById(entities, auditId); if (oldAudit != null) { // create the copy PLANT auditPlant = SQMModelMgr.LookupPlant((decimal)oldAudit.DETECT_PLANT_ID); DateTime localTime = WebSiteCommon.LocalTime(DateTime.UtcNow, auditPlant.LOCAL_TIMEZONE); AUDIT reAudit = new AUDIT() { DETECT_COMPANY_ID = Convert.ToDecimal(oldAudit.DETECT_COMPANY_ID), DETECT_BUS_ORG_ID = oldAudit.DETECT_BUS_ORG_ID, DETECT_PLANT_ID = oldAudit.DETECT_PLANT_ID, DEPT_ID = oldAudit.DEPT_ID, AUDIT_TYPE = oldAudit.AUDIT_TYPE, CREATE_DT = localTime, CREATE_BY = SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_NAME, DESCRIPTION = oldAudit.DESCRIPTION, CREATE_PERSON = SessionManager.UserContext.Person.PERSON_ID, // do we want to set this to admin? AUDIT_DT = localTime, AUDIT_TYPE_ID = oldAudit.AUDIT_TYPE_ID, AUDIT_PERSON = SessionManager.UserContext.Person.PERSON_ID, CURRENT_STATUS = "A", PERCENT_COMPLETE = 0, TOTAL_SCORE = 0, AUDITING_ID = auditId }; entities.AddToAUDIT(reAudit); entities.SaveChanges(); reauditId = reAudit.AUDIT_ID; AUDIT_ANSWER answer = null; List <EHSAuditQuestion> questions = EHSAuditMgr.SelectAuditQuestionList(reAudit.AUDIT_TYPE_ID, 0, auditId); foreach (var q in questions) { answer = new AUDIT_ANSWER() { AUDIT_ID = reauditId, AUDIT_QUESTION_ID = q.QuestionId, ANSWER_VALUE = "", ORIGINAL_QUESTION_TEXT = q.QuestionText, //COMMENT = q.AnswerComment }; entities.AddToAUDIT_ANSWER(answer); } entities.SaveChanges(); } return(reauditId); }
private void DisplayBusOrg() { BUSINESS_ORG busOrg = (BUSINESS_ORG)SessionManager.EffLocation.BusinessOrg; DropDownList ddl = (DropDownList)hfBase.FindControl("ddlCurrencyCodes"); if (ddl.Items.Count == 0) { SQMBasePage.FillCurrencyDDL(ddl, "USD"); List <BUSINESS_ORG> parent_orgs = SQMModelMgr.SelectBusOrgList(entities, SessionManager.EffLocation.Company.COMPANY_ID, 0, true); ddl = (DropDownList)hfBase.FindControl("ddlParentBusOrg"); ddl.DataSource = parent_orgs; ddl.DataTextField = "ORG_NAME"; ddl.DataValueField = "BUS_ORG_ID"; ddl.DataBind(); List <Settings> status_codes = SQMSettings.Status; ddl = (DropDownList)hfBase.FindControl("ddlStatus"); ddl.DataSource = status_codes; ddl.DataTextField = "short_desc"; ddl.DataValueField = "code"; ddl.DataBind(); } if (busOrg != null) { if (busOrg.PARENT_BUS_ORG_ID == busOrg.BUS_ORG_ID || busOrg.PARENT_BUS_ORG_ID < 1) { SetFindControlValue("lblParentBU_out", hfBase, "Top Level"); } else { if (SessionManager.ParentBusinessOrg == null) { SessionManager.ParentBusinessOrg = SQMModelMgr.LookupParentBusOrg(entities, busOrg); } BUSINESS_ORG parentOrg = (BUSINESS_ORG)SessionManager.ParentBusinessOrg; SetFindControlValue("lblParentBU_out", hfBase, parentOrg.ORG_NAME); } // editable fields SetFindControlValue("tbOrgname", hfBase, busOrg.ORG_NAME); SetFindControlValue("tbOrgLocCode", hfBase, busOrg.DUNS_CODE); SetFindControlValue("ddlCurrencyCodes", hfBase, busOrg.PREFERRED_CURRENCY_CODE); SetFindControlValue("ddlStatus", hfBase, busOrg.STATUS); if (busOrg.PARENT_BUS_ORG_ID > 0) { SetFindControlValue("ddlParentBusOrg", hfBase, busOrg.PARENT_BUS_ORG_ID.ToString()); } SetFindControlValue("lblLastUpdate_out", hfBase, busOrg.LAST_UPD_BY); lblLastUpdateDate_out.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)busOrg.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "d", false); } }
private void DisplayReport() { EnableControls(divNavArea.Controls, true); EnableControls(divWorkArea.Controls, true); EnableControls(divCostTable.Controls, false); uclSearchBar.TitleItem.Text = costReport.ReportID; tbCRName.Text = costReport.CostReport.COST_REPORT_NAME; tbCRDesc.Text = costReport.CostReport.COST_REPORT_DESC; lblCRTotalCostActual.Text = FormatValue((decimal)costReport.CostReport.SUM_ACT_COST, 2); lblCRTotalCostAvoid.Text = FormatValue((decimal)costReport.CostReport.SUM_POT_COST, 2); lblUpdateBy.Text = costReport.CostReport.LAST_UPD_BY; lblUpdateDate.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)costReport.CostReport.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "d", false); uclIncidents.BindQualityIssueList(costReport.IncidentList, false); }
private int SaveLostTime(decimal incidentId, List <INCFORM_LOSTTIME_HIST> itemList) { int status = 0; PSsqmEntities entities = new PSsqmEntities(); using (var ctx = new PSsqmEntities()) { ctx.ExecuteStoreCommand("DELETE FROM INCFORM_LOSTTIME_HIST WHERE INCIDENT_ID = {0}", incidentId); } int seq = 0; foreach (INCFORM_LOSTTIME_HIST item in itemList) { var newItem = new INCFORM_LOSTTIME_HIST(); if (!String.IsNullOrEmpty(item.WORK_STATUS) && item.WORK_STATUS != "") { newItem.INCIDENT_ID = incidentId; newItem.ITEM_DESCRIPTION = item.ITEM_DESCRIPTION; newItem.WORK_STATUS = item.WORK_STATUS; newItem.BEGIN_DT = item.BEGIN_DT; newItem.RETURN_TOWORK_DT = item.RETURN_TOWORK_DT; newItem.NEXT_MEDAPPT_DT = item.NEXT_MEDAPPT_DT; newItem.RETURN_EXPECTED_DT = item.RETURN_EXPECTED_DT; newItem.LAST_UPD_BY = SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_NAME; newItem.LAST_UPD_DT = WebSiteCommon.LocalTime(DateTime.UtcNow, IncidentLocationTZ); entities.AddToINCFORM_LOSTTIME_HIST(newItem); status = entities.SaveChanges(); } } if (seq > 0) { EHSIncidentMgr.UpdateIncidentStatus(incidentId, IncidentStepStatus.workstatus, WebSiteCommon.LocalTime(DateTime.UtcNow, IncidentLocationTZ)); } /* * if (status > -1) * { * EHSNotificationMgr.NotifyIncidentStatus(WorkStatusIncident, ((int)SysPriv.update).ToString(), "Work status updated"); * } */ return(status); }
private void SetupPage() { theModel = MetricsMgr.LookupSCORModel(SessionManager.SessionContext.ActiveCompany().COMPANY_ID); if (theModel == null) { // throw and error here return; } lblModel_out.Text = theModel.MODEL_DESC; lblUpdateBy_out.Text = theModel.LAST_UPD_BY; lblUpdateDate_out.Text = WebSiteCommon.LocalTime((DateTime)theModel.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID).ToString(); gvMetrics.DataSource = theModel.SCOR_METRIC; gvMetrics.DataBind(); }
public int NewIssue() { int status = 0; if (IssueCtl().PageMode != PageUseMode.EditEnabled) { divWorkArea.ViewStateMode = System.Web.UI.ViewStateMode.Disabled; } SetB2BLocation((decimal)SessionManager.UserContext.WorkingLocation.Plant.PLANT_ID); divWorkArea.Visible = true; SQMBasePage.ResetControlValues(divWorkArea.Controls); lblIssueDate_out.Text = WebSiteCommon.LocalTime(DateTime.Now, SessionManager.UserContext.TimeZoneID).ToString(); lblOriginator_out.Text = SessionManager.UserContext.UserName(); DisplayIssue(); return(status); }
private void SetupPage() { BUSINESS_ORG busOrg = (BUSINESS_ORG)SessionManager.BusinessOrg; pnlBusOrgDetail.Visible = true; // bu summary section SetFindControlValue("lblOrgName_out", hfBase, busOrg.ORG_NAME); SetFindControlValue("lblLocCode_out", hfBase, busOrg.DUNS_CODE); SetFindControlValue("lblCurrency_out", hfBase, busOrg.PREFERRED_CURRENCY_CODE); SetFindControlValue("lblCaseThreshold_out", hfBase, busOrg.THRESHOLD_AMT.ToString()); SetFindControlValue("lblStatus_out", hfBase, WebSiteCommon.GetStatusString(busOrg.STATUS)); SetFindControlValue("lblUpdatedBy_out", hfBase, busOrg.LAST_UPD_BY); SetFindControlValue("lblUpdatedDate_out", hfBase, WebSiteCommon.LocalTime((DateTime)busOrg.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID).ToString()); if (busOrg.PARENT_BUS_ORG_ID == busOrg.BUS_ORG_ID || busOrg.PARENT_BUS_ORG_ID < 1) { SetFindControlValue("lblParentBU_out", hfBase, "Top Level"); } else { if (SessionManager.ParentBusinessOrg == null) { SessionManager.ParentBusinessOrg = SQMModelMgr.LookupParentBusOrg(entities, busOrg); } BUSINESS_ORG parentOrg = (BUSINESS_ORG)SessionManager.ParentBusinessOrg; SetFindControlValue("lblParentBU_out", hfBase, parentOrg.ORG_NAME); } // editable fields SetFindControlValue("tbOrgname", hfBase, busOrg.ORG_NAME); SetFindControlValue("tbOrgLocCode", hfBase, busOrg.DUNS_CODE); SetFindControlValue("tbThreshold", hfBase, busOrg.THRESHOLD_AMT.ToString()); SetFindControlValue("ddlCurrencyCodes", hfBase, busOrg.PREFERRED_CURRENCY_CODE); SetFindControlValue("ddlStatus", hfBase, busOrg.STATUS); if (busOrg.PARENT_BUS_ORG_ID > 0) { SetFindControlValue("ddlParentBusOrg", hfBase, busOrg.PARENT_BUS_ORG_ID.ToString()); } SetFindControlValue("lblLastUpdate_out", hfBase, busOrg.LAST_UPD_BY); SetFindControlValue("lblLastUpdateDate_out", hfBase, WebSiteCommon.LocalTime((DateTime)busOrg.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID).ToString()); }
protected AUDIT_SCHEDULER UpdateAuditScheduler(decimal auditScheduleId) { AUDIT_SCHEDULER scheduler = (from i in entities.AUDIT_SCHEDULER where i.AUDIT_SCHEDULER_ID == auditScheduleId select i).FirstOrDefault(); PLANT auditPlant = SQMModelMgr.LookupPlant(Convert.ToDecimal(hdnAuditLocation.Value.ToString())); DateTime localTime = WebSiteCommon.LocalTime(DateTime.UtcNow, auditPlant.LOCAL_TIMEZONE); if (scheduler != null) { scheduler.PLANT_ID = auditPlant.PLANT_ID; scheduler.AUDIT_TYPE_ID = Convert.ToDecimal(rddlAuditType.SelectedValue.ToString()); scheduler.DAY_OF_WEEK = Convert.ToInt32(rddlDayOfWeek.SelectedValue.ToString()); scheduler.JOBCODE_CD = rddlAuditJobcodes.SelectedValue.ToString(); scheduler.INACTIVE = cbInactive.Checked; scheduler.UPDATE_DT = localTime; scheduler.UPDATE_PERSON = SessionManager.UserContext.Person.PERSON_ID; entities.SaveChanges(); } return(scheduler); }
private int SaveContainment(decimal incidentId, List <INCFORM_CONTAIN> itemList) { PSsqmEntities entities = new PSsqmEntities(); int status = 0; using (var ctx = new PSsqmEntities()) { ctx.ExecuteStoreCommand("DELETE FROM INCFORM_CONTAIN WHERE INCIDENT_ID = {0}", incidentId); } int seq = 0; foreach (INCFORM_CONTAIN item in itemList) { var newItem = new INCFORM_CONTAIN(); if (!string.IsNullOrEmpty(item.ITEM_DESCRIPTION)) { seq = seq + 1; newItem.INCIDENT_ID = incidentId; newItem.ITEM_SEQ = seq; newItem.ITEM_DESCRIPTION = item.ITEM_DESCRIPTION; newItem.ASSIGNED_PERSON_ID = item.ASSIGNED_PERSON_ID; newItem.START_DATE = item.START_DATE; newItem.COMMENTS = item.COMMENTS; newItem.LAST_UPD_BY = SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_NAME; newItem.LAST_UPD_DT = WebSiteCommon.LocalTime(DateTime.UtcNow, IncidentLocationTZ); entities.AddToINCFORM_CONTAIN(newItem); status = entities.SaveChanges(); } } if (seq > 0) { EHSIncidentMgr.UpdateIncidentStatus(incidentId, IncidentStepStatus.containment, WebSiteCommon.LocalTime(DateTime.UtcNow, IncidentLocationTZ)); } return(status); }
protected int SaveRootCauses(decimal incidentId, List <INCFORM_ROOT5Y> itemList) { PSsqmEntities entities = new PSsqmEntities(); int status = 0; using (var ctx = new PSsqmEntities()) { ctx.ExecuteStoreCommand("DELETE FROM INCFORM_ROOT5Y WHERE INCIDENT_ID = {0}", incidentId); } int seq = 0; foreach (INCFORM_ROOT5Y item in itemList) { var newItem = new INCFORM_ROOT5Y(); if (!string.IsNullOrEmpty(item.ITEM_DESCRIPTION)) { seq = seq + 1; newItem.INCIDENT_ID = incidentId; newItem.ITEM_SEQ = seq; newItem.ITEM_TYPE = item.ITEM_TYPE; newItem.PROBLEM_SERIES = item.PROBLEM_SERIES; newItem.ITEM_DESCRIPTION = item.ITEM_DESCRIPTION; newItem.IS_ROOTCAUSE = item.IS_ROOTCAUSE; newItem.LAST_UPD_BY = SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_NAME; newItem.LAST_UPD_DT = WebSiteCommon.LocalTime(DateTime.UtcNow, IncidentLocationTZ); entities.AddToINCFORM_ROOT5Y(newItem); status = entities.SaveChanges(); } } if (seq > 0) { EHSIncidentMgr.UpdateIncidentStatus(incidentId, IncidentStepStatus.rootcause, WebSiteCommon.LocalTime(DateTime.UtcNow, IncidentLocationTZ)); } return(status); }
public void BindPlantLine(PLANT_LINE line) { isNew = true; ToggleVisible(pnlLineEdit); tbLineName.Text = line.PLANT_LINE_NAME; tbLineDownRate.Text = line.DOWNTIME_RATE.ToString(); lblLineLastUpdate.Text = line.LAST_UPD_BY; if (line.LAST_UPD_DT != null) { lblLineLastUpdateDate.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)line.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "d", false); //WebSiteCommon.LocalTime((DateTime)line.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID).ToString(); isNew = false; } if (string.IsNullOrEmpty(line.STATUS)) { SetStatusList(ddlLineStatus, "A"); } else { SetStatusList(ddlLineStatus, line.STATUS); } }
public void BindDeptartment(DEPARTMENT dept) { isNew = true; ToggleVisible(pnlEditDept); tbDeptName.Text = dept.DEPT_NAME; tbDeptCode.Text = dept.DEPT_CODE; lblDeptLastUpdate.Text = dept.LAST_UPD_BY; if (dept.LAST_UPD_DT != null) { lblDeptLastUpdateDate.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)dept.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "d", false); // WebSiteCommon.LocalTime((DateTime)dept.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID).ToString(); isNew = false; } if (string.IsNullOrEmpty(dept.STATUS)) { SetStatusList(ddlDeptStatus, "A"); } else { SetStatusList(ddlDeptStatus, dept.STATUS); } }
protected AUDIT_SCHEDULER CreateNewAuditScheduler() { decimal auditScheduleId = 0; PLANT auditPlant = SQMModelMgr.LookupPlant(Convert.ToDecimal(hdnAuditLocation.Value.ToString())); DateTime localTime = WebSiteCommon.LocalTime(DateTime.UtcNow, auditPlant.LOCAL_TIMEZONE); var newAuditScheduler = new AUDIT_SCHEDULER() { DAY_OF_WEEK = Convert.ToInt32(rddlDayOfWeek.SelectedValue.ToString()), INACTIVE = false, JOBCODE_CD = rddlAuditJobcodes.SelectedValue.ToString(), PLANT_ID = auditPlant.PLANT_ID, CREATE_DT = localTime, CREATE_PERSON = SessionManager.UserContext.Person.PERSON_ID, AUDIT_TYPE_ID = auditTypeId }; entities.AddToAUDIT_SCHEDULER(newAuditScheduler); entities.SaveChanges(); auditScheduleId = newAuditScheduler.AUDIT_SCHEDULER_ID; return(newAuditScheduler); }
private int SaveActions(decimal incidentId, List <TASK_STATUS> actionList) { PSsqmEntities entities = new PSsqmEntities(); int status = 0; foreach (TASK_STATUS action in actionList) { if (!string.IsNullOrEmpty(action.DESCRIPTION) && action.DUE_DT.HasValue && action.RESPONSIBLE_ID.HasValue) { EHSIncidentMgr.CreateOrUpdateTask(ActionIncident, action, WebSiteCommon.LocalTime(DateTime.UtcNow, IncidentLocationTZ)); } } if (status > -1) { EHSNotificationMgr.NotifyIncidentStatus(ActionIncident, ((int)SysPriv.update).ToString(), "Corrective action specified"); } EHSIncidentMgr.UpdateIncidentStatus(incidentId, IncidentStepStatus.correctiveaction, WebSiteCommon.LocalTime(DateTime.UtcNow, IncidentLocationTZ)); return(status); }
public void BindLaborType(LABOR_TYPE labor) { isNew = true; ToggleVisible(pnlLaborEdit); tbLaborName.Text = labor.LABOR_NAME; tbLaborCode.Text = labor.LABOR_CODE; tbLaborRate.Text = labor.LABOR_RATE.ToString(); lblLaborLastUpdate.Text = labor.LAST_UPD_BY; if (labor.LAST_UPD_DT != null) { lblLaborLastUpdateDate.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)labor.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "d", false); //WebSiteCommon.LocalTime((DateTime)labor.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID).ToString(); isNew = false; } if (string.IsNullOrEmpty(labor.STATUS)) { SetStatusList(ddlLaborStatus, "A"); } else { SetStatusList(ddlLaborStatus, labor.STATUS); } }
public void rptResponseList_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { try { ResponseItem response = (ResponseItem)e.Item.DataItem; Label lbl = (Label)e.Item.FindControl("lblPersonName_out"); lbl.Text = SQMModelMgr.FormatPersonListItem(SQMModelMgr.LookupPerson(response.Response.PERSON_ID, "")); if (!string.IsNullOrEmpty(response.Response.REFERENCE_DATA)) { Control parent = lbl.Parent; int idx = parent.Controls.IndexOf(lbl) + 1; lbl = new Label(); lbl.Text = response.Response.REFERENCE_DATA; lbl.CssClass = "refText"; parent.Controls.AddAt(idx, new LiteralControl("<br />")); parent.Controls.AddAt(idx + 1, lbl); } lbl = (Label)e.Item.FindControl("lblResponseDate_out"); lbl.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime(response.Response.RESPONSE_DT, SessionManager.UserContext.TimeZoneID), "g", true); RadTextBox rt = (RadTextBox)e.Item.FindControl("rtResponseText_out"); rt.Text = response.Response.RESPONSE_TEXT; if (response.AttachmentList != null && response.AttachmentList.Count > 0) { Ucl_Attach attch = (Ucl_Attach)Page.LoadControl("/Include/Ucl_Attach.ascx"); // rt.Parent.Controls.AddAt(rt.Parent.Controls.IndexOf(rt),new LiteralControl("<br/>")); rt.Parent.Controls.AddAt(rt.Parent.Controls.IndexOf(rt) + 1, attch); attch.BindListAttachment(response.AttachmentList, "1", 0, false); } } 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 { } } }
protected void DisplayPart() { tbPartNumber.Text = staticPartData.Part.PART_NUM; tbPartPrefix.Text = staticPartData.Part.PART_PREFIX; tbPartSuffix.Text = staticPartData.Part.PART_SUFFIX; tbPartSep.Text = staticPartData.Part.PART_NUM_SEPARATOR; tbPartName.Text = staticPartData.Part.PART_NAME; tbPartSerialNum.Text = staticPartData.Part.SERIAL_NUM; tbPartRevision.Text = staticPartData.Part.REVISION_LEVEL; lblPartLastUpdate.Text = staticPartData.Part.LAST_UPD_BY; lblPartLastUpdateDate.Text = WebSiteCommon.LocalTime((DateTime)staticPartData.Part.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID).ToString(); if (ddlPartProgram.Items.FindByValue(staticPartData.Part.PROGRAM_ID.ToString()) != null) { ddlPartProgram.SelectedValue = staticPartData.Part.PROGRAM_ID.ToString(); } ddlPartStatus.DataSource = SQMSettings.Status; ddlPartStatus.DataTextField = "short_desc"; ddlPartStatus.DataValueField = "code"; ddlPartStatus.DataBind(); if (ddlPartStatus.Items.FindByValue(staticPartData.Part.STATUS) != null) { ddlPartStatus.SelectedValue = staticPartData.Part.STATUS; } editObject = staticPartData; // enable part number field only when creating new or if NOT created by the upload process if (string.IsNullOrEmpty(staticPartData.Part.CREATE_BY) || staticPartData.Part.CREATE_BY.IndexOf(' ') > 0) { tbPartNumber.ReadOnly = false; } string script = "function f(){OpenPartDetailWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); }
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 PROB_DEFINE UpdateProblemDefinition(PROB_DEFINE prDefine) { foreach (INCIDENT incident in this.IncidentList) { if (this.ProbCase.PROBCASE_TYPE == "QI") { QualityIssue qualityIssue = new QualityIssue().Load(incident.INCIDENT_ID); string str = ""; // who reported the problem str = incident.CREATE_BY; if (incident.CREATE_PERSON != null && incident.CREATE_PERSON > 0) { PERSON person = SQMModelMgr.LookupPerson((decimal)incident.CREATE_PERSON, ""); COMPANY company = SQMModelMgr.LookupCompany(person.COMPANY_ID); str += " (" + company.COMPANY_NAME + ")"; } if (string.IsNullOrEmpty(prDefine.WHO_IS) || !prDefine.WHO_IS.Contains(str)) { if (!string.IsNullOrEmpty(prDefine.WHO_IS)) { prDefine.WHO_IS += ", "; } prDefine.WHO_IS += str; } // where did the problem occur str = qualityIssue.DetectedLocation.Company.COMPANY_NAME; if (incident.DETECT_BUS_ORG_ID != null && incident.DETECT_BUS_ORG_ID > 0) { str += (" / " + qualityIssue.DetectedLocation.BusinessOrg.ORG_NAME); } if (incident.DETECT_PLANT_ID != null && incident.DETECT_PLANT_ID > 0) { str += (" / " + qualityIssue.DetectedLocation.Plant.PLANT_NAME); } if (string.IsNullOrEmpty(prDefine.WHERE_IS) || !prDefine.WHERE_IS.Contains(str)) { if (!string.IsNullOrEmpty(prDefine.WHERE_IS)) { prDefine.WHERE_IS += ", "; } prDefine.WHERE_IS += str; } // where detected str = WebSiteCommon.GetXlatValueLong("issueResponsible", qualityIssue.IssueOccur.SOURCE); if (string.IsNullOrEmpty(prDefine.DETECTED_IS) || !prDefine.DETECTED_IS.Contains(str)) { if (!string.IsNullOrEmpty(prDefine.DETECTED_IS)) { prDefine.DETECTED_IS += ", "; } prDefine.DETECTED_IS += str; } // who or where is impacted if (!string.IsNullOrEmpty(prDefine.IMPACT_IS)) { prDefine.IMPACT_IS += ", "; } prDefine.IMPACT_IS += WebSiteCommon.GetXlatValueLong("issueResponsible", qualityIssue.IssueOccur.SOURCE); // when did the problem occur str = WebSiteCommon.FormatDateString(WebSiteCommon.LocalTime(incident.INCIDENT_DT, SessionManager.UserContext.TimeZoneID), false); if (string.IsNullOrEmpty(prDefine.WHEN_IS) || !prDefine.WHEN_IS.Contains(str)) { if (!string.IsNullOrEmpty(prDefine.WHEN_IS)) { prDefine.WHEN_IS += ", "; } prDefine.WHEN_IS += str; } // what is the problem if (!string.IsNullOrEmpty(prDefine.WHAT_IS)) { prDefine.WHAT_IS += ", "; } prDefine.WHAT_IS += (" " + qualityIssue.Partdata.Part.PART_NUM + "(" + qualityIssue.Partdata.Part.PART_NAME + ")"); // how many how often detected double qty = 0; if (!string.IsNullOrEmpty(prDefine.HOW_MANY)) { qty = double.Parse(prDefine.HOW_MANY); } foreach (QI_OCCUR_ITEM item in qualityIssue.IssueOccur.QI_OCCUR_ITEM) { qty += Convert.ToDouble(item.INSPECT_NC_QTY); foreach (QI_OCCUR_NC sample in item.QI_OCCUR_NC) { if (!string.IsNullOrEmpty(prDefine.NC_IS)) { prDefine.NC_IS += ", "; } NONCONFORMANCE nc = SQMResourcesMgr.LookupNonconf(this.Entities, (decimal)sample.NONCONF_ID, ""); if (nc != null) { prDefine.NC_IS += (qualityIssue.IssueOccur.OCCUR_DESC + ": " + nc.NONCONF_DESC); } } } prDefine.HOW_MANY = qty.ToString(); str = qualityIssue.IssueOccur.OCCUR_DESC; if (string.IsNullOrEmpty(prDefine.WHY_IS) || !prDefine.WHY_IS.Contains(str)) { if (!string.IsNullOrEmpty(prDefine.WHY_IS)) { prDefine.WHY_IS += ", "; } prDefine.WHY_IS += str; } prDefine.URGENT_IS = prDefine.MEASURE_IS = prDefine.OFTEN_IS = "TBD"; } } return(prDefine); }
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; } }