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 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); //} }
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; } } }
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; } } }