public static List <PERSON> SelectAuditPersonList(decimal auditId)
        {
            var personSelectList = new List <PERSON>();
            var entities         = new PSsqmEntities();

            AUDIT   audit     = SelectAuditById(entities, auditId);
            decimal companyId = 0;

            if (audit.DETECT_COMPANY_ID != null)
            {
                companyId = audit.DETECT_COMPANY_ID;
            }

            // start with all data originators for the company
            List <PERSON> personList = SQMModelMgr.SelectPersonList(companyId, 0, true, false).Where(l => l.ROLE <= 300).OrderBy(p => p.LAST_NAME).ToList();

            personList = SQMModelMgr.FilterPersonListByAppContext(personList, "EHS");
            // limit the list to those people having access to the plant where the audit (if defined) occurred
            if (audit != null)
            {
                foreach (PERSON person in personList)
                {
                    if (SQMModelMgr.PersonPlantAccess(person, (decimal)audit.DETECT_PLANT_ID))
                    {
                        personSelectList.Add(person);
                    }
                }
            }

            personSelectList = personSelectList.OrderBy(p => p.FIRST_NAME).ToList();
            personSelectList = personSelectList.OrderBy(p => p.LAST_NAME).ToList();

            return(personSelectList);
        }
        public static List <PERSON> SelectCompanyPersonList(decimal companyId)
        {
            var personList = new List <PERSON>();

            // select admins for the company with EHS access
            personList = SQMModelMgr.SelectPersonList(companyId, 0, true, false).Where(l => l.ROLE <= 300).ToList();
            personList = SQMModelMgr.FilterPersonListByAppContext(personList, "EHS");

            personList = personList.OrderBy(p => p.FIRST_NAME).ToList();
            personList = personList.OrderBy(p => p.LAST_NAME).ToList();

            return(personList);
        }
Exemple #3
0
        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
                {
                }
            }
        }