Exemplo n.º 1
0
		///<summary></summary>
		public static long Insert(Supplier supp) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				supp.SupplierNum=Meth.GetLong(MethodBase.GetCurrentMethod(),supp);
				return supp.SupplierNum;
			}
			return Crud.SupplierCrud.Insert(supp);
		}
Exemplo n.º 2
0
		///<summary></summary>
		public static void Update(Supplier supp) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),supp);
				return;
			}
			Crud.SupplierCrud.Update(supp);
		}
Exemplo n.º 3
0
		private void butAdd_Click(object sender,EventArgs e) {
			Supplier supp=new Supplier();
			supp.IsNew=true;
			FormSupplierEdit FormS=new FormSupplierEdit();
			FormS.Supp=supp;
			FormS.ShowDialog();
			if(FormS.DialogResult==DialogResult.OK) {
				FillGrid();
			}
		}
Exemplo n.º 4
0
		///<summary>Surround with try-catch.</summary>
		public static void DeleteObject(Supplier supp){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),supp);
				return;
			}
			//validate that not already in use.
			string command="SELECT COUNT(*) FROM supplyorder WHERE SupplierNum="+POut.Long(supp.SupplierNum);
			int count=PIn.Int(Db.GetCount(command));
			if(count>0) {
				throw new ApplicationException(Lans.g("Supplies","Supplier is already in use on an order. Not allowed to delete."));
			}
			command="SELECT COUNT(*) FROM supply WHERE SupplierNum="+POut.Long(supp.SupplierNum);
			count=PIn.Int(Db.GetCount(command));
			if(count>0) {
				throw new ApplicationException(Lans.g("Supplies","Supplier is already in use on a supply. Not allowed to delete."));
			}
			Crud.SupplierCrud.Delete(supp.SupplierNum);
		}