///<summary></summary> public static void Update(SupplyOrderItem supp) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),supp); return; } Crud.SupplyOrderItemCrud.Update(supp); }
///<summary></summary> public static long Insert(SupplyOrderItem supp){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { supp.SupplyOrderItemNum=Meth.GetLong(MethodBase.GetCurrentMethod(),supp); return supp.SupplyOrderItemNum; } return Crud.SupplyOrderItemCrud.Insert(supp); }
///<summary>Surround with try-catch.</summary> public static void DeleteObject(SupplyOrderItem supp){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),supp); return; } //validate that not already in use. Crud.SupplyOrderItemCrud.Delete(supp.SupplyOrderItemNum); }
///<summary></summary> public static void Update(SupplyOrderItem supp) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), supp); return; } Crud.SupplyOrderItemCrud.Update(supp); }
///<summary></summary> public static long Insert(SupplyOrderItem supp) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { supp.SupplyOrderItemNum = Meth.GetLong(MethodBase.GetCurrentMethod(), supp); return(supp.SupplyOrderItemNum); } return(Crud.SupplyOrderItemCrud.Insert(supp)); }
///<summary>Surround with try-catch.</summary> public static void DeleteObject(SupplyOrderItem supp) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), supp); return; } //validate that not already in use. Crud.SupplyOrderItemCrud.Delete(supp.SupplyOrderItemNum); }
private void butAddToOrder_Click(object sender,EventArgs e) { if(gridOrder.GetSelectedIndex()==-1){ MsgBox.Show(this,"Please select an order first."); return; } if(gridSupplyMain.SelectedIndices.Length==0){ MsgBox.Show(this,"Please select one or more supplies first."); return; } SupplyOrderItem item; List<long> itemNums=new List<long>(); List<Supply> skippedSupplies=new List<Supply>(); bool isSkipped; for(int i=0;i<gridSupplyMain.SelectedIndices.Length;i++){ isSkipped=false; for(int t=0;t<tableOrderItem.Rows.Count;t++){ if(listSupply[gridSupplyMain.SelectedIndices[i]].SupplyNum.ToString()==tableOrderItem.Rows[t]["SupplyNum"].ToString()) { isSkipped=true; break;; } } if(isSkipped){ skippedSupplies.Add(listSupply[gridSupplyMain.SelectedIndices[i]]); continue; } item=new SupplyOrderItem(); item.SupplyOrderNum=listOrder[gridOrder.GetSelectedIndex()].SupplyOrderNum; item.SupplyNum=listSupply[gridSupplyMain.SelectedIndices[i]].SupplyNum; item.Qty=1; item.Price=listSupply[gridSupplyMain.SelectedIndices[i]].Price; SupplyOrderItems.Insert(item); itemNums.Add(item.SupplyOrderItemNum); } if(gridSupplyMain.SelectedIndices.Length==1 && skippedSupplies.Count==1){ MsgBox.Show(this,"Selected supply is already on the order."); return; } else if(skippedSupplies.Count==gridSupplyMain.SelectedIndices.Length){ MsgBox.Show(this,"Selected supplies are already on the order."); return; } else if(skippedSupplies.Count>0){ MessageBox.Show(skippedSupplies.Count.ToString()+" "+Lan.g(this,"supplies were skipped because they are already on the order.")); } FillGridOrderItem(); tabControl.SelectedIndex=1; for(int i=0;i<tableOrderItem.Rows.Count;i++){ if(itemNums.Contains(PIn.Long(tableOrderItem.Rows[i]["SupplyOrderItemNum"].ToString()))){ gridOrderItem.SetSelected(i,true); } } }
private void butAddSupply_Click(object sender,EventArgs e) { if(gridOrders.GetSelectedIndex()==-1) { MsgBox.Show(this,"Please select a supply order to add items to first."); return; } FormSupplies FormSup = new FormSupplies(); FormSup.IsSelectMode = true; FormSup.SelectedSupplierNum = ListOrders[gridOrders.GetSelectedIndex()].SupplierNum; FormSup.ShowDialog(); if(FormSup.DialogResult!=DialogResult.OK) { return; } for(int i=0;i<FormSup.ListSelectedSupplies.Count;i++) { //check for existing---- if(itemExistsHelper(FormSup.ListSelectedSupplies[i])) { //MsgBox.Show(this,"Selected item already exists in currently selected order. Please edit quantity instead."); continue; } SupplyOrderItem orderitem = new SupplyOrderItem(); orderitem.SupplyNum = FormSup.ListSelectedSupplies[i].SupplyNum; orderitem.Qty=1; orderitem.Price = FormSup.ListSelectedSupplies[i].Price; orderitem.SupplyOrderNum = ListOrders[gridOrders.GetSelectedIndex()].SupplyOrderNum; //soi.SupplyOrderItemNum SupplyOrderItems.Insert(orderitem); } FillGridOrderItem(); }