//if (sc.Name == e.TableCellIdentity.SummaryColumn.Name) //{ // textBox1.Text = e.Style.CellValue.ToString(); //} void gc1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { var db = new TestEntities(); #region PicturesOn if (rb1.Checked == true) { if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "BaseID" && e.TableCellIdentity.DisplayElement.Kind == Syncfusion.Grouping.DisplayElementKind.Record) { picture findpic = db.pictures.Find(e.Style.CellValue.ToString()); if (findpic != null) { using (var bmpTemp = new Bitmap(findpic.Path)) { image = new Bitmap(bmpTemp); e.Style.CommentTip.CommentImage = image; e.Style.CommentTip.CommentArrowColor = Color.Green; e.Style.CommentTip.CommentIndicatorColor = Color.White; } } else { e.Style.CommentTip.CommentImage = Image.FromFile(@"r:\wippictures\na.jpg"); e.Style.CommentTip.CommentArrowColor = Color.Red; e.Style.CommentTip.CommentIndicatorColor = Color.Black; } } } #endregion // int machinehrs = 0; int weldhrs = 0; int buildhrs = 0; //if (e.Style.TableCellIdentity.Column != null && e.TableCellIdentity.DisplayElement.Kind == Syncfusion.Grouping.DisplayElementKind.Record) //{ // //switch (e.Style.TableCellIdentity.Column.Name) // //{ // // case "Machine": // // machinehrs += Convert.ToInt16(e.Style.CellValue); // // // txtMachine.Text = machinehrs.ToString(); // // break; // //} // txtMachine.Text = machinehrs.ToString(); //} }
private void button1_Click(object sender, EventArgs e) { int tagnumber = Convert.ToInt16(txtTag.Text); TestEntities db = new TestEntities(); tblRedTag check = db.tblRedTags.Find(tagnumber); if (check == null) { MessageBox.Show("Sorry, that Tag does not exist"); } else { frmRedTag rtform = new frmRedTag(tagnumber); rtform.Show(); } }
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(); }
public FolderSet(string content) { InitializeComponent(); jobnumber = content; using (var db = new TestEntities()) { Folder fFolder = db.Folders.Find(jobnumber.Trim()); if (fFolder != null) { if (fFolder.BuildFolder != null) { dtpBuild.Value = fFolder.BuildFolder.Value; } if (fFolder.PMFolder != null) { dtpPM.Value = fFolder.PMFolder.Value; } if (fFolder.MachineFolder != null) { dtpMachine.Value = fFolder.MachineFolder.Value; } if (fFolder.ProcessingFolder != null) { dtpProcessor.Value = fFolder.ProcessingFolder.Value; } if (fFolder.WeldFolder != null) { dtpWeld.Value = fFolder.WeldFolder.Value; } } } }
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(); }
private void jobview2_Load(object sender, EventArgs e) { this.actionItemsTableAdapter.FillBy(this.ds_ActionItems.ActionItems, strJobNumber); job_batchesTableAdapter.FillBatchData(jobBatches.Job_batches, strJobNumber); commentsTableAdapter.fillComments(dsComments.comments, strJobNumber); this.Text = strJobNumber; //check for red tag //using (var db = new TestEntities()) //{ // tblRedTag rt = db.tblRedTags.Find(strJobNumber); // if (rt != null) // { // pbLight.Visible = true; // } //} lblJobNumber.Text = strJobNumber; lblTooltype.Text = strToolType; lblShipdate.Text = strShipdate; string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name; if (userName == "VISIONEERING\\zhallett") { btnGuys.Visible = true; } if (userName == "VISIONEERING\\jrotary") { btnGuys.Visible = true; } if (userName == "VISIONEERING\\bhallett") { btnGuys.Visible = true; } if (userName == "VISIONEERING\\ashinsky") { btnGuys.Visible = true; } if (userName == "VISIONEERING\\bdobleske") { btnGuys.Visible = true; } if (userName == "VISIONEERING\\smoore") { btnGuys.Visible = true; } if (userName == "VISIONEERING\\jfranz") { btnGuys.Visible = true; } if (userName == "VISIONEERING\\nhanna") { btnGuys.Visible = true; } if (userName == "VISIONEERING\\ANielsen") { btnGuys.Visible = true; } if (userName == "VISIONEERING\\cbacon") { btnGuys.Visible = true; } if (userName == "VISIONEERING\\dconrad") { btnGuys.Visible = true; } DataGridViewCellStyle style = new DataGridViewCellStyle(); style.BackColor = Color.Orange; style.ForeColor = Color.White; using (var db = new TestEntities()) { ImportantDate iDate = db.ImportantDates.Find(strJobNumber); picture findpic = db.pictures.Find(strJobNumber); NewestBaseline baseline = db.NewestBaselines.Find(strJobNumber); NewestActual actual = db.NewestActuals.Find(strJobNumber); if (baseline != null) { // lblMachineEndBase.Text = Convert.ToString(baseline.machineend); DateTime processingstart = Convert.ToDateTime(baseline.processingstart).Date; string processingstart1 = processingstart.ToString("d"); lblProcessingStartBase.Text = processingstart1; // lblProcessingStartBase.Text = Convert.ToString(baseline.processingstart); DateTime processingend = Convert.ToDateTime(baseline.processingend).Date; string processingend1 = processingend.ToString("d"); lblProcessingEndBase.Text = processingend1; DateTime materialstart = Convert.ToDateTime(baseline.materialstart).Date; string materialstart1 = materialstart.ToString("d"); lblMaterialOrderBase.Text = materialstart1; DateTime materialend = Convert.ToDateTime(baseline.materialend).Date; string materialend1 = materialend.ToString("d"); lblMaterialReceivedBase.Text = materialend1; DateTime machinestart = Convert.ToDateTime(baseline.machinestart).Date; string machinestart1 = machinestart.ToString("d"); lblMachineStartBase.Text = machinestart1; DateTime machineend = Convert.ToDateTime(baseline.machineend).Date; string machineend1 = machineend.ToString("d"); lblMachineEndBase.Text = machineend1; DateTime fabstart = Convert.ToDateTime(baseline.weldstart).Date; string fabstart1 = fabstart.ToString("d"); lblFabStartBase.Text = fabstart1; DateTime fabend = Convert.ToDateTime(baseline.weldend).Date; string fabend1 = fabend.ToString("d"); lblFabFinishBase.Text = fabend1; DateTime assemblystart = Convert.ToDateTime(baseline.assemblystart).Date; string assemblystart1 = assemblystart.ToString("d"); lblAssemblyStartBase.Text = assemblystart1; DateTime assemblyend = Convert.ToDateTime(baseline.assemblyend).Date; string assemblyend1 = assemblyend.ToString("d"); lblAssemblyFinishBase.Text = assemblyend1; } if (actual != null) { DateTime processingstart = Convert.ToDateTime(actual.processingstart).Date; string processingstart1 = processingstart.ToString("d"); lblProcessingStartAct.Text = processingstart1; DateTime processingend = Convert.ToDateTime(actual.processingend).Date; string processingsend1 = processingend.ToString("d"); lblProcessingEndAct.Text = processingsend1; DateTime materialstart = Convert.ToDateTime(actual.materialstart).Date; string materialstart1 = materialstart.ToString("d"); lblMaterialOrderAct.Text = materialstart1; DateTime materialfinish = Convert.ToDateTime(actual.materialend).Date; string materialfinish1 = materialfinish.ToString("d"); lblMaterialReceivedAct.Text = materialfinish1; DateTime machinestart = Convert.ToDateTime(actual.machinestart).Date; string machinestart1 = machinestart.ToString("d"); lblMachineStartAct.Text = machinestart1; DateTime machineend = Convert.ToDateTime(actual.machineend).Date; string machineend1 = machineend.ToString("d"); lblMachineEndAct.Text = machineend1; DateTime fabstart = Convert.ToDateTime(actual.weldstart).Date; string fabstart1 = fabstart.ToString("d"); lblFabStartAct.Text = fabstart1; DateTime fabend = Convert.ToDateTime(actual.weldend).Date; string fabend1 = fabend.ToString("d"); lblFabFinishAct.Text = fabend1; DateTime assemblystart = Convert.ToDateTime(actual.assemblystart).Date; string assemblystart1 = assemblystart.ToString("d"); lblAssemblyStartAct.Text = assemblystart1; DateTime assemblyfinish = Convert.ToDateTime(actual.assemblyend).Date; string assemblyfinish1 = assemblyfinish.ToString("d"); lblAssemblyFinishAct.Text = assemblyfinish1; } if (findpic != null) { using (var bmpTemp = new Bitmap(findpic.Path)) { image = new Bitmap(bmpTemp); pbJob.Image = image; } //stream.Read(findpic.Path,0); //image = System.Drawing.Image.FromStream(stream); //image = (Image.FromFile(findpic.Path)); //pbJob.Image = image; } else { pbJob.Image = Image.FromFile(@"r:\wippictures\na.jpg"); } //db.SaveChanges(); //MessageBox.Show("Dates Saved. GREAT JOB!"); // dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; dataGridView1.Columns[1].DefaultCellStyle.WrapMode = DataGridViewTriState.True; // dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCells; //TestEntities jobteam1 = new TestEntities(); Team jobteam1 = new Team(); bool check1 = db.Teams.Any(u => u.JobNumber == strJobNumber); if (check1 == true) { jobteam1 = db.Teams.Find(strJobNumber); if (jobteam1.ProgramManager != null) { lblPm.Text = "Program Manager: " + jobteam1.ProgramManager; } if (jobteam1.Processor != null) { lblProcessor.Text = "Processor: " + jobteam1.Processor; } if (jobteam1.BuildLeader != null) { lblBuldLeader.Text = "Build Leader: " + jobteam1.BuildLeader; } if (jobteam1.Folder != null) { lblPoDate.Text = "PO Date: " + jobteam1.PODate.Value.ToString("MM-dd-yyyy"); } } //Folder fFolder = db.Folders.Find(strJobNumber.Substring(0,15)); // bool check2 = db.Folders.Any(u => u.JobNumber.Substring(0,15) == strJobNumber.Substring(0,15)); } }
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!"); // } }
private void JobView4_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'dsComments.comments' table. You can move, or remove it, as needed. // this.commentsTableAdapter1.Fill(this.dsComments.comments); // TODO: This line of code loads data into the 'ds_Comments.comments' table. You can move, or remove it, as needed. // this.commentsTableAdapter.Fill(this.ds_Comments.comments); // commentsTableAdapter.fillComments(dsComments.comments, strJobNumber); try { commentsTableAdapter1.fillComments(this.dsComments.comments, strJobNumber); this.gridGroupingControl1.TableDescriptor.VisibleColumns.Remove("id"); this.gridGroupingControl1.TableDescriptor.VisibleColumns.Remove("baseid"); this.gridGroupingControl1.Appearance.AlternateRecordFieldCell.BackColor = Color.LightGray; this.gridGroupingControl1.TableOptions.ColumnHeaderRowHeight = 20; this.gridGroupingControl1.TableOptions.RecordRowHeight = 40; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } using (var db = new TestEntities()) { ImportantDate idate = db.ImportantDates.Find(strJobNumber); picture findpic = db.pictures.Find(strJobNumber); // Margin_Over_time mot = db.Margin_Over_time.Find(strJobNumber); // rbcMain if (findpic != null) { using (var bmpTemp = new Bitmap(findpic.Path)) { image = new Bitmap(bmpTemp); // is3.Images.Add(image); is3.BackgroundImage = image; is3.BackgroundImageLayout = ImageLayout.Stretch; // is1.SlideShow = false; // dscomments // is1. is3.ImageCollection.ImageSize.Height.Equals(512); is3.ImageCollection.ImageSize.Width.Equals(512); } } else { Image i2 = Image.FromFile(@"r:\wippictures\na.jpg"); is3.Images.Add(i2); } Team jobteam1 = new Team(); bool check1 = db.Teams.Any(u => u.JobNumber == strJobNumber); #region LabelChecks string strJob = strJobNumber.Replace("/", "_").Replace(" ", ""); string path = "R:\\wipviewer2017\\jobfiles\\" + strJob + "\\riskassessment.xlsx"; if (File.Exists(path) == true) { } else { btnRA.BackColor = Color.Red; btnRA.Enabled = false; } path = "R:\\wipviewer2017\\jobfiles\\" + strJob + "\\aqp.xlsx"; if (File.Exists(path) == true) { } else { btnAQP.BackColor = Color.Red; btnAQP.Enabled = false; } if (check1 == true) { jobteam1 = db.Teams.Find(strJobNumber); if (jobteam1.ProgramManager != null) { lblPm.Text = "Program Manager: " + jobteam1.ProgramManager; } else { lblPm.Text = "PM NOT SET"; } if (jobteam1.Processor != null) { lblProcessor.Text = "Processor: " + jobteam1.Processor; } else { lblProcessor.Text = "PROCESSOR NOT SET"; } if (jobteam1.BuildLeader != null) { lblBl.Text = "Build Leader: " + jobteam1.BuildLeader; } else { lblBl.Text = "BUILD LEADER NOT SET"; } if (jobteam1.PODate != null) { lblPO.Text = "PO Date: " + jobteam1.PODate.Value.ToString("MM-dd-yyyy"); } else { lblPO.Text = "PO DATE NOT ENTERED"; } #endregion ActiveJob aj1 = db.ActiveJobs.Find(strJobNumber); this.Text = strJobNumber; } } }
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!"); }
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!"); }
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"); } } }
private void testjobview_Load(object sender, EventArgs e) { using (var db = new TestEntities()) { ImportantDate idate = db.ImportantDates.Find(strJobNumber); picture findpic = db.pictures.Find(strJobNumber); // Margin_Over_time mot = db.Margin_Over_time.Find(strJobNumber); // rbcMain if (findpic != null) { using (var bmpTemp = new Bitmap(findpic.Path)) { image = new Bitmap(bmpTemp); // is3.Images.Add(image); is3.BackgroundImage = image; is3.BackgroundImageLayout = ImageLayout.Stretch; // is1.SlideShow = false; // dscomments // is1. is3.ImageCollection.ImageSize.Height.Equals(512); is3.ImageCollection.ImageSize.Width.Equals(512); } } else { Image i2 = Image.FromFile(@"r:\wippictures\na.jpg"); is3.Images.Add(i2); } Team jobteam1 = new Team(); bool check1 = db.Teams.Any(u => u.JobNumber == strJobNumber); #region LabelChecks string strJob = strJobNumber.Replace("/", "_").Replace(" ", ""); string path = "R:\\wipviewer2017\\jobfiles\\" + strJob + "\\riskassessment.xlsx"; if (File.Exists(path) == true) { } else { btnRA.BackColor = Color.Red; btnRA.Enabled = false; } path = "R:\\wipviewer2017\\jobfiles\\" + strJob + "\\aqp.xlsx"; if (File.Exists(path) == true) { } else { btnAQP.BackColor = Color.Red; btnAQP.Enabled = false; } if (check1 == true) { jobteam1 = db.Teams.Find(strJobNumber); if (jobteam1.ProgramManager != null) { lblPm.Text = "Program Manager: " + jobteam1.ProgramManager; } else { lblPm.Text = "PM NOT SET"; } if (jobteam1.Processor != null) { lblProcessor.Text = "Processor: " + jobteam1.Processor; } else { lblProcessor.Text = "PROCESSOR NOT SET"; } if (jobteam1.BuildLeader != null) { lblBl.Text = "Build Leader: " + jobteam1.BuildLeader; } else { lblBl.Text = "BUILD LEADER NOT SET"; } if (jobteam1.PODate != null) { lblPO.Text = "PO Date: " + jobteam1.PODate.Value.ToString("MM-dd-yyyy"); } else { lblPO.Text = "PO DATE NOT ENTERED"; } #endregion ActiveJob aj1 = db.ActiveJobs.Find(strJobNumber); #region agechecks if (aj1.age1 <= 30) { DateTime testdate = Convert.ToDateTime(db.Margin_Over_time.Where(cc4 => cc4.BaseID == strJobNumber).Select(cc4 => cc4.BatchDate).Min()); DateTime testdate2 = Convert.ToDateTime(db.Margin_Over_time.Where(cc4 => cc4.BaseID == strJobNumber).Select(cc4 => cc4.BatchDate).Max()); cc1.PrimaryXAxis.DateTimeRange = new Syncfusion.Windows.Forms.Chart.ChartDateTimeRange(testdate, testdate2, 5, Syncfusion.Windows.Forms.Chart.ChartDateTimeIntervalType.Days); } if (aj1.age1 > 30 && aj1.age1 <= 60) { DateTime testdate = Convert.ToDateTime(db.Margin_Over_time.Where(cc4 => cc4.BaseID == strJobNumber).Select(cc4 => cc4.BatchDate).Min()); DateTime testdate2 = Convert.ToDateTime(db.Margin_Over_time.Where(cc4 => cc4.BaseID == strJobNumber).Select(cc4 => cc4.BatchDate).Max()); cc1.PrimaryXAxis.DateTimeRange = new Syncfusion.Windows.Forms.Chart.ChartDateTimeRange(testdate, testdate2, 10, Syncfusion.Windows.Forms.Chart.ChartDateTimeIntervalType.Days); } if (aj1.age1 > 60 && aj1.age1 <= 150) { DateTime testdate = Convert.ToDateTime(db.Margin_Over_time.Where(cc4 => cc4.BaseID == strJobNumber).Select(cc4 => cc4.BatchDate).Min()); DateTime testdate2 = Convert.ToDateTime(db.Margin_Over_time.Where(cc4 => cc4.BaseID == strJobNumber).Select(cc4 => cc4.BatchDate).Max()); cc1.PrimaryXAxis.DateTimeRange = new Syncfusion.Windows.Forms.Chart.ChartDateTimeRange(testdate, testdate2, 1, Syncfusion.Windows.Forms.Chart.ChartDateTimeIntervalType.Months); } if (aj1.age1 > 150 && aj1.age1 <= 365) { DateTime testdate = Convert.ToDateTime(db.Margin_Over_time.Where(cc4 => cc4.BaseID == strJobNumber).Select(cc4 => cc4.BatchDate).Min()); DateTime testdate2 = Convert.ToDateTime(db.Margin_Over_time.Where(cc4 => cc4.BaseID == strJobNumber).Select(cc4 => cc4.BatchDate).Max()); cc1.PrimaryXAxis.DateTimeRange = new Syncfusion.Windows.Forms.Chart.ChartDateTimeRange(testdate, testdate2, 2, Syncfusion.Windows.Forms.Chart.ChartDateTimeIntervalType.Months); } if (aj1.age1 > 365) { DateTime testdate = Convert.ToDateTime(db.Margin_Over_time.Where(cc4 => cc4.BaseID == strJobNumber).Select(cc4 => cc4.BatchDate).Min()); DateTime testdate2 = Convert.ToDateTime(db.Margin_Over_time.Where(cc4 => cc4.BaseID == strJobNumber).Select(cc4 => cc4.BatchDate).Max()); cc1.PrimaryXAxis.DateTimeRange = new Syncfusion.Windows.Forms.Chart.ChartDateTimeRange(testdate, testdate2, 3, Syncfusion.Windows.Forms.Chart.ChartDateTimeIntervalType.Months); } #endregion this.Text = strJobNumber; } } }
public team2(string jobnumber) { InitializeComponent(); strjobnumber = jobnumber; using (var db = new TestEntities()) { Team tTeam = db.Teams.Find(strjobnumber); if (tTeam != null) { if (tTeam.ProgramManager != null) { cmbPM.Text = tTeam.ProgramManager.Trim(); } if (tTeam.Processor != null) { cmbProcessor.Text = tTeam.Processor.Trim(); } if (tTeam.BuildLeader != null) { cmbBl.Text = tTeam.BuildLeader.Trim(); } if (tTeam.QA != null) { cmbQa.Text = tTeam.QA.Trim(); } if (tTeam.PODate != null) { dtpPoDate.Value = Convert.ToDateTime(tTeam.PODate); } if (tTeam.KickOff != null) { chkKickoff.Checked = true; dtpKickoff.Value = Convert.ToDateTime(tTeam.KickOff); } if (tTeam.DataRelease != null) { chkDataRelease.Checked = true; dtpDataRelease.Value = Convert.ToDateTime(tTeam.DataRelease); } if (tTeam.Folder != null) { chkFolder.Checked = true; dtpFolderReceived.Value = Convert.ToDateTime(tTeam.Folder); } if (tTeam.Hold != null) { cmbHold.Text = tTeam.Hold.Trim(); } else { cmbHold.Text = "Active"; } //using (var bmpTemp = new Bitmap(findpic.Path)) //{ // image = new Bitmap(bmpTemp); // pbJob.Image = image; //} } } }
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(); } } }
private void testgrid2_Load(object sender, EventArgs e) { gc1.ShowGroupDropArea = true; // gc1.DataSource = ds_activejobs; activeJobsTableAdapter.Fill(this.ds_activejobs.ActiveJobs); gc1.TableModel.ReadOnly = true; zoom = new ZoomGroupingGrid(gc1); // gc1.DataMember = ds_activejobs.ActiveJobs; Syncfusion.Grouping.SortColumnDescriptor cd = new Syncfusion.Grouping.SortColumnDescriptor("ShipDate"); cd.Categorizer = new CustomCategorizer(); this.gc1.TableDescriptor.GroupedColumns.Add(cd); // this.gc1.QueryCellText += gc1_QueryCellText; //Summary Columns TestEntities db = new TestEntities(); DateTime maxbatch = db.Batches.Max(p => p.BatchTime); lblTimeStamp.Text = "Data Accurate as of: " + maxbatch.ToString(); #region summary columns gc1.TableDescriptor.VisibleColumns.Remove("ShipMonth"); gc1.TableDescriptor.VisibleColumns.Remove("Batch"); gc1.TableDescriptor.Columns["ShipDate"].Appearance.AnyRecordFieldCell.Format = "MM/dd/yyyy"; gc1.TableDescriptor.Appearance.AnyRecordFieldCell.WrapText = true; gc1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Table()); GridSummaryColumnDescriptor sc1 = new GridSummaryColumnDescriptor(); sc1.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165)); sc1.DataMember = "RemainingRev"; sc1.Format = "{Sum}"; sc1.Name = "Remaining Revenue"; sc1.SummaryType = SummaryType.Int32Aggregate; GridSummaryColumnDescriptor sc2 = new GridSummaryColumnDescriptor(); sc2.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165)); sc2.DataMember = "POValue"; sc2.Format = "{Sum}"; sc2.Name = "Purchase Order Value"; sc2.SummaryType = SummaryType.Int32Aggregate; // sc2.TableDescriptor.Columns[0].Appearance.AnyRecordFieldCell.Format = "C"; GridSummaryColumnDescriptor sc3 = new GridSummaryColumnDescriptor(); sc3.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165)); sc3.DataMember = "Actual"; sc3.Format = "{Sum}"; sc3.Name = "Actual"; sc3.SummaryType = SummaryType.Int32Aggregate; sc1.Appearance.AnySummaryCell.Format = "c"; sc2.Appearance.AnySummaryCell.Format = "c"; sc3.Appearance.AnySummaryCell.Format = "c"; GridSummaryColumnDescriptor sc4 = new GridSummaryColumnDescriptor(); sc4.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165)); sc4.DataMember = "Weld"; sc4.Format = "{Sum}"; sc4.Name = "Weld Hours Remaining"; sc4.SummaryType = SummaryType.Int32Aggregate; GridSummaryColumnDescriptor sc5 = new GridSummaryColumnDescriptor(); sc5.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165)); sc5.DataMember = "Machine"; sc5.Format = "{Sum}"; sc5.Name = "Machine Hours Remaining"; sc5.SummaryType = SummaryType.Int32Aggregate; GridSummaryColumnDescriptor sc6 = new GridSummaryColumnDescriptor(); sc6.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165)); sc6.DataMember = "Design"; sc6.Format = "{Sum}"; sc6.Name = "Design Hours Remaining"; sc6.SummaryType = SummaryType.Int32Aggregate; GridSummaryColumnDescriptor sc7 = new GridSummaryColumnDescriptor(); sc7.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165)); sc7.DataMember = "Tracker"; sc7.Format = "{Sum}"; sc7.Name = "Tracker Hours Remaining"; sc7.SummaryType = SummaryType.Int32Aggregate; GridSummaryColumnDescriptor sc8 = new GridSummaryColumnDescriptor(); sc8.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165)); sc8.DataMember = "Build"; sc8.Format = "{Sum}"; sc8.Name = "Build Hours Remaining"; sc8.SummaryType = SummaryType.Int32Aggregate; GridSummaryRowDescriptor sr1 = new GridSummaryRowDescriptor(); sr1.SummaryColumns.Add(sc1); sr1.SummaryColumns.Add(sc2); sr1.SummaryColumns.Add(sc3); sr1.SummaryColumns.Add(sc4); sr1.SummaryColumns.Add(sc5); sr1.SummaryColumns.Add(sc6); sr1.SummaryColumns.Add(sc7); sr1.SummaryColumns.Add(sc8); gc1.Appearance.AnySummaryCell.HorizontalAlignment = GridHorizontalAlignment.Right; sr1.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(255, 231, 162)); gc1.TableDescriptor.SummaryRows.Add(sr1); #endregion // gc1.TableControl.PrepareViewStyleInfo += new; gc1.TableControl.CommentTipShowing += new CommentTipShowingEventHandler(TableControl_CommentTipShowing); //GridConditionalFormatDescriptor f1 = new GridConditionalFormatDescriptor(); f1.Appearance.AnyRecordFieldCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(220, 20, 60)); f1.Appearance.AnyRecordFieldCell.TextColor = Color.White; f1.Expression = "[age1] > 10 and [Comp] < 20"; f1.Name = "Format1"; //GridConditionalFormatDescriptor f2 = new GridConditionalFormatDescriptor(); f2.Appearance.AnyRecordFieldCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(30, 144, 255)); f2.Appearance.AnyRecordFieldCell.TextColor = Color.White; f2.Expression = "[age1] < 10"; f2.Name = "Format2"; gc1.TableDescriptor.ConditionalFormats.Add(f1); gc1.TableDescriptor.ConditionalFormats.Add(f2); gc1.QueryCellStyleInfo += new GridTableCellStyleInfoEventHandler(gc1_QueryCellStyleInfo); gc1.SourceListListChangedCompleted += Gc1_SourceListListChangedCompleted; GridColumnDescriptor desc1 = new GridColumnDescriptor(); desc1.MappingName = "BaseID"; desc1.Appearance.AnyRecordFieldCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(237, 240, 246)); gc1.TableControl.HScroll = true; gc1.TableControl.VScroll = true; if (gc1.TableControl.HScrollBar.InnerScrollBar != null && gc1.TableControl.VScrollBar != null) { gc1.TableControl.HScrollBar.InnerScrollBar.Height = 50; gc1.TableControl.VScrollBar.InnerScrollBar.Height = 50; } gc1.TableControl.ControlAdded += TableControl_ControlAdded; }
public frmRedTag() { InitializeComponent(); using (var db2 = new TestEntities()) { var defectCodes = (from em in db2.Reasons where em.Code.StartsWith("D") select new { Code = em.Code, Description = em.Detail }); var scripts = (from em in db2.Reasons where em.Code.StartsWith("D") select em.Detail).ToArray(); // cmbDefect.DataSource = (from em in db2.Reasons // where em.Code.StartsWith("D") // select em).ToList(); cmbDefect.DataSource = defectCodes.ToList(); cmbDefect.DisplayMember = "Description"; AutoCompleteStringCollection autoc = new AutoCompleteStringCollection(); autoc.AddRange(scripts); cmbDefect.AutoCompleteMode = AutoCompleteMode.SuggestAppend; cmbDefect.AutoCompleteCustomSource = autoc; cmbDefect.AutoCompleteSource = AutoCompleteSource.CustomSource; var causeCodes = (from em in db2.Reasons where em.Code.StartsWith("C") select new { Code = em.Code, Description = em.Detail }); scripts = (from em in db2.Reasons where em.Code.StartsWith("C") select em.Detail).ToArray(); cmbCause.DataSource = causeCodes.ToList(); cmbCause.DisplayMember = "Description"; AutoCompleteStringCollection autoc2 = new AutoCompleteStringCollection(); autoc2.AddRange(scripts); cmbCause.AutoCompleteMode = AutoCompleteMode.SuggestAppend; cmbCause.AutoCompleteCustomSource = autoc2; cmbCause.AutoCompleteSource = AutoCompleteSource.CustomSource; var deptCodes = (from em in db2.Reasons where em.Code.StartsWith("R") select new { Code = em.Code, Description = em.Detail }); scripts = (from em in db2.Reasons where em.Code.StartsWith("R") select em.Detail).ToArray(); cmbDept.DataSource = deptCodes.ToList(); cmbDept.DisplayMember = "Description"; AutoCompleteStringCollection autoc3 = new AutoCompleteStringCollection(); autoc3.AddRange(scripts); cmbDept.AutoCompleteMode = AutoCompleteMode.SuggestAppend; cmbDept.AutoCompleteCustomSource = autoc3; cmbDept.AutoCompleteSource = AutoCompleteSource.CustomSource; } }
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); //} }
public frmRedTag(int tagnumber) { InitializeComponent(); int iTagnumber = Convert.ToInt16(tagnumber); TestEntities db = new TestEntities(); tblRedTag rt1 = db.tblRedTags.Find(iTagnumber); Reason rs1 = new Reason(); using (var db2 = new TestEntities()) { cmbDefect.DataSource = db2.Reasons.SqlQuery("select Code from dbo.reasons where code like '%D'"); } if (rt1 != null) { txtTag.Text = rt1.ID.ToString(); if (rt1.JOB != null) { txtJob.Text = rt1.JOB; } if (rt1.Detail != null) { txtTool.Text = rt1.Detail; } if (rt1.Initiator != null) { cmbInitiator.Text = rt1.Initiator; } if (rt1.Dept != null) { cmbDept.Text = rt1.Dept; } if (rt1.Spec != null) { txtSpec.Text = rt1.Spec; } if (rt1.Condition != null) { txtCondition.Text = rt1.Condition; } if (rt1.Date != null) { dtpInspection.Text = rt1.Date.ToString(); } if (rt1.Defect != null) { cmbDefect.Text = rt1.Defect; } if (rt1.Cause != null) { cmbCause.Text = rt1.Cause; } if (rt1.Reinspection != null) { dtpReinspection.Text = rt1.Reinspection.ToString(); } if (rt1.Cost != null) { txtRework.Text = rt1.Cost.ToString(); } if (rt1.InstanceCost != null) { txtInstance.Text = rt1.InstanceCost.ToString(); } if (rt1.ScrapCost != null) { txtScrap.Text = rt1.ScrapCost.ToString(); } if (rt1.VendorPO != null) { txtVendor.Text = rt1.VendorPO; } if (rt1.Instructions != null) { txtInstructions.Text = rt1.Instructions; } if (rt1.Comment != null) { txtComments.Text = rt1.Comment; } // cmbDisposition.Text = rt1. } }
public void schedule_Load(object sender, EventArgs e) { int xx1 = 12; int xx2 = 127; int xx3 = 237; int xx4 = 354; int yy = 24; if (department == "fab") { lblCategory.Text = "Start Fab"; lblfinsih.Visible = false; using (var context = new TestEntities()) { var jobs = from b in context.ImportantDates .Where(b => b.StartFab.ToString() != "0001-01-01") .OrderBy(x => x.StartFab) select b; var result = jobs.ToList(); var count = jobs.Count(); for (int i = 0; i < count; i++) { Controls.Add(new Label { Location = new Point(xx1, yy), AutoSize = true, Text = result[i].BaseID.ToString() }); Controls.Add(new Label { Location = new Point(xx2, yy), AutoSize = true, Text = result[i].StartFab.ToString() }); // Controls.Add(new Label { Location = new Point(xx3, yy), AutoSize = true, Text = result[i].h}) yy += 20; } } } if (department == "machine") { lblCategory.Text = "Start Machine"; lblfinsih.Text = "Machine Complete"; using (var context = new TestEntities()) { var jobs = from b in context.ImportantDates .Where(b => b.StartMachining.ToString() != "0001-01-01") .OrderBy(x => x.StartMachining) select b; var result = jobs.ToList(); var count = jobs.Count(); for (int i = 0; i < count; i++) { Controls.Add(new Label { Location = new Point(xx1, yy), AutoSize = true, Text = result[i].BaseID.ToString() }); Controls.Add(new Label { Location = new Point(xx2, yy), AutoSize = true, Text = Convert.ToDateTime(result[i].StartMachining).ToString("MM/dd/yyyy") }); Controls.Add(new Label { Location = new Point(xx3, yy), AutoSize = true, Text = Convert.ToDateTime(result[i].MachComp).ToString("MM/dd/yyyy") }); yy += 20; } } } }