Ejemplo n.º 1
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;
        }