public CustomersOrdersDetail[] GetOrderDetailData() //פונקציה לאחסון פירוט הזמנה של לקוח { DataSet ds = new DataSet(); ArrayList OrderDetail = new ArrayList(); string cmdStr = "SELECT * FROM [CustomersOrdersDetail]"; using (OleDbCommand command = new OleDbCommand(cmdStr)) { ds = GetMultiplyQuery(command); } DataTable dt = new DataTable(); try { dt = ds.Tables[0]; } catch { } foreach (DataRow tType in dt.Rows) { CustomersOrdersDetail CusOrder = new CustomersOrdersDetail(); CusOrder.CustomerOrder_ID = int.Parse(tType[0].ToString()); CusOrder.CustomerOrder_ClientID = int.Parse(tType[1].ToString()); CusOrder.CustomerOrder_ClientName = tType[2].ToString(); CusOrder.CustomerOrder_ProductID = int.Parse(tType[3].ToString()); CusOrder.CustomerOrder_ProductDescription = tType[4].ToString(); CusOrder.CustomerOrder_Quantity = int.Parse(tType[5].ToString()); CusOrder.CustomerOrder_ProductReceived = bool.Parse(tType[6].ToString()); OrderDetail.Add(CusOrder); } return((CustomersOrdersDetail[])OrderDetail.ToArray(typeof(CustomersOrdersDetail))); }
public void UpdateOrderReceivedInCustomersOrdersDetail(CustomersOrdersDetail cusorderdet)//פונקציה שמעדכנת שהלקוח קיבל את הזמנתו בטבלת הזמנות מפורטות { string cmdStr = "UPDATE CustomersOrdersDetail SET ProductReceived=@ProductReceived WHERE OrderID=" + cusorderdet.CustomerOrder_ID + "AND ProductID=" + cusorderdet.CustomerOrder_ProductID; using (OleDbCommand command = new OleDbCommand(cmdStr)) { command.Parameters.AddWithValue("@ProductReceived", cusorderdet.CustomerOrder_ProductReceived); base.ExecuteSimpleQuery(command); } }
public void UpdateCustomerNameInCustomersOrdersDetail(Customers cus, CustomersOrdersDetail cusorder)//פונקציה לעדכון שם של לקוח בטבלת הזמנות מפורטות במידה והלקוח שינה את שמו { string cmdStr = "UPDATE CustomersOrdersDetail SET CustomerName =" + cusorder.CustomerOrder_ClientName + " WHERE CustomerID=" + cus.Customer_ID; using (OleDbCommand command = new OleDbCommand(cmdStr)) { command.Parameters.AddWithValue("@First_Name", cusorder.CustomerOrder_ClientName); base.ExecuteSimpleQuery(command); } }
public void SubProductStock(Products product, CustomersOrdersDetail c)//פונקציה להורדת מלאי של מוצר ספציפי לאחר ביצוע הזמנה { string cmdStr = "UPDATE Products SET In_Stock=" + product.Product_Stock + " WHERE Product_ID=" + c.CustomerOrder_ProductID; using (OleDbCommand command = new OleDbCommand(cmdStr)) { command.Parameters.AddWithValue("@Stock", product.Product_Stock); base.ExecuteSimpleQuery(command); } }
public void AddCustomerOrderDetail(CustomersOrdersDetail CusOrder)// פונקציה להוספת הזמנה למאגר ההזמנות המפורט { string cmdStr = "INSERT INTO CustomersOrdersDetail (OrderID,CustomerID,CustomerName,ProductID,ProductDescription,Quantity) VALUES (@OrderID,@CustomerID,@CustomerName,@ProductID,@ProductDescription,@Quantity)"; using (OleDbCommand command = new OleDbCommand(cmdStr)) { command.Parameters.AddWithValue("@OrderID", CusOrder.CustomerOrder_ID); command.Parameters.AddWithValue("@CustomerID", CusOrder.CustomerOrder_ClientID); command.Parameters.AddWithValue("@CustomerName", CusOrder.CustomerOrder_ClientName); command.Parameters.AddWithValue("@ProductID", CusOrder.CustomerOrder_ProductID); command.Parameters.AddWithValue("@ProductDescription", CusOrder.CustomerOrder_ProductDescription); command.Parameters.AddWithValue("@Quantity", CusOrder.CustomerOrder_Quantity); base.ExecuteSimpleQuery(command); } }
public void RemoveCustomersOrderDetail(CustomersOrdersDetail CusOrderDet)//פונקציה למחיקת פרטי הזמנה בטבלת הזמנות מפורטות { string cmdStr = "DELETE FROM CustomersOrdersDetail WHERE OrderID = @OrderID"; using (OleDbCommand command = new OleDbCommand(cmdStr)) { command.Parameters.AddWithValue("@OrderID", CusOrderDet.CustomerOrder_ID); command.Parameters.AddWithValue("@CustomerID", CusOrderDet.CustomerOrder_ClientID); command.Parameters.AddWithValue("@CustomerName", CusOrderDet.CustomerOrder_ClientName); command.Parameters.AddWithValue("@ProductID", CusOrderDet.CustomerOrder_ProductID); command.Parameters.AddWithValue("@ProductDescription", CusOrderDet.CustomerOrder_ProductDescription); command.Parameters.AddWithValue("@Quantity", CusOrderDet.CustomerOrder_Quantity); base.ExecuteSimpleQuery(command); } }