///<summary></summary> public static void Update(SupplyOrder order) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),order); return; } Crud.SupplyOrderCrud.Update(order); }
///<summary></summary> public static long Insert(SupplyOrder order) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { order.SupplyOrderNum=Meth.GetLong(MethodBase.GetCurrentMethod(),order); return order.SupplyOrderNum; } return Crud.SupplyOrderCrud.Insert(order); }
///<summary></summary> public static void Update(SupplyOrder order) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), order); return; } Crud.SupplyOrderCrud.Update(order); }
///<summary></summary> public static long Insert(SupplyOrder order) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { order.SupplyOrderNum = Meth.GetLong(MethodBase.GetCurrentMethod(), order); return(order.SupplyOrderNum); } return(Crud.SupplyOrderCrud.Insert(order)); }
///<summary>No need to surround with try-catch.</summary> public static void DeleteObject(SupplyOrder order){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),order); return; } //validate that not already in use-no //delete associated orderItems string command="DELETE FROM supplyorderitem WHERE SupplyOrderNum="+POut.Long(order.SupplyOrderNum); Db.NonQ(command); Crud.SupplyOrderCrud.Delete(order.SupplyOrderNum); }
///<summary>No need to surround with try-catch.</summary> public static void DeleteObject(SupplyOrder order) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), order); return; } //validate that not already in use-no //delete associated orderItems string command = "DELETE FROM supplyorderitem WHERE SupplyOrderNum=" + POut.Long(order.SupplyOrderNum); Db.NonQ(command); Crud.SupplyOrderCrud.Delete(order.SupplyOrderNum); }
//Retotals all items attached to order and updates AmountTotal. public static SupplyOrder UpdateOrderPrice(long orderNum) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <SupplyOrder>(MethodBase.GetCurrentMethod(), orderNum)); } string command = "SELECT SUM(Qty*Price) FROM supplyorderitem WHERE SupplyOrderNum=" + orderNum; double amountTotal = PIn.Double(Db.GetScalar(command)); command = "SELECT * FROM supplyorder WHERE SupplyOrderNum=" + orderNum; SupplyOrder so = Crud.SupplyOrderCrud.SelectOne(command); so.AmountTotal = amountTotal; SupplyOrders.Update(so); return(so); }
private void butNewOrder_Click(object sender,EventArgs e) { if(listSupplier.Count==0) { MsgBox.Show(this,"Please add suppliers first. Use the menu at the top of this window."); return; } if(comboSupplier.SelectedIndex==-1) { MsgBox.Show(this,"Please select a supplier first."); return; } for(int i=0;i<listOrder.Count;i++){ if(listOrder[i].DatePlaced.Year>2200){ MsgBox.Show(this,"Not allowed to add a new order when there is already one pending. Please finish the other order instead."); return; } } SupplyOrder order=new SupplyOrder(); order.SupplierNum=listSupplier[comboSupplier.SelectedIndex].SupplierNum; order.IsNew=true; order.DatePlaced=new DateTime(2500,1,1); order.Note=""; SupplyOrders.Insert(order); FillGridOrder(); gridOrder.SetSelected(listOrder.Count-1,true); }
private void butNewOrder_Click(object sender,EventArgs e) { if(comboSupplier.SelectedIndex < 1) {//Includes no items or the ALL supplier being selected. MsgBox.Show(this,"Please select a supplier first."); return; } for(int i=0;i<ListOrders.Count;i++) { if(ListOrders[i].DatePlaced.Year>2200) { MsgBox.Show(this,"Not allowed to add a new order when there is already one pending. Please finish the other order instead."); return; } } SupplyOrder order=new SupplyOrder(); if(comboSupplier.SelectedIndex==0) {//Supplier "All". order.SupplierNum=0; } else {//Specific supplier selected. order.SupplierNum=ListSuppliers[comboSupplier.SelectedIndex-1].SupplierNum;//SelectedIndex-1 because "All" is first option. } order.IsNew=true; order.DatePlaced=new DateTime(2500,1,1); order.Note=""; SupplyOrders.Insert(order); ListOrdersAll=SupplyOrders.GetAll();//Refresh the list all. FillGridOrders(); gridOrders.SetSelected(ListOrders.Count-1,true); gridOrders.ScrollToEnd(); FillGridOrderItem(); }