Ejemplo n.º 1
0
        public static List <PERSON> SelectIncidentPersonList(decimal incidentId)
        {
            var personSelectList = new List <PERSON>();
            var entities         = new PSsqmEntities();

            INCIDENT incident  = SelectIncidentById(entities, incidentId);
            decimal  companyId = 0;

            if (incident.DETECT_COMPANY_ID != null)
            {
                companyId = incident.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 incident (if defined) occurred
            if (incident != null)
            {
                foreach (PERSON person in personList)
                {
                    if (SQMModelMgr.PersonPlantAccess(person, (decimal)incident.DETECT_PLANT_ID) || (incident.RESP_PLANT_ID.HasValue && SQMModelMgr.PersonPlantAccess(person, (decimal)incident.RESP_PLANT_ID)))
                    {
                        personSelectList.Add(person);
                    }
                }
            }

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

            return(personSelectList);
        }
Ejemplo n.º 2
0
        protected void lnkDisplayCustParts(object sender, EventArgs e)
        {
            PLANT      plant = (PLANT)SessionManager.EffLocation.Plant;
            CheckBox   cb;
            LinkButton lnk   = (LinkButton)sender;
            string     cmdID = lnk.CommandArgument;

            foreach (RepeaterItem r in rptCustPartHeader.Items)
            {
                Repeater rd = (Repeater)r.FindControl("rptCustPartDetail");
                lnk = (LinkButton)rd.Items[0].FindControl("lnkPartList");
                if (lnk.CommandArgument == cmdID)
                {
                    Ucl_PartList uclPartList = (Ucl_PartList)rd.Items[0].FindControl("uclPartList");
                    cb         = (CheckBox)rd.Items[0].FindControl("cbPartListSelect");
                    cb.Checked = cb.Checked == false ? true : false;
                    if (cb.Checked && !string.IsNullOrEmpty(lnk.CommandArgument))
                    {
                        uclPartList.BindPartList(SQMModelMgr.SelectTradingRelationshipList(new PSsqmEntities(), SessionManager.SessionContext.PrimaryCompany.COMPANY_ID, plant.PLANT_ID, 0, 1, Convert.ToDecimal(lnk.CommandArgument)));
                    }
                    else
                    {
                        uclPartList.BindPartList(null);
                    }
                }
            }
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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", "");
                }
            }
        }
Ejemplo n.º 5
0
        public PROB_VERIFY_VERS AddVerifyTrial()
        {
            PROB_VERIFY_VERS newTrial = new PROB_VERIFY_VERS();

            newTrial = (PROB_VERIFY_VERS)SQMModelMgr.CopyObjectValues(newTrial, this.ProbCase.PROB_VERIFY, false);
            newTrial.VERIFY_TRIAL_NO = this.ProbCase.PROB_VERIFY.PROB_VERIFY_VERS.Count + 1;
            this.Entities.AddToPROB_VERIFY_VERS(newTrial);
            foreach (PROB_CAUSE_ACTION action in this.ProbCase.PROB_CAUSE_ACTION)
            {
                PROB_CAUSE_ACTION_VERS trial = new PROB_CAUSE_ACTION_VERS();
                trial = (PROB_CAUSE_ACTION_VERS)SQMModelMgr.CopyObjectValues(trial, action, false);
                trial.VERIFY_TRIAL_NO = newTrial.VERIFY_TRIAL_NO;
                this.Entities.AddToPROB_CAUSE_ACTION_VERS(trial);
            }
            try
            {
                this.Entities.SaveChanges();
            }
            catch (Exception e)
            {
                //  SQMLogger.LogException(e);
                newTrial = null;
            }

            return(newTrial);
        }
Ejemplo n.º 6
0
        public static SQM_MEASURE UpdateSQMMeasure(SQM.Website.PSsqmEntities ctx, SQM_MEASURE measure, string updateBy)
        {
            try
            {
                measure = (SQM_MEASURE)SQMModelMgr.SetObjectTimestamp((object)measure, updateBy, measure.EntityState);

                if (measure.EntityState == EntityState.Detached || measure.EntityState == EntityState.Added)
                {
                    ctx.AddToSQM_MEASURE(measure);
                }

                if (measure.STATUS == "D")
                {
                    ctx.DeleteObject(measure);
                }

                ctx.SaveChanges();
            }
            catch (Exception e)
            {
                //SQMLogger.LogException(e);
            }

            return(measure);
        }
Ejemplo n.º 7
0
        public static NONCONFORMANCE UpdateNonconf(SQM.Website.PSsqmEntities ctx, NONCONFORMANCE nonconf, string updateBy)
        {
            try
            {
                nonconf = (NONCONFORMANCE)SQMModelMgr.SetObjectTimestamp((object)nonconf, updateBy, nonconf.EntityState);

                if (nonconf.EntityState == EntityState.Detached || nonconf.EntityState == EntityState.Added)
                {
                    ctx.AddToNONCONFORMANCE(nonconf);
                }

                if (nonconf.STATUS == "D")
                {
                    ctx.DeleteObject(nonconf);
                }

                ctx.SaveChanges();
            }
            catch (Exception e)
            {
                //SQMLogger.LogException(e);
            }

            return(nonconf);
        }
Ejemplo n.º 8
0
        static void UpdatePastDueAuditStatus()
        {
            string status = "";
            // get a list of all audits that do not have a close date
            List <AUDIT> openAudits = EHSAuditMgr.SelectOpenAudits(0, null);

            foreach (AUDIT audit in openAudits)
            {
                AUDIT_TYPE type      = EHSAuditMgr.SelectAuditTypeById(entities, audit.AUDIT_TYPE_ID);
                PLANT      plant     = SQMModelMgr.LookupPlant((decimal)audit.DETECT_PLANT_ID);
                DateTime   closeDT   = Convert.ToDateTime(audit.AUDIT_DT.AddDays(type.DAYS_TO_COMPLETE + 1));              // add one to the date and it will default to the next day at 00:00:00, which means midnight
                DateTime   localTime = WebSiteCommon.LocalTime(DateTime.UtcNow, plant.LOCAL_TIMEZONE);
                if (closeDT.CompareTo(localTime) < 0)
                {
                    // close the audit
                    // valid status codes... A = active, C = complete, I = incomplete/in-process, E = Expired. We are closing audits that are past due, so Expired.
                    try
                    {
                        status = audit.CURRENT_STATUS;
                        if (status != "C")
                        {
                            status = "E";
                        }
                    }
                    catch
                    {
                        status = "E";
                    }
                    EHSAuditMgr.CloseAudit(audit.AUDIT_ID, status, closeDT.AddDays(-1));                     // now take the one day back off so that the close date sets correctly
                    // now mark the Task as expired too!
                    EHSAuditMgr.CreateOrUpdateTask(audit.AUDIT_ID, (decimal)audit.AUDIT_PERSON, 50, closeDT.AddDays(-1), status, 0);
                }
            }
        }
        protected void ddlSelectChanged(object sender, EventArgs e)
        {
            DropDownList ddlSender = (DropDownList)sender;
            decimal      recordID  = 0;

            if (ddlSender.ID.Contains("PlantLine"))
            {
                if (staticPlantLine == null || staticPlantLine.PLANT_LINE_ID != Convert.ToDecimal(ddlSender.SelectedValue))
                {
                    staticPlantLine = SQMModelMgr.LookupPlantLine(costReport.Entities, 0, Convert.ToDecimal(ddlSender.SelectedValue), "", false);
                }
            }
            if (ddlSender.ID.Contains("LaborType"))
            {
                if (staticLaborType == null || staticLaborType.LABOR_TYP_ID != Convert.ToDecimal(ddlSender.SelectedValue))
                {
                    staticLaborType = SQMModelMgr.LookupLaborType(costReport.Entities, 0, 0, 0, Convert.ToDecimal(ddlSender.SelectedValue), "", false);
                }
            }

            switch (ddlSender.ID)
            {
            case "ddlCRPlantLineActual":

                if (staticPlantLine != null)
                {
                    tbCRDowntimeRateActual.Text = staticPlantLine.DOWNTIME_RATE.ToString();
                    udpBurdenActual.Update();
                }
                break;

            case "ddlCRPlantLineAvoid":
                if (staticPlantLine != null)
                {
                    tbCRDowntimeRateAvoid.Text = staticPlantLine.DOWNTIME_RATE.ToString();
                    udpBurdenAvoid.Update();
                }
                break;

            case "ddlCRLaborTypeActual":

                if (staticLaborType != null)
                {
                    tbCRLaborRateActual.Text = staticLaborType.LABOR_RATE.ToString();
                    udpLaborActual.Update();
                }
                break;

            case "ddlCRLaborTypeAvoid":
                if (staticLaborType != null)
                {
                    tbCRLaborRateAvoid.Text = staticLaborType.LABOR_RATE.ToString();
                    udpLaborAvoid.Update();
                }
                break;

            default:
                break;
            }
        }
        public void gvPlantList_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())))
            {
                System.Web.UI.WebControls.Label       lbl     = new Label();
                System.Web.UI.WebControls.HiddenField hfField = new HiddenField();

                try
                {
                    lbl = (Label)e.Row.Cells[0].FindControl("lblBusorg_out");
                    if (!String.IsNullOrEmpty(lbl.Text))
                    {
                        BUSINESS_ORG busorg = SQMModelMgr.LookupBusOrg(entities, SessionManager.SessionContext.ActiveCompany().COMPANY_ID, Convert.ToDecimal(lbl.Text));
                        if (busorg != null)
                        {
                            lbl.Text = busorg.ORG_NAME;
                        }
                    }

                    lbl      = (Label)e.Row.Cells[0].FindControl("lblStatus_out");
                    hfField  = (HiddenField)e.Row.Cells[0].FindControl("hfStatus_out");
                    lbl.Text = WebSiteCommon.GetStatusString(hfField.Value);
                }
                catch
                {
                }
            }
        }
Ejemplo n.º 11
0
        private void LoadSelects()
        {
            List <Settings> currency_codes = SQMSettings.CurrencyCode;
            DropDownList    ddl            = (DropDownList)hfBase.FindControl("ddlCurrencyCodes");

            ddl.DataSource     = currency_codes;
            ddl.DataTextField  = "code";
            ddl.DataValueField = "code";
            ddl.DataBind();
            ddl.SelectedValue = "USD";

            List <BUSINESS_ORG> parent_orgs = SQMModelMgr.SelectBusOrgList(entities, SessionManager.SessionContext.ActiveCompany().COMPANY_ID, 0, true);

            ddl                = (DropDownList)hfBase.FindControl("ddlParentBusOrg");
            ddl.DataSource     = parent_orgs;
            ddl.DataTextField  = "ORG_NAME";
            ddl.DataValueField = "BUS_ORG_ID";
            ddl.DataBind();

            List <Settings> status_codes = SQMSettings.Status;

            ddl                = (DropDownList)hfBase.FindControl("ddlStatus");
            ddl.DataSource     = status_codes;
            ddl.DataTextField  = "short_desc";
            ddl.DataValueField = "code";
            ddl.DataBind();
        }
        protected void lnklPrivGroupItem_Click(object sender, EventArgs e)
        {
            LinkButton lnk = (LinkButton)sender;

            try
            {
                PRIVGROUP privGroup = SQMModelMgr.LookupPrivGroup(new PSsqmEntities(), lnk.CommandArgument.ToString(), false);
                if (privGroup != null)
                {
                    hfPrivGroupID.Value     = privGroup.PRIV_GROUP;
                    tbEditPrivGroup.Text    = privGroup.PRIV_GROUP;
                    tbEditPrivGroup.Enabled = false;
                    tbEditDescription.Text  = privGroup.DESCRIPTION;
                    if (ddlPrivGroupStatus.FindItemByValue(privGroup.STATUS) != null)
                    {
                        ddlPrivGroupStatus.SelectedValue = privGroup.STATUS;
                    }
                    ddlEdit_OnIndexChanged(null, null);
                    //btnDelete.Visible = true;
                }

                string script = "function f(){OpenPrivGroupEditWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
            }
            catch
            {
            }
        }
Ejemplo n.º 13
0
        protected void lnklRegionalApproverItem_Click(object sender, EventArgs e)
        {
            LinkButton lnk = (LinkButton)sender;

            try
            {
                INCFORMAPPROVERLIST ApproverAction = SQMModelMgr.LookupINCFORMAPPROVERLIST(new PSsqmEntities(), Convert.ToDecimal(lnk.CommandArgument), "R");
                if (ApproverAction != null)
                {
                    hfApproverActionID.Value = ApproverAction.INCFORM_APPROVER_LIST_ID.ToString();
                    //ddlApprover.SelectedValue = ApproverAction.PERSON_ID.ToString();
                    ddlApproverType.SelectedValue = ApproverAction.TYPE;
                    txtDescription.Text           = ApproverAction.DESCRIPTION;
                    //ddlPriv.SelectedValue = ApproverAction.PRIV.ToString();
                    //ddlStep.SelectedValue = ApproverAction.STEP.ToString();
                    //txtDescriptionQuestion.Text = ApproverAction.DESCRIPTION_QUESTION;
                    btnDelete.Visible = true;
                }

                string script = "function f(){OpenApproverEditWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 14
0
        private void SetupPage()
        {
            if (ddlIncidentSeverity2.Items.Count == 0)
            {
                ddlIncidentSeverity2.Items.AddRange(WebSiteCommon.PopulateRadListItems("incidentSeverity"));
                ddlIncidentSeverity2.Items.Insert(0, new RadComboBoxItem("", ""));
                ddlIncidentSeverity2.SelectedIndex = 0;

                ddlDisposition.Items.AddRange(WebSiteCommon.PopulateRadListItems("NCDisposition"));
                ddlDisposition.Items.Insert(0, new RadComboBoxItem("", ""));
                ddlDisposition.SelectedIndex = 0;

                ddlStatus.Items.AddRange(WebSiteCommon.PopulateRadListItems("recordStatus"));

                SQMBasePage.FillCurrencyDDL(ddlCurrency, "EUR", false);
                ddlCurrency.Items.Insert(0, new RadComboBoxItem("", ""));

                List <PART_ATTRIBUTE> attributeList = SQMModelMgr.SelectPartAttributeList("TYPE", "", false);
                ddlPartType.Items.Add(new RadComboBoxItem("", ""));
                foreach (PART_ATTRIBUTE pat in attributeList)
                {
                    ddlPartType.Items.Add(new RadComboBoxItem(pat.ATTRIBUTE_VALUE, pat.ATTRIBUTE_CD));
                }
            }

            radIssueDate.Culture          = System.Threading.Thread.CurrentThread.CurrentUICulture;
            radIssueDate.MinDate          = new DateTime(2001, 1, 1);
            radIssueDate.MaxDate          = DateTime.UtcNow.AddDays(7);
            radIssueDate.SelectedDate     = WebSiteCommon.LocalTime(DateTime.UtcNow, SessionManager.UserContext.TimeZoneID);
            radIssueDate.ShowPopupOnFocus = true;

            uclPartSearch1.Initialize("", false, false, false, IssueCtl().qualityIssue.IssueOccur.QS_ACTIVITY);
        }
Ejemplo n.º 15
0
        protected void SelectActivityType(object sender, EventArgs e)
        {
            RadComboBoxItem item = null;

            switch (ddlIncidentType.SelectedValue)
            {
            case "CST":
                ddlReportedLocation.Items.Clear();
                ddlReportedLocation.Items.Add(new RadComboBoxItem(SessionManager.UserContext.HRLocation.Company.COMPANY_NAME + ", " + SessionManager.UserContext.HRLocation.Plant.PLANT_NAME, SessionManager.UserContext.HRLocation.Plant.PLANT_ID.ToString()));
                List <BusinessLocation> custLocations = SQMModelMgr.UserAccessibleLocations(SessionManager.UserContext.Person, SQMModelMgr.SelectBusinessLocationList(0, 0, false, true, true), false, true, ddlIncidentType.SelectedValue);
                foreach (BusinessLocation loc in custLocations)
                {
                    ddlReportedLocation.Items.Add(SQMBasePage.SetLocationItem(loc, true));
                }
                break;

            case "RCV":
                ddlReportedLocation.Items.Clear();
                List <BusinessLocation> locationList = UserContext.FilterPlantAccessList(SQMModelMgr.SelectBusinessLocationList(SessionManager.PrimaryCompany().COMPANY_ID, 0, true), "SQM", "");
                SQMBasePage.SetLocationList(ddlReportedLocation, locationList, 0);
                break;

            default:
                ddlReportedLocation.Items.Clear();
                ddlReportedLocation.Items.Add(new RadComboBoxItem(SessionManager.UserContext.WorkingLocation.Company.COMPANY_NAME + ", " + SessionManager.UserContext.WorkingLocation.Plant.PLANT_NAME, SessionManager.UserContext.WorkingLocation.Plant.PLANT_ID.ToString()));
                if (SessionManager.UserContext.WorkingLocation.Plant.PLANT_ID != SessionManager.UserContext.HRLocation.Plant.PLANT_ID)
                {
                    ddlReportedLocation.Items.Add(new RadComboBoxItem(SessionManager.UserContext.HRLocation.Company.COMPANY_NAME + ", " + SessionManager.UserContext.HRLocation.Plant.PLANT_NAME, SessionManager.UserContext.HRLocation.Plant.PLANT_ID.ToString()));
                }
                break;
            }
        }
Ejemplo n.º 16
0
        public void gvPartAssyList_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())))
            {
                System.Web.UI.WebControls.Label lbl = new Label();

                try
                {
                    lbl = (Label)e.Row.Cells[0].FindControl("lblBOMPartID");
                    PART compPart = SQMModelMgr.LookupPart(Convert.ToDecimal(lbl.Text), SessionManager.SessionContext.ActiveCompany().COMPANY_ID);  // mt - todo: get the component part info from the original query
                    if (compPart != null)
                    {
                        lbl      = (Label)e.Row.Cells[0].FindControl("lblCompPartNum");
                        lbl.Text = compPart.PART_NUM;
                        lbl      = (Label)e.Row.Cells[0].FindControl("lblCompPartName");
                        lbl.Text = compPart.PART_NAME;
                        lbl      = (Label)e.Row.Cells[0].FindControl("lblCompSerial");
                        lbl.Text = compPart.SERIAL_NUM;
                    }
                }
                catch
                {
                }
            }
        }
        private void SetupPage()
        {
            DropDownList ddl;


            if (ddlPlantList.Items.Count == 0)
            {
                List <BusinessLocation> locationList = SQMModelMgr.SelectBusinessLocationList(SessionManager.EffLocation.Company.COMPANY_ID, 0, false);

                SQMBasePage.SetLocationList(ddlPlantList, locationList, SessionManager.UserContext.HRLocation.Plant.PLANT_ID);
                ddlPlantList.Items.Insert(0, new RadComboBoxItem(Resources.LocalizedText.All, ""));

                ddlRoleList.DataSource     = SQMModelMgr.SelectPrivGroupList("", true);
                ddlRoleList.DataTextField  = "DESCRIPTION";
                ddlRoleList.DataValueField = "PRIV_GROUP";
                ddlRoleList.DataBind();
                ddlRoleList.ClearCheckedItems();

                ddl = (DropDownList)hfBase.FindControl("ddlPrefListSize");
                if (ddl != null)
                {
                    ddl.Items.AddRange(WebSiteCommon.PopulateDropDownListNums(1, 50, 10));
                }

                if (ddlJobCode.Items.Count == 0)
                {
                    ddlJobCode.Items.Insert(0, new RadComboBoxItem("", ""));
                    foreach (JOBCODE jc in SQMModelMgr.SelectJobcodeList("", "").OrderBy(j => j.JOB_DESC).ToList())
                    {
                        ddlJobCode.Items.Add(new RadComboBoxItem(SQMModelMgr.FormatJobcode(jc), jc.JOBCODE_CD));
                    }

                    ddlPrivGroup.Items.Insert(0, new RadComboBoxItem("", ""));
                    foreach (PRIVGROUP pg in SQMModelMgr.SelectPrivGroupList("", true).OrderBy(g => g.DESCRIPTION).ToList())
                    {
                        ddlPrivGroup.Items.Add(new RadComboBoxItem(SQMModelMgr.FormatPrivGroup(pg), pg.PRIV_GROUP));
                    }
                }

                ddlUserLanguage.DataSource     = SQMModelMgr.SelectLanguageList(entities, true);
                ddlUserLanguage.DataTextField  = "LANGUAGE_NAME";
                ddlUserLanguage.DataValueField = "LANGUAGE_ID";
                ddlUserLanguage.DataBind();
                ddlUserLanguage.SelectedIndex = 0;

                ddlUserTimezone.DataSource     = SQMSettings.TimeZone;
                ddlUserTimezone.DataTextField  = "long_desc";
                ddlUserTimezone.DataValueField = "code";
                ddlUserTimezone.DataBind();
                ddlUserTimezone.SelectedValue = "035";


                ddlHRLocation.Items.Clear();
                ddlPlantSelect.Items.Clear();
                SQMBasePage.SetLocationList(ddlHRLocation, locationList, 0);
                ddlHRLocation.Items.Insert(0, new RadComboBoxItem("", ""));
                SQMBasePage.SetLocationList(ddlPlantSelect, locationList, 0);
            }
        }
        protected void btnMeasureSave_Click(object sender, EventArgs e)
        {
            bool success;

            if (hfOper.Value == "add")
            {
                staticMeasure            = new EHS_MEASURE();
                staticMeasure.COMPANY_ID = SessionManager.SessionContext.ActiveCompany().COMPANY_ID;
                staticMeasure.STATUS     = "A";
            }
            else
            {
                staticMeasure = SQMResourcesMgr.LookupEHSMeasure(entities, staticMeasure.MEASURE_ID, "");
            }

            btnMeasureSave.Enabled = false;
            hfOper.Value           = "";

            staticMeasure.MEASURE_CATEGORY    = ddlMeasureCategory.SelectedValue;
            staticMeasure.STD_CURRENCY_CODE   = ddlMeasureCurrency.SelectedValue;
            staticMeasure.MEASURE_SUBCATEGORY = ddlMeasureSubcategory.SelectedValue;
            staticMeasure.STATUS  = ddlMeasureStatus.SelectedValue;
            staticMeasure.STD_UOM = Convert.ToDecimal(null);
            string sel = GetFindControlValue("hfMeasureUOM_out", hfBase, out success);

            if (!string.IsNullOrEmpty(sel))
            {
                string[] parms = sel.Split('|');
                if (parms.Length > 1)
                {
                    staticMeasure.STD_UOM = Convert.ToDecimal(parms[1]);
                }
            }

            staticMeasure.MEASURE_CD   = tbMeasureCode.Text;
            staticMeasure.MEASURE_NAME = tbMeasureName.Text;
            staticMeasure.MEASURE_DESC = tbMeasureDesc.Text;

            if ((staticMeasure = SQMResourcesMgr.UpdateEHSMeasure(entities, staticMeasure, SessionManager.UserContext.UserName())) != null)
            {
                EHS_MEASURE measure;
                if ((measure = measureList.FirstOrDefault(l => l.MEASURE_ID == staticMeasure.MEASURE_ID)) == null)
                {
                    measureList.Add(staticMeasure);
                }
                else
                {
                    if (staticMeasure.EntityState == System.Data.EntityState.Detached || staticMeasure.EntityState == System.Data.EntityState.Deleted)
                    {
                        measureList.Remove(measure);
                    }
                    else
                    {
                        measure = (EHS_MEASURE)SQMModelMgr.CopyObjectValues(measure, staticMeasure, false);
                    }
                }
                BindMeasureList(measureList);
            }
        }
Ejemplo n.º 19
0
 protected void OnPartAdd(object sender, EventArgs e)
 {
     staticPartData       = new PartData();
     staticPartData.IsNew = true;
     staticPartData.Part  = SQMModelMgr.CreatePart(SessionManager.PrimaryCompany().COMPANY_ID, SessionManager.UserContext.UserName());
     // ClearTempData();
     DisplayPart();
 }
        private void DoLaborList()
        {
            PLANT plant = (PLANT)SessionManager.EffLocation.Plant;

            LocalOrg().LaborList = SQMModelMgr.SelectLaborTypeList(entities, (decimal)plant.COMPANY_ID, (decimal)plant.BUS_ORG_ID, plant.PLANT_ID);

            uclSubLists.BindLaborList(LocalOrg().LaborList);
        }
Ejemplo n.º 21
0
 private void SearchReceipts(string cmd)
 {
     uclIssueList.Visible   = ddlChartType.Enabled = false;
     uclReceiptList.Visible = true;
     uclReceiptList.BindReceiptList(SQMModelMgr.SelectReceiptList(entities, uclIssueSearch.FromDate, uclIssueSearch.ToDate, uclIssueSearch.DDLPlantSelectIDS(), new decimal[0] {
     }, new decimal[0] {
     }));
 }
Ejemplo n.º 22
0
        private void DoLaborList()
        {
            BUSINESS_ORG busOrg = (BUSINESS_ORG)SessionManager.EffLocation.BusinessOrg;

            LocalOrg().LaborList = SQMModelMgr.SelectLaborTypeList(entities, SessionManager.EffLocation.Company.COMPANY_ID, busOrg.BUS_ORG_ID, 0);

            uclSubLists.BindLaborList(LocalOrg().LaborList);
        }
Ejemplo n.º 23
0
        private List <BusinessLocation> LocationList()
        {
            List <BusinessLocation> locationList = new List <BusinessLocation>();

            locationList = SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true).ToList();
            locationList = UserContext.FilterPlantAccessList(locationList);
            return(locationList);
        }
Ejemplo n.º 24
0
        protected void lnkView_Click(object sender, EventArgs e)
        {
            LinkButton lnk      = (LinkButton)sender;
            decimal    busOrgID = Convert.ToDecimal(lnk.CommandArgument.ToString().Trim());

            SessionManager.BusinessOrg = SQMModelMgr.LookupBusOrg(entities, SessionManager.SessionContext.ActiveCompany().COMPANY_ID, busOrgID);
            Response.Redirect("/Admin/Administrate_ViewBusOrg.aspx");
        }
Ejemplo n.º 25
0
        public void rptOrgList_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                Label       lbl;
                HiddenField hfField;

                try
                {
                    BUSINESS_ORG busOrg = (BUSINESS_ORG)e.Item.DataItem;

                    lbl = (Label)e.Item.FindControl("lblParentBUHdr_out");
                    if (busOrg.PARENT_BUS_ORG_ID == busOrg.BUS_ORG_ID || busOrg.PARENT_BUS_ORG_ID < 1)
                    {
                        lbl.Text = "Top Level";
                    }
                    else
                    {
                        BUSINESS_ORG parentOrg = null;
                        if ((parentOrg = SQMModelMgr.LookupParentBusOrg(null, busOrg)) != null)
                        {
                            lbl.Text = parentOrg.ORG_NAME;
                        }
                    }

                    lbl      = (Label)e.Item.FindControl("lblStatus");
                    hfField  = (HiddenField)e.Item.FindControl("hfStatus");
                    lbl.Text = WebSiteCommon.GetStatusString(hfField.Value);

                    GridView gv = (GridView)e.Item.FindControl("gvPlantList");
                    gv.DataSource = busOrg.PLANT.OrderBy(l => l.PLANT_NAME).ToList();  // order by plant name
                    gv.DataBind();

                    Label divLabel         = (Label)e.Item.FindControl("lblPlantListEmpty");
                    HtmlGenericControl div = (HtmlGenericControl)e.Item.FindControl("divPlantGVScroll");
                    SetGridViewDisplay(gv, divLabel, div, 20, gv.Rows.Count, "scrollArea");

                    if (UserContext.GetMaxScopePrivilege(SysScope.busloc) <= SysPriv.admin)
                    {
                        if (busOrg.PLANT.Count > 0)
                        {
                            Button btnAddPlant = (Button)gv.HeaderRow.FindControl("btnAddPlant");
                            btnAddPlant.CommandArgument = busOrg.BUS_ORG_ID.ToString();
                            btnAddPlant.Visible         = true;
                        }
                        else
                        {
                            Button btnAddPlant = (Button)e.Item.FindControl("btnAddPlantEmpty");
                            btnAddPlant.CommandArgument = busOrg.BUS_ORG_ID.ToString();
                            btnAddPlant.Visible         = true;
                        }
                    }
                }
                catch
                {
                }
            }
        }
Ejemplo n.º 26
0
        public void rptProgramPart_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                try
                {
                    PartData partData = (PartData)e.Item.DataItem;
                    PLANT    plant    = null;
                    Label    lbl1     = (Label)e.Item.FindControl("lblPartSource");
                    Label    lbl2     = (Label)e.Item.FindControl("lblPartSourceCode");

                    if (partData.Used.SUPP_PLANT_ID.HasValue)
                    {
                        if ((plant = staticPlantList.Where(l => l.PLANT_ID == partData.Used.SUPP_PLANT_ID).SingleOrDefault()) == null)
                        {
                            staticPlantList.Add((plant = SQMModelMgr.LookupPlant((decimal)partData.Used.SUPP_PLANT_ID)));
                        }
                        lbl1.Text = plant.PLANT_NAME;
                        lbl2.Text = plant.ADDRESS.FirstOrDefault().CITY;
                    }
                    else
                    {
                        if ((plant = staticPlantList.Where(l => l.PLANT_ID == partData.Used.PLANT_ID).SingleOrDefault()) == null)
                        {
                            staticPlantList.Add((plant = SQMModelMgr.LookupPlant((decimal)partData.Used.PLANT_ID)));
                        }
                        lbl1.Text = plant.PLANT_NAME;
                        lbl2.Text = plant.DUNS_CODE;
                    }

                    lbl1 = (Label)e.Item.FindControl("lblPartUsed");
                    lbl2 = (Label)e.Item.FindControl("lblPartUsedCode");
                    if (partData.Used.CUST_PLANT_ID.HasValue)
                    {
                        if ((plant = staticPlantList.Where(l => l.PLANT_ID == partData.Used.CUST_PLANT_ID).SingleOrDefault()) == null)
                        {
                            staticPlantList.Add((plant = SQMModelMgr.LookupPlant((decimal)partData.Used.CUST_PLANT_ID)));
                        }
                        lbl1.Text = plant.PLANT_NAME;
                        lbl2.Text = plant.ADDRESS.FirstOrDefault().CITY;
                    }
                    else
                    {
                        if ((plant = staticPlantList.Where(l => l.PLANT_ID == partData.Used.PLANT_ID).SingleOrDefault()) == null)
                        {
                            staticPlantList.Add((plant = SQMModelMgr.LookupPlant((decimal)partData.Used.PLANT_ID)));
                        }
                        lbl1.Text = plant.PLANT_NAME;
                        lbl2.Text = plant.DUNS_CODE;
                    }

                    GridView gv = (GridView)e.Item.FindControl("gvProgramPartList");
                    gv.DataSource = staticPartList.Where(l => l.Used.PLANT_ID == partData.Used.PLANT_ID && l.Used.SUPP_PLANT_ID == partData.Used.SUPP_PLANT_ID && l.Used.CUST_PLANT_ID == partData.Used.CUST_PLANT_ID).ToList();
                    gv.DataBind();
                }
                catch { }
            }
        }
Ejemplo n.º 27
0
        private void SetupPage()
        {
            ddlScheduleScope.Items.Clear();

            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, 0, SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_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, 0, true);
                    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";
                }
            }
            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";
            }

            // get tasks - due or escalated
            respForList = new List <decimal>();
            respForList.Add(SessionManager.UserContext.Person.PERSON_ID);
            respForList.AddRange(SQMModelMgr.SelectPersonListBySupvID(SessionManager.UserContext.Person.EMP_ID).Select(l => l.PERSON_ID).ToList());
            respPlantList = new List <decimal>();


            SessionManager.UserContext.TaskList.Clear();
            SessionManager.UserContext.TaskList = new List <TaskItem>();
            DateTime fromDate = DateTime.Now.AddMonths(-3);

            if (UserContext.CheckUserPrivilege(SysPriv.view, SysScope.inbox))
            {
                SessionManager.UserContext.TaskList.AddRange(TaskMgr.ProfileInputStatus(new DateTime(fromDate.Year, fromDate.Month, 1), new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day), respForList, respPlantList));
                SessionManager.UserContext.TaskList.AddRange(TaskMgr.IncidentTaskStatus(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, respForList, respPlantList, false));
            }

            ++SessionManager.UserContext.InboxReviews;
        }
Ejemplo n.º 28
0
        protected void tab_Click(string tabID, string cmdArg)
        {
            pnlSubLists.Visible = pnlPartProgram.Visible = pnlBusOrgEdit.Visible = pnlAdminEdit.Visible = pnlEscalation.Visible = false;

            if (tabID != null)
            {
                SetActiveTab(SessionManager.CurrentSecondaryTab = tabID);

                BUSINESS_ORG busOrg = (BUSINESS_ORG)SessionManager.EffLocation.BusinessOrg;

                switch (cmdArg)
                {
                case "dept":
                    DoDeptList();
                    pnlSubLists.Visible = true;
                    break;

                case "labor":
                    DoLaborList();
                    pnlSubLists.Visible = true;
                    break;

                case "prog":
                    isEditMode = true;
                    uclProgramList.BindProgramList(SQMModelMgr.SelectPartProgramList(0, busOrg.BUS_ORG_ID));
                    pnlPartProgram.Visible = true;
                    break;

                case "notify":
                    pnlEscalation.Visible = true;
                    List <TaskRecordType> recordTypeList = new List <TaskRecordType>();
                    if (UserContext.CheckAccess("SQM", "") >= AccessMode.Update)
                    {
                        recordTypeList.Add(TaskRecordType.InternalQualityIncident);
                        recordTypeList.Add(TaskRecordType.CustomerQualityIncident);
                        recordTypeList.Add(TaskRecordType.SupplierQualityIncident);
                    }
                    if (UserContext.CheckAccess("EHS", "") >= AccessMode.Admin)
                    {
                        recordTypeList.Add(TaskRecordType.ProfileInput);
                        recordTypeList.Add(TaskRecordType.ProfileInputApproval);
                        recordTypeList.Add(TaskRecordType.HealthSafetyIncident);
                        recordTypeList.Add(TaskRecordType.PreventativeAction);
                    }
                    if (recordTypeList.Count > 0 && !recordTypeList.Contains(TaskRecordType.ProblemCase))
                    {
                        recordTypeList.Add(TaskRecordType.ProblemCase);
                    }
                    uclNotifyList.BindNotifyList(entities, SessionManager.EffLocation.Company.COMPANY_ID, SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID, 0, recordTypeList);
                    break;

                default:
                    pnlBusOrgEdit.Visible = true;
                    DisplayBusOrg();
                    break;
                }
            }
        }
Ejemplo n.º 29
0
        public static void NotifyOnCreate(decimal incidentId, decimal plantId)
        {
            var entities = new PSsqmEntities();

            decimal companyId = SessionManager.UserContext.HRLocation.Company.COMPANY_ID;
            decimal busOrgId  = SessionManager.UserContext.HRLocation.BusinessOrg.BUS_ORG_ID;
            var     emailIds  = new HashSet <decimal>();

            INCIDENT incident         = EHSIncidentMgr.SelectIncidentById(entities, incidentId);
            string   incidentLocation = EHSIncidentMgr.SelectIncidentLocationNameByIncidentId(incidentId);
            string   incidentType     = EHSIncidentMgr.SelectIncidentTypeByIncidentId(incidentId);

            List <ATTACHMENT> attachList = SQM.Website.Classes.SQMDocumentMgr.SelectAttachmentListByRecord(40, incidentId, "", "");

            List <NOTIFY> notifications = SQMModelMgr.SelectNotifyHierarchy(companyId, busOrgId, plantId, 0, TaskRecordType.HealthSafetyIncident);

            foreach (NOTIFY n in notifications)
            {
                if (n.NOTIFY_PERSON1 != null)
                {
                    emailIds.Add((decimal)n.NOTIFY_PERSON1);
                }
                if (n.NOTIFY_PERSON2 != null)
                {
                    emailIds.Add((decimal)n.NOTIFY_PERSON2);
                }
            }

            if (emailIds.Count > 0)
            {
                string appUrl = SQMSettings.SelectSettingByCode(entities, "MAIL", "TASK", "MailURL").VALUE;
                if (string.IsNullOrEmpty(appUrl))
                {
                    appUrl = "the website";
                }

                string emailSubject = "Incident Created: " + incidentType + " (" + incidentLocation + ")";
                string emailBody    = "A new incident has been created:<br/>" +
                                      "<br/>" +
                                      incidentLocation + "<br/>" +
                                      incidentType + "<br/>" +
                                      "<br/>" +
                                      incident.DESCRIPTION + "<br/>" +
                                      "<br/>" +
                                      "Please log in to " + appUrl + " to view the incident.";

                foreach (decimal eid in emailIds)
                {
                    string emailAddress = (from p in entities.PERSON where p.PERSON_ID == eid select p.EMAIL).FirstOrDefault();

                    Thread thread = new Thread(() => WebSiteCommon.SendEmail(emailAddress, emailSubject, emailBody, "", "web", attachList));
                    thread.IsBackground = true;
                    thread.Start();

                    //WebSiteCommon.SendEmail(emailAddress, emailSubject, emailBody, "");
                }
            }
        }
Ejemplo n.º 30
0
        protected void lbSave_Click(object sender, EventArgs e)
        {
            BUSINESS_ORG bu     = (BUSINESS_ORG)SessionManager.BusinessOrg;
            BUSINESS_ORG busOrg = null;

            if (!Page.IsValid)
            {
                return;
            }

            if (bu == null)
            {
                busOrg = new BUSINESS_ORG();
            }
            else
            {
                busOrg = SQMModelMgr.LookupBusOrg(entities, SessionManager.SessionContext.ActiveCompany().COMPANY_ID, bu.BUS_ORG_ID);
            }

            bool    success;
            decimal decVal;

            busOrg.ORG_NAME  = GetFindControlValue("tbOrgname", hfBase, out success);
            busOrg.DUNS_CODE = GetFindControlValue("tbOrgLocCode", hfBase, out success);
            if (decimal.TryParse(GetFindControlValue("tbThreshold", hfBase, out success), out decVal))
            {
                busOrg.THRESHOLD_AMT = decVal;
            }
            busOrg.PREFERRED_CURRENCY_CODE = GetFindControlValue("ddlCurrencyCodes", hfBase, out success);
            busOrg.STATUS = GetFindControlValue("ddlStatus", hfBase, out success);
            string sel = GetFindControlValue("ddlParentBusOrg", hfBase, out success);

            if (string.IsNullOrEmpty(sel))
            {
                busOrg.PARENT_BUS_ORG_ID = Convert.ToInt32(null);
            }
            else
            {
                busOrg.PARENT_BUS_ORG_ID = Int32.Parse(sel);
            }

            busOrg = (BUSINESS_ORG)SQMModelMgr.SetObjectTimestamp((object)busOrg, SessionManager.UserContext.UserName(), busOrg.EntityState);

            if (bu == null)
            {
                busOrg.COMPANY_ID = SessionManager.SessionContext.ActiveCompany().COMPANY_ID;
                SQMModelMgr.CreateBusOrg(entities, busOrg);
                SessionManager.BusOrgSearchCriteria = busOrg.ORG_NAME;
            }
            else
            {
                entities.SaveChanges();
            }

            SessionManager.BusinessOrg = busOrg;

            SetupPage();
        }