public void BindRegionalApproverList(List <INCFORMREGIONALAPPROVERLIST> RegionalApproverItemList, BusinessLocation businessLocation, string context) { hfRegionalApproverActionContext.Value = context; if (context != "company") { hfRegionalApproverActionBusLoc.Value = context == "plant" ? businessLocation.Plant.PLANT_ID.ToString() : businessLocation.BusinessOrg.BUS_ORG_ID.ToString(); } List <PERSON> personList = null; List <PERSON> personListGlobalSafety = null; using (PSsqmEntities entities = new PSsqmEntities()) { if (businessLocation.BusinessOrg.BUS_ORG_ID > 0) { personList = (from P in entities.PERSON where (P.BUS_ORG_ID == businessLocation.BusinessOrg.BUS_ORG_ID && P.ROLE > 1) select P).ToList(); } personList = personList.Where(l => l.STATUS == "A").ToList(); List <decimal?> pid = new List <decimal?>(); foreach (PERSON person in personList) { pid.Add(person.PERSON_ID); } personListGlobalSafety = (from P in entities.PERSON where (P.PRIV_GROUP.ToUpper() == "GLOBAL SAFETY GROUP" && P.ROLE > 1) select P).ToList(); personListGlobalSafety = personListGlobalSafety.Where(l => l.STATUS == "A").ToList(); personListGlobalSafety = personListGlobalSafety.Except(personList).ToList(); } if (personList.Count > 0) { ddlRegionalApprover.Items.Clear(); ddlRegionalApprover.Items.Add(new ListItem("Please select an regional approver from list.", "0")); foreach (PERSON person in personList) { ddlRegionalApprover.Items.Add(new ListItem(SQMModelMgr.FormatPersonListItemWithEmail(person, false, "LF"), person.PERSON_ID.ToString())); } foreach (PERSON person in personListGlobalSafety) { ddlRegionalApprover.Items.Add(new ListItem(SQMModelMgr.FormatPersonListItemWithEmail(person, false, "LF"), person.PERSON_ID.ToString())); } } pnlRegionalApproverAction.Visible = true; rgRegionalApproverAction.DataSource = RegionalApproverItemList; rgRegionalApproverAction.DataBind(); }
private void FillApproverList(DropDownList ddl) { List <PERSON> personList = null; List <PERSON> personListGlobalSafety = null; using (PSsqmEntities entities = new PSsqmEntities()) { if (SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID > 0) { personList = (from P in entities.PERSON where (P.BUS_ORG_ID == SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID && P.ROLE > 1) select P).ToList(); } personList = personList.Where(l => l.STATUS == "A").ToList(); List <decimal?> pid = new List <decimal?>(); foreach (PERSON person in personList) { pid.Add(person.PERSON_ID); } personListGlobalSafety = (from P in entities.PERSON where (P.PRIV_GROUP.ToUpper() == "GLOBAL SAFETY GROUP" && P.ROLE > 1) select P).ToList(); personListGlobalSafety = personListGlobalSafety.Where(l => l.STATUS == "A").ToList(); personListGlobalSafety = personListGlobalSafety.Except(personList).ToList(); } if (personList.Count > 0) { ddl.Items.Clear(); ddl.Items.Add(new ListItem("Please select an approver from list.", "0")); foreach (PERSON person in personList) { ddl.Items.Add(new ListItem(SQMModelMgr.FormatPersonListItemWithEmail(person, false, "LF"), person.PERSON_ID.ToString())); } foreach (PERSON person in personListGlobalSafety) { ddl.Items.Add(new ListItem(SQMModelMgr.FormatPersonListItemWithEmail(person, false, "LF"), person.PERSON_ID.ToString())); } } }