Exemplo n.º 1
0
 private void buttonInsert_Click(object sender, EventArgs e)
 {
     AdventureWorksDAL.Product product = new AdventureWorksDAL.Product
     {
         Name  = textBoxName.Text,
         Color = textBoxColor.Text,
         Price = decimal.Parse(textBoxPrice.Text)
     };
     productsDAL.PostProduct(product);
     LoadProducts();
 }
Exemplo n.º 2
0
 private void buttonInsert_Click(object sender, EventArgs e)
 {
     AdventureWorksDAL.Product product = new AdventureWorksDAL.Product
     {
         Name = textBoxName.Text,
         Color = textBoxColor.Text,
         Price = decimal.Parse(textBoxPrice.Text)
     };
     productsDAL.PostProduct(product);
     LoadProducts();
 }
Exemplo n.º 3
0
 private void buttonUpdate_Click(object sender, EventArgs e)
 {
     AdventureWorksDAL.Product product = new AdventureWorksDAL.Product
     {
         ProductID = int.Parse(textBoxProductID.Text),
         Name      = textBoxName.Text,
         Color     = textBoxColor.Text,
         Price     = decimal.Parse(textBoxPrice.Text)
     };
     productsDAL.PutProduct(product.ProductID, product);
     LoadProducts();
 }
Exemplo n.º 4
0
 private void buttonUpdate_Click(object sender, EventArgs e)
 {
     AdventureWorksDAL.Product product = new AdventureWorksDAL.Product
     {
         ProductID = int.Parse(textBoxProductID.Text),
         Name = textBoxName.Text,
         Color = textBoxColor.Text,
         Price = decimal.Parse(textBoxPrice.Text)
     };
     productsDAL.PutProduct(product.ProductID, product);
     LoadProducts();
 }
Exemplo n.º 5
0
        private void listBoxProducts_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listBoxProducts.SelectedItem == null)
            {
                return;
            }

            AdventureWorksDAL.Product selectedItem =
                ((AdventureWorksDAL.Product)listBoxProducts.SelectedItem);
            textBoxProductID.Text = selectedItem.ProductID.ToString();
            textBoxName.Text      = selectedItem.Name.ToString();
            textBoxColor.Text     = selectedItem.Color;
            textBoxPrice.Text     = selectedItem.Price.ToString();
            buttonUpdate.Enabled  = true;
            buttonInsert.Enabled  = false;
        }