public void CreateInvioceDetail() { foreach (InvoiceDetail item in list) { item.InvoiceID = Convert.ToInt32(txtInvoiceID.Text); db.InvoiceDetails.Add(item); } db.SaveChanges(); }
private void btnInsert_Click(object sender, EventArgs e) { Unit unit = new Unit(); unit.UnitName = txtUnitName.Text; db.Units.Add(unit); db.SaveChanges(); List(); txtUnitName.Text = string.Empty; }
private void btnInsert_Click(object sender, EventArgs e) { Product product = new Product(); product.ProductName = txtProductName.Text; product.ProductNumber = Convert.ToInt32(txtProductNumber.Text); product.UnitID = (int)cmbUnit.SelectedValue; product.UnitPrice = Convert.ToInt32(txtUnitPrice.Text); db.Products.Add(product); db.SaveChanges(); List(); txtProductName.Text = string.Empty; txtProductNumber.Text = string.Empty; txtUnitPrice.Text = string.Empty; }
private void btnInsert_Click(object sender, EventArgs e) { try { City c = new City(); c.CityName = txtCityName.Text; db.Cities.Add(c); db.SaveChanges(); List(); txtCityName.Text = string.Empty; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnInsert_Click(object sender, EventArgs e) { try { County county = new County(); county.CountyName = txtCountyName.Text; county.CityID = (int)cmbCity.SelectedValue; db.Counties.Add(county); db.SaveChanges(); List(); txtCountyName.Text = string.Empty; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnInsert_Click(object sender, EventArgs e) { try { Customer customer = new Customer(); customer.CompanyName = txtCompanyName.Text; customer.CountyID = (int)cmbCustomerCounty.SelectedValue; customer.Adrress = txtAddress.Text; db.Customers.Add(customer); db.SaveChanges(); List(); txtCompanyName.Text = string.Empty; } catch (Exception ex) { MessageBox.Show(ex.Message); } }