Esempio n. 1
0
		///<summary></summary>
		public static void Update(SupplyOrder order) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),order);
				return;
			}
			Crud.SupplyOrderCrud.Update(order);
		}
Esempio n. 2
0
		///<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);
		}
Esempio n. 3
0
 ///<summary></summary>
 public static void Update(SupplyOrder order)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         Meth.GetVoid(MethodBase.GetCurrentMethod(), order);
         return;
     }
     Crud.SupplyOrderCrud.Update(order);
 }
Esempio n. 4
0
 ///<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));
 }
Esempio n. 5
0
		///<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);
		}
Esempio n. 6
0
        ///<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);
        }
Esempio n. 7
0
        //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);
        }
Esempio n. 8
0
 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();
		}