Ejemplo n.º 1
0
 /// <summary>
 /// Save execute
 /// </summary>
 private void SaveExecute()
 {
     try
     {
         if (Product.Quantity <= 0 || Product.Price <= 0)
         {
             MessageBox.Show("Invalid data input. Please try again.");
         }
         else
         {
             tblProduct product = service.AddProduct(Product);
             if (product != null)
             {
                 if (Service.action == "added")
                 {
                     MessageBox.Show("Product has been added");
                 }
                 else if (Service.action == "updated")
                 {
                     MessageBox.Show("Product has been updated");
                 }
                 isUpdateProduct = true;
                 addView.Close();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
 /// <summary>
 /// This method invokes method for adding product.
 /// </summary>
 public void SaveExecute()
 {
     try
     {
         products.AddProduct(Product);
         addProductView.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
 private void SaveExecute()
 {
     try
     {
         productModel.AddProduct(Product);
         apv.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception " + ex.Message.ToString());
     }
 }