Beispiel #1
0
        public BusinessLocation ProblemBusinessLocation()
        {
            BusinessLocation problemLocation = new BusinessLocation();

            if (this.IncidentList != null && this.IncidentList.Count > 0)
            {
                INCIDENT incident = this.IncidentList[0];
                if (incident.INCIDENT_TYPE == "QI")
                {
                    problemLocation.Company     = SQMModelMgr.LookupCompany((decimal)incident.RESP_COMPANY_ID);
                    problemLocation.BusinessOrg = SQMModelMgr.LookupBusOrg((decimal)incident.RESP_BUS_ORG_ID);
                    problemLocation.Plant       = SQMModelMgr.LookupPlant((decimal)incident.RESP_PLANT_ID);
                }
                else
                {
                    problemLocation.Company     = SQMModelMgr.LookupCompany((decimal)incident.DETECT_COMPANY_ID);
                    problemLocation.BusinessOrg = SQMModelMgr.LookupBusOrg((decimal)incident.DETECT_BUS_ORG_ID);
                    problemLocation.Plant       = SQMModelMgr.LookupPlant((decimal)incident.DETECT_PLANT_ID);
                }
            }
            else
            {
                problemLocation.Company = this.ProbCase.COMPANY;
            }

            return(problemLocation);
        }
Beispiel #2
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                COMPANY company = SQMModelMgr.LookupCompany(entities, SessionManager.EffLocation.Company.COMPANY_ID, "", false);
                uclItemHdr.DisplayCompany(company);
                if (SessionManager.IsEffLocationPrimary())
                {
                    divNavArea.Visible = true;
                }
                else
                {
                    divNavArea.Visible = false;
                }

                if (ddlStatus.Items.Count == 0)
                {
                    List <Settings> status_codes = SQMSettings.Status;
                    ddlStatus.DataSource     = status_codes;
                    ddlStatus.DataTextField  = "short_desc";
                    ddlStatus.DataValueField = "code";
                    ddlStatus.DataBind();
                }

                if (string.IsNullOrEmpty(hfActiveTab.Value))
                {
                    tab_Click("lbCompanyDetail_tab", "");
                }
            }
        }
Beispiel #3
0
 protected void AddPlant(decimal busOrgID, decimal plantID)
 {
     newLocation.BusinessOrg = SQMModelMgr.LookupBusOrg(busOrgID);
     newLocation.Company     = SQMModelMgr.LookupCompany(newLocation.BusinessOrg.COMPANY_ID);
     newLocation.Plant       = null;
     OnBusinessLocationAdd(newLocation);
 }
        private void SetupPage()
        {
            COMPANY company = SQMModelMgr.LookupCompany(entities, SessionManager.EffLocation.Company.COMPANY_ID, "", false);

            uclItemHdr.DisplayCompany(company);
            SetFindControlValue("cbIsCustomer", hfBase, company.IS_CUSTOMER.ToString(), editEnabled);
            SetFindControlValue("cbIsSupplier", hfBase, company.IS_SUPPLIER.ToString(), editEnabled);

            if (SessionManager.IsEffLocationPrimary())
            {
                uclDocMgr.BindDocMgr("SYS", 0, 0);
            }
        }
        protected void UpdateCompany(object sender, EventArgs e)
        {
            COMPANY company = SQMModelMgr.LookupCompany(entities, SessionManager.EffLocation.Company.COMPANY_ID, "", false);

            if (company != null)
            {
                company.IS_CUSTOMER = true;
                company.IS_SUPPLIER = true;
                company.STATUS      = ddlStatus.SelectedValue;
                if (entities.SaveChanges() > 0)
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alertResult('hfAlertSaveSuccess');", true);
                }
                SessionManager.EffLocation.Company = company;
            }
        }
        protected void SaveSettings()
        {
            bool    success;
            string  value;
            COMPANY company = SQMModelMgr.LookupCompany(entities, SessionManager.EffLocation.Company.COMPANY_ID, "", false);

            value = GetFindControlValue("cbIsCustomer", hfBase, out success);
            if (success)
            {
                company.IS_CUSTOMER = Convert.ToBoolean(value);
            }

            value = GetFindControlValue("cbIsSupplier", hfBase, out success);
            if (success)
            {
                company.IS_SUPPLIER = Convert.ToBoolean(value);
            }

            SQMModelMgr.UpdateCompany(entities, company, SessionManager.UserContext.UserName());
            SetupPage();
        }
Beispiel #7
0
 protected void SelectCompany(decimal companyID)
 {
     if (companyID > 0)
     {
         newLocation         = new BusinessLocation();
         newLocation.Company = (COMPANY)SQMModelMgr.LookupCompany(companyID);
         lblSelBusOrg.Text   = lblSelPlant.Text = "";
         if (staticShowHeader)
         {
             uclItemHdr.DisplayCompanyData(newLocation.Company, SQMModelMgr.PersonCount(companyID));
         }
         uclCompanyList.BindOrgListRepeater(SQMModelMgr.SearchBusOrgList(new PSsqmEntities(), companyID, "", false).OrderBy(l => l.BUS_ORG_ID).ToList());
         if (OnCompanyChange != null)
         {
             OnCompanyChange(newLocation);
         }
     }
     else
     {
         pnlSelectCompany.Visible = false;
     }
 }
        protected void btnEffDateSelect(object sender, EventArgs e)
        {
            if (radEffFrom.SelectedDate > radEffTo.SelectedDate)
            {
                lblTimespanDateError.Visible = true;
                return;
            }

            COMPANY company = SQMModelMgr.LookupCompany(entities, SessionManager.UserContext.HRLocation.Company.COMPANY_ID, "", false);

            company.COMPANY_ACTIVITY.EFF_EHS_METRIC_FROM_DT = new DateTime(Convert.ToDateTime(radEffFrom.SelectedDate).Year, Convert.ToDateTime(radEffFrom.SelectedDate).Month, 1);
            company.COMPANY_ACTIVITY.EFF_EHS_METRIC_DT      = new DateTime(Convert.ToDateTime(radEffTo.SelectedDate).Year, Convert.ToDateTime(radEffTo.SelectedDate).Month, DateTime.DaysInMonth(Convert.ToDateTime(radEffTo.SelectedDate).Year, Convert.ToDateTime(radEffTo.SelectedDate).Month));
            company.COMPANY_ACTIVITY.EFF_EHS_METRIC_UPD_BY  = SessionManager.UserContext.UserName();
            if (SQMModelMgr.UpdateCompany(entities, company, SessionManager.UserContext.UserName()) != null)
            {
                lblTimespanDateError.Visible = false;
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alertResult('hfAlertSaveSuccess');", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alertResult('hfAlertSaveError');", true);
            }
        }
 public void gvProgramList_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())))
     {
         try
         {
             HiddenField hf         = (HiddenField)e.Row.Cells[0].FindControl("hfCustomerID");
             Label       lbl        = (Label)e.Row.Cells[0].FindControl("lblCustomer");
             decimal     customerID = Convert.ToDecimal(hf.Value);
             COMPANY     customer   = SQMModelMgr.LookupCompany(customerID);
             if (customer != null)
             {
                 lbl.Text = customer.COMPANY_NAME;
                 GridView gv = (GridView)e.Row.Cells[0].FindControl("gvProgram");
                 gv.DataSource = staticProgramList.FindAll(l => l.CUSTOMER_ID == customerID);
                 gv.DataBind();
             }
         }
         catch
         {
         }
     }
 }
        public SQMStream Load(decimal streamID)
        {
            this.Entities = new PSsqmEntities();
            this.isNew    = false;
            this.Stream   = LookupStream(this.Entities, streamID);
            if (this.Stream.PART_ID > 0)
            {
                this.Data.Partdata = SQMModelMgr.LookupPartData(this.Entities, (decimal)this.Stream.COMPANY_ID, (decimal)this.Stream.PART_ID);
            }
            if (this.Stream.SUPP_COMPANY_ID > 0)
            {
                this.Data.Supplier      = SQMModelMgr.LookupCompany((decimal)this.Stream.SUPP_COMPANY_ID);
                this.Data.SupplierPlant = SQMModelMgr.LookupPlant((decimal)this.Stream.SUPP_PLANT_ID);
            }
            if (this.Stream.CUST_COMPANY_ID > 0)
            {
                this.Data.Customer      = SQMModelMgr.LookupCompany((decimal)this.Stream.CUST_COMPANY_ID);
                this.Data.CustomerPlant = SQMModelMgr.LookupPlant((decimal)this.Stream.CUST_PLANT_ID);
            }
            this.RecList = FillHistory(12);

            return(this);
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect("SYS", 10, true, false, hfDocviewMessage.Value);
                    //ucl.BindDocumentSelect("EHS", 2, true, false, hfDocviewMessage.Value);
                }

                COMPANY company = SQMModelMgr.LookupCompany(entities, SessionManager.EffLocation.Company.COMPANY_ID, "", false);
                uclItemHdr.DisplayCompany(company);
                if (SessionManager.IsEffLocationPrimary())
                {
                    divNavArea.Visible = true;
                }
                else
                {
                    divNavArea.Visible = false;
                }

                if (ddlStatus.Items.Count == 0)
                {
                    List <Settings> status_codes = SQMSettings.Status;
                    ddlStatus.DataSource     = status_codes;
                    ddlStatus.DataTextField  = "short_desc";
                    ddlStatus.DataValueField = "code";
                    ddlStatus.DataBind();
                }

                if (string.IsNullOrEmpty(hfActiveTab.Value))
                {
                    tab_Click("lbCompanyDetail_tab", "");
                }
            }
        }
        public static BusinessLocation LookupHRLocation()
        {
            if (SessionManager.UserContext.Person != null)
            {
                SessionManager.UserContext.HRLocation = new BusinessLocation().Initialize(SQMModelMgr.LookupCompany((decimal)SessionManager.UserContext.Person.COMPANY_ID), SQMModelMgr.LookupBusOrg((decimal)SessionManager.UserContext.Person.BUS_ORG_ID), SQMModelMgr.LookupPlant((decimal)SessionManager.UserContext.Person.PLANT_ID));
            }

            return(SessionManager.UserContext.HRLocation);
        }
        public UserContext Initialize(string SSOID, string pwd, bool activeOnly)
        {
            SQM.Website.PSsqmEntities ctx = new PSsqmEntities();
            this.LoginStatus = LoginStatus.SSOUndefined;
            SQM_ACCESS access = SQMModelMgr.LookupCredentials(ctx, SSOID, pwd, true);

            if (access != null)
            {
                string key = SQMModelMgr.GetPasswordKey();
                // AW - for now, we want to allow if the password = the password OR the encrypted password
                string password = WebSiteCommon.Decrypt(access.PASSWORD, key);
                //string encrypt = WebSiteCommon.Encrypt(pwd, key);
                //string ss = encrypt;

                /*
                 * if ((string.IsNullOrEmpty(pwd) && (SSOID.ToLower() != "admin")) || (pwd != password && pwd != access.PASSWORD))
                 *      this.LoginStatus = LoginStatus.PasswordMismatch;
                 */
                //if (!string.IsNullOrEmpty(access.PASSWORD)  && (pwd != password && pwd != access.PASSWORD))

                if (pwd != password && pwd != access.PASSWORD)
                {
                    this.LoginStatus = LoginStatus.PasswordMismatch;
                }
                else if (activeOnly && access.STATUS == "I")
                {
                    this.LoginStatus = LoginStatus.Inactive;
                }
                else if (access.STATUS == "L")
                {
                    this.LoginStatus = LoginStatus.Locked;
                }
                else
                {
                    if ((this.Person = SQMModelMgr.LookupPerson(ctx, 0, access.SSO_ID, false)) == null)
                    {
                        this.LoginStatus = LoginStatus.PersonUndefined;
                    }
                    else
                    {
                        this.LoginStatus = LoginStatus.Success;
                        this.HRLocation  = new BusinessLocation().Initialize(SQMModelMgr.LookupCompany((decimal)this.Person.COMPANY_ID), SQMModelMgr.LookupBusOrg((decimal)this.Person.BUS_ORG_ID), SQMModelMgr.LookupPlant((decimal)this.Person.PLANT_ID));

                        if (this.HRLocation.Company == null)
                        {
                            this.LoginStatus = LoginStatus.CompanyUndefined;
                        }
                        else
                        {
                            this.PrivList = SQMModelMgr.SelectPrivGroupPerson(this.Person.PRIV_GROUP, "COMMON");

                            SessionManager.EffLocation = new BusinessLocation().Initialize(SQMModelMgr.LookupCompany((decimal)this.Person.COMPANY_ID), SQMModelMgr.LookupBusOrg((decimal)this.Person.BUS_ORG_ID), SQMModelMgr.LookupPlant((decimal)this.Person.PLANT_ID));

                            this.WorkingLocation = new BusinessLocation();
                            this.WorkingLocation = SessionManager.EffLocation;

                            this.PlantAccessList = new List <decimal>();
                            this.PlantAccessList.Add(this.WorkingLocation.Plant.PLANT_ID);
                            if (!string.IsNullOrEmpty(Person.NEW_LOCATION_CD))
                            {
                                decimal  plantID;
                                string[] locs = Person.NEW_LOCATION_CD.Split(',');
                                foreach (string locid in locs)
                                {
                                    if (!string.IsNullOrEmpty(locid))
                                    {
                                        if (decimal.TryParse(locid, out plantID) && plantID != this.WorkingLocation.Plant.PLANT_ID)
                                        {
                                            this.PlantAccessList.Add(plantID);
                                        }
                                    }
                                }
                            }

                            access.LAST_LOGON_DT = WebSiteCommon.CurrentUTCTime();
                            int ctxstatus = 0;
                            SQMModelMgr.UpdateCredentials(ctx, access, "", out ctxstatus);
                            this.Credentials = access;
                            this.TimeZoneID  = this.HRLocation.Plant.LOCAL_TIMEZONE;
                            this.LocalTime   = !string.IsNullOrEmpty(this.TimeZoneID) ? WebSiteCommon.LocalTime(DateTime.UtcNow, this.TimeZoneID) : DateTime.UtcNow;
                            this.Language    = SQMModelMgr.LookupLanguage(ctx, "", this.Person.PREFERRED_LANG_ID.HasValue ? (int)this.Person.PREFERRED_LANG_ID : 1, false);

                            if (SessionManager.CreateSessionContext(this) == null)
                            {
                                this.LoginStatus = LoginStatus.SessionError;
                            }

                            this.InboxReviews = 0;
                        }
                    }
                }
            }
            return(this);
        }
 public static BusinessLocation SetIncidentLocation(PLANT plant)
 {
     return(SessionManager.IncidentLocation = new BusinessLocation().Initialize(SQMModelMgr.LookupCompany((decimal)plant.COMPANY_ID), SQMModelMgr.LookupBusOrg((decimal)plant.BUS_ORG_ID), SQMModelMgr.LookupPlant((decimal)plant.PLANT_ID)));
 }
Beispiel #15
0
        private void SetupPage()
        {
            COMPANY company = SQMModelMgr.LookupCompany(entities, SessionManager.SessionContext.ActiveCompany().COMPANY_ID, "", false);

            divPageBody.Visible = true;

            if (NCList == null || NCList.Count == 0)
            {
                NCList    = SQMModelMgr.SelectCompanyNCList(company.COMPANY_ID, SessionManager.UserContext.BusinessOrg.BUS_ORG_ID, true);
                plantList = SQMModelMgr.SelectPlantList(entities, company.COMPANY_ID, SessionManager.UserContext.BusinessOrg.BUS_ORG_ID);
                lineList  = new List <PLANT_LINE>();
                foreach (PLANT plant in plantList)
                {
                    plant.PLANT_LINE.Load();
                    foreach (PLANT_LINE line in plant.PLANT_LINE)
                    {
                        lineList.Add(line);
                    }
                }
                custList = SQMModelMgr.SelectCustomerPlantPartList(entities, SessionManager.SessionContext.ActiveCompany().COMPANY_ID, 0, 0);
            }

            if (ddlQualityIssueType.Items.Count == 0)
            {
                ddlDisposition.Items.AddRange(WebSiteCommon.PopulateDropDownListItems("NCDisposition"));

                ddlQualityIssueType.DataSource     = NCList.GroupBy(l => l.ProblemTypeID).Select(l => l.First());
                ddlQualityIssueType.DataTextField  = "ProblemType";
                ddlQualityIssueType.DataValueField = "ProblemTypeID";
                ddlQualityIssueType.DataBind();
            }

            ddlPlant.DataSource     = plantList;
            ddlPlant.DataTextField  = "PLANT_NAME";
            ddlPlant.DataValueField = "PLANT_ID";
            ddlPlant.DataBind();
            ddlPlant.Items.Insert(0, new ListItem("", "0"));

            ddlPlantLine.DataSource     = lineList;
            ddlPlantLine.DataTextField  = "PLANT_LINE_NAME";
            ddlPlantLine.DataValueField = "PLANT_LINE_ID";
            ddlPlantLine.DataBind();
            ddlPlantLine.Items.Insert(0, new ListItem("", "0"));

            ddlCustomer.DataSource     = custList.GroupBy(l => l.CUST_COMPANY_ID).Select(l => l.First());
            ddlCustomer.DataTextField  = "CUST_COMPANY_NAME";
            ddlCustomer.DataValueField = "CUST_COMPANY_ID";
            ddlCustomer.DataBind();
            ddlCustomer.Items.Insert(0, new ListItem("", "0"));

            ddlCustomerPlant.DataSource     = custList.GroupBy(l => l.CUST_COMPANY_ID).Select(l => l.First());
            ddlCustomerPlant.DataTextField  = "CUST_PLANT_NAME";
            ddlCustomerPlant.DataValueField = "CUSTOMER_PLANT_ID";
            ddlCustomerPlant.DataBind();
            ddlCustomerPlant.Items.Insert(0, new ListItem("", "0"));

            if (qualityIssue.IsNew)
            {
                uclSearchBar.TitleItem.Visible = false;
                lblIssueDate_out.Text          = WebSiteCommon.LocalTime(DateTime.Now, SessionManager.UserContext.TimeZoneID).ToString();
                lblOriginator_out.Text         = (SessionManager.UserContext.UserName() + "  (" + SessionManager.UserContext.BusinessOrg.ORG_NAME + ")");
            }

            //if (qualityIssue.Part != null && qualityIssue.Part.PART_ID > 0)
            // uclSearchBar.SetButtonsEnabled(true, true, true, false, false, false);

            DisplayIssue();

            isEditMode = true;
        }
        public UserContext Initialize(string SSOID, string pwd, bool activeOnly)
        {
            SQM.Website.PSsqmEntities ctx = new PSsqmEntities();
            this.LoginStatus = LoginStatus.SSOUndefined;
            SQM_ACCESS access = SQMModelMgr.LookupCredentials(ctx, SSOID, pwd, true);

            if (access != null)
            {
                string key = SQMModelMgr.GetPasswordKey();
                // AW - for now, we want to allow if the password = the password OR the encrypted password
                string password = WebSiteCommon.Decrypt(access.PASSWORD, key);
                //string encrypt = WebSiteCommon.Encrypt(pwd, key);
                //string ss = encrypt;

                /*
                 * if ((string.IsNullOrEmpty(pwd) && (SSOID.ToLower() != "admin")) || (pwd != password && pwd != access.PASSWORD))
                 *  this.LoginStatus = LoginStatus.PasswordMismatch;
                 */
                //if (!string.IsNullOrEmpty(access.PASSWORD)  && (pwd != password && pwd != access.PASSWORD))

                if (pwd != password && pwd != access.PASSWORD)
                {
                    this.LoginStatus = LoginStatus.PasswordMismatch;
                }
                else if (activeOnly && access.STATUS == "I")
                {
                    this.LoginStatus = LoginStatus.Inactive;
                }
                else if (access.STATUS == "L")
                {
                    this.LoginStatus = LoginStatus.Locked;
                }
                else
                {
                    if ((this.Person = SQMModelMgr.LookupPerson(ctx, 0, access.SSO_ID, false)) == null)
                    {
                        this.LoginStatus = LoginStatus.PersonUndefined;
                    }
                    else
                    {
                        this.LoginStatus = LoginStatus.Success;
                        this.HRLocation  = new BusinessLocation().Initialize(SQMModelMgr.LookupCompany((decimal)this.Person.COMPANY_ID), SQMModelMgr.LookupBusOrg((decimal)this.Person.BUS_ORG_ID), SQMModelMgr.LookupPlant((decimal)this.Person.PLANT_ID));

                        if (this.HRLocation.Company == null)
                        {
                            this.LoginStatus = LoginStatus.CompanyUndefined;
                        }
                        else
                        {
                            SessionManager.EffLocation = new BusinessLocation().Initialize(SQMModelMgr.LookupCompany((decimal)this.Person.COMPANY_ID), SQMModelMgr.LookupBusOrg((decimal)this.Person.BUS_ORG_ID), SQMModelMgr.LookupPlant((decimal)this.Person.PLANT_ID));

                            if (this.Person.PERSON_RESP.ALT_COMPANY_ID > 0)
                            {
                                this.WorkingLocation = new BusinessLocation().Initialize(SQMModelMgr.LookupCompany((decimal)this.Person.PERSON_RESP.ALT_COMPANY_ID), SQMModelMgr.LookupBusOrg((decimal)this.Person.PERSON_RESP.ALT_BUS_ORG_ID), SQMModelMgr.LookupPlant((decimal)this.Person.PERSON_RESP.ALT_PLANT_ID));
                            }
                            else
                            {
                                this.WorkingLocation = new BusinessLocation();
                                this.WorkingLocation = SessionManager.EffLocation;
                            }
                            //this.WorkingLocation = new BusinessLocation().Initialize(SQMModelMgr.LookupCompany((decimal)this.Person.COMPANY_ID), SQMModelMgr.LookupBusOrg((decimal)this.Person.BUS_ORG_ID), SQMModelMgr.LookupPlant((decimal)this.Person.PLANT_ID));

                            this.PlantAccessList = new List <decimal>();
                            if (!string.IsNullOrEmpty(Person.NEW_LOCATION_CD))
                            {
                                decimal  plantID;
                                string[] locs = Person.NEW_LOCATION_CD.Split(',');
                                foreach (string locid in locs)
                                {
                                    if (decimal.TryParse(locid, out plantID))
                                    {
                                        this.PlantAccessList.Add(plantID);
                                    }
                                }
                            }

                            access.LAST_LOGON_DT = WebSiteCommon.CurrentUTCTime();
                            int ctxstatus = 0;
                            SQMModelMgr.UpdateCredentials(ctx, access, "", out ctxstatus);
                            this.Credentials = access;
                            this.TimeZoneID  = WebSiteCommon.GetXlatValue("timeZone", this.Person.PREFERRED_TIMEZONE);

                            this.DelegateList          = new List <decimal>();
                            this.DelegateList          = SQMModelMgr.SelectDelegateList(ctx, this.Person.PERSON_ID).Select(l => l.PERSON_ID).ToList();
                            this.EscalationAssignments = SQMModelMgr.SelectPersonEscalationList(ctx, this.Person.PERSON_ID);

                            if (SessionManager.CreateSessionContext(this) == null)
                            {
                                this.LoginStatus = LoginStatus.SessionError;
                            }

                            this.InboxReviews = 0;
                            this.TaskList     = new List <TaskItem>();
                        }
                    }
                }
            }
            return(this);
        }
        protected void tab_Click(string tabID, string cmdArg)
        {
            if (tabID != null)
            {
                // setup for ps_admin.js to toggle the tab active/inactive display
                SetActiveTab(SessionManager.CurrentSecondaryTab = hfActiveTab.Value = tabID);

                pnlDetails.Visible = uclDocMgr.DocMgrPnl.Visible = pnlTargetList.Visible = pnlUomStd.Visible = pnlEscalation.Visible = pnlPrivGroups.Visible = false;
                COMPANY company = SQMModelMgr.LookupCompany(entities, SessionManager.EffLocation.Company.COMPANY_ID, "", false);

                switch (tabID)
                {
                case "lbCompanyDetail_tab":
                    pnlDetails.Visible = true;
                    if (ddlStatus.Items.FindByValue(company.STATUS) != null)
                    {
                        ddlStatus.SelectedValue = company.STATUS;
                    }
                    if (SessionManager.IsEffLocationPrimary() == true)
                    {
                        phUpdateCompany.Visible = false;
                        ddlStatus.Enabled       = false;
                    }
                    break;

                case "lbCompanyNotify_tab":
                    pnlEscalation.Visible = true;
                    UpdateNotifyActionList("");
                    break;

                case "lbUomStds_tab":
                    pnlUomStd.Visible = true;
                    BindStdUnits(SessionManager.EffLocation.Company);
                    break;

                case "lbCompanyTargets_tab":
                    pnlTargetList.Visible = true;
                    targetList            = ViewModel.SelectTargets(entities, company.COMPANY_ID, 0);
                    BindTargetList(targetList);
                    if (ddlEffYear.Items.Count == 0)
                    {
                        ddlEffYear.Items.AddRange(WebSiteCommon.PopulateDropDownListNums(2005, 15));
                        ddlTargetStatus.Items.AddRange(WebSiteCommon.PopulateDropDownListItems("statusCodeDelete", "short"));
                        string[] targs = { "statScopeE", "statScopeHS", "statScopeQS" };
                        foreach (string scopelist in targs)
                        {
                            foreach (WebSiteCommon.SelectItem si in WebSiteCommon.PopulateListItems(scopelist))
                            {
                                if (string.IsNullOrEmpty(si.Value))
                                {
                                    RadComboBoxItem li = new RadComboBoxItem(si.Text, si.Text);
                                    li.IsSeparator = true;
                                    ddlTarget.Items.Add(li);
                                }
                                else
                                {
                                    ddlTarget.Items.Add(new RadComboBoxItem(si.Text, (si.Value + "|" + scopelist.Substring(9))));
                                }
                            }
                        }
                    }

                    break;

                case "lbPrivilegeGroups_tab":
                    pnlPrivGroups.Visible = true;
                    UpdatePrivGroupList("");
                    break;

                default:
                    if (SessionManager.IsEffLocationPrimary())
                    {
                        uclDocMgr.BindDocMgr("SYS", 0, 0);
                    }
                    break;
                }
            }
        }
Beispiel #18
0
        public PROB_DEFINE UpdateProblemDefinition(PROB_DEFINE prDefine)
        {
            foreach (INCIDENT incident in this.IncidentList)
            {
                if (this.ProbCase.PROBCASE_TYPE == "QI")
                {
                    QualityIssue qualityIssue = new QualityIssue().Load(incident.INCIDENT_ID);
                    string       str          = "";

                    // who reported the problem
                    str = incident.CREATE_BY;
                    if (incident.CREATE_PERSON != null && incident.CREATE_PERSON > 0)
                    {
                        PERSON  person  = SQMModelMgr.LookupPerson((decimal)incident.CREATE_PERSON, "");
                        COMPANY company = SQMModelMgr.LookupCompany(person.COMPANY_ID);
                        str += " (" + company.COMPANY_NAME + ")";
                    }
                    if (string.IsNullOrEmpty(prDefine.WHO_IS) || !prDefine.WHO_IS.Contains(str))
                    {
                        if (!string.IsNullOrEmpty(prDefine.WHO_IS))
                        {
                            prDefine.WHO_IS += ", ";
                        }
                        prDefine.WHO_IS += str;
                    }

                    // where did the problem occur
                    str = qualityIssue.DetectedLocation.Company.COMPANY_NAME;
                    if (incident.DETECT_BUS_ORG_ID != null && incident.DETECT_BUS_ORG_ID > 0)
                    {
                        str += (" /  " + qualityIssue.DetectedLocation.BusinessOrg.ORG_NAME);
                    }
                    if (incident.DETECT_PLANT_ID != null && incident.DETECT_PLANT_ID > 0)
                    {
                        str += (" / " + qualityIssue.DetectedLocation.Plant.PLANT_NAME);
                    }
                    if (string.IsNullOrEmpty(prDefine.WHERE_IS) || !prDefine.WHERE_IS.Contains(str))
                    {
                        if (!string.IsNullOrEmpty(prDefine.WHERE_IS))
                        {
                            prDefine.WHERE_IS += ", ";
                        }
                        prDefine.WHERE_IS += str;
                    }


                    // where detected
                    str = WebSiteCommon.GetXlatValueLong("issueResponsible", qualityIssue.IssueOccur.SOURCE);
                    if (string.IsNullOrEmpty(prDefine.DETECTED_IS) || !prDefine.DETECTED_IS.Contains(str))
                    {
                        if (!string.IsNullOrEmpty(prDefine.DETECTED_IS))
                        {
                            prDefine.DETECTED_IS += ", ";
                        }
                        prDefine.DETECTED_IS += str;
                    }

                    // who or where is impacted
                    if (!string.IsNullOrEmpty(prDefine.IMPACT_IS))
                    {
                        prDefine.IMPACT_IS += ", ";
                    }

                    prDefine.IMPACT_IS += WebSiteCommon.GetXlatValueLong("issueResponsible", qualityIssue.IssueOccur.SOURCE);

                    // when did the problem occur
                    str = WebSiteCommon.FormatDateString(WebSiteCommon.LocalTime(incident.INCIDENT_DT, SessionManager.UserContext.TimeZoneID), false);
                    if (string.IsNullOrEmpty(prDefine.WHEN_IS) || !prDefine.WHEN_IS.Contains(str))
                    {
                        if (!string.IsNullOrEmpty(prDefine.WHEN_IS))
                        {
                            prDefine.WHEN_IS += ", ";
                        }
                        prDefine.WHEN_IS += str;
                    }

                    // what is the problem
                    if (!string.IsNullOrEmpty(prDefine.WHAT_IS))
                    {
                        prDefine.WHAT_IS += ", ";
                    }
                    prDefine.WHAT_IS += (" " + qualityIssue.Partdata.Part.PART_NUM + "(" + qualityIssue.Partdata.Part.PART_NAME + ")");

                    // how many how often detected
                    double qty = 0;
                    if (!string.IsNullOrEmpty(prDefine.HOW_MANY))
                    {
                        qty = double.Parse(prDefine.HOW_MANY);
                    }
                    foreach (QI_OCCUR_ITEM item in qualityIssue.IssueOccur.QI_OCCUR_ITEM)
                    {
                        qty += Convert.ToDouble(item.INSPECT_NC_QTY);
                        foreach (QI_OCCUR_NC sample in item.QI_OCCUR_NC)
                        {
                            if (!string.IsNullOrEmpty(prDefine.NC_IS))
                            {
                                prDefine.NC_IS += ", ";
                            }
                            NONCONFORMANCE nc = SQMResourcesMgr.LookupNonconf(this.Entities, (decimal)sample.NONCONF_ID, "");
                            if (nc != null)
                            {
                                prDefine.NC_IS += (qualityIssue.IssueOccur.OCCUR_DESC + ": " + nc.NONCONF_DESC);
                            }
                        }
                    }
                    prDefine.HOW_MANY = qty.ToString();

                    str = qualityIssue.IssueOccur.OCCUR_DESC;
                    if (string.IsNullOrEmpty(prDefine.WHY_IS) || !prDefine.WHY_IS.Contains(str))
                    {
                        if (!string.IsNullOrEmpty(prDefine.WHY_IS))
                        {
                            prDefine.WHY_IS += ", ";
                        }
                        prDefine.WHY_IS += str;
                    }

                    prDefine.URGENT_IS = prDefine.MEASURE_IS = prDefine.OFTEN_IS = "TBD";
                }
            }

            return(prDefine);
        }
        protected void ddlReportList_Select(object sender, EventArgs e)
        {
            phBasicCriteria.Visible      = true;
            radExportDateSelect2.Enabled = true;
            divGHGReport.Visible         = divProfilePeriodScrollRepeater.Visible = divMetricHistory.Visible = divMetricHistory.Visible = phIncidentCriteria.Visible = divMetricsTimespan.Visible = false;

            radExportDateSelect1.MinDate          = new DateTime(2001, 1, 1);
            radExportDateSelect1.MaxDate          = DateTime.Now.AddMonths(1);
            radExportDateSelect1.SelectedDate     = radExportDateSelect2.SelectedDate = DateTime.Now;
            radExportDateSelect1.ShowPopupOnFocus = radExportDateSelect2.ShowPopupOnFocus = true;

            ddlExportPlantSelect.Items.Clear();
            switch (ddlReportList.SelectedValue)
            {
            case "1":
                SQMBasePage.SetLocationList(ddlExportPlantSelect, LocationList().Where(l => l.Plant.TRACK_EW_DATA == true || l.Plant.TRACK_FIN_DATA == true).ToList(), 0);
                break;

            case "2":      // incident export
                SQMBasePage.SetLocationList(ddlExportPlantSelect, LocationList(), 0);
                phIncidentCriteria.Visible = true;
                List <INCIDENT_TYPE> typeList = EHSIncidentMgr.SelectIncidentTypeList(SessionManager.PrimaryCompany().COMPANY_ID);
                ddlExportIncidentType.Items.Clear();
                foreach (INCIDENT_TYPE intype in typeList)
                {
                    RadComboBoxItem item = new RadComboBoxItem(intype.TITLE, intype.INCIDENT_TYPE_ID.ToString());
                    item.Checked = true;
                    ddlExportIncidentType.Items.Add(item);
                }
                break;

            case "3":      // metric status
                SQMBasePage.SetLocationList(ddlExportPlantSelect, LocationList().Where(l => l.Plant.TRACK_EW_DATA == true || l.Plant.TRACK_FIN_DATA == true).ToList(), 0);
                radExportDateSelect2.Enabled = false;
                break;

            case "4":      // dashboard eff date
                phBasicCriteria.Visible      = false;
                divMetricsTimespan.Visible   = true;
                lblTimespanDateError.Visible = false;
                COMPANY company = SQMModelMgr.LookupCompany(SessionManager.UserContext.HRLocation.Company.COMPANY_ID);
                if (company.COMPANY_ACTIVITY != null)
                {
                    try
                    {
                        if (company.COMPANY_ACTIVITY.EFF_EHS_METRIC_FROM_DT.HasValue)
                        {
                            radEffFrom.SelectedDate = (DateTime)company.COMPANY_ACTIVITY.EFF_EHS_METRIC_FROM_DT;
                        }
                        if (company.COMPANY_ACTIVITY.EFF_EHS_METRIC_DT.HasValue)
                        {
                            radEffTo.SelectedDate = (DateTime)company.COMPANY_ACTIVITY.EFF_EHS_METRIC_DT;
                        }
                    }
                    catch
                    {
                        radEffFrom.SelectedDate = DateTime.Now.AddMonths(-1);
                        radEffTo.SelectedDate   = DateTime.Now;
                    }
                }
                break;

            case "11":     // CO2 reports
                SQMBasePage.SetLocationList(ddlExportPlantSelect, LocationList().Where(l => l.Plant.TRACK_EW_DATA == true || l.Plant.TRACK_FIN_DATA == true).ToList(), 0);
                break;

            default:
                phBasicCriteria.Visible = phIncidentCriteria.Visible = false;
                break;
            }
        }