Esempio n. 1
0
        private void btnComment_Click(object sender, EventArgs e)
        {
            TestEntities db1 = new TestEntities();
            //  CommentEntities db = new CommentEntities();
            comment dbComment = new comment();

            dbComment.baseid    = strJobNumber;
            dbComment.date      = DateTime.Now.Date;
            dbComment.comment1  = txtComment.Text;
            dbComment.commenter = Environment.UserName;

            db1.comments.Add(dbComment);
            try
            {
                db1.SaveChanges();
            }
            catch (DbEntityValidationException ex)
            {
                var errorMessages = ex.EntityValidationErrors
                                    .SelectMany(x => x.ValidationErrors)
                                    .Select(x => x.ErrorMessage);

                var fullErrorMessage = string.Join("; ", errorMessages);

                var exceptionMessage = string.Concat(ex.Message, " The validation errors are: ", fullErrorMessage);

                throw new DbEntityValidationException(exceptionMessage, ex.EntityValidationErrors);
            }

            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong. Call Jacob. Give him this error: " + ex);
            }

            finally
            {
                //   MessageBox.Show("Comment Saved.");
                this.Close();
            }


            //adoEntities db = new adoEntities();

            //JobHour batch = new JobHour();
        }
Esempio n. 2
0
        private void dgvActionItems_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DialogResult result = MessageBox.Show("Close Action Item?", "Close Action Item?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                TestEntities db1 = new TestEntities();



                db1.SaveChanges();

                PerformRefresh();
            }

            //DateTime shipdate = Convert.ToDateTime(dgvActiveJobs.SelectedRows[0].Cells[6].Value);



            //jobview2 jobview = new jobview2(content, tooltype, shipdate);
            //jobview.Show();
        }
Esempio n. 3
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            int    strTag         = Convert.ToInt16(txtTag.Text);
            string strJob         = txtJob.Text;
            string strTool        = txtTool.Text;
            string strInitiator   = cmbInitiator.Text;
            string strDept        = cmbDept.Text;
            string strSpec        = txtSpec.Text;
            string strCondition   = txtCondition.Text;
            string strDefect      = cmbDefect.Text;
            string strCause       = cmbCause.Text;
            string strDisposition = cmbDisposition.Text;
            //  string strDisposition = cmbDisposition.Text;

            bool bCar = chkCar.Checked;

            int strRework = 0;

            if (txtRework == null)
            {
                strRework = 0;
            }
            else
            {
                //  strRework = Convert.ToInt16(txtRework.Text);
                strRework = 0;
            }


            int    strInstance     = Convert.ToInt16(txtInstance.Text);
            int    strScrap        = Convert.ToInt16(txtScrap.Text);
            string strVendor       = txtVendor.Text;
            string strInstructions = txtInstructions.Text;
            string strComments     = txtComments.Text;



            DateTime dtInspection   = dtpInspection.Value.Date;
            DateTime dtReinspection = dtpReinspection.Value.Date;

            var db = new TestEntities();

            tblRedTag rt    = db.tblRedTags.Find(strTag);
            Job       check = db.Jobs.Find(strJob);

            if (rt != null)
            {
                DialogResult dialogResult = MessageBox.Show("This Tag ID Already Exists. Update?", "Tag Exists!", MessageBoxButtons.YesNo);

                if (dialogResult == DialogResult.Yes)
                {
                    if (check != null)
                    {
                        rt.ID           = strTag;
                        rt.JOB          = strJob;
                        rt.Detail       = strTool;
                        rt.Initiator    = strInitiator;
                        rt.Dept         = strDept;
                        rt.Spec         = strSpec;
                        rt.Condition    = strCondition;
                        rt.Date         = dtInspection;
                        rt.Defect       = strDefect;
                        rt.Cause        = strCause;
                        rt.Instructions = strInstructions;
                        rt.Comment      = strComments;
                        rt.Reinspection = dtReinspection;
                        rt.Cost         = strRework;
                        rt.InstanceCost = strInstance;
                        rt.ScrapCost    = strScrap;
                        rt.VendorPO     = strVendor;


                        try
                        {
                            //   db.tblRedTags(rt)
                            db.SaveChanges();
                            bool bEmail  = true;
                            Team jobTeam = db.Teams.Find(strJob);

                            if (jobTeam != null)
                            {
                                bEmail = true;
                                string strSubject = "Red Tag # " + strTag + " Updated";
                                string strBody    = "A red tag has been updated. <br> You are receiving this email because you are part of the job team. <br><br><b>THIS IS A TEST OF THE WIPVIEWER RED TAG EMAIL SYSTEM.</b> <br><br>";
                                strBody += "<br>Here is some information about the Tag: <br>Tag Number: " + strTag + "<br>Job Number: " + strJob + "<br>Tool #: " + strTool + "<br>Initiator: " + strInitiator + "<br>Department #: " + strDept;


                                Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application();

                                MailItem eMail = (MailItem)oApp.CreateItem(OlItemType.olMailItem);


                                Recipients oRecips = (Recipients)eMail.Recipients;
                                eMail.Subject    = strSubject;
                                eMail.Body       = strBody;
                                eMail.Importance = OlImportance.olImportanceLow;

                                eMail.BodyFormat = OlBodyFormat.olFormatHTML;



                                if (jobTeam.ProgramManager != null)
                                {
                                    Recipient oRecip = (Recipient)oRecips.Add("*****@*****.**");
                                }


                                if (jobTeam.Processor != null)
                                {
                                    //eMail.To = "*****@*****.**";

                                    Recipient oRecip = (Recipient)oRecips.Add("*****@*****.**");
                                }


                                if (jobTeam.BuildLeader != null)
                                {
                                    Recipient oRecip = (Recipient)oRecips.Add("*****@*****.**");
                                }

                                eMail.HTMLBody = strBody;


                                eMail.Send();
                            }

                            else
                            {
                                bEmail = false;
                            }


                            if (bEmail == true)
                            {
                                MessageBox.Show("Success. Email Sent");
                            }

                            else
                            {
                                MessageBox.Show("Red Tag created, but no Team for job present. No Email sent.");
                            }
                        }

                        catch (System.Exception ex)
                        { }
                    }

                    else
                    {
                        MessageBox.Show("That Job Does not exist. You may have your formatting wrong. In WipViewer, Jobs are always formatted 'XXXX9999 / 9'. If you have any questions, please contact Jacob Rotary");
                    }
                }
                else
                {
                }
            }

            else
            {
                if (check != null)
                {
                    tblRedTag rt2 = new tblRedTag();


                    rt2.ID           = strTag;
                    rt2.JOB          = strJob;
                    rt2.Detail       = strTool;
                    rt2.Initiator    = strInitiator;
                    rt2.Dept         = strDept;
                    rt2.Spec         = strSpec;
                    rt2.Condition    = strCondition;
                    rt2.Date         = dtInspection;
                    rt2.Defect       = strDefect;
                    rt2.Cause        = strCause;
                    rt2.Instructions = strInstructions;
                    rt2.Comment      = strComments;
                    rt2.Reinspection = dtReinspection;
                    rt2.Cost         = strRework;
                    rt2.InstanceCost = strInstance;
                    rt2.ScrapCost    = strScrap;
                    rt2.VendorPO     = strVendor;
                    rt2.Disposition  = strDisposition;
                    rt2.CAR          = Convert.ToString(bCar);



                    try
                    {
                        db.tblRedTags.Add(rt2);
                        db.SaveChanges();
                        bool bEmail  = true;
                        Team jobTeam = db.Teams.Find(strJob);

                        if (jobTeam != null)
                        {
                            bEmail = true;
                            string strSubject = "New Red Tag created for " + strJob + " IGNORE THIS - ITS A TEST EMAIL";
                            string strBody    = "A new red tag has been created. <br> You are receiving this email because you are part of the job team. <br><br><b>THIS IS A TEST OF THE WIPVIEWER RED TAG EMAIL SYSTEM.</b> <br><br>";
                            strBody += "<br>Here is some information about the Tag: <br>Tag Number: " + strTag + "<br>Job Number: " + strJob + "<br>Tool #: " + strTool + "<br>Initiator: " + strInitiator + "<br>Department #: " + strDept;


                            Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application();

                            MailItem eMail = (MailItem)oApp.CreateItem(OlItemType.olMailItem);


                            Recipients oRecips = (Recipients)eMail.Recipients;
                            eMail.Subject    = strSubject;
                            eMail.Body       = strBody;
                            eMail.Importance = OlImportance.olImportanceLow;

                            eMail.BodyFormat = OlBodyFormat.olFormatHTML;



                            if (jobTeam.ProgramManager != null)
                            {
                                Recipient oRecip = (Recipient)oRecips.Add("*****@*****.**");
                            }


                            if (jobTeam.Processor != null)
                            {
                                //eMail.To = "*****@*****.**";

                                Recipient oRecip = (Recipient)oRecips.Add("*****@*****.**");
                            }


                            if (jobTeam.BuildLeader != null)
                            {
                                Recipient oRecip = (Recipient)oRecips.Add("*****@*****.**");
                            }

                            eMail.HTMLBody = strBody;


                            eMail.Send();
                        }

                        else
                        {
                            bEmail = false;
                        }


                        if (bEmail == true)
                        {
                            MessageBox.Show("Success. Email Sent");
                        }

                        else
                        {
                            MessageBox.Show("Red Tag created, but no Team for job present. No Email sent.");
                        }
                    }

                    //catch (System.Exception ex)
                    // { }

                    catch (DbEntityValidationException dbEx)
                    {
                        foreach (var validationErrors in dbEx.EntityValidationErrors)
                        {
                            foreach (var validationError in validationErrors.ValidationErrors)
                            {
                                Trace.TraceInformation("Property: {0} Error: {1}",
                                                       validationError.PropertyName,
                                                       validationError.ErrorMessage);
                            }
                        }
                    }
                }

                else
                {
                    MessageBox.Show("That Job Does not exist. You may have your formatting wrong. In WipView, Jobs are always formatted 'XXXX9999 / 9'. If you have any questions, please contact Jacob Rotary");
                }
            }
        }
Esempio n. 4
0
        private void btnUpdatePicture_Click(object sender, EventArgs e)
        {
            ofdPicture.ShowDialog();
            string strPicture = ofdPicture.FileName.ToString();

            pbJob.Image = Image.FromFile(strPicture);
            string jobfilename = strJobNumber.Trim();

            jobfilename = jobfilename.Replace(@"/", "-");
            File.Copy(ofdPicture.FileName, "R:\\wippictures\\" + jobfilename + ".jpg", true);

            using (var db = new TestEntities())
            {
                picture jobPicture = db.pictures.Find(strJobNumber);
                if (jobPicture != null)
                {
                    jobPicture.BaseId = strJobNumber;
                    jobPicture.Path   = "R:\\wippictures\\" + jobfilename + ".jpg";
                    db.SaveChanges();
                    MessageBox.Show("Picture Updated. GREAT JOB!!");
                }
                else
                {
                    picture pic2 = new picture();
                    pic2.BaseId = strJobNumber;
                    pic2.Path   = "R:\\wippictures\\" + jobfilename + ".jpg";
                    db.pictures.Add(pic2);
                    db.SaveChanges();
                    MessageBox.Show("Image Saved. GREAT JOB!!");
                }
            }
            //using (var db = new CommentEntities())
            //{
            //    ImportantDate iDate = db.ImportantDates.Find(strJobNumber);
            //    if (iDate != null)
            //    {
            //        iDate.BaseID = strJobNumber;
            //        iDate.RecvMaterial = dtMaterial;
            //        iDate.StartFab = dtFabrication;
            //        iDate.HeatTreat = dtHeat;
            //        iDate.StartMachining = dtMachining;
            //        iDate.StartAssy = dtAssembly;
            //        iDate.MachComp = dtMachComplete;
            //        iDate.RdyChk = dtCheck;
            //        iDate.RdySrc = dtSrc;
            //        iDate.DesRel = dtDesRel;
            //        db.SaveChanges();
            //        MessageBox.Show("Dates Updates. GREAT JOB!");

            //    }
            //    else
            //    {
            //        ImportantDate iDate2 = new ImportantDate();
            //        iDate2.BaseID = strJobNumber;
            //        iDate2.RecvMaterial = dtMaterial;
            //        iDate2.StartFab = dtFabrication;
            //        iDate2.HeatTreat = dtHeat;
            //        iDate2.StartMachining = dtMachining;
            //        iDate2.StartAssy = dtAssembly;
            //        iDate2.MachComp = dtMachComplete;
            //        iDate2.RdyChk = dtCheck;
            //        iDate2.RdySrc = dtSrc;
            //        iDate2.DesRel = dtDesRel;
            //        db.ImportantDates.Add(iDate2);
            //        db.SaveChanges();
            //        MessageBox.Show("Dates Saved. GREAT JOB!");

            //    }
        }
Esempio n. 5
0
        public void btnSubmit_Click(object sender, EventArgs e)
        {
            TestEntities db      = new TestEntities();
            Folder       fFolder = db.Folders.Find(jobnumber.Substring(0, 15));

            dtPM = dtpPM.Value.Date;



            if (fFolder == null)

            {
                fFolder           = new Folder();
                fFolder.JobNumber = jobnumber.Substring(0, 15);
                if (bPM == true)
                {
                    fFolder.PMFolder = dtpPM.Value.Date;
                }

                if (bProc == true)
                {
                    fFolder.ProcessingFolder = dtpProcessor.Value.Date;
                }

                if (bWeld == true)
                {
                    fFolder.WeldFolder = dtpWeld.Value.Date;
                }

                if (bMach == true)
                {
                    fFolder.MachineFolder = dtpMachine.Value.Date;
                }

                if (bBuild == true)
                {
                    fFolder.BuildFolder = dtpBuild.Value.Date;
                }

                try
                {
                    db.Folders.Add(fFolder);
                    db.SaveChanges();
                }

                catch (DbEntityValidationException f)
                {
                    foreach (var eve in f.EntityValidationErrors)
                    {
                        Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                          eve.Entry.Entity.GetType().Name, eve.Entry.State);
                        foreach (var ve in eve.ValidationErrors)
                        {
                            Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                              ve.PropertyName, ve.ErrorMessage);
                        }
                    }
                    throw;
                }
            }


            else

            {
                if (bPM == true)
                {
                    fFolder.PMFolder = dtpPM.Value.Date;
                }

                if (bProc == true)
                {
                    fFolder.ProcessingFolder = dtpProcessor.Value.Date;
                }

                if (bWeld == true)
                {
                    fFolder.WeldFolder = dtpWeld.Value.Date;
                }

                if (bMach == true)
                {
                    fFolder.MachineFolder = dtpMachine.Value.Date;
                }

                if (bBuild == true)
                {
                    fFolder.BuildFolder = dtpBuild.Value.Date;
                }

                db.SaveChanges();
            }



            MessageBox.Show("Folder Updated. NICE JOB!");
        }
Esempio n. 6
0
        private void btnDates_Click(object sender, EventArgs e)
        {
            //    dtMaterial;
            //public DateTime dtFabrication;
            //public DateTime dtHeat;
            //public DateTime dtMachining;
            //public DateTime dtAssembly;

            dtMaterial     = dtpMaterial.Value.Date;
            dtFabrication  = dtpFab.Value.Date;
            dtHeat         = dtpHt.Value.Date;
            dtMachining    = dtpMachine.Value.Date;
            dtAssembly     = dtpAssy.Value.Date;
            dtMachComplete = dtpMachineComp.Value.Date;
            dtCheck        = dtpRdyChk.Value.Date;
            dtSrc          = dtpSrc.Value.Date;
            dtDesRel       = dtpDesRel.Value.Date;

            //   CommentEntities db = new CommentEntities();
            //   ImportantDate iDate = new ImportantDate();

            using (var db = new TestEntities())
            {
                ImportantDate iDate = db.ImportantDates.Find(strJobNumber);
                if (iDate != null)
                {
                    iDate.BaseID         = strJobNumber;
                    iDate.RecvMaterial   = dtMaterial;
                    iDate.StartFab       = dtFabrication;
                    iDate.HeatTreat      = dtHeat;
                    iDate.StartMachining = dtMachining;
                    iDate.StartAssy      = dtAssembly;
                    iDate.MachComp       = dtMachComplete;
                    iDate.RdyChk         = dtCheck;
                    iDate.RdySrc         = dtSrc;
                    iDate.DesRel         = dtDesRel;
                    MessageBox.Show("Dates Updates. GREAT JOB!");
                }
                else
                {
                    ImportantDate iDate2 = new ImportantDate();
                    iDate2.BaseID         = strJobNumber;
                    iDate2.RecvMaterial   = dtMaterial;
                    iDate2.StartFab       = dtFabrication;
                    iDate2.HeatTreat      = dtHeat;
                    iDate2.StartMachining = dtMachining;
                    iDate2.StartAssy      = dtAssembly;
                    iDate2.MachComp       = dtMachComplete;
                    iDate2.RdyChk         = dtCheck;
                    iDate2.RdySrc         = dtSrc;
                    iDate2.DesRel         = dtDesRel;
                    db.ImportantDates.Add(iDate2);
                }

                db.SaveChanges();
                MessageBox.Show("Dates Saved. GREAT JOB!");
            }



            //try
            //{
            //    db.SaveChanges();
            //    MessageBox.Show("Dates Saved. GREAT JOB!");
            //}

            //catch (Exception ex)
            //{
            //    MessageBox.Show("Something went wrong. Call Jacob. Give him this error: " + ex);

            //}
        }
Esempio n. 7
0
        private void buttonAdv1_Click(object sender, EventArgs e)
        {
            #region if statements
            if (bheldfordata == true)
            {
                sc1.DataHold = Convert.ToDateTime(ddheld.DateTimeText);
            }
            if (bstartfab == true)
            {
                sc1.StartFab = Convert.ToDateTime(ddstartfab.DateTimeText);
            }
            if (bFinishFab == true)
            {
                sc1.FinishFab = Convert.ToDateTime(ddfinishfab.DateTimeText);
            }
            if (bStartMachine3 == true)
            {
                sc1.StartMach3 = Convert.ToDateTime(ddstartmachine3.DateTimeText);
            }
            if (bFinishMachine3 == true)
            {
                sc1.FinishMach3 = Convert.ToDateTime(ddfinishmachine3.DateTimeText);
            }
            if (bStartMachine5 == true)
            {
                sc1.StartMach5 = Convert.ToDateTime(ddstartmachine5.DateTimeText);
            }
            if (bFinishMachine5 == true)
            {
                sc1.FinishMach5 = Convert.ToDateTime(ddfinishmachine5.DateTimeText);
            }
            if (bStartAssembly == true)
            {
                sc1.StartAssembly = Convert.ToDateTime(ddStartAssembly.DateTimeText);
            }
            if (bFinishAssembly == true)
            {
                sc1.FinishAsssembly = Convert.ToDateTime(ddFinishAssembly.DateTimeText);
            }
            if (bStartHeatTreat == true)
            {
                sc1.StartHeat = Convert.ToDateTime(ddStartHeatTreat.DateTimeText);
            }
            if (bFinishHeatTreat == true)
            {
                sc1.FinishHeat = Convert.ToDateTime(ddFinishHeatTreat.DateTimeText);
            }
            if (bMaterialOrderStart == true)
            {
                sc1.StartMaterial = Convert.ToDateTime(ddMaterialOrderStart.DateTimeText);
            }
            if (bMaterialOrderFinish == true)
            {
                sc1.FinishMaterial = Convert.ToDateTime(ddMaterialOrderFinish.DateTimeText);
            }
            if (bStartBench == true)
            {
                sc1.StartBench = Convert.ToDateTime(ddStartBench.DateTimeText);
            }
            if (bFinishBench == true)
            {
                sc1.FinishBench = Convert.ToDateTime(ddFinishBench.DateTimeText);
            }

            if (bStartPaint == true)
            {
                sc1.StartPaint = Convert.ToDateTime(ddStartPaint.DateTimeText);
            }
            if (bFinishPaint == true)
            {
                sc1.FinishPaint = Convert.ToDateTime(ddFinishPaint.DateTimeText);
            }
            if (bStartFinalize == true)
            {
                sc1.StartFinalize = Convert.ToDateTime(ddStartFinalize.DateTimeText);
            }
            if (bFinishFinalize == true)
            {
                sc1.FinishFinalize = Convert.ToDateTime(ddFinishFinalize.DateTimeText);
            }
            if (bStartTracker == true)
            {
                sc1.StartTracker = Convert.ToDateTime(ddStartTracker.DateTimeText);
            }
            if (bFinishTracker == true)
            {
                sc1.FinishTracker = Convert.ToDateTime(ddFinishTracker.DateTimeText);
            }
            if (bStartQA == true)
            {
                sc1.StartQa = Convert.ToDateTime(ddStartQA.DateTimeText);
            }
            if (bFinishQA == true)
            {
                sc1.FinishQa = Convert.ToDateTime(ddFinishQA.DateTimeText);
            }
            if (bSell == true)
            {
                sc1.StartSts = Convert.ToDateTime(ddSell.DateTimeText);
            }
            if (bCommercialItemsOrder == true)
            {
                sc1.StartCommercial = Convert.ToDateTime(ddCommercialItemsOrder.DateTimeText);
            }
            if (bCommercialItemsReceive == true)
            {
                sc1.FinishCommercial = Convert.ToDateTime(ddCommercialItemsReceive.DateTimeText);
            }
            if (bDesignStart == true)
            {
                sc1.StartDesign = Convert.ToDateTime(ddDesignStart.DateTimeText);
            }
            if (bDesignFinish == true)
            {
                sc1.FinishDesign = Convert.ToDateTime(ddDesignFinish.DateTimeText);
            }
            if (bReleaseManufacturing == true)
            {
                sc1.DesignRelease = Convert.ToDateTime(ddReleaseManufacturing.DateTimeText);
            }

            #endregion

            db1.Schedulings.Add(sc1);
            db1.SaveChanges();
        }
Esempio n. 8
0
        private void btnSubmit2_Click(object sender, EventArgs e)
        {
            using (var db = new TestEntities())
            {
                Team tTeam = db.Teams.Find(strjobnumber);

                if (tTeam == null)
                {
                    Team tTeam2 = new Team();
                    tTeam2.JobNumber = strjobnumber;

                    if (cmbPM.SelectedIndex != -1)
                    {
                        tTeam2.ProgramManager = cmbPM.SelectedItem.ToString();
                    }
                    if (cmbProcessor.SelectedIndex != -1)
                    {
                        tTeam2.Processor = cmbProcessor.SelectedItem.ToString();
                    }

                    if (cmbBl.SelectedIndex != -1)
                    {
                        tTeam2.BuildLeader = cmbBl.SelectedItem.ToString();
                    }

                    if (cmbQa.SelectedIndex != -1)
                    {
                        tTeam2.QA = cmbQa.SelectedItem.ToString();
                    }

                    if (chkKickoff.Checked == true)
                    {
                        tTeam2.KickOff = dtpKickoff.Value;
                    }
                    if (chkDataRelease.Checked == true)
                    {
                        tTeam2.DataRelease = dtpDataRelease.Value;
                    }
                    if (chkFolder.Checked == true)
                    {
                        tTeam2.Folder = dtpFolderReceived.Value;
                    }

                    tTeam2.PODate = dtpPoDate.Value;

                    string hold = "";
                    hold = cmbHold.Text;

                    tTeam2.Hold = hold;

                    db.Teams.Add(tTeam2);
                    db.SaveChanges();
                    MessageBox.Show("Team Created!");
                    this.Close();
                }

                else
                {
                    tTeam.JobNumber      = strjobnumber;
                    tTeam.ProgramManager = Convert.ToString(cmbPM.Text);
                    tTeam.BuildLeader    = Convert.ToString(cmbBl.Text);
                    tTeam.Processor      = Convert.ToString(cmbProcessor.Text);
                    tTeam.QA             = Convert.ToString(cmbQa.Text);
                    if (chkKickoff.Checked == true)
                    {
                        tTeam.KickOff = dtpKickoff.Value;
                    }
                    if (chkDataRelease.Checked == true)
                    {
                        tTeam.DataRelease = dtpDataRelease.Value;
                    }
                    if (chkFolder.Checked == true)
                    {
                        tTeam.Folder = dtpFolderReceived.Value;
                    }

                    tTeam.PODate = dtpPoDate.Value;


                    string hold = "";
                    hold = cmbHold.Text;

                    tTeam.Hold = hold;

                    db.SaveChanges();

                    MessageBox.Show("Team Updated!");
                    this.Close();
                }
            }
        }
Esempio n. 9
0
        private void button1_Click(object sender, EventArgs e)
        {
            TestEntities db1 = new TestEntities();
            // CommentEntities db = new CommentEntities();

            SupplierMain supp1 = new SupplierMain();

            supp1.Name           = txtSupplierName.Text;
            supp1.Risk           = cmbRisk.Text;
            supp1.VendorID       = txtVendorId.Text;
            supp1.Email          = txtEmail.Text;
            supp1.PrimaryContact = txtPrimaryContact.Text;

            supp1.EvalDate = dtpEval.Value;

            db1.SupplierMains.Add(supp1);


            if (rbDirect.Checked == true)
            {
                SupplierDirect supp2 = new SupplierDirect();
                supp2.Name               = txtSupplierName.Text;
                supp2.FOB                = txtFob.Text;
                supp2.PrimaryCommodity   = cmbPrimary.Text;
                supp2.SecondaryCommodity = cmbSecondary.Text;

                if (rbAsYes.Checked == true)

                {
                    supp2.AS9100Registration = "True";
                    supp2.ASExpiration       = dtpAS.Value;
                    supp2.ASDocument         = "Test";
                }
                else
                {
                    supp2.AS9100Registration = "False";
                }

                if (rbIsoYes.Checked == true)
                {
                    supp2.IsoRegistration = "True";
                    supp2.IsoExpiration   = dtpIso.Value;
                    supp2.IsoDocument     = "Test";
                }
                else
                {
                    supp2.IsoRegistration = "False";
                }

                if (rbOtherYes.Checked == true)
                {
                    supp2.OtherRegistration = "True";
                    supp2.OtherExpiration   = dtpOther.Value;
                    supp2.OtherDocument     = "Test";
                }
                else
                {
                    supp2.OtherRegistration = "False";
                }

                if (rbItarYes.Checked == true)
                {
                    supp2.ItarApproved   = "True";
                    supp2.ItarExpiration = dtpItar.Value;
                    supp2.ItarDocument   = "Test";
                }
                else
                {
                    supp2.ItarApproved = "False";
                }

                if (rbDpdYes.Checked == true)
                {
                    supp2.DPDApproval = "True";
                }
                else
                {
                    supp2.DPDApproval = "False";
                }

                if (rbSpecialYes.Checked == true)
                {
                    supp2.SpecialProcesses     = "True";
                    supp2.SpecialProcessDetail = txtSpecialDetail.Text;
                }

                string path = "r:\\wipviewer2017\\suppliers\\" + txtSupplierName.Text;
                System.IO.Directory.CreateDirectory(path);

                if (bIso == true)
                {
                    System.IO.File.Copy(strFile1, path + "\\Iso.pdf");
                    supp2.IsoDocument = path + "\\Iso.pdf";
                }
                else
                {
                    MessageBox.Show("F**k Me. No Iso File.");
                    supp2.IsoDocument = "None";
                }

                if (bAs == true)
                {
                    System.IO.File.Copy(strFile2, path + "\\AS9100.pdf");
                    supp2.ASDocument = path + "\\AS9100.pdf";
                }
                else
                {
                    MessageBox.Show("No As");
                    supp2.ASDocument = "None";
                }

                if (bOther == true)
                {
                    System.IO.File.Copy(strFile3, path + "\\Other.pdf");
                    supp2.OtherDocument = path + "\\Other.pdf";
                }
                else
                {
                    MessageBox.Show("No Other");
                    supp2.OtherDocument = "None";
                }

                if (bItar == true)
                {
                    System.IO.File.Copy(strFile4, path + "\\Itar.pdf");
                    supp2.ItarDocument = path + "\\Itar.pdf";
                }
                else
                {
                    MessageBox.Show("No Itar");
                    supp2.ItarDocument = "None";
                }


                db1.SupplierDirects.Add(supp2);
            }



            db1.SaveChanges();
            MessageBox.Show("Supplier Added. F**k Yea!");
        }