protected void lnkPartView_Click(object sender, EventArgs e)
        {
            LinkButton lnk    = (LinkButton)sender;
            decimal    partID = Convert.ToDecimal(lnk.CommandArgument.ToString().Trim());

            SessionManager.Part = SQMModelMgr.LookupPartData(entities, SessionManager.ActiveCompany().COMPANY_ID, partID);

            Response.Redirect("/Admin/Administrate_ViewPart.aspx");
        }
Exemplo n.º 2
0
        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);
        }
        private void OnPartSelect(string partID)
        {
            PART part = SQMModelMgr.LookupPart(new PSsqmEntities(), Convert.ToDecimal(partID), "", SessionManager.PrimaryCompany().COMPANY_ID, false);

            if (part != null)
            {
                IssueCtl().qualityIssue.IssueOccur.PART_ID = part.PART_ID;
                PartData partData = SQMModelMgr.LookupPartData(new PSsqmEntities(), SessionManager.PrimaryCompany().COMPANY_ID, part.PART_ID);
                partData.Locations();
                IssueCtl().qualityIssue.AddPartInfo(partData);
                lblPartDesc.Text = part.PART_NAME;
                ddlResponsibleLocation.Items.Clear();
                ddlResponsibleLocation.Items.Add(new RadComboBoxItem(IssueCtl().qualityIssue.DetectedLocation.Company.COMPANY_NAME + ", " + IssueCtl().qualityIssue.DetectedLocation.Plant.PLANT_NAME, IssueCtl().qualityIssue.DetectedLocation.Plant.PLANT_ID.ToString()));
                if (IssueCtl().qualityIssue.Partdata.B2BList != null)
                {
                    foreach (BusinessLocation location in IssueCtl().qualityIssue.Partdata.B2BList)
                    {
                        if (ddlResponsibleLocation.Items.FindItemByValue(location.Plant.PLANT_ID.ToString()) == null)
                        {
                            ddlResponsibleLocation.Items.Add(new RadComboBoxItem(location.Company.COMPANY_NAME + ", " + location.Plant.PLANT_NAME, location.Plant.PLANT_ID.ToString()));
                        }
                    }
                    if (IssueCtl().qualityIssue.Incident.RESP_PLANT_ID.HasValue)
                    {
                        ddlResponsibleLocation.SelectedValue = IssueCtl().qualityIssue.Incident.RESP_PLANT_ID.ToString();
                    }
                    else if (ddlResponsibleLocation.Items.Count > 0)
                    {
                        ddlResponsibleLocation.SelectedIndex = 0;
                    }

                    GetResponsibleList();
                }
                updResponsible.Update();
            }
        }
Exemplo n.º 4
0
        protected void SavePart()
        {
            bool partAdded = false;

            if (string.IsNullOrEmpty(tbPartNumber.Text))
            {
                DisplayPart();
                DisplayErrorMessage(hfRequiredInputs);
                return;
            }

            if (!staticPartData.IsNew)
            {
                staticPartData = SQMModelMgr.LookupPartData(entities, (decimal)staticPartData.Part.COMPANY_ID, staticPartData.Part.PART_ID);
            }

            staticPartData.Part.PART_NUM           = tbPartNumber.Text;
            staticPartData.Part.PART_PREFIX        = tbPartPrefix.Text;
            staticPartData.Part.PART_SUFFIX        = tbPartSuffix.Text;
            staticPartData.Part.PART_NUM_SEPARATOR = tbPartSep.Text;
            staticPartData.Part.PART_NAME          = tbPartName.Text;
            staticPartData.Part.REVISION_LEVEL     = tbPartRevision.Text;
            if (!string.IsNullOrEmpty(ddlPartProgram.SelectedValue))
            {
                staticPartData.Part.PROGRAM_ID = Convert.ToDecimal(ddlPartProgram.SelectedValue);
            }
            else
            {
                staticPartData.Part.PROGRAM_ID = null;
            }

            staticPartData.Part.SERIAL_NUM = tbPartSerialNum.Text;
            staticPartData.Part.STATUS     = ddlPartStatus.SelectedValue;
            staticPartData.Part            = SQMModelMgr.UpdatePart(entities, staticPartData.Part, SessionManager.UserContext.UserName());

            if (staticPartData.IsNew)
            {
                try
                {
                    PLANT  suppPlant = SQMModelMgr.LookupPlant(Convert.ToDecimal(ddlSourceSelect.SelectedValue));
                    string custSel   = ddlUsedSelect.CheckedItems.FirstOrDefault().Value;
                    PLANT  custPlant = SQMModelMgr.LookupPlant(Convert.ToDecimal(custSel));
                    STREAM stream    = SQMModelMgr.CreatePartStream(SessionManager.PrimaryCompany().COMPANY_ID, staticPartData.Part.PART_ID);
                    if (suppPlant.COMPANY_ID == SessionManager.PrimaryCompany().COMPANY_ID)
                    {
                        // primary company is supplier to customer
                        stream.COMPANY_ID      = (decimal)suppPlant.COMPANY_ID;
                        stream.PLANT_ID        = suppPlant.PLANT_ID;
                        stream.CUST_COMPANY_ID = custPlant.COMPANY_ID;
                        stream.CUST_PLANT_ID   = custPlant.PLANT_ID;
                        stream.CUST_PART_NUM   = staticPartData.Part.PART_NUM;
                        stream.SUPP_COMPANY_ID = stream.SUPP_PLANT_ID = null;
                        stream = SQMModelMgr.UpdatePartStream(entities, stream, SessionManager.UserContext.UserName());
                    }
                    else
                    {
                        // primary company is customer
                        stream.COMPANY_ID      = (decimal)custPlant.COMPANY_ID;
                        stream.PLANT_ID        = custPlant.PLANT_ID;
                        stream.SUPP_COMPANY_ID = suppPlant.COMPANY_ID;
                        stream.SUPP_PLANT_ID   = suppPlant.PLANT_ID;
                        stream.SUPP_PART_NUM   = staticPartData.Part.PART_NUM;
                        stream.CUST_COMPANY_ID = stream.CUST_PLANT_ID = null;
                    }
                    partAdded = true;
                }
                catch
                {
                    ;
                }
            }

            staticPartData.IsNew = false;
            editObject           = null;

            if (partAdded)
            {
                uclSearchBar_OnSearchClick();
            }
        }
Exemplo n.º 5
0
 protected void OnPartDataClick(decimal partID)
 {
     staticPartData = SQMModelMgr.LookupPartData(entities, SessionManager.SessionContext.PrimaryCompany.COMPANY_ID, partID);
     DisplayPart();
 }