Ejemplo n.º 1
0
        public string IWantToSupplyAdd(QueryCommon <IWantToSupplyQuery> query)
        {
            Result_Msg res = new Result_Msg();

            try
            {
                Result_Model <IWantToSupply> resIWantToSupply = supplyService.GetObjectById_Web_Supply(query.ParamInfo.IWantToBuyID, base.CurrentUser.Id);
                Result_Model <IWantToBuy>    resIWantToBuy    = supplyService.GetObjectById_Web_Buy(query.ParamInfo.IWantToBuyID);
                DateTime now = DateTime.Now;

                query.ParamInfo.PurchaseNum    = resIWantToBuy.Model.PurchaseNum;
                query.ParamInfo.Unit           = resIWantToBuy.Model.Unit;
                query.ParamInfo.TypeOfCurrency = resIWantToBuy.Model.TypeOfCurrency;
                query.ParamInfo.SupplierID     = base.CurrentUser.Id;

                query.ParamInfo.CreateDate = now;
                query.ParamInfo.UpdateDate = now;
                query.ParamInfo.BidDate    = now;

                if (resIWantToSupply.Msg.IsSuccess == false)
                {
                    //记录不存在:新增记录
                    res = supplyService.AddIWantToSupply(query);
                }
                else
                {
                    //记录已存在:更新记录
                    res = supplyService.UpdateSupply(query);
                }
                return(Newtonsoft.Json.JsonConvert.SerializeObject(res));
            }
            catch (Exception ex)
            {
                throw;
            }
        }