예제 #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;
            }
        }
예제 #2
0
        /// <summary>
        /// 根据IWantToBuyId , supplierId 获取当前登录供应商的竞价信息
        /// </summary>
        /// <param name="iWantToBuy"></param>
        /// <param name="supplierId"></param>
        /// <returns></returns>
        public Result_Model <Result_IWantToSupply> GetObjectById_Web_Supply(long iWantToBuy, long supplierId)
        {
            var listHash = hashSet.Get_DictionariesList();

            Result_Model <Result_IWantToSupply> res = new Result_Model <Result_IWantToSupply>()
            {
                Msg = new Result_Msg()
                {
                },
                Model = new Result_IWantToSupply()
            };
            Result_Model <IWantToSupply> model = iWantToBuyService.GetObjectById_Web_Supply(iWantToBuy, supplierId);

            if (model.Msg.IsSuccess)
            {
                res.Model = new Result_IWantToSupply()
                {
                    Id           = model.Model.Id,
                    IWantToBuyID = model.Model.IWantToBuyID,
                    PurchaseNum  = model.Model.PurchaseNum.ToString(),
                    UnitPrice    = model.Model.UnitPrice,
                    Quantity     = model.Model.Quantity,
                    TotalPrice   = model.Model.TotalPrice,
                    Unit         = model.Model.Unit,

                    Status             = model.Model.Status,
                    SupplierID         = model.Model.SupplierID,
                    CreateDate         = model.Model.CreateDate.ToString("yyyy-MM-dd hh:mm"),
                    LatestDeliveryTime = model.Model.LatestDeliveryTime.ToString("yyyy-MM-dd hh:mm"),
                    UpdateDate         = model.Model.UpdateDate.ToString("yyyy-MM-dd hh:mm"),
                    BidDate            = model.Model.BidDate.ToString("yyyy-MM-dd hh:mm"),
                    TypeOfCurrency     = listHash.Where(y => y.DictionaryTypeId == 1 && y.DValue == model.Model.TypeOfCurrency.ToString()).FirstOrDefault().Remarks,
                };
            }
            else
            {
                res.Msg = model.Msg;
            }
            return(res);
        }