Exemplo n.º 1
0
 public int UpdateProductOrderData(ProductOrder productOrder)
 {
     try
     {
         SqlCommand sqlCommand = new SqlCommand("ProductOrderCrud", sqlConnection);
         sqlCommand.CommandType = CommandType.StoredProcedure;
         sqlCommand.Parameters.AddWithValue("@ProductOrder", "Update");
         sqlCommand.Parameters.AddWithValue("@ProductOderId", productOrder.ProductOderId);
         sqlCommand.Parameters.AddWithValue("@CustId", productOrder.CustId);
         sqlCommand.Parameters.AddWithValue("@ProductId", productOrder.ProductId);
         sqlCommand.Parameters.AddWithValue("@ProductOrderStatus", productOrder.ProductOrderStatus);
         sqlCommand.Parameters.AddWithValue("@CancelDate", productOrder.CancelDate.ToLongDateString());
         sqlConnection.Open();
         int dataUpdated = sqlCommand.ExecuteNonQuery();
         CloseAndDisposeCon();
         return(dataUpdated);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         CloseAndDisposeCon();
     }
 }
Exemplo n.º 2
0
 public int DeleteProductOrderData(ProductOrder productOrder)
 {
     try
     {
         SqlCommand sqlCommand = new SqlCommand("ProductOrderCrud", sqlConnection);
         sqlCommand.CommandType = CommandType.StoredProcedure;
         sqlCommand.Parameters.AddWithValue("@ProductOrder", "Delete");
         sqlCommand.Parameters.AddWithValue("@ProductOrderId", productOrder.ProductOderId);
         sqlConnection.Open();
         int dataDeleted = sqlCommand.ExecuteNonQuery();
         CloseAndDisposeCon();
         return(dataDeleted);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         CloseAndDisposeCon();
     }
 }