Ejemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Unit unit = new Unit();

            unit.UnitName = txtUnitName.Text;
            ctx.Units.Add(unit);
            ctx.SaveChanges();
            List();
        }
Ejemplo n.º 2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Product product = new Product();

            product.ProductName   = txtProductName.Text;
            product.ProductNumber = Convert.ToInt32(txtProductNumber.Text);
            product.UnitID        = (int)cmbUnitName.SelectedValue;
            product.UnitPrice     = Convert.ToInt32(txtUnitPrice.Text);
            ctx.Products.Add(product);
            ctx.SaveChanges();
            List();
        }
Ejemplo n.º 3
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         City c = new City();
         c.CityName = txtCityName.Text;
         ctx.Cities.Add(c);
         ctx.SaveChanges();
         List();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 4
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         County county = new County();
         county.CountyName = txtCounty.Text;
         county.CityID     = (int)cmbCity.SelectedValue;
         ctx.Counties.Add(county);
         ctx.SaveChanges();
         List();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void btnAddInvoice_Click(object sender, EventArgs e)
        {
            if (!CheckInvoiceInputs())
            {
                return;
            }

            InvoiceHeader invoiceHeader = new InvoiceHeader()
            {
                InvoieceID         = _invoiceID,
                invoicedetail      = _invoiceDetail,
                InvoiceDateTime    = DateTime.Now,
                DeliveryNoteNumber = Convert.ToInt32(txtDeliveryNumber.Text),
                CustomerID         = _selectedCustomer.CustomerID,
                PaymentDateTime    = dtpPaymentDate.Value,
                InvoiceAmount      = _invoiceDetail.Select(f => f.TotalAmount).Sum()
            };

            DbContextTransaction tran = _db.Database.BeginTransaction();

            try
            {
                _db.InvoiceHeaders.Add(invoiceHeader);
                _db.SaveChanges();
                ClearFaturaInputs();
                tran.Commit();
            }
            catch (Exception)
            {
                tran.Rollback();
                MessageBox.Show("Beklenmeyen bir hata meydana geldi");
            }
        }
Ejemplo n.º 6
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         Customer customer = new Customer();
         customer.CompanyName = txtCompanyName.Text;
         customer.CountyID    = (int)cmbCounty.SelectedValue;
         customer.Address     = txtAddress.Text;
         ctx.Customers.Add(customer);
         ctx.SaveChanges();
         List();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }