private void BtnSave_Click(object sender, EventArgs e) { try { var cd = TxtCode.Text; Image img = PbClient.Image as Image; byte[] imgbyte; using (MemoryStream m = new MemoryStream()) { img.Save(m, System.Drawing.Imaging.ImageFormat.Png); imgbyte = m.ToArray(); } var cl = new Client() { Code = cd, Name = TxtName.Text, ImgCl = imgbyte, }; db.Clients.Add(cl); db.SaveChanges(); } catch (Exception ex) { MessageBox.Show("His data not upload" + ex.ToString(), "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } this.Close(); }
private void BtnSave_Click(object sender, EventArgs e) { var pd = db.ProjectDevs.Find(pdId); pd.InspectorGeo = TxtInspector.Text; pd.LocationGeo = TxtLocation.Text; db.SaveChanges(); this.Close(); }
private void BtnAdd_Click(object sender, EventArgs e) { try { var pdev = db.ProjectDevs.Include(a => a.Project.Client).Include(a => a.Project).Where(a => a.Id == proDevId).FirstOrDefault(); Development dev = new Development(); dev.DeploymentDate = Convert.ToDateTime(pdev.DevTime.ToShortDateString()); dev.PanelNo = Convert.ToInt32(DGVDev.CurrentRow.Cells["PanelNo"].Value); dev.RollNo = Convert.ToInt32(DGVDev.CurrentRow.Cells["RollNo"].Value); dev.Lenght = Convert.ToInt32(DGVDev.CurrentRow.Cells["Lenght"].Value); dev.Width = Convert.ToDecimal(DGVDev.CurrentRow.Cells["Width"].Value); if (DGVDev.CurrentRow.Cells["Thickness"].Value != null) { dev.Thickness = DGVDev.CurrentRow.Cells["Thickness"].Value.ToString(); } else { dev.Thickness = " "; } dev.Area = Convert.ToInt32(DGVDev.CurrentRow.Cells["Lenght"].Value) * Convert.ToDecimal(DGVDev.CurrentRow.Cells["Width"].Value); if (DGVDev.CurrentRow.Cells["Remarks"].Value != null) { dev.Remarks = DGVDev.CurrentRow.Cells["Remarks"].Value.ToString(); } else { dev.Remarks = " "; } dev.ProjectDevId = pdev.Id; db.Developments.Add(dev); db.SaveChanges(); DevelopmentForm_Load(sender, e); } catch (Exception ex) { MetroMessageBox.Show(this, "Error in your record " + ex.ToString(), "Info", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BtnDelete_Click(object sender, EventArgs e) { var id = Convert.ToInt32(GDVClients.CurrentRow.Cells[0].Value); if (MetroFramework.MetroMessageBox.Show(this, "Are you sure want to delete this record?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { var cdb = db.Clients.Find(id); db.Entry <Client>(cdb).State = EntityState.Deleted; db.SaveChanges(); MetroFramework.MetroMessageBox.Show(this, "Deleted Successfully", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } UpdateDGV(); }
private void BtnSave_Click(object sender, EventArgs e) { try { int id = Convert.ToInt32(TxtId.Text); var pdev = db.ProjectDevs.Find(id); pdev.DevTime = Convert.ToDateTime(DateInspection.Text); pdev.MachineNo = TxtMachineNo.Text; pdev.Operator = TxtOperator.Text; db.SaveChanges(); this.Close(); } catch (Exception ex) { MetroFramework.MetroMessageBox.Show(this, "An Error has ocurred: " + ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BtnDelete_Click(object sender, EventArgs e) { try { int pdId = Convert.ToInt32(DGVDev.CurrentRow.Cells[0].Value); var pd = db.ProjectDevs.Find(pdId); if (MetroFramework.MetroMessageBox.Show(this, "Are you sure want to delete this record?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { db.ProjectDevs.Remove(pd); db.SaveChanges(); } MetroMessageBox.Show(this, "Delete Success ", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); DevForm_Load(sender, e); } catch (Exception ex) { MetroMessageBox.Show(this, "An Error Ocurred " + ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void BtnSave_Click(object sender, EventArgs e) { try { var insp = new ProjectDev() { DevTime = DateInspection.Value, MachineNo = TxtMachine.Text, Operator = TxtOperator.Text, ProjectId = Convert.ToInt32(CbProject.SelectedValue) }; db.ProjectDevs.Add(insp); db.SaveChanges(); this.Close(); MetroMessageBox.Show(this, "Saved successfully", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception) { } }
private void BtnDelete_Click_1(object sender, EventArgs e) { try { var cell = DGVProject.CurrentRow.Cells[0].Value; var cdb = db.Projects.Find(cell); if (MetroFramework.MetroMessageBox.Show(this, "Are you sure want to delete this record?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { db.Projects.Remove(cdb); db.SaveChanges(); MetroFramework.MetroMessageBox.Show(this, "Deleted Successfully", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } ProjectForm_Load(sender, e); } catch (Exception ex) { MetroFramework.MetroMessageBox.Show(this, "Have a Error :" + ex.ToString(), "Info"); } }
private void BtnSave_Click(object sender, EventArgs e) { try { var project = new Project() { ClientId = idCl, Contractor = TxtContractor.Text, GeoSynthetic = TxtGeosynthetic.Text, PName = TxtProject.Text, ProjectNo = TxtProjectNo.Text, Supplier = TxtSupplier.Text }; db.Projects.Add(project); db.SaveChanges(); this.Close(); } catch (Exception ex) { MetroFramework.MetroMessageBox.Show(this, "Error :" + ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public Face Add(Face entity) { _graphDbContext.Faces.Add(entity); _graphDbContext.SaveChanges(); return(entity); }
private void BtnAdd_Click(object sender, EventArgs e) { try { if (DGVGeo.CurrentRow.Cells["SeamNo"].Value != null) { var pdev = db.ProjectDevs.Include(a => a.Project.Client).Include(a => a.Project).Where(a => a.Id == pdId).FirstOrDefault(); var geolist = db.GeoMembranes.Where(a => a.ProjectDevId == pdev.Id).ToList(); double count = 0; double seamtotal = 0; foreach (var item in geolist) { count += item.SeamLength; } seamtotal = count; var geo = new GeoMembrane(); geo.SeamingDate = Convert.ToDateTime(pdev.DevTime.ToShortDateString()); if (DGVGeo.CurrentRow.Cells["SeamNo"].Value != null) { geo.SeamNo = DGVGeo.CurrentRow.Cells["SeamNo"].Value.ToString(); } else { geo.SeamNo = " "; } if (DGVGeo.CurrentRow.Cells["SeamTime"].Value != null) { geo.SeamTime = DGVGeo.CurrentRow.Cells["SeamTime"].Value.ToString(); } else { geo.SeamTime = " "; } geo.WedgeTemp = Convert.ToInt32(DGVGeo.CurrentRow.Cells["WedgeTemp"].Value); geo.WedgeSpeed = Convert.ToDouble(DGVGeo.CurrentRow.Cells["WedgeSpeed"].Value); geo.SeamLength = Convert.ToDouble(DGVGeo.CurrentRow.Cells["SeamLength"].Value); geo.CarryOver = seamtotal + Convert.ToDouble(DGVGeo.CurrentRow.Cells["SeamLength"].Value); if (DGVGeo.CurrentRow.Cells["Destructive"].Value != null) { geo.Destructive = DGVGeo.CurrentRow.Cells["Destructive"].Value.ToString(); } else { geo.Destructive = " "; } if (DGVGeo.CurrentRow.Cells["RemarksDestructive"].Value != null) { geo.RemarksDestructive = DGVGeo.CurrentRow.Cells["RemarksDestructive"].Value.ToString(); } else { geo.RemarksDestructive = " "; } geo.ProjectDevId = pdev.Id; db.GeoMembranes.Add(geo); db.SaveChanges(); GeomembraneForm_Load(sender, e); } else { MetroMessageBox.Show(this, "Ingrese datos a la linea", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MetroMessageBox.Show(this, "Error" + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Add(Plate entity) { _graphDbContext.Plates.Add(entity); _graphDbContext.SaveChanges(); }
public Owner Add(Owner entity) { _graphDbContext.Add(entity); _graphDbContext.SaveChanges(); return(entity); }