Esempio n. 1
0
        public void Initialize(string problemArea, decimal nonconfID, int ncCount, PageUseMode mode)
        {
            pageMode = mode;
            FillLists(true, false);
            if (!string.IsNullOrEmpty(problemArea))
            {
                //ddlProblemArea.SelectedValue = problemArea;
                SQMBasePage.DisplayControlValue(ddlProblemArea, problemArea, pageMode, "textStd");

                FillLists(false, true);
                if (nonconfID > 0)
                {
                    NONCONFORMANCE nconf = SQMResourcesMgr.LookupNonconf(new PSsqmEntities(), nonconfID, "");
                    if (nconf != null && ddlNCCategory.Items.FindItemByValue(nconf.NONCONF_CATEGORY) != null)
                    {
                        // ddlNCCategory.SelectedValue = nconf.NONCONF_CATEGORY;
                        SQMBasePage.DisplayControlValue(ddlNCCategory, nconf.NONCONF_CATEGORY, pageMode, "textStd");
                        SelectNCCategory(null, null);
                        // ddlNC.SelectedValue = nconf.NONCONF_ID.ToString();
                        SQMBasePage.DisplayControlValue(ddlNC, nconf.NONCONF_ID.ToString(), pageMode, "textStd");
                        // tbCount.Text = ncCount.ToString();
                        SQMBasePage.DisplayControlValue(tbCount, ncCount.ToString(), pageMode, "textStd");
                    }
                }
            }
        }
        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);
        }
        public static NONCONFORMANCE LookupNonconf(SQM.Website.PSsqmEntities ctx, decimal nonconfID, string nonconfCode)
        {
            NONCONFORMANCE nonconf = null;

            try
            {
                if (nonconfID == 0)
                {
                    nonconf = (from m in ctx.NONCONFORMANCE
                               where (m.NONCONF_CD.ToUpper() == nonconfCode.ToUpper())
                               select m).SingleOrDefault();
                    if (nonconf == null)
                    {
                        nonconf = (from m in ctx.NONCONFORMANCE
                                   where (m.NONCONF_NAME.ToUpper() == nonconfCode.ToUpper())
                                   select m).SingleOrDefault();
                    }
                }
                else
                {
                    nonconf = (from m in ctx.NONCONFORMANCE
                               where (m.NONCONF_ID == nonconfID)
                               select m).SingleOrDefault();
                }
            }
            catch { }

            return(nonconf);
        }
        protected void lnkNonconfList_Click(object sender, EventArgs e)
        {
            LinkButton lnk       = (LinkButton)sender;
            decimal    nonconfID = Convert.ToDecimal(lnk.CommandArgument.ToString().Trim());

            BindNonconf((staticNonconf = nonconfList.FirstOrDefault(l => l.NONCONF_ID == nonconfID)));
            lblAddNonconf.Visible = true;
        }
Esempio n. 5
0
        public void SetAttributeRef(QSAttribute atrType)
        {
            switch (atrType)
            {
            case QSAttribute.QS_ACTIVITY:
                this.Calc.AttributeXref = WebSiteCommon.GetXlatList("qualityActivity", "", "short");
                break;

            case QSAttribute.PROBLEM_AREA:
                this.Calc.AttributeXref = WebSiteCommon.GetXlatList("problemArea", "", "short");
                break;

            case QSAttribute.NONCONF_CATEGORY:
                this.NCCategoryList = SQMResourcesMgr.SelectNonconfCategoryList("");
                string[] catList = this.RecordList.Where(r => r.Nonconform != null && !string.IsNullOrEmpty(r.Nonconform.NONCONF_CATEGORY)).Select(r => r.Nonconform.NONCONF_CATEGORY).Distinct().ToArray();
                this.Calc.AttributeXref = new Dictionary <string, string>();
                foreach (string cat in catList)
                {
                    NONCONFORMANCE nc = this.NCCategoryList.Where(l => l.NONCONF_CD == cat).FirstOrDefault();
                    this.Calc.AttributeXref.Add(nc.NONCONF_CD.ToString(), nc.NONCONF_NAME);
                }
                break;

            case QSAttribute.NONCONF_ID:
                this.NonConfList        = this.RecordList.Where(r => r.Nonconform != null).Select(r => r.Nonconform).Distinct().ToList();
                this.Calc.AttributeXref = new Dictionary <string, string>();
                foreach (NONCONFORMANCE nc in this.NonConfList)
                {
                    this.Calc.AttributeXref.Add(nc.NONCONF_ID.ToString(), nc.NONCONF_NAME);
                }
                break;

            case QSAttribute.DISPOSITION:
                this.Calc.AttributeXref = WebSiteCommon.GetXlatList("NCDisposition", "", "short");
                break;

            case QSAttribute.SEVERITY:
                this.Calc.AttributeXref = WebSiteCommon.GetXlatList("incidentSeverity", "", "short");
                break;

            case QSAttribute.PART_TYPE:
                this.Calc.AttributeXref = new Dictionary <string, string>();
                foreach (PART_ATTRIBUTE pat in SQMModelMgr.SelectPartAttributeList("TYPE", "", false))
                {
                    this.Calc.AttributeXref.Add(pat.ATTRIBUTE_CD, pat.ATTRIBUTE_VALUE);
                }
                break;

            default:
                break;
            }
            return;
        }
        protected void btnNonconfSave_Click(object sender, EventArgs e)
        {
            bool success;

            if (hfOper.Value == "add")
            {
                staticNonconf            = new NONCONFORMANCE();
                staticNonconf.COMPANY_ID = SessionManager.UserContext.HRLocation.Company.COMPANY_ID;
                staticNonconf.STATUS     = "A";
            }
            else
            {
                staticNonconf = SQMResourcesMgr.LookupNonconf(entities, staticNonconf.NONCONF_ID, "");
            }

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

            staticNonconf.PROBLEM_AREA     = ddlProblemArea.SelectedValue;
            staticNonconf.NONCONF_CATEGORY = ddlNonconfCategory.SelectedValue;
            staticNonconf.NONCONF_CD       = tbNonconfCode.Text;
            staticNonconf.NONCONF_NAME     = tbNonconfName.Text;
            staticNonconf.NONCONF_DESC     = tbNonconfDesc.Text;
            staticNonconf.STATUS           = ddlNonconfStatus.SelectedValue;

            if ((staticNonconf = SQMResourcesMgr.UpdateNonconf(entities, staticNonconf, SessionManager.UserContext.UserName())) != null)
            {
                NONCONFORMANCE nonconf = null;
                if ((nonconf = nonconfList.FirstOrDefault(l => l.NONCONF_ID == staticNonconf.NONCONF_ID)) == null)
                {
                    nonconfList.Add(staticNonconf);
                }
                else
                {
                    if (staticNonconf.EntityState == System.Data.EntityState.Detached || staticNonconf.EntityState == System.Data.EntityState.Deleted)
                    {
                        nonconfList.Remove(nonconf);
                    }
                    else
                    {
                        nonconf = (NONCONFORMANCE)SQMModelMgr.CopyObjectValues(nonconf, staticNonconf, false);
                    }
                }
                BindNonconfList(nonconfList);
            }
        }
        public int BindNonconf(NONCONFORMANCE nonconf)
        {
            int status = 0;

            if (nonconf != null)
            {
                tbNonconfCode.Text = nonconf.NONCONF_CD;
                tbNonconfName.Text = nonconf.NONCONF_NAME;
                tbNonconfDesc.Text = nonconf.NONCONF_DESC;
                ddlNonconfCategory.SelectedValue = nonconf.NONCONF_CATEGORY;
                SQMBasePage.SetStatusList(ddlNonconfStatus, nonconf.STATUS);

                pnlNonconfEdit.Enabled = btnNonconfCancel.Enabled = btnNonconfSave.Enabled = true;
            }

            return(status);
        }
        protected void btnNonconfCatSave_Click(object sender, EventArgs e)
        {
            bool           success;
            NONCONFORMANCE nonconfCat = null;

            if (!string.IsNullOrEmpty(tbNonconfCategoryCode.Text))
            {
                nonconfCat              = new NONCONFORMANCE();
                nonconfCat.NONCONF_CD   = tbNonconfCategoryCode.Text;
                nonconfCat.NONCONF_NAME = nonconfCat.NONCONF_DESC = tbNonconfCategoryName.Text;
                nonconfCat.STATUS       = "A";
                nonconfCat.PROBLEM_AREA = ddlProblemArea.SelectedValue;
                if ((nonconfCat = SQMResourcesMgr.UpdateNonconf(entities, nonconfCat, SessionManager.UserContext.UserName())) != null)
                {
                    categoryList.Add(nonconfCat);
                    BindNonconfList(nonconfList);
                    BindCategoryList();
                }
            }
        }
 public void gvList_OnNonconfCatRowDataBound(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
         {
             Label          lbl     = (Label)e.Row.Cells[0].FindControl("lblNonconfCat");
             HiddenField    hf      = (HiddenField)e.Row.Cells[0].FindControl("hfNonconfCat");
             NONCONFORMANCE nonconf = categoryList.FirstOrDefault(l => l.NONCONF_CD == hf.Value);
             if (nonconf != null)
             {
                 lbl.Text = nonconf.NONCONF_NAME;
             }
             GridView gv = (GridView)e.Row.Cells[0].FindControl("gvNonconfList");
             gv.DataSource = nonconfList.Where(l => l.NONCONF_CATEGORY == hf.Value).ToList();
             gv.DataBind();
         }
         catch (Exception ex)
         {
             ;
         }
     }
 }
Esempio n. 10
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);
        }