public void BindProblemCaseHeader(ProblemCase problemCase, TaskItem taskItem) { pnlIncidentTaskHdr.Visible = true; lblIncidentDescription.Visible = lblActionDescription.Visible = false; lblCaseDescription.Visible = true; if (taskItem.Plant != null) { lblCasePlant_out.Text = taskItem.Plant.PLANT_NAME; } lblResponsible_out.Text = SQMModelMgr.FormatPersonListItem(taskItem.Person); lblCase2ID_out.Text = problemCase.CaseID; lblCase2Desc_out.Text = problemCase.ProbCase.DESC_SHORT; }
public void BindAuditListHeader(AUDIT audit, TaskItem taskItem) { pnlIncidentTaskHdr.Visible = true; lblCaseDescription.Visible = lblIncidentDescription.Visible = lblActionDescription.Visible = false; lblIncidentDescription.Visible = true; if (taskItem.Plant != null) { lblCasePlant_out.Text = taskItem.Plant.PLANT_NAME; } lblResponsible_out.Text = SQMModelMgr.FormatPersonListItem(taskItem.Person); lblCase2ID_out.Text = WebSiteCommon.FormatID(audit.AUDIT_ID, 6); lblCase2Desc_out.Text = taskItem.Task.DESCRIPTION; }
protected string formatName(object responsiblePerson) { string fullname = ""; PERSON person = new PERSON(); try { person = (PERSON)responsiblePerson; fullname = SQMModelMgr.FormatPersonListItem(person, false, "LF"); } catch { fullname = ""; } return(fullname); }
public void BindQualityIncidentHeader(QualityIncidentData qualityIncident, bool showAll) { pnlQualityIncidentHdr.Visible = true; lblDetectedLocation_out.Text = qualityIncident.Plant.PLANT_NAME; lblIssueID_out.Text = WebSiteCommon.FormatID(qualityIncident.Incident.INCIDENT_ID, 6); lblIssueDesc_out.Text = qualityIncident.Incident.DESCRIPTION; if (qualityIncident.Part != null) { lblIssuePartNum_out.Text = qualityIncident.Part.PART_NUM; } lblIssueResponsible_out.Text = SQMModelMgr.FormatPersonListItem(qualityIncident.Person); if (qualityIncident.PlantResponsible != null) { lblIssueResponsible_out.Text += " (" + qualityIncident.PlantResponsible.PLANT_NAME + ")"; } }
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 BindIncidentListHeader(INCIDENT incident, TaskItem taskItem) { pnlIncidentTaskHdr.Visible = true; lblCaseDescription.Visible = lblIncidentDescription.Visible = lblActionDescription.Visible = false; if (incident.ISSUE_TYPE_ID == 13) // preventative action { lblActionDescription.Visible = true; } else { lblIncidentDescription.Visible = true; } if (taskItem.Plant != null) { lblCasePlant_out.Text = taskItem.Plant.PLANT_NAME; } lblResponsible_out.Text = SQMModelMgr.FormatPersonListItem(taskItem.Person); lblCase2ID_out.Text = WebSiteCommon.FormatID(incident.INCIDENT_ID, 6); // lblCase2Desc_out.Text = incident.ISSUE_TYPE; lblCase2Desc_out.Text = taskItem.Task.DESCRIPTION; }
public int MetricSeries(DateTime fromDate, DateTime toDate, decimal[] plantArray) { int status = 0; int item = 0; GaugeSeries series; this.Results.Initialize(); QSAttribute atr; bool isAttribute; if ((isAttribute = Enum.TryParse(this.Calculation, out atr)) == false) { this.SetScopeRef(this.Calculation); } List <object> foList = new List <object>(); string text = ""; switch (this.Seriesorder) { case QSCalcsCtl.SeriesOrder.MeasureSeries: switch (this.MetricScope) { case "plant": foList = this.RecordList.Where(r => plantArray.Contains(r.PlantResponsible.PLANT_ID)).Select(r => (object)r.PlantResponsible).Distinct().ToList(); break; case "plantResp": foList = this.RecordList.Select(r => (object)r.PlantResponsible).Distinct().ToList(); break; case "plantDetect": foList = this.RecordList.Select(r => (object)r.Plant).Distinct().ToList(); break; case "person": foList = this.RecordList.Select(r => (object)r.Person).Distinct().ToList(); break; case "partType": List <string> pat = this.RecordList.Select(r => r.QIIssue.PART_TYPE).Distinct().ToList(); foList = SQMModelMgr.SelectPartAttributeList("TYPE", "", false).Where(l => pat.Contains(l.ATTRIBUTE_CD)).Select(l => (object)l).ToList(); break; case "month": foreach (WebSiteCommon.DatePeriod pd in WebSiteCommon.CalcDatePeriods(fromDate, toDate, DateIntervalType.month, DateSpanOption.FYEffTimespan, "")) { foList.Add(pd); } break; default: if ((isAttribute = Enum.TryParse(this.MetricScope, out atr))) { this.SetAttributeRef(atr); foreach (KeyValuePair <string, string> xlat in this.Calc.AttributeXref) { foList.Add(xlat); } } break; } foreach (string factor in this.GetFactorsByScope(this.Calculation)) { series = new GaugeSeries().CreateNew(1, factor, ""); foreach (object fo in foList) { switch (this.MetricScope) { case "plant": case "plantDetect": case "plantResp": text = ((PLANT)fo).PLANT_NAME; this.FilterByPlant(new decimal[1] { ((PLANT)fo).PLANT_ID }); break; case "person": text = SQMModelMgr.FormatPersonListItem((PERSON)fo); this.FilterByPerson(new decimal[1] { ((PERSON)fo).PERSON_ID }); break; case "partType": text = ((PART_ATTRIBUTE)fo).ATTRIBUTE_VALUE; this.FilterByPartType(new string[1] { ((PART_ATTRIBUTE)fo).ATTRIBUTE_CD }); break; case "month": WebSiteCommon.DatePeriod pd = (WebSiteCommon.DatePeriod)fo; text = pd.Label; this.FilterByDate(pd.FromDate, pd.ToDate); break; default: text = ((KeyValuePair <string, string>)fo).Value; this.FilterByAttribute(this.MetricScope, new string[1] { ((KeyValuePair <string, string>)fo).Key }); break; } this.MetricFactor(plantArray, new decimal[0] { }, fromDate, toDate, factor, "", null); if (this.Results.ValidResult) { series.ItemList.Add(new GaugeSeriesItem().CreateNew(1, item++, text, this.Results)); } } this.Results.metricSeries.Add(series); } break; case QSCalcsCtl.SeriesOrder.SumAll: if (isAttribute) { this.InitCalc(); this.SetAttributeRef(atr); GaugeSeries sumSeries = new GaugeSeries().CreateNew(0, "", ""); foreach (KeyValuePair <string, string> xlat in this.Calc.AttributeXref) { if (this.MetricFactor(plantArray, new decimal[0] { }, fromDate, toDate, this.Calculation, xlat.Key, null) > 0) { sumSeries.ItemList.Add(new GaugeSeriesItem().CreateNew(1, item++, 0, this.Results.Result, xlat.Value)); } } if (sumSeries.ItemList.Count > 0) { this.Results.metricSeries.Add(sumSeries); } if (this.Results.metricSeries.Count > 0) { this.Results.ValidResult = true; } if (this.Stat == SStat.pct) // transform series from values to percentages { this.Results.TransformSeries(this.Stat, EHSCalcsCtl.SeriesOrder.MeasureSeries); } } break; default: break; } return(status); }
private void OnLocationSelect(decimal plantID) { PLANT plant = SQMModelMgr.LookupPlant(plantID); if (plant == null) { DisplayProfileMessage(lblProfileNotExist); } else { List <BusinessLocation> locationList = new List <BusinessLocation>(); locationList.Add(new BusinessLocation().Initialize(plantID)); List <PERSON> responsibleList = SQMModelMgr.SelectPlantPersonList(locationList, "311", AccessMode.Update); SQMBasePage.SetPersonList(ddlMetricResponsible, responsibleList, ""); SQMBasePage.SetPersonList(ddlFinalApprover, responsibleList.Where(l => l.ROLE < SessionManager.AccessModeRoleXREF(AccessMode.Update)).ToList(), ""); LoadPlantProfile(plant); if (LocalProfile() != null && (LocalProfile().Profile.EHS_PROFILE_MEASURE == null || LocalProfile().Profile.EHS_PROFILE_MEASURE.Count == 0)) { if (UserContext.RoleAccess() > AccessMode.Plant) { List <EHS_PROFILE> profileList = EHSModel.SelectPlantProfileList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID); SQMBasePage.SetLocationList(ddlCopyProfile, SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true).Where(l => profileList.Select(p => p.PLANT_ID).ToArray().Contains(l.Plant.PLANT_ID)).ToList(), 0); ddlCopyProfile.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("", "")); responsibleList = SQMModelMgr.SelectPersonList((decimal)plant.COMPANY_ID, (decimal)plant.BUS_ORG_ID, true, false).Where(p => p.ROLE >= SessionManager.AccessModeRoleXREF(AccessMode.Admin) && p.ROLE < SessionManager.AccessModeRoleXREF(AccessMode.View)).OrderBy(l => l.LAST_NAME).ToList(); ddlDefaultResponsible.Items.Clear(); foreach (PERSON person in responsibleList) { if (SQMModelMgr.PersonPlantAccess(person, plant.PLANT_ID)) { ddlDefaultResponsible.Items.Add(new Telerik.Web.UI.RadComboBoxItem(SQMModelMgr.FormatPersonListItem(person), person.PERSON_ID.ToString())); } } ddlDefaultResponsible.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("", "")); pnlCopyProfile.Visible = true; } } pnlProfileEdit.Style.Add("display", "none"); } }
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 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 BindTaskUpdate(TASK_STATUS task, string context) { PSsqmEntities ctx = new PSsqmEntities(); if (TaskXLATList == null || TaskXLATList.Count == 0) { TaskXLATList = SQMBasePage.SelectXLATList(new string[5] { "TASK_STATUS", "RECORD_TYPE", "INCIDENT_STATUS", "NOTIFY_SCOPE_TASK", "ACTION_CATEGORY" }); } CurrentTask = task; pnlUpdateTask.Visible = true; btnTaskUpdate.CommandArgument = btnTaskComplete.CommandArgument = btnTaskAssign.CommandArgument = task.TASK_ID.ToString(); if (task.STATUS == ((int)TaskStatus.Complete).ToString()) { btnTaskComplete.Visible = btnTaskUpdate.Visible = btnTaskAssign.Visible = false; //tbTaskDescription.Enabled = rdpTaskDueDT.Enabled = tbTaskComments.Enabled = false; rdpTaskDueDT.Enabled = tbTaskComments.Enabled = false; } else { btnTaskComplete.Visible = btnTaskUpdate.Visible = btnTaskAssign.Visible = true; //tbTaskDescription.Enabled = rdpTaskDueDT.Enabled = tbTaskComments.Enabled = true; rdpTaskDueDT.Enabled = tbTaskComments.Enabled = true; } switch ((TaskRecordType)task.RECORD_TYPE) { case TaskRecordType.HealthSafetyIncident: lblTaskTypeValue.Text = TaskXLATList.Where(l => l.XLAT_GROUP == "RECORD_TYPE" && l.XLAT_CODE == task.RECORD_TYPE.ToString()).FirstOrDefault().DESCRIPTION; if (task.TASK_STEP == "350") { // corrective action task lblTaskTypeValue.Text += (" - " + TaskXLATList.Where(l => l.XLAT_GROUP == "NOTIFY_SCOPE_TASK" && l.XLAT_CODE == task.TASK_STEP).FirstOrDefault().DESCRIPTION); } else { lblTaskTypeValue.Text += (" - " + TaskXLATList.Where(l => l.XLAT_GROUP == "NOTIFY_SCOPE_TASK" && l.XLAT_CODE == task.TASK_STEP).FirstOrDefault().DESCRIPTION); } break; case TaskRecordType.PreventativeAction: lblTaskTypeValue.Text = TaskXLATList.Where(l => l.XLAT_GROUP == "RECORD_TYPE" && l.XLAT_CODE == task.RECORD_TYPE.ToString()).FirstOrDefault().DESCRIPTION; if (task.TASK_STEP == "350") { // corrective action task lblTaskTypeValue.Text += (" - " + TaskXLATList.Where(l => l.XLAT_GROUP == "NOTIFY_SCOPE_TASK" && l.XLAT_CODE == task.TASK_STEP).FirstOrDefault().DESCRIPTION); } else { lblTaskTypeValue.Text += (" - " + TaskXLATList.Where(l => l.XLAT_GROUP == "NOTIFY_SCOPE_TASK" && l.XLAT_CODE == task.TASK_STEP).FirstOrDefault().DESCRIPTION); } btnTaskLink.CommandArgument = task.RECORD_ID.ToString(); btnTaskLink.Visible = true; btnTaskAssign.Visible = btnTaskComplete.Visible = false; break; case TaskRecordType.Audit: //AUDIT audit = EHSAuditMgr.SelectAuditById(ctx, task.RECORD_ID); lblTaskTypeValue.Text = TaskXLATList.Where(l => l.XLAT_GROUP == "RECORD_TYPE" && l.XLAT_CODE == task.RECORD_TYPE.ToString()).FirstOrDefault().DESCRIPTION; if ((task.RECORD_SUBID.HasValue && task.RECORD_SUBID > 0) || task.TASK_STEP == "350") { // action required if subid references a specific audit question lblTaskTypeValue.Text += (" - " + TaskXLATList.Where(l => l.XLAT_GROUP == "NOTIFY_SCOPE_TASK" && l.XLAT_CODE == task.TASK_STEP).FirstOrDefault().DESCRIPTION); } else { lblTaskTypeValue.Text += (" - " + TaskXLATList.Where(l => l.XLAT_GROUP == "NOTIFY_SCOPE_TASK" && l.XLAT_CODE == "300").FirstOrDefault().DESCRIPTION); } break; default: return; break; } //tbTaskDescription.Text = task.DESCRIPTION; // command of what to do lbTaskDescription.Text = task.DESCRIPTION; // command of what to do lblTaskDetailValue.Text = task.DETAIL; // incident description or audit question PERSON createBy = null; // mt - predeclare create by person to better handle NULL CREATE_ID // get the Create By person name and display if (task.CREATE_ID.HasValue) { createBy = SQMModelMgr.LookupPerson(ctx, (decimal)task.CREATE_ID, "", false); } if (createBy == null) { lblCreatedByValue.Text = Resources.LocalizedText.AutomatedScheduler; } else { lblCreatedByValue.Text = SQMModelMgr.FormatPersonListItem(createBy, false, "LF"); } PERSON assignTo = SQMModelMgr.LookupPerson(ctx, (decimal)task.RESPONSIBLE_ID, "", false); if (assignTo == null) { lblAssignPersonValue.Text = Resources.LocalizedText.AutomatedScheduler; } else { lblAssignPersonValue.Text = SQMModelMgr.FormatPersonListItem(assignTo, false, "LF"); } rdpTaskDueDT.SelectedDate = (DateTime)task.DUE_DT; lblTaskStatusValue.Text = TaskXLATList.Where(l => l.XLAT_GROUP == "TASK_STATUS" && l.XLAT_CODE == ((int)TaskMgr.CalculateTaskStatus(task)).ToString()).FirstOrDefault().DESCRIPTION; tbTaskComments.Text = task.COMMENTS; int attachCount = SQM.Website.Classes.SQMDocumentMgr.GetAttachmentCountByRecord(CurrentTask.RECORD_TYPE, CurrentTask.RECORD_ID, CurrentTask.TASK_STEP, ""); lnkAttachments.Text = attachCount == 0 ? Resources.LocalizedText.Attachments : (Resources.LocalizedText.Attachments + " (" + attachCount.ToString() + ")"); lnkAttachments.Visible = true; }
PdfPTable ActionSection(decimal questionId, List <TASK_STATUS> actions) { PdfPTable tableAction = new PdfPTable(new float[] { 80f, 50f, 150f, 50f, 150f, 55f }); tableAction.TotalWidth = 535f; tableAction.LockedWidth = true; // add a action header PdfPCell cell = new PdfPCell() { Padding = 1f, Border = 0 }; cell.AddElement(new Paragraph(Resources.LocalizedText.ResponsiblePerson, colHdrFont)); tableAction.AddCell(cell); cell = new PdfPCell() { Padding = 1f, Border = 0 }; cell.AddElement(new Paragraph(Resources.LocalizedText.DueDate, colHdrFont)); tableAction.AddCell(cell); cell = new PdfPCell() { Padding = 1f, Border = 0 }; cell.AddElement(new Paragraph(Resources.LocalizedText.Description, colHdrFont)); tableAction.AddCell(cell); cell = new PdfPCell() { Padding = 1f, Border = 0 }; cell.AddElement(new Paragraph(Resources.LocalizedText.Status, colHdrFont)); tableAction.AddCell(cell); cell = new PdfPCell() { Padding = 1f, Border = 0 }; cell.AddElement(new Paragraph(Resources.LocalizedText.Comments, colHdrFont)); tableAction.AddCell(cell); cell = new PdfPCell() { Padding = 1f, Border = 0 }; cell.AddElement(new Paragraph(Resources.LocalizedText.Completed, colHdrFont)); tableAction.AddCell(cell); foreach (TASK_STATUS ac in actions) { cell = new PdfPCell() { Padding = 1f, Border = 0 }; string person = ""; if (ac.RESPONSIBLE_ID.HasValue) { person = SQMModelMgr.FormatPersonListItem(SQMModelMgr.LookupPerson((decimal)ac.RESPONSIBLE_ID, "")); } cell.AddElement(new Paragraph(person, detailTxtFont)); tableAction.AddCell(cell); cell = new PdfPCell() { Padding = 1f, Border = 0 }; if (ac.DUE_DT.HasValue) { cell.AddElement(new Paragraph(SQMBasePage.FormatDate((DateTime)ac.DUE_DT, "d", false), detailTxtFont)); } else { cell.AddElement(new Paragraph(" ", detailTxtFont)); } tableAction.AddCell(cell); cell = new PdfPCell() { Padding = 1f, Border = 0 }; try { if (!ac.DESCRIPTION.Equals(null)) { cell.AddElement(new Paragraph(FormatText(ac.DESCRIPTION), detailTxtFont)); } else { cell.AddElement(new Paragraph(" ", detailTxtFont)); } } catch { cell.AddElement(new Paragraph(" ", detailTxtFont)); } tableAction.AddCell(cell); cell = new PdfPCell() { Padding = 1f, Border = 0 }; if (!ac.STATUS.Equals(null)) { try { int value = Convert.ToInt16(ac.STATUS); TaskStatus status = (TaskStatus)value; cell.AddElement(new Paragraph(status.ToString(), detailTxtFont)); } catch { cell.AddElement(new Paragraph(ac.STATUS, detailTxtFont)); } } else { cell.AddElement(new Paragraph(" ", detailTxtFont)); } tableAction.AddCell(cell); cell = new PdfPCell() { Padding = 1f, Border = 0 }; try { if (!ac.COMMENTS.Equals(null)) { cell.AddElement(new Paragraph(FormatText(ac.COMMENTS), detailTxtFont)); } else { cell.AddElement(new Paragraph(" ", detailTxtFont)); } } catch { cell.AddElement(new Paragraph(" ", detailTxtFont)); } tableAction.AddCell(cell); cell = new PdfPCell() { Padding = 1f, Border = 0 }; if (ac.COMPLETE_DT.HasValue) { cell.AddElement(new Paragraph(SQMBasePage.FormatDate((DateTime)ac.COMPLETE_DT, "d", false), detailTxtFont)); } else { cell.AddElement(new Paragraph(" ", detailTxtFont)); } tableAction.AddCell(cell); } return(tableAction); }
PdfPTable HeaderSection(AuditData pageData) { PdfPTable tableHeader = new PdfPTable(new float[] { 540f }); tableHeader.TotalWidth = 540f; tableHeader.LockedWidth = true; PdfPCell cell; INCIDENT_ANSWER answer = null; cell = new PdfPCell() { Padding = 2f, PaddingBottom = 2f, Border = 0 }; //cell.BorderWidthTop = cell.BorderWidthLeft = .25f; cell.AddElement(new Paragraph(String.Format(SQMBasePage.GetXLAT(reportXLAT, "AUDIT_PRINT", "PLANT").DESCRIPTION_SHORT + ": {0}", pageData.auditLocation), detailTxtFont)); tableHeader.AddCell(cell); cell = new PdfPCell() { Padding = 2f, PaddingBottom = 2f, Border = 0 }; //cell.BorderWidthTop = cell.BorderWidthLeft = cell.BorderWidthRight =.25f; cell.AddElement(new Paragraph(String.Format(SQMBasePage.GetXLAT(reportXLAT, "AUDIT_PRINT", "DEPARTMENT").DESCRIPTION_SHORT + ": {0}", pageData.auditDepartment), detailTxtFont)); tableHeader.AddCell(cell); cell = new PdfPCell() { Padding = 2f, PaddingBottom = 2f, Border = 0 }; //cell.BorderWidthTop = cell.BorderWidthLeft = cell.BorderWidthRight =.25f; cell.AddElement(new Paragraph(String.Format(SQMBasePage.GetXLAT(reportXLAT, "AUDIT_PRINT", "DESCRIPTION").DESCRIPTION_SHORT + ": {0}", pageData.auditDescription), detailTxtFont)); tableHeader.AddCell(cell); cell = new PdfPCell() { Padding = 2f, PaddingBottom = 2f, Border = 0 }; //cell.BorderWidthTop = cell.BorderWidthLeft = cell.BorderWidthRight =.25f; cell.AddElement(new Paragraph(String.Format(SQMBasePage.GetXLAT(reportXLAT, "AUDIT_PRINT", "DATE").DESCRIPTION_SHORT + ": {0}", pageData.auditDate), detailTxtFont)); tableHeader.AddCell(cell); cell = new PdfPCell() { Padding = 2f, PaddingBottom = 2f, Border = 0 }; //cell.BorderWidthTop = cell.BorderWidthLeft = cell.BorderWidthRight =.25f; cell.AddElement(new Paragraph(String.Format(SQMBasePage.GetXLAT(reportXLAT, "AUDIT_PRINT", "CLOSE_DATE").DESCRIPTION_SHORT + ": {0}", pageData.auditCloseDate), detailTxtFont)); tableHeader.AddCell(cell); cell = new PdfPCell() { Padding = 2f, PaddingBottom = 2f, Border = 0 }; //cell.BorderWidthTop = cell.BorderWidthLeft = cell.BorderWidthRight =.25f; cell.AddElement(new Paragraph(String.Format(SQMBasePage.GetXLAT(reportXLAT, "AUDIT_PRINT", "AUDIT_PERSON").DESCRIPTION_SHORT + ": {0}", pageData.auditPerson == null ? "" : SQMModelMgr.FormatPersonListItem(pageData.auditPerson)), detailTxtFont)); tableHeader.AddCell(cell); return(tableHeader); }
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; LinkButton lnk = (LinkButton)e.Item.FindControl("lbAuditId"); lnk.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"); List <XLAT> TaskXLATList = SQMBasePage.SelectXLATList(new string[1] { "AUDIT_STATUS" }); if (data.Audit.CURRENT_STATUS == "C") { // TODO: This throws a null reference error when the database field is NULL (which is valid) DateTime clsDate = (DateTime)data.Audit.CLOSE_DATE_DATA_COMPLETE; lbl.Text = TaskXLATList.Where(l => l.XLAT_GROUP == "AUDIT_STATUS" && l.XLAT_CODE == "C").FirstOrDefault().DESCRIPTION + " " + SQMBasePage.FormatDate(clsDate, "d", false); // TODO: Possible fix //DateTime? clsDate = data.Audit.CLOSE_DATE; //if (data.Audit.CLOSE_DATE_DATA_COMPLETE.HasValue) //{ // clsDate = data.Audit.CLOSE_DATE_DATA_COMPLETE; //} //if (clsDate.HasValue) //{ // lbl.Text = TaskXLATList.Where(l => l.XLAT_GROUP == "AUDIT_STATUS" && l.XLAT_CODE == "C").FirstOrDefault().DESCRIPTION + " " + SQMBasePage.FormatDate(clsDate.Value, "d", false); //} } else { if (data.DaysToClose == 0) { DateTime tmp = ((DateTime)data.Audit.AUDIT_DT).AddDays(data.AuditType.DAYS_TO_COMPLETE); lbl.Text = TaskXLATList.Where(l => l.XLAT_GROUP == "AUDIT_STATUS" && l.XLAT_CODE == "X").FirstOrDefault().DESCRIPTION + "<br/>(" + SQMBasePage.FormatDate(tmp, "d", false) + ")"; } else if (data.Audit.PERCENT_COMPLETE > 0) { lbl.Text = TaskXLATList.Where(l => l.XLAT_GROUP == "AUDIT_STATUS" && l.XLAT_CODE == "I").FirstOrDefault().DESCRIPTION + "<br/>(" + data.DaysToClose + ")"; } else { lbl.Text = TaskXLATList.Where(l => l.XLAT_GROUP == "AUDIT_STATUS" && l.XLAT_CODE == "A").FirstOrDefault().DESCRIPTION + "<br/>(" + data.DaysToClose + ")"; } } lnk = (LinkButton)e.Item.FindControl("lbAuditId"); LinkButton lnkReAudit = (LinkButton)e.Item.FindControl("lbReAudit"); Label lblAuditingId = (Label)e.Item.FindControl("lblAuditingId"); HiddenField hdnId = (HiddenField)e.Item.FindControl("hdnAuditingId"); if (allowReAudits.ToUpper().Equals("Y")) { if (SessionManager.CheckUserPrivilege(SysPriv.admin, SysScope.audit)) { if (hdnId.Value.ToString().Trim().Equals("0") || hdnId.Value.ToString().Trim().Equals("")) { lblAuditingId.Visible = false; } else { lnkReAudit.Visible = false; lblAuditingId.Text = Resources.LocalizedText.ReAuditing + " " + hdnId.Value.ToString(); } } else { lnkReAudit.Visible = false; lblAuditingId.Visible = false; } } else { lnkReAudit.Visible = false; lblAuditingId.Visible = false; } if (SessionManager.UserContext.Person.PERSON_ID == data.Person.PERSON_ID) { lnk.CommandArgument = data.Audit.AUDIT_ID.ToString() + "~" + data.Status; lnkReAudit.Visible = false; //lblAuditingId.Visible = false; } else if (!data.Status.Equals("C")) { lnk.CommandArgument = data.Audit.AUDIT_ID.ToString() + "~D"; } else { lnk.CommandArgument = data.Audit.AUDIT_ID.ToString() + "~C"; } } }