Beispiel #1
0
        public void NewMaterialPrice()
        {
            using (ProxyBE p = new ProxyBE())
            {
                try
                {
                    var materialPrice = p.Client.GetMaterialQuotePrice(null, parm.MaterialID);
                    if (materialPrice != null)
                    {
                        WriteError("该材料已确定价格,请选择其他材料");
                    }
                    else
                    {
                        MaterialQuotePrice MaterialQuotePrice = new MaterialQuotePrice();
                        MaterialQuotePrice.MaterialID = parm.MaterialID;
                        MaterialQuotePrice.Price      = parm.Price;

                        SaveMaterialQuotePriceArgs args = new SaveMaterialQuotePriceArgs();
                        args.MaterialQuotePrice = MaterialQuotePrice;

                        p.Client.SaveMaterialQuotePrice(SenderUser, args);
                        WriteSuccess();
                    }
                }
                catch (Exception ex)
                {
                    WriteError(ex.Message, ex);
                }
            }
        }
 public void SaveMaterialQuotePrice(Sender sender, SaveMaterialQuotePriceArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             MaterialQuotePrice obj = new MaterialQuotePrice();
             obj.MaterialID = args.MaterialQuotePrice.MaterialID;
             if (op.LoadMaterialQuotePriceByMaterialID(obj) == 0)
             {
                 op.InsertMaterialQuotePrice(args.MaterialQuotePrice);
             }
             else
             {
                 op.UpdateMaterialQuotePriceByMaterialID(args.MaterialQuotePrice);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Beispiel #3
0
        public void ModifyMaterialPrice()
        {
            try
            {
                using (ProxyBE p = new ProxyBE())
                {
                    MaterialQuotePrice materialQuotePrice = p.Client.GetMaterialQuotePrice(SenderUser, parm.MaterialID);
                    if (materialQuotePrice == null)
                    {
                        materialQuotePrice.MaterialID = parm.MaterialID;
                    }
                    materialQuotePrice.Price = parm.Price;

                    SaveMaterialQuotePriceArgs args = new SaveMaterialQuotePriceArgs();
                    args.MaterialQuotePrice = materialQuotePrice;

                    p.Client.SaveMaterialQuotePrice(SenderUser, args);
                    WriteSuccess();
                }
            }
            catch (Exception ex)
            {
                WriteError(ex.Message, ex);
            }
        }