Ejemplo n.º 1
0
        public string IWantToBuy_Update(QueryCommon <IWantToBuyQuery> query)
        {
            Result_Msg res = new Result_Msg()
            {
                IsSuccess = true
            };
            DateTime dtNow = DateTime.Now;

            query.ParamInfo.UpdateDate = dtNow;

            try
            {
                Result_Model <IWantToBuy> resIWantToBuy = iWantToBuyService.GetObjectById_Web_Buy(query.ParamInfo.Id);
                if (resIWantToBuy.Msg.IsSuccess)
                {
                    switch (resIWantToBuy.Model.Status)
                    {
                    case 0:
                        break;

                    case 1:
                        res.Message   = "“废弃采购”采购单不能修改!";
                        res.IsSuccess = false;
                        break;

                    case 2:
                        res.Message   = "“终止公示”采购单不能修改!";
                        res.IsSuccess = false;
                        break;

                    case 3:
                        res.Message   = "“已确定”采购单不能修改!";
                        res.IsSuccess = false;

                        break;

                    default:
                        break;
                    }
                    if (res.IsSuccess)
                    {
                        res = iWantToBuyService.IWantToBuy_Update(query);
                    }
                }
            }
            catch (Exception ex)
            {
                res.IsSuccess = false;
                res.Message   = ex.Message;
            }
            return(Newtonsoft.Json.JsonConvert.SerializeObject(res));
        }
Ejemplo n.º 2
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;
            }
        }