Example #1
0
 public Int32 DeleteProduct(OtterBoxSales sale)
 {
     using (MySqlConnection cn = new MySqlConnection(ConneStr))
     {
         String       query = "Delete from OtterBoxSalesHistory where Id=@Id ";
         MySqlCommand cmand = new MySqlCommand(query, cn);
         cmand.Parameters.Add("@Id", MySqlDbType.Decimal).Value                = sale.ID;
         cmand.Parameters.Add("@ModelName", MySqlDbType.VarChar).Value         = sale.OtterBoxModel;
         cmand.Parameters.Add("@ModelType", MySqlDbType.VarChar).Value         = sale.Type;
         cmand.Parameters.Add("@ModelColor", MySqlDbType.VarChar).Value        = sale.Color;
         cmand.Parameters.Add("@ModelInStock", MySqlDbType.Decimal).Value      = sale.InStock;
         cmand.Parameters.Add("@ModelSold", MySqlDbType.Decimal).Value         = sale.Sold;
         cmand.Parameters.Add("@ModelCurrentStock", MySqlDbType.Decimal).Value = sale.ModelStock;
         cn.Open();
         return(cmand.ExecuteNonQuery());
     }
 }
Example #2
0
 public Int32 AddProduct(OtterBoxSales sale)
 {
     using (MySqlConnection cn = new MySqlConnection(ConneStr))
     {
         String       query = "INSERT INTO OtterBoxSalesHistory(id,ModelName,ModelType,ModelColor,ModelInStock,ModelSold,ModelCurrentStock) Values (@Id,@ModelName,@ModelType,@ModelColor,@ModelInStock,@ModelSold,@ModelCurrentStock) ";
         MySqlCommand cmand = new MySqlCommand(query, cn);
         cmand.Parameters.Add("@Id", MySqlDbType.Decimal).Value                = sale.ID;
         cmand.Parameters.Add("@ModelName", MySqlDbType.VarChar).Value         = sale.OtterBoxModel;
         cmand.Parameters.Add("@ModelType", MySqlDbType.VarChar).Value         = sale.Type;
         cmand.Parameters.Add("@ModelColor", MySqlDbType.VarChar).Value        = sale.Color;
         cmand.Parameters.Add("@ModelInStock", MySqlDbType.Decimal).Value      = sale.InStock;
         cmand.Parameters.Add("@ModelSold", MySqlDbType.Decimal).Value         = sale.Sold;
         cmand.Parameters.Add("@ModelCurrentStock", MySqlDbType.Decimal).Value = sale.ModelStock;
         cn.Open();
         return(cmand.ExecuteNonQuery());
     }
 }