Beispiel #1
0
        private void Update_Click(object sender, EventArgs e)
        {
            var invoice  = new BusinessLayer.FooEnterprises.CustomerProduct(Convert.ToInt32(dataGridView1.SelectedCells[0].Value));
            var customer = new BusinessLayer.FooEnterprises.Customer(invoice.CustomerId);
            var product  = new BusinessLayer.FooEnterprises.Product(invoice.ProductId);

            customer.FirstName = FirstName.Text;
            customer.LastName  = LastName.Text;
            customer.Save();
            product.ProductName   = ProductName.Text;
            product.WholesaleCost = Convert.ToDecimal(wholesalecost.Text);
            product.SaleCost      = Convert.ToDecimal(SaleCost.Text);
            product.Save();
            MessageBox.Show("Data Updated Successfully");
            Clear_textBoxes();
            Show_Click(sender, e);
        }
Beispiel #2
0
        private void button5_Click(object sender, EventArgs e)
        {
            var customer = new BusinessLayer.FooEnterprises.Customer();
            var product  = new BusinessLayer.FooEnterprises.Product();
            var invoice  = new BusinessLayer.FooEnterprises.CustomerProduct();

            customer.FirstName = FirstName.Text;
            customer.LastName  = LastName.Text;
            customer.Save();
            product.ProductName   = ProductName.Text;
            product.WholesaleCost = Convert.ToDecimal(wholesalecost.Text);
            product.SaleCost      = Convert.ToDecimal(SaleCost.Text);
            product.Save();
            invoice.CustomerId = customer.CustomerId;
            invoice.ProductId  = product.ProductId;
            invoice.Save();
            MessageBox.Show("Data Added Successfully");
            Show_Click(sender, e);
            Clear_textBoxes();
        }