public bool UpdateOrderItem(OrderItem item) { SqlParameter[] Params = new SqlParameter[] { new SqlParameter("@ProductID", item.ProductID), new SqlParameter("@Quantity", item.Quantity ) }; return DataProvider.ExecuteNonQuery("sp_UpdateOrderItems", CommandType.StoredProcedure, Params); }
public bool InsertOrderItem(OrderItem orderItem) { SqlParameter[] Params = new SqlParameter[] { new SqlParameter("@ProductID", orderItem.ProductID), new SqlParameter("@Quantity", orderItem.Quantity), new SqlParameter("@OrderNo", orderItem.OrderNo) }; return DataProvider.ExecuteNonQuery("sp_InsertOrderItems", CommandType.StoredProcedure, Params); }
public OrderItem CreateOrder(Order order) { OrderItem OrderLine; SqlParameter[] Params = { new SqlParameter("@DateCreated", order.DateCreated), new SqlParameter("@DateLastModified", order.DateLastModified), new SqlParameter("@InvoiceID", order.InvoiceID), new SqlParameter("@Status", order.Status), new SqlParameter("@SupplierID",order.SupplierID) }; using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("sp_CreateOrder", CommandType.StoredProcedure, Params)) { OrderLine = new OrderItem(); if (table.Rows.Count == 1) { DataRow row = table.Rows[0]; OrderLine.OrderNo = Convert.ToInt32(row["OrderNumber"]); } } return OrderLine; }
public List<OrderItem> GetOrderItemList(int orderNo) { List<OrderItem> orderItems = null; SqlParameter [] Params = {new SqlParameter ("OrderNo", orderNo) }; using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("sp_GetOrderItemList",CommandType.StoredProcedure, Params)) { if (table.Rows.Count > 0) { orderItems = new List<OrderItem>(); foreach (DataRow row in table.Rows) { OrderItem orderItem = new OrderItem(); orderItem.OrderItemNumber = Convert.ToInt32(row["OrderItemNo"]); orderItem.ProductID = Convert.ToInt32(row["ProductID"]); orderItem.Quantity = Convert.ToInt32(row["Quantity"]); orderItem.OrderNo = Convert.ToInt32(row["OrderNo"]); orderItems.Add(orderItem); } } } return orderItems; }
public bool AddOrderItem(OrderItem item) { OrderItemHandler myHandler = new OrderItemHandler(); return myHandler.InsertOrderItem(item); }
public bool UpdateOrderItem(OrderItem item) { OrderItemHandler myHandler = new OrderItemHandler(); return myHandler.UpdateOrderItem(item); }