public void rptScope1Fuel_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { try { EHSModel.GHGResult ghgRrec = (EHSModel.GHGResult)e.Item.DataItem; Label lbl = (Label)e.Item.FindControl("lblScope1Fuel"); lbl.Text = SessionManager.EFMList.Where(l => l.EFM_TYPE == ghgRrec.EFMType).Select(l => l.DESCRIPTION).FirstOrDefault(); lbl = (Label)e.Item.FindControl("lblScope1FuelQtyHdr"); lbl.Text = lbl.Text + "<i>(" + SessionManager.UOMList.FirstOrDefault(l => l.UOM_ID == ghgRrec.MetricUOM).UOM_CD + ")</i>"; decimal efmQty = LocalGHGResultList().ResultList.Where(l => l.Plant.PLANT_ID == ghgRrec.Plant.PLANT_ID && l.EFMType == ghgRrec.EFMType).Select(l => l.MetricValue).FirstOrDefault(); lbl = (Label)e.Item.FindControl("lblScope1FuelQty"); lbl.Text = SQMBasePage.FormatValue(efmQty, 2); GridView gv = (GridView)e.Item.FindControl("gvGasList1"); gv.Columns[3].HeaderText = gv.Columns[3].HeaderText + "<i>(" + SessionManager.UOMList.FirstOrDefault(l => l.UOM_ID == ghgRrec.GHGUOM).UOM_CD + ")</i>"; List <EHSModel.GHGResult> gasList = LocalGHGResultList().ResultList.Where(l => l.Plant.PLANT_ID == ghgRrec.Plant.PLANT_ID && l.EFMType == ghgRrec.EFMType).ToList(); gv.DataSource = gasList.Distinct().ToList(); gv.DataBind(); } catch { ; } } }
protected void SetupPage() { hdCurrentActiveMenu.Value = SessionManager.CurrentMenuItem; lbBusinessCard1_out.Text = SessionManager.UserContext.UserName(); // +": " + SessionManager.UserContext.HRLocation.Company.COMPANY_NAME + ", " + SessionManager.UserContext.HRLocation.Plant.PLANT_NAME; lblActiveLocation.Text = SessionManager.UserContext.HRLocation.Company.COMPANY_NAME + ", " + SessionManager.UserContext.HRLocation.Plant.PLANT_NAME; if (SessionManager.StatOfTheDay != null) { lblActiveLocation.Text = SessionManager.UserContext.HRLocation.Company.COMPANY_NAME + ", " + SessionManager.UserContext.HRLocation.Plant.PLANT_NAME + ": "; lblStatOfTheDay_out.Text = SQMBasePage.FormatValue(SessionManager.StatOfTheDay.Value, 0); lblStatOfTheDay.Visible = lblStatOfTheDay_out.Visible = true; } else { lblStatOfTheDay_out.Text = "n/a"; } pnlStatOfTheDay.Visible = true; if (ddlUserLang.Items.Count == 0) { foreach (LOCAL_LANGUAGE lang in SQMModelMgr.SelectLanguageList(new PSsqmEntities(), true)) { ddlUserLang.Items.Add(new RadComboBoxItem(lang.LANGUAGE_NAME, lang.LANGUAGE_ID.ToString())); } } tbUserPhone.Text = SessionManager.UserContext.Person.PHONE; if (ddlUserLang.FindItemByValue(SessionManager.UserContext.Person.PREFERRED_LANG_ID.ToString()) != null) { ddlUserLang.SelectedValue = SessionManager.UserContext.Person.PREFERRED_LANG_ID.ToString(); } }
public void BindProdFieldsList(EHSProfile profile, string acctFields) { Dictionary <string, string> fieldList = new Dictionary <string, string>(); string[] fieldNames = { "OPER_COST", "REVENUE", "TIME_WORKED", "RECORDED_CASES", "TIME_LOST_CASES" }; // default fields to display if (!string.IsNullOrEmpty(acctFields)) // desired fields to display { fieldNames = acctFields.Split(','); if (profile.InputPeriod.PlantAccounting != null) { var PropertyInfos = profile.InputPeriod.PlantAccounting.GetType().GetProperties(); foreach (System.Reflection.PropertyInfo pInfo in PropertyInfos) { if (fieldNames.Contains(pInfo.Name)) { object obj = pInfo.GetValue(profile.InputPeriod.PlantAccounting, null); if (obj != null) { fieldList.Add(pInfo.Name, SQMBasePage.FormatValue((decimal)obj, 2)); } else { fieldList.Add(pInfo.Name, ""); } } } pnlProdList.Visible = true; gvProdList.DataSource = fieldList; gvProdList.DataBind(); } } }
public void gvList_OnTargetRowDataBound(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 hf = (HiddenField)e.Row.Cells[0].FindControl("hfTargetValue"); Label lbl = (Label)e.Row.Cells[0].FindControl("lblTargetValue"); lbl.Text = SQMBasePage.FormatValue(Convert.ToDecimal(hf.Value), 4); } catch { } } }
protected void SetupPage() { hdCurrentActiveMenu.Value = SessionManager.CurrentMenuItem; lbBusinessCard1_out.Text = SessionManager.UserContext.UserName(); // +": " + SessionManager.UserContext.HRLocation.Company.COMPANY_NAME + ", " + SessionManager.UserContext.HRLocation.Plant.PLANT_NAME; lblActiveLocation.Text = SessionManager.UserContext.HRLocation.Company.COMPANY_NAME + ", " + SessionManager.UserContext.HRLocation.Plant.PLANT_NAME; if (SessionManager.StatOfTheDay != null && UserContext.RoleAccess() != AccessMode.Partner) { lblActiveLocation.Text = SessionManager.UserContext.HRLocation.Company.COMPANY_NAME + ", " + SessionManager.UserContext.HRLocation.Plant.PLANT_NAME + ": "; lblStatOfTheDay_out.Text = SQMBasePage.FormatValue(SessionManager.StatOfTheDay.Value, 0); lblStatOfTheDay.Visible = lblStatOfTheDay_out.Visible = true; } else { lblStatOfTheDay_out.Text = "n/a"; } pnlStatOfTheDay.Visible = true; tbUserPhone.Text = SessionManager.UserContext.Person.PHONE; }
protected void SetupPage() { hdCurrentActiveMenu.Value = SessionManager.CurrentMenuItem; lbBusinessCard1_out.Text = SessionManager.UserContext.UserName(); // +": " + SessionManager.UserContext.HRLocation.Company.COMPANY_NAME + ", " + SessionManager.UserContext.HRLocation.Plant.PLANT_NAME; lblActiveLocation.Text = SessionManager.UserContext.HRLocation.Company.COMPANY_NAME + ", " + SessionManager.UserContext.HRLocation.Plant.PLANT_NAME; if (SessionManager.StatOfTheDay != null) { lblActiveLocation.Text = SessionManager.UserContext.HRLocation.Company.COMPANY_NAME + ", " + SessionManager.UserContext.HRLocation.Plant.PLANT_NAME + ": "; lblStatOfTheDay_out.Text = SQMBasePage.FormatValue(SessionManager.StatOfTheDay.Value, 0); lblStatOfTheDay.Visible = lblStatOfTheDay_out.Visible = true; } else { lblStatOfTheDay_out.Text = "n/a"; } pnlStatOfTheDay.Visible = true; if (ddlUserLang.Items.Count == 0) { foreach (LOCAL_LANGUAGE lang in SQMModelMgr.SelectLanguageList(new PSsqmEntities(), true)) { ddlUserLang.Items.Add(new RadComboBoxItem(lang.LANGUAGE_NAME, lang.LANGUAGE_ID.ToString())); } } tbUserPhone.Text = SessionManager.UserContext.Person.PHONE; if (ddlUserLang.FindItemByValue(SessionManager.UserContext.Person.PREFERRED_LANG_ID.ToString()) != null) { ddlUserLang.SelectedValue = SessionManager.UserContext.Person.PREFERRED_LANG_ID.ToString(); } // ABW 20160118 - show password reset based on parameter SETTINGS setsPwdReset = SQMSettings.SelectSettingByCode(new PSsqmEntities(), "COMPANY", "TASK", "PasswordResetEnable"); if (setsPwdReset != null && setsPwdReset.VALUE.ToUpper() == "Y") { trChangePwd.Visible = true; } }
public int BindProfileMeasure(EHS_PROFILE_MEASURE pm) { int status = 0; divMetricUOM.Visible = true; divUserUOM.Visible = false; if (pm == null) { ddlMetricCategory.SelectedIndex = ddlMetricID.SelectedIndex = ddlMetricDisposalCode.SelectedIndex = ddlMetricUOM.SelectedIndex = ddlMetricResponsible.SelectedIndex = 0; ddlMetricCurrency.SelectedValue = staticProfile.Plant.CURRENCY_CODE; lblMetricName.Text = lblDisposalDesc.Text = ""; tbMetricPrompt.Text = ""; } else { staticProfileMeasure = pm; staticMeasure = pm.EHS_MEASURE; // ScriptManager.RegisterStartupScript(this, GetType(), "enablelist", "enableListItems('ddlMetricCategory','ddlMetricID'); enableListItems('ddlMetricUOMCategory','ddlMetricUOM');", true); ddlMetricCategory.SelectedValue = pm.EHS_MEASURE.MEASURE_CATEGORY; ddlMetricID.SelectedValue = pm.EHS_MEASURE.MEASURE_CATEGORY + "|" + pm.EHS_MEASURE.MEASURE_ID.ToString(); lblMetricName.Text = pm.EHS_MEASURE.MEASURE_CD; tbMetricPrompt.Text = pm.MEASURE_PROMPT; ddlMetricRegStatus.SelectedValue = pm.REG_STATUS; ddlMetricDisposalCode.SelectedValue = pm.UN_CODE; if (!string.IsNullOrEmpty(pm.UN_CODE)) { lblDisposalDesc.Text = disposalList.FirstOrDefault(l => l.UN_CODE == pm.UN_CODE).DESCRIPTION; } else { lblDisposalDesc.Text = ""; } if (pm.EHS_MEASURE.MEASURE_CATEGORY == "EUTL" || pm.EHS_MEASURE.MEASURE_CATEGORY == "PROD") { tbWasteCode.Enabled = false; tbWasteCode.Text = ""; } else { tbWasteCode.Enabled = true; tbWasteCode.Text = pm.WASTE_CODE; } ddlMetricCurrency.SelectedValue = pm.DEFAULT_CURRENCY_CODE; if (pm.RESPONSIBLE_ID > 0) { ddlMetricResponsible.SelectedValue = pm.RESPONSIBLE_ID.ToString(); } if (pm.DEFAULT_UOM > 0) { UOM uom = staticUOM = SessionManager.UOMList.FirstOrDefault(l => l.UOM_ID == pm.DEFAULT_UOM); if (uom != null) { ddlMetricUOM.SelectedValue = WebSiteCommon.PackItemValue(uom.UOM_CATEGORY, uom.UOM_ID.ToString()); if (uom.UOM_CATEGORY == "CUST") { divUserUOM.Visible = true; tbUserUOMName.Text = uom.UOM_NAME; tbUserUOMCode.Text = uom.UOM_CD; UOM_XREF xref = uom.UOM_XREF.FirstOrDefault(); if (xref != null) { UOM refUOM = SessionManager.UOMList.FirstOrDefault(l => l.UOM_ID == xref.UOM_TO); if (refUOM != null) { ddlUserUOMConvertTo.SelectedValue = WebSiteCommon.PackItemValue(refUOM.UOM_CATEGORY, refUOM.UOM_ID.ToString()); tbUserUOMConversionFactor.Text = SQMBasePage.FormatValue(xref.CONVERSION, 4); } } } } } ddlMetricStatus.SelectedValue = pm.STATUS; cbMetricNegValue.Checked = (bool)pm.NEG_VALUE_ALLOWED; cbMetricRequired.Checked = (bool)pm.IS_REQUIRED; } UpdateListTitles(); pnlMetricEdit.Enabled = btnMetricCancel.Enabled = btnMetricSave.Enabled = true; return(status); }
public int BindProfileMeasure(EHS_PROFILE_MEASURE pm) { int status = 0; pnlMetricEdit.Visible = true; spUOMFactor.Visible = false; pnlMetricEdit.Visible = true; btnMetricCancel.Enabled = true; DisplayErrorMessage(null); if (pm == null) { ddlMetricID.Enabled = ddlMetricCost.Enabled = ddlMetricDisposalCode.Enabled = ddlMetricRegStatus.Enabled = ddlMetricUOM.Enabled = ddlMetricCurrency.Enabled = ddlMetricResponsible.Enabled = false; ddlMetricCategory.SelectedIndex = ddlMetricID.SelectedIndex = ddlMetricDisposalCode.SelectedIndex = ddlMetricRegStatus.SelectedIndex = ddlMetricUOM.SelectedIndex = ddlMetricCost.SelectedIndex = ddlMetricResponsible.SelectedIndex = 0; if (ddlMetricCurrency.Items.FindByValue(LocalProfile().Plant.CURRENCY_CODE) != null) { ddlMetricCurrency.SelectedValue = LocalProfile().Plant.CURRENCY_CODE; } lblMetricName.Text = lblDisposalDesc.Text = ""; tbMetricPrompt.Text = tbUOMFactor.Text = tbWasteCode.Text = ""; winMetricEdit.Title = hfAddMetric.Value; tbValueDflt.Text = tbCostDflt.Text = ""; cbEnableOverride.Checked = false; cbMetricRequired.Checked = true; } else { winMetricEdit.Title = hfUpdateMetric.Value; LocalProfile().CurrentProfileMeasure = pm; LocalProfile().CurrentEHSMeasure = pm.EHS_MEASURE; if (pm.EHS_MEASURE != null && ddlMetricCategory.Items.FindByValue(pm.EHS_MEASURE.MEASURE_CATEGORY) != null) { ddlMetricCategory.SelectedValue = pm.EHS_MEASURE.MEASURE_CATEGORY; ddlCategoryChanged(ddlMetricCategory, null); ddlMetricID.SelectedValue = WebSiteCommon.PackItemValue(pm.EHS_MEASURE.MEASURE_CATEGORY, pm.EHS_MEASURE.EFM_TYPE, pm.EHS_MEASURE.MEASURE_ID.ToString()); lblMetricName.Text = pm.EHS_MEASURE.MEASURE_CD; if (pm.EHS_MEASURE.MEASURE_CATEGORY != "PROD" && pm.EHS_MEASURE.MEASURE_CATEGORY != "SAFE" && pm.EHS_MEASURE.MEASURE_CATEGORY != "FACT" && ddlMetricCurrency.Items.FindByValue(pm.DEFAULT_CURRENCY_CODE) != null) { ddlMetricCurrency.SelectedValue = pm.DEFAULT_CURRENCY_CODE; } if (pm.EHS_MEASURE.MEASURE_CATEGORY != "PROD" && pm.EHS_MEASURE.MEASURE_CATEGORY != "SAFE" && pm.EHS_MEASURE.MEASURE_CATEGORY != "FACT" && pm.DEFAULT_UOM > 0) { UOM uom = SessionManager.UOMList.FirstOrDefault(l => l.UOM_ID == pm.DEFAULT_UOM); if (uom != null) { if (ddlMetricUOM.Items.FindByValue(WebSiteCommon.PackItemValue(uom.UOM_CATEGORY, uom.EFM_TYPE, uom.UOM_ID.ToString())) != null) { ddlMetricUOM.SelectedValue = WebSiteCommon.PackItemValue(uom.UOM_CATEGORY, uom.EFM_TYPE, uom.UOM_ID.ToString()); } else { ddlMetricUOM.SelectedIndex = 0; } if (uom.UOM_CATEGORY == "CUST") { spUOMFactor.Visible = true; } } if (pm.UOM_FACTOR.HasValue) { tbUOMFactor.Text = SQMBasePage.FormatValue((decimal)pm.UOM_FACTOR, 5); } } if (pm.EHS_MEASURE.MEASURE_CATEGORY != "PROD" && pm.EHS_MEASURE.MEASURE_CATEGORY != "SAFE" && pm.EHS_MEASURE.MEASURE_CATEGORY != "FACT") { if (pm.NEG_VALUE_ALLOWED.HasValue && (bool)pm.NEG_VALUE_ALLOWED) { ddlMetricCost.SelectedValue = "CREDIT"; } else { ddlMetricCost.SelectedValue = "COST"; } } } tbMetricPrompt.Text = pm.MEASURE_PROMPT; ddlMetricRegStatus.SelectedValue = pm.REG_STATUS; ddlMetricDisposalCode.SelectedValue = pm.UN_CODE; if (!string.IsNullOrEmpty(pm.UN_CODE)) { lblDisposalDesc.Text = SessionManager.DisposalCodeList.FirstOrDefault(l => l.UN_CODE == pm.UN_CODE).DESCRIPTION; } else { lblDisposalDesc.Text = ""; } tbWasteCode.Text = pm.WASTE_CODE; if (pm.RESPONSIBLE_ID > 0 && ddlMetricResponsible.Items.FindByValue(pm.RESPONSIBLE_ID.ToString()) != null) { ddlMetricResponsible.SelectedValue = pm.RESPONSIBLE_ID.ToString(); } else { ddlMetricResponsible.SelectedIndex = 0; } ddlUOMChanged(ddlMetricUOM, null); ddlMetricStatus.SelectedValue = pm.STATUS; cbMetricRequired.Checked = (bool)pm.IS_REQUIRED; tbValueDflt.Text = tbCostDflt.Text = ""; cbEnableOverride.Checked = false; // radEffEndDate.ShowPopupOnFocus = true; //radEffEndDate.SelectedDate = null; if (pm.EHS_PROFILE_MEASURE_EXT != null && pm.EHS_PROFILE_MEASURE_EXT.VALUE_DEFAULT.HasValue) { tbValueDflt.Text = SQMBasePage.FormatValue((decimal)pm.EHS_PROFILE_MEASURE_EXT.VALUE_DEFAULT, 2); } if (pm.EHS_PROFILE_MEASURE_EXT != null && pm.EHS_PROFILE_MEASURE_EXT.COST_DEFAULT.HasValue) { tbCostDflt.Text = SQMBasePage.FormatValue((decimal)pm.EHS_PROFILE_MEASURE_EXT.COST_DEFAULT, 2); } if (pm.EHS_PROFILE_MEASURE_EXT != null && pm.EHS_PROFILE_MEASURE_EXT.OVERRIDE_ALLOWED.HasValue) { cbEnableOverride.Checked = (bool)pm.EHS_PROFILE_MEASURE_EXT.OVERRIDE_ALLOWED; } //if (pm.EHS_PROFILE_MEASURE_EXT != null && pm.EHS_PROFILE_MEASURE_EXT.EFF_END_DT.HasValue) // radEffEndDate.SelectedDate = pm.EHS_PROFILE_MEASURE_EXT.EFF_END_DT; } UpdateListTitles(); pnlMetricEdit.Enabled = btnMetricCancel.Enabled = btnMetricSave.Enabled = UserContext.CheckUserPrivilege(SysPriv.config, SysScope.envdata); string script = "function f(){OpenMetricEditWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); return(status); }
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 BindTarget(PERSPECTIVE_TARGET target) { int n = -1; if (target != null) { if (!string.IsNullOrEmpty(target.CALCS_SCOPE)) { foreach (RadComboBoxItem item in ddlTarget.Items) { ++n; string[] args = item.Value.Split('|'); if (!item.IsSeparator && args[0] == target.CALCS_SCOPE) { ddlTarget.SelectedIndex = n; break; } } } tbTargetDescLong.Text = target.DESCR_LONG; if (ddlStatType.Items.FindByValue(target.SSTAT) != null) { ddlStatType.SelectedValue = target.SSTAT; } if (target.EFF_YEAR > 0) { ddlEffYear.SelectedValue = target.EFF_YEAR.ToString(); } btnYTDMetric.Checked = btnYOYMetric.Checked = btnABSMetric.Checked = false; if (target.DATE_SPAN <= 0) { btnABSMetric.Checked = true; } else if (target.DATE_SPAN == 1) { btnYTDMetric.Checked = true; } else { btnYOYMetric.Checked = true; } if (target.TARGET_VALUE.HasValue) { tbTargetValue.Text = SQMBasePage.FormatValue((decimal)target.TARGET_VALUE, 4); } else { tbTargetValue.Text = ""; } btnTargetMin.Checked = btnTargetMax.Checked = false; if (target.MIN_MAX > 0) { btnTargetMax.Checked = true; } else { btnTargetMin.Checked = true; } ddlTargetStatus.SelectedValue = target.STATUS; pnlTargetEdit.Enabled = true; btnTargetSave.Enabled = btnTargetCancel.Enabled = true; udpTarget.Update(); } }
protected void DisplayIssue() { SetupPage(); if (ddlIncidentType.Items.FindItemByValue(IssueCtl().qualityIssue.IssueOccur.QS_ACTIVITY) != null) { SQMBasePage.DisplayControlValue(ddlIncidentType, IssueCtl().qualityIssue.IssueOccur.QS_ACTIVITY, PageUseMode.ViewOnly, ""); SelectActivityType(null, null); trQIActivity.Visible = false; switch (IssueCtl().qualityIssue.IssueOccur.QS_ACTIVITY) { case "CST": trPartType.Visible = true; ph8DRef.Visible = true; // external problem control system reference number trReceipt.Visible = false; break; case "RCV": trPartType.Visible = false; ph8DRef.Visible = false; trReceipt.Visible = true; // reference receipt or po number break; default: trPartType.Visible = false; ph8DRef.Visible = false; trReceipt.Visible = false; break; } } tbTotalEstNCQty.ReadOnly = true; QI_OCCUR_NC sample = IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.FirstOrDefault(); if (sample != null) { if (IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.First().NONCONF_ID.HasValue) { uclNC.Initialize(IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.First().PROBLEM_AREA, (decimal)IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.First().NONCONF_ID, (int)IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.First().PROBLEM_COUNT, IssueCtl().PageMode); } else { uclNC.Initialize("", 0, 0, IssueCtl().PageMode); } gvMeasureGrid.DataSource = sample.QI_OCCUR_MEASURE; gvMeasureGrid.DataBind(); } SetB2BLocation(Convert.ToDecimal(IssueCtl().qualityIssue.DetectedLocation.Plant.PLANT_ID.ToString())); if (ddlReportedLocation.Items.FindItemByValue(IssueCtl().qualityIssue.DetectedLocation.Plant.PLANT_ID.ToString()) != null) { SQMBasePage.DisplayControlValue(ddlReportedLocation, IssueCtl().qualityIssue.DetectedLocation.Plant.PLANT_ID.ToString(), IssueCtl().PageMode, "textStd"); } else { // add the reported location in case the viewing user doesn't have it assigned to him BusinessLocation reportLoc = new BusinessLocation().Initialize(IssueCtl().qualityIssue.DetectedLocation.Plant.PLANT_ID); if (reportLoc != null) { ddlReportedLocation.Items.Add(SQMBasePage.SetLocationItem(reportLoc, true)); SQMBasePage.DisplayControlValue(ddlReportedLocation, IssueCtl().qualityIssue.DetectedLocation.Plant.PLANT_ID.ToString(), IssueCtl().PageMode, "textStd"); } } ddlResponsibleLocation.Items.Clear(); if (IssueCtl().qualityIssue.Partdata.B2BList != null) { foreach (BusinessLocation loc in IssueCtl().qualityIssue.Partdata.B2BList) { ddlResponsibleLocation.Items.Add(SQMBasePage.SetLocationItem(loc, true)); } // ddlResponsibleLocation.SelectedValue = qualityIssue.Incident.RESP_PLANT_ID.ToString(); SQMBasePage.DisplayControlValue(ddlResponsibleLocation, IssueCtl().qualityIssue.Incident.RESP_PLANT_ID.ToString(), IssueCtl().PageMode, "textStd"); } if (IssueCtl().qualityIssue.Partdata != null && IssueCtl().qualityIssue.Partdata.Part != null) { SQMBasePage.DisplayControlValue(uclPartSearch1.PartTextBox, IssueCtl().qualityIssue.Partdata.PartDisplayNum(IssueCtl().qualityIssue.IssueOccur.QS_ACTIVITY), IssueCtl().PageMode, "textStd"); lblPartDesc.Text = IssueCtl().qualityIssue.Partdata.Part.PART_NAME; SQMBasePage.DisplayControlValue(tbRelatedParts, IssueCtl().qualityIssue.IssueOccur.RELATED_PARTS, IssueCtl().PageMode, "textStd"); } ddlDisposition.SelectedIndex = ddlStatus.SelectedIndex = 0; if (IssueCtl().qualityIssue.IsNew) { cbNotify.Checked = true; cbNotify.Enabled = false; ddlResponseTime.SelectedIndex = 1; } else { cbNotify.Checked = false; cbNotify.Enabled = true; lblIssueDate_out.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)IssueCtl().qualityIssue.Incident.CREATE_DT, SessionManager.UserContext.TimeZoneID), "d", false); SQMBasePage.DisplayControlValue(radIssueDate, IssueCtl().qualityIssue.Incident.INCIDENT_DT.ToShortDateString(), IssueCtl().PageMode, "textStd"); SQMBasePage.DisplayControlValue(tbIssueDesc, IssueCtl().qualityIssue.Incident.DESCRIPTION, IssueCtl().PageMode, "textStd"); lblOriginator_out.Text = IssueCtl().qualityIssue.Incident.CREATE_BY; SQMBasePage.DisplayControlValue(ddlIncidentSeverity2, IssueCtl().qualityIssue.IssueOccur.SEVERITY, IssueCtl().PageMode, "textStd"); SQMBasePage.DisplayControlValue(tbReceipt, IssueCtl().qualityIssue.IssueOccur.QS_ACTIVITY == "RCV" ? IssueCtl().qualityIssue.IssueOccur.REF_OPERATION : "", IssueCtl().PageMode, "textStd"); if (ddlPartType.Items.FindItemByValue(IssueCtl().qualityIssue.IssueOccur.PART_TYPE) != null) { SQMBasePage.DisplayControlValue(ddlPartType, IssueCtl().qualityIssue.IssueOccur.PART_TYPE, IssueCtl().PageMode, "textStd"); } SQMBasePage.DisplayControlValue(tbNCLotNum, IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().LOT_NUM, IssueCtl().PageMode, "textStd"); try { SQMBasePage.DisplayControlValue(tbNCTotalQty, IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().TOTAL_QTY.ToString(), IssueCtl().PageMode, "textStd"); SQMBasePage.DisplayControlValue(tbNCSampleQty, IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().INSPECT_QTY.ToString(), IssueCtl().PageMode, "textStd"); SQMBasePage.DisplayControlValue(tbNCNonConformQty, IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().INSPECT_NC_QTY.ToString(), IssueCtl().PageMode, "textStd"); SQMBasePage.DisplayControlValue(tbTotalEstNCQty, Math.Round((decimal)IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().TOTAL_NC_QTY, 1).ToString(), IssueCtl().PageMode, "labelEmphasis"); lnkCalculateNC.Visible = IssueCtl().PageMode == PageUseMode.EditEnabled ? true : false; lblCalculateNC.Visible = IssueCtl().PageMode == PageUseMode.EditEnabled ? false : true; } catch { tbNCTotalQty.Text = tbNCSampleQty.Text = tbNCNonConformQty.Text = tbTotalEstNCQty.Text = ""; } SQMBasePage.DisplayControlValue(tbObservations, IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.First().SAMPLE_COMMENTS, IssueCtl().PageMode, "textStd"); cb8DRequired.Checked = (bool)(IssueCtl().qualityIssue.IssueOccur.PROBCASE_REQD.HasValue == true ? IssueCtl().qualityIssue.IssueOccur.PROBCASE_REQD : false); if (IssueCtl().PageMode != PageUseMode.EditEnabled) { cb8DRequired.Enabled = phNotify.Visible = false; } SQMBasePage.DisplayControlValue(tb8DRef, IssueCtl().qualityIssue.IssueOccur.QS_ACTIVITY == "CST" && !string.IsNullOrEmpty(IssueCtl().qualityIssue.IssueOccur.REF_OPERATION) ? IssueCtl().qualityIssue.IssueOccur.REF_OPERATION : "", IssueCtl().PageMode, "refText"); SQMBasePage.DisplayControlValue(ddlDisposition, IssueCtl().qualityIssue.IssueOccur.DISPOSITION, IssueCtl().PageMode, "textStd"); if (IssueCtl().PageMode == PageUseMode.Active) { if (ddlStatus.Items.FindItemByValue(IssueCtl().qualityIssue.IssueOccur.STATUS) != null) { ddlStatus.SelectedValue = IssueCtl().qualityIssue.IssueOccur.STATUS; } } else { SQMBasePage.DisplayControlValue(ddlStatus, IssueCtl().qualityIssue.IssueOccur.STATUS, IssueCtl().PageMode, "textStd"); } if (ddlCurrency.Items.FindItemByValue(IssueCtl().qualityIssue.IssueOccur.CURRENCY_CODE) != null) { SQMBasePage.DisplayControlValue(ddlCurrency, IssueCtl().qualityIssue.IssueOccur.CURRENCY_CODE, IssueCtl().PageMode, "textStd"); } SQMBasePage.DisplayControlValue(tbActCost, IssueCtl().qualityIssue.IssueOccur.EST_ACT_COST.HasValue ? SQMBasePage.FormatValue((decimal)IssueCtl().qualityIssue.IssueOccur.EST_ACT_COST, 2) : "", IssueCtl().PageMode, "textStd"); SQMBasePage.DisplayControlValue(tbActCostNote, IssueCtl().qualityIssue.IssueOccur.ACT_COST_COMMENT, IssueCtl().PageMode, "textStd"); SQMBasePage.DisplayControlValue(tbPotCost, IssueCtl().qualityIssue.IssueOccur.EST_POT_COST.HasValue ? SQMBasePage.FormatValue((decimal)IssueCtl().qualityIssue.IssueOccur.EST_POT_COST, 2) : "", IssueCtl().PageMode, "textStd"); SQMBasePage.DisplayControlValue(tbPotCostNote, IssueCtl().qualityIssue.IssueOccur.POT_COST_COMMENT, IssueCtl().PageMode, "textStd"); if (IssueCtl().PageMode == PageUseMode.EditEnabled) { uclRadAttach.SetReportOption(false); uclRadAttach.GetUploadedFiles(20, IssueCtl().qualityIssue.Incident.INCIDENT_ID, "1"); } else { Ucl_Attach attch = (Ucl_Attach)Page.LoadControl("/Include/Ucl_Attach.ascx"); uclRadAttach.Parent.Controls.AddAt(uclRadAttach.Parent.Controls.IndexOf(uclRadAttach), attch); attch.BindDisplayAttachments(20, IssueCtl().qualityIssue.Incident.INCIDENT_ID, "1", 0); uclRadAttach.Visible = false; } btnDupIncident.Visible = IssueCtl().PageMode == PageUseMode.EditEnabled ? true : false; //uclQISearch1.Load(false); if (!string.IsNullOrEmpty(IssueCtl().qualityIssue.IssueOccur.RELATED_INCIDENTS)) { QualityIssue refIssue = new QualityIssue().Load(Convert.ToDecimal(IssueCtl().qualityIssue.IssueOccur.RELATED_INCIDENTS)); if (refIssue != null) { tbDupIssue.Text = IssueCtl().qualityIssue.IssueOccur.RELATED_INCIDENTS + " - " + refIssue.Incident.DESCRIPTION; } } else { tbDupIssue.Text = ""; } // determine selectable list of responsible persons based on the trading partner locations GetResponsibleList(); if (ddlResponseTime.Items.FindItemByValue(IssueCtl().qualityIssue.IssueOccur.INIT_ACTION) != null) { SQMBasePage.DisplayControlValue(ddlResponseTime, IssueCtl().qualityIssue.IssueOccur.INIT_ACTION, IssueCtl().PageMode, "textStd"); } // update the ddl based per selected persons in the task list foreach (TASK_STATUS task in IssueCtl().qualityIssue.TeamTask.TaskList) { RadComboBoxItem resp = null; if ((resp = ddlResponsible.FindItemByValue(task.RESPONSIBLE_ID.ToString())) != null) { resp.Checked = true; } } if (IssueCtl().PageMode != PageUseMode.EditEnabled) { SQMBasePage.DisplayControlValue(ddlResponsible, "", IssueCtl().PageMode, "textSTd"); } // btnPrintLabel.OnClientClick = "Popup('../Quality/QualityIssue_Label.aspx?issue=" + qualityIssue.IssueOccur.INCIDENT_ID.ToString() + "', 'newPage', 600, 450); return false;"; } uclResponse.BindResponseList(IssueCtl().qualityIssue.TeamResponse.ResponseList, IssueCtl().PageMode == PageUseMode.EditEnabled || IssueCtl().PageMode == PageUseMode.EditPartial ? true : false, true); lblIssueResponseCount.Text = IssueCtl().qualityIssue.TeamResponse.ResponseList.Count.ToString(); phResponseAlert.Visible = IssueCtl().PageMode == PageUseMode.EditEnabled ? true : false; }
public void gvInputsList_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()))) { Label lbl; DateTime dt; UOM uom = null; try { HiddenField hf = (HiddenField)e.Row.Cells[0].FindControl("hfPRMRID"); lbl = (Label)e.Row.Cells[0].FindControl("lblMetricName"); EHS_PROFILE_MEASURE measure = currentProfile.Profile.EHS_PROFILE_MEASURE.Where(l => l.PRMR_ID == Convert.ToDecimal(hf.Value)).FirstOrDefault(); lbl.Text = measure.EHS_MEASURE.MEASURE_NAME.Trim(); lbl = (Label)e.Row.Cells[0].FindControl("lblMetricCode"); lbl.Text = measure.EHS_MEASURE.MEASURE_CD; if ((bool)measure.IS_REQUIRED) { e.Row.Cells[1].Attributes.Add("Class", "required"); } hf = (HiddenField)e.Row.Cells[0].FindControl("hfStatus"); if (hf.Value == "D") { Image img = (Image)e.Row.Cells[0].FindControl("imgStatus"); img.ImageUrl = "~/images/defaulticon/16x16/delete.png"; img.Visible = true; } if (measure.EHS_MEASURE.MEASURE_CATEGORY == "ENGY" || measure.EHS_MEASURE.MEASURE_CATEGORY == "EUTL") { e.Row.Cells[0].Attributes.Add("Class", "textStd energyColor"); } else if (measure.EHS_MEASURE.MEASURE_CATEGORY == "PROD" || measure.EHS_MEASURE.MEASURE_CATEGORY == "SAFE") { ; } else { e.Row.Cells[0].Attributes.Add("Class", "textStd wasteColor"); } lbl = (Label)e.Row.Cells[0].FindControl("lblInvoiceDateFrom"); if (!string.IsNullOrEmpty(lbl.Text)) { dt = Convert.ToDateTime(lbl.Text); lbl.Text = SQMBasePage.FormatDate(dt, "d", false); } lbl = (Label)e.Row.Cells[0].FindControl("lblInvoiceDateTo"); if (!string.IsNullOrEmpty(lbl.Text)) { dt = Convert.ToDateTime(lbl.Text); lbl.Text = SQMBasePage.FormatDate(dt, "d", false); } lbl = (Label)e.Row.Cells[0].FindControl("lblValue"); if (!string.IsNullOrEmpty(lbl.Text)) { decimal val; if (Decimal.TryParse(lbl.Text, out val)) { lbl.Text = SQMBasePage.FormatValue(val, 2); } } lbl = (Label)e.Row.Cells[0].FindControl("lblCost"); if (!string.IsNullOrEmpty(lbl.Text)) { decimal val; if (Decimal.TryParse(lbl.Text, out val)) { if (val < 0) { lbl.Text = ""; lbl = (Label)e.Row.Cells[0].FindControl("lblCredit"); } lbl.Text = SQMBasePage.FormatValue(val, 2); } } lbl = (Label)e.Row.Cells[0].FindControl("lblValueUOM"); uom = SessionManager.UOMList.FirstOrDefault(l => l.UOM_ID == Convert.ToDecimal(lbl.Text)); if (uom != null) { lbl.Text = uom.UOM_CD; } } catch { } } }
public void gvHSTMetricsList_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()))) { Label lbl; decimal val; UOM uom = null; try { HiddenField hf = (HiddenField)e.Row.Cells[0].FindControl("hfHSTMetricID"); lbl = (Label)e.Row.Cells[0].FindControl("lblHSTMetricName"); EHS_PROFILE_MEASURE measure = currentProfile.Profile.EHS_PROFILE_MEASURE.Where(l => l.MEASURE_ID == Convert.ToDecimal(hf.Value)).FirstOrDefault(); lbl.Text = measure.EHS_MEASURE.MEASURE_NAME.Trim(); lbl = (Label)e.Row.Cells[0].FindControl("lblHSTMetricCode"); lbl.Text = measure.EHS_MEASURE.MEASURE_CD; if ((bool)measure.IS_REQUIRED) { // System.Web.UI.HtmlControls.HtmlTableCell cell1 = (System.Web.UI.HtmlControls.HtmlTableCell)e.Row.Cells[0].FindControl("lblInvoiceDateFrom"); e.Row.Cells[1].Attributes.Add("Class", "required"); } if (measure.EHS_MEASURE.MEASURE_CATEGORY == "ENGY" || measure.EHS_MEASURE.MEASURE_CATEGORY == "EUTL") { e.Row.Cells[0].Attributes.Add("Class", "textStd energyColor"); } else { e.Row.Cells[0].Attributes.Add("Class", "textStd wasteColor"); } lbl = (Label)e.Row.Cells[0].FindControl("lblHSTValue"); if (!string.IsNullOrEmpty(lbl.Text)) { if (Decimal.TryParse(lbl.Text, out val)) { lbl.Text = SQMBasePage.FormatValue(val, 2); } } lbl = (Label)e.Row.Cells[0].FindControl("lblHSTInputValue"); if (!string.IsNullOrEmpty(lbl.Text)) { if (Decimal.TryParse(lbl.Text, out val)) { lbl.Text = SQMBasePage.FormatValue(val, 2); } } lbl = (Label)e.Row.Cells[0].FindControl("lblHSTCost"); if (!string.IsNullOrEmpty(lbl.Text)) { if (Decimal.TryParse(lbl.Text, out val)) { lbl.Text = SQMBasePage.FormatValue(val, 2); } } lbl = (Label)e.Row.Cells[0].FindControl("lblHSTInputCost"); if (!string.IsNullOrEmpty(lbl.Text)) { if (Decimal.TryParse(lbl.Text, out val)) { lbl.Text = SQMBasePage.FormatValue(val, 2); } } lbl = (Label)e.Row.Cells[0].FindControl("lblHSTValueUOM"); uom = SessionManager.UOMList.FirstOrDefault(l => l.UOM_ID == Convert.ToDecimal(lbl.Text)); if (uom != null) { lbl.Text = uom.UOM_CD; } lbl = (Label)e.Row.Cells[0].FindControl("lblHSTInputUOM"); uom = SessionManager.UOMList.FirstOrDefault(l => l.UOM_ID == Convert.ToDecimal(lbl.Text)); if (uom != null) { lbl.Text = uom.UOM_CD; } } catch { } } }