public void rptCustPartHeader_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { PartData partData = (PartData)e.Item.DataItem; List <PartData> partList = new List <PartData>(); partList.Add(partData); Label lbl = (Label)e.Item.FindControl("lblLocation"); lbl.Text = partData.CustomerPlant.PLANT_NAME; Repeater rpt = (Repeater)e.Item.FindControl("rptCustPartDetail"); rpt.DataSource = partList; rpt.DataBind(); LinkButton lnk = (LinkButton)rpt.Items[0].FindControl("lnkPartList"); lnk.CommandArgument = partData.CustomerPlant.PLANT_ID.ToString(); lnk = (LinkButton)rpt.Items[0].FindControl("lnkSaveCust"); lnk.CommandArgument = partData.CustomerPlant.PLANT_ID.ToString(); lbl = (Label)rpt.Items[0].FindControl("lblLocationCode"); lbl.Text = partData.CustomerPlant.DUNS_CODE; lbl = (Label)rpt.Items[0].FindControl("lblParentCompany"); lbl.Text = partData.PartnerCompany.COMPANY_NAME; HiddenField hf = (HiddenField)rpt.Items[0].FindControl("hfQSNotify"); RadComboBox ddl1 = (RadComboBox)rpt.Items[0].FindControl("ddlQSNotify1"); SQMBasePage.SetPersonList(ddl1, staticPersonList, "", 20); RadComboBox ddl2 = (RadComboBox)rpt.Items[0].FindControl("ddlQSNotify2"); SQMBasePage.SetPersonList(ddl2, staticPersonList, "", 20); } }
private void GetResponsibleList() { ddlResponseTime.Items.AddRange(WebSiteCommon.PopulateComboBoxListNums(1, 14, ddlResponseTime.EmptyMessage)); if (!string.IsNullOrEmpty(ddlResponsibleLocation.SelectedValue)) { IssueCtl().qualityIssue.SetResponsibleLocation(Convert.ToDecimal(ddlResponsibleLocation.SelectedValue)); List <BusinessLocation> locationList = new List <BusinessLocation>(); // locationList.Add(qualityIssue.DetectedLocation); locationList.Add(IssueCtl().qualityIssue.ResponsibleLocation); // td: fetch the supplier persons responsible List <PERSON> respList = SQMModelMgr.SelectPlantPersonList(locationList, IssueCtl().qualityIssue.IssueOccur.QS_ACTIVITY == "RCV" ? "211" : "212", AccessMode.Partner); SQMBasePage.SetPersonList(ddlResponsible, respList, "", 20); updResponsible.Update(); } }
public void rptSuppPartHeader_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { PartData partData = (PartData)e.Item.DataItem; try { List <PartData> partList = new List <PartData>(); partList.Add(partData); Label lbl = (Label)e.Item.FindControl("lblLocation"); lbl.Text = partData.SupplierPlant.PLANT_NAME; Repeater rpt = (Repeater)e.Item.FindControl("rptSuppPartDetail"); rpt.DataSource = partList; rpt.DataBind(); LinkButton lnk = (LinkButton)rpt.Items[0].FindControl("lnkPartList"); lnk.CommandArgument = partData.SupplierPlant.PLANT_ID.ToString(); lbl = (Label)rpt.Items[0].FindControl("lblLocationCode"); lbl.Text = partData.SupplierPlant.DUNS_CODE; lbl = (Label)rpt.Items[0].FindControl("lblParentCompany"); lbl.Text = partData.PartnerCompany.COMPANY_NAME; HiddenField hf = (HiddenField)rpt.Items[0].FindControl("hfQSNotify"); RadComboBox ddl1 = (RadComboBox)rpt.Items[0].FindControl("ddlQSNotify1"); SQMBasePage.SetPersonList(ddl1, staticPersonList, "", 20); RadComboBox ddl2 = (RadComboBox)rpt.Items[0].FindControl("ddlQSNotify2"); SQMBasePage.SetPersonList(ddl2, staticPersonList, "", 20); if (partData.Notify != null) { hf.Value = partData.Notify.NOTIFY_ID.ToString(); if (ddl1.Items.FindItemByValue(partData.Notify.NOTIFY_PERSON1.ToString()) != null) { ddl1.SelectedValue = partData.Notify.NOTIFY_PERSON1.ToString(); } if (ddl2.Items.FindItemByValue(partData.Notify.NOTIFY_PERSON2.ToString()) != null) { ddl2.SelectedValue = partData.Notify.NOTIFY_PERSON2.ToString(); } } } catch { } } }
protected void ScheduleScope_Select(object sender, EventArgs e) { decimal plantID = 0; string scopId = ""; try { if (sender is RadMenu) { RadMenu scope = (RadMenu)sender; scope.Items[0].Text = scope.SelectedItem.Text; plantID = Convert.ToDecimal(scope.SelectedValue); scopId = scope.ID; } else { RadComboBox scope = (RadComboBox)sender; plantID = Convert.ToDecimal(scope.SelectedValue); scopId = scope.ID; } List <PERSON> personList = SQMModelMgr.SelectPlantPersonList(1, plantID).Where(l => !string.IsNullOrEmpty(l.EMAIL)).OrderBy(l => l.LAST_NAME).ToList(); if (scopId.EndsWith("Add")) { SQMBasePage.SetPersonList(ddlAssignPersonAdd, personList, "", 0, false, "LF"); } else { SQMBasePage.SetPersonList(ddlAssignPerson, personList, "", 0, false, "LF"); } } catch { } if (scopId.EndsWith("Add")) { string script = "function f(){OpenUpdateTaskWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); } else { string script = "function f(){OpenAssignTaskWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); } }
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"); } }
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.SelectPrivGroupPersonList(SysPriv.approve, SysScope.envdata, plant.PLANT_ID); responsibleList.AddRange(SQMModelMgr.SelectPrivGroupPersonList(SysPriv.admin, SysScope.system, 0)); // append any system administrators to the approval list SQMBasePage.SetPersonList(ddlFinalApprover, responsibleList, "", true); SQMBasePage.SetPersonList(ddlMetricResponsible, SQMModelMgr.SelectPrivGroupPersonList(SysPriv.originate, SysScope.envdata, plant.PLANT_ID), "", true); LoadPlantProfile(plant); if (LocalProfile() != null && (LocalProfile().Profile.EHS_PROFILE_MEASURE == null || LocalProfile().Profile.EHS_PROFILE_MEASURE.Count == 0)) { if (UserContext.GetMaxScopePrivilege(SysScope.envdata) <= SysPriv.config) { 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.SelectPrivGroupPersonList(SysPriv.originate, SysScope.envdata, plant.PLANT_ID); SQMBasePage.SetPersonList(ddlDefaultResponsible, responsibleList, ""); ddlDefaultResponsible.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("", "")); pnlCopyProfile.Visible = true; } } pnlProfileEdit.Style.Add("display", "none"); } }
public void gvNotifyList_OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString()))) { RadComboBox rdl1, rdl2; System.Web.UI.WebControls.HiddenField hfField = new HiddenField(); try { HiddenField hf = (HiddenField)e.Row.Cells[0].FindControl("hfScope"); Label lbl = (Label)e.Row.Cells[0].FindControl("lblScope"); lbl.Text = WebSiteCommon.GetXlatValue("taskRecordType", hf.Value); lbl = (Label)e.Row.Cells[0].FindControl("lblScopeDesc"); lbl.Text = WebSiteCommon.GetXlatValueLong("taskRecordType", hf.Value); TaskRecordType scope = (TaskRecordType)Enum.Parse(typeof(TaskRecordType), hf.Value, true); if (scope == TaskRecordType.InternalQualityIncident || scope == TaskRecordType.CustomerQualityIncident || scope == TaskRecordType.SupplierQualityIncident || scope == TaskRecordType.HealthSafetyIncident || scope == TaskRecordType.PreventativeAction) { rdl1 = (RadComboBox)e.Row.Cells[0].FindControl("ddlNotify1"); hf = (HiddenField)e.Row.Cells[0].FindControl("hfNotify1"); if (scope == TaskRecordType.HealthSafetyIncident || scope == TaskRecordType.PreventativeAction) { SQMBasePage.SetPersonList(rdl1, SQMModelMgr.FilterPersonListByAppContext(staticPersonList, "EHS"), "", 20); } else { SQMBasePage.SetPersonList(rdl1, SQMModelMgr.FilterPersonListByAppContext(staticPersonList, "SQM"), "", 20); } SQMBasePage.DisplayControlValue(rdl1, hf.Value, PageUseMode.EditEnabled, ""); rdl1.Visible = true; rdl2 = (RadComboBox)e.Row.Cells[0].FindControl("ddlNotify2"); hf = (HiddenField)e.Row.Cells[0].FindControl("hfNotify2"); if (scope == TaskRecordType.HealthSafetyIncident || scope == TaskRecordType.PreventativeAction) { SQMBasePage.SetPersonList(rdl2, SQMModelMgr.FilterPersonListByAppContext(staticPersonList, "EHS"), "", 20); } else { SQMBasePage.SetPersonList(rdl2, SQMModelMgr.FilterPersonListByAppContext(staticPersonList, "SQM"), "", 20); } SQMBasePage.DisplayControlValue(rdl2, hf.Value, PageUseMode.EditEnabled, ""); rdl2.Visible = true; } if (scope == TaskRecordType.ProfileInput || scope == TaskRecordType.ProfileInputApproval || scope == TaskRecordType.HealthSafetyIncident || scope == TaskRecordType.PreventativeAction || scope == TaskRecordType.ProblemCase) { SETTINGS sets = SQMSettings.GetSetting("COMPANY", "ESCALATEANYUSER"); rdl1 = (RadComboBox)e.Row.Cells[0].FindControl("ddlEscalate1"); hf = (HiddenField)e.Row.Cells[0].FindControl("hfEscalate1"); SQMBasePage.SetPersonList(rdl1, staticPersonList.Where(l => l.RCV_ESCALATION == true || (sets != null && sets.VALUE.ToUpper() == "Y")).ToList(), "", 20); SQMBasePage.DisplayControlValue(rdl1, hf.Value, PageUseMode.EditEnabled, ""); rdl1.Visible = true; rdl2 = (RadComboBox)e.Row.Cells[0].FindControl("ddlEscalate2"); hf = (HiddenField)e.Row.Cells[0].FindControl("hfEscalate2"); SQMBasePage.SetPersonList(rdl2, staticPersonList.Where(l => l.RCV_ESCALATION == true || (sets != null && sets.VALUE.ToUpper() == "Y")).ToList(), "", 20); SQMBasePage.DisplayControlValue(rdl2, hf.Value, PageUseMode.EditEnabled, ""); rdl2.Visible = true; rdl1 = (RadComboBox)e.Row.Cells[0].FindControl("ddlEscalateDays1"); hf = (HiddenField)e.Row.Cells[0].FindControl("hfEscalateDays1"); rdl1.Items.Add(new RadComboBoxItem("", "")); rdl1.Items.AddRange(WebSiteCommon.PopulateComboBoxListNums(1, 14, rdl1.EmptyMessage)); SQMBasePage.DisplayControlValue(rdl1, hf.Value, PageUseMode.EditEnabled, ""); rdl1.Visible = true; rdl2 = (RadComboBox)e.Row.Cells[0].FindControl("ddlEscalateDays2"); hf = (HiddenField)e.Row.Cells[0].FindControl("hfEscalateDays2"); rdl2.Items.Add(new RadComboBoxItem("", "")); rdl2.Items.AddRange(WebSiteCommon.PopulateComboBoxListNums(1, 14, rdl2.EmptyMessage)); SQMBasePage.DisplayControlValue(rdl2, hf.Value, PageUseMode.EditEnabled, ""); rdl2.Visible = true; } } catch { } } }
protected void btnTaskAssign_Click(object sender, EventArgs e) { PSsqmEntities ctx = new PSsqmEntities(); Button btn = (Button)sender; if (btn == null || string.IsNullOrEmpty(btn.CommandArgument)) { return; } TaskStatusMgr taskMgr = new TaskStatusMgr().CreateNew(0, 0); TASK_STATUS task = taskMgr.SelectTask(Convert.ToDecimal(btn.CommandArgument)); btnAssignSave.CommandArgument = task.TASK_ID.ToString(); decimal plantID = GetTaskLocation(task); BusinessLocation location = new BusinessLocation().Initialize(plantID); // AW 20161229 - if they get this far, they can assign the task to anyone in a plant that they have access... //SysPriv maxPriv = UserContext.GetMaxScopePrivilege(SysScope.busloc); //if (maxPriv <= SysPriv.config) // is a plant admin or greater ? //{ List <BusinessLocation> locationList = SessionManager.PlantList; locationList = UserContext.FilterPlantAccessList(locationList); if (locationList.Select(l => l.Plant.BUS_ORG_ID).Distinct().Count() > 1 && SessionManager.IsUserAgentType("ipad,iphone") == false) { ddlScheduleScope.Visible = false; mnuScheduleScope.Visible = true; SQMBasePage.SetLocationList(mnuScheduleScope, locationList, location.Plant.PLANT_ID, location.Plant.PLANT_NAME, "TOP", true); //RadMenuItem mi = new RadMenuItem(); //mi.Text = (SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_NAME); //mi.Value = "0"; //mi.ImageUrl = "~/images/defaulticon/16x16/user-alt-2.png"; //mnuScheduleScope.Items[0].Items.Insert(0, mi); } else { ddlScheduleScope.Visible = true; mnuScheduleScope.Visible = false; SQMBasePage.SetLocationList(ddlScheduleScope, locationList, location.Plant.PLANT_ID, true); } //} //else //{ // ddlScheduleScope.Visible = true; // mnuScheduleScope.Visible = false; // //ddlScheduleScope.Items.Insert(0, new RadComboBoxItem((SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_NAME), "0")); // //ddlScheduleScope.Items[0].ImageUrl = "~/images/defaulticon/16x16/user-alt-2.png"; //} List <PERSON> personList = SQMModelMgr.SelectPlantPersonList(1, plantID).Where(l => !string.IsNullOrEmpty(l.EMAIL)).OrderBy(l => l.LAST_NAME).ToList(); SQMBasePage.SetPersonList(ddlAssignPerson, personList, "", 0, false, "LF"); tbAssignComment.Text = task.COMMENTS; string script = "function f(){OpenAssignTaskWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); }
public void BindTaskAdd(int recordType, decimal recordID, decimal recordSubID, string taskStep, string taskType, string originalDetail, decimal plantID, 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" }); } pnlUpdateTask.Visible = false; pnlAddTask.Visible = true; btnTaskAdd.CommandArgument = recordType.ToString() + "~" + recordID.ToString() + "~" + recordSubID.ToString() + "~" + taskStep + "~" + taskType + "~" + plantID.ToString(); lblTaskTypeValueAdd.Text = TaskXLATList.Where(l => l.XLAT_GROUP == "RECORD_TYPE" && l.XLAT_CODE == recordType.ToString()).FirstOrDefault().DESCRIPTION; switch ((TaskRecordType)recordType) { case TaskRecordType.Audit: if ((recordSubID > 0) || taskStep == "350") { // action required if subid references a specific audit question lblTaskTypeValueAdd.Text += (" - " + TaskXLATList.Where(l => l.XLAT_GROUP == "NOTIFY_SCOPE_TASK" && l.XLAT_CODE == taskStep).FirstOrDefault().DESCRIPTION); } else { lblTaskTypeValueAdd.Text += (" - " + TaskXLATList.Where(l => l.XLAT_GROUP == "NOTIFY_SCOPE_TASK" && l.XLAT_CODE == "300").FirstOrDefault().DESCRIPTION); } break; default: return; break; } lblTaskDetailValueAdd.Text = originalDetail; // cause of the requirement rdpTaskDueDTAdd.SelectedDate = SessionManager.UserContext.LocalTime; // default to today? lblTaskStatusValueAdd.Text = TaskXLATList.Where(l => l.XLAT_GROUP == "TASK_STATUS" && l.XLAT_CODE == (0).ToString()).FirstOrDefault().DESCRIPTION; // default to the "Open" status ddlScheduleScopeAdd.Items.Clear(); mnuScheduleScopeAdd.Items.Clear(); BusinessLocation location = new BusinessLocation().Initialize(plantID); SysPriv maxPriv = UserContext.GetMaxScopePrivilege(SysScope.busloc); List <BusinessLocation> locationList = SessionManager.PlantList; locationList = UserContext.FilterPlantAccessList(locationList); if (maxPriv <= SysPriv.config) // is a plant admin or greater ? { // AW20170105 - move this up so it can be used by both admin and non admin //List<BusinessLocation> locationList = SessionManager.PlantList; //locationList = UserContext.FilterPlantAccessList(locationList); if (locationList.Select(l => l.Plant.BUS_ORG_ID).Distinct().Count() > 1 && SessionManager.IsUserAgentType("ipad,iphone") == false) { ddlScheduleScopeAdd.Visible = false; mnuScheduleScopeAdd.Visible = true; SQMBasePage.SetLocationList(mnuScheduleScopeAdd, locationList, plantID, location.Plant.PLANT_NAME, "TOP", true); //RadMenuItem mi = new RadMenuItem(); //mi.Text = (location.Plant.PLANT_NAME); //mi.Value = plantID.ToString(); ////mi.ImageUrl = "~/images/defaulticon/16x16/user-alt-2.png"; //mnuScheduleScopeAdd.Items[0].Items.Insert(0, mi); //mnuScheduleScopeAdd.Attributes.Add("z-index", "9"); } else { ddlScheduleScopeAdd.Visible = true; mnuScheduleScopeAdd.Visible = false; SQMBasePage.SetLocationList(ddlScheduleScopeAdd, locationList, plantID, true); } } else { ddlScheduleScopeAdd.Visible = true; mnuScheduleScopeAdd.Visible = false; //ddlScheduleScopeAdd.Items.Insert(0, new RadComboBoxItem((SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_NAME), "0")); //ddlScheduleScopeAdd.Items[0].ImageUrl = "~/images/defaulticon/16x16/user-alt-2.png"; SQMBasePage.SetLocationList(ddlScheduleScopeAdd, locationList, plantID, true); } List <PERSON> personList = SQMModelMgr.SelectPlantPersonList(1, plantID).Where(l => !string.IsNullOrEmpty(l.EMAIL)).OrderBy(l => l.LAST_NAME).ToList(); SQMBasePage.SetPersonList(ddlAssignPersonAdd, personList, "", 0, false, "LF"); List <TaskItem> tasklist = TaskMgr.ExceptionTaskListByRecord(recordType, recordID, recordSubID); rptTaskList.DataSource = tasklist; rptTaskList.DataBind(); if (tasklist.Count > 0) { pnlListTasks.Visible = true; } else { pnlListTasks.Visible = false; } btnTaskAdd.Visible = true; btnTaskUpdate.Visible = false; }