Esempio n. 1
0
 public void SaveSupplier(Sender sender, SaveSupplierArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             Supplier obj = new Supplier();
             obj.SupplierID = args.Supplier.SupplierID;
             if (op.LoadSupplierBySupplierID(obj) == 0)
             {
                 args.Supplier.Created    = DateTime.Now;
                 args.Supplier.CreatedBy  = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 args.Supplier.Modified   = DateTime.Now;
                 args.Supplier.ModifiedBy = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 op.InsertSupplier(args.Supplier);
             }
             else
             {
                 args.Supplier.Modified   = DateTime.Now;
                 args.Supplier.ModifiedBy = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 op.UpdateSupplierBySupplierID(args.Supplier);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 2
0
 public void SaveSupplier()
 {
     using (ProxyBE p = new ProxyBE())
     {
         try
         {
             if (Request["Province"] == "")
             {
                 throw new Exception("请选择省份");
             }
             if (Request["City"] == "请选择城市")
             {
                 throw new Exception("请选择城市");
             }
             Supplier supplier = p.Client.GetSupplier(null, parm.SupplierID);
             if (supplier == null)
             {
                 supplier            = new Supplier();
                 supplier.SupplierID = parm.SupplierID;
             }
             supplier.SupplierName = parm.SupplierName.Trim();
             supplier.LinkMan      = parm.LinkMan.Trim();
             supplier.SupplierCode = parm.SupplierCode.Trim();
             supplier.Email        = parm.Email.Trim();
             supplier.Mobile       = parm.Mobile.Trim();
             supplier.Tel          = parm.Tel.Trim();
             supplier.Category     = parm.Category.Trim();
             supplier.Remark       = parm.Remark.Trim();
             supplier.Province     = parm.Province;
             supplier.City         = parm.City;
             supplier.Address      = parm.Address.Trim();
             SaveSupplierArgs args = new SaveSupplierArgs();
             args.Supplier = supplier;
             p.Client.SaveSupplier(SenderUser, args);
             WriteSuccess();
         }
         catch (Exception ex)
         {
             WriteError(ex.Message, ex);
         }
     }
 }