Beispiel #1
0
        /// <summary>
        /// 保存/修改补助申请
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public BaseResponse <SubsidyView> Save(SubsidyView request)
        {
            var response = new BaseResponse <SubsidyView>();

            if (!string.IsNullOrEmpty(request.ApplyBy))
            {
                Mapper.CreateMap <SubsidyView, LTC_SUBSIDYREC>();
                var model = unitOfWork.GetRepository <LTC_SUBSIDYREC>().dbSet.FirstOrDefault(m => m.ID == request.Id);
                if (model == null)
                {
                    model = BuildModel(request);
                    //model = Mapper.Map<LTC_SUBSIDYREC>(request);
                    unitOfWork.GetRepository <LTC_SUBSIDYREC>().Insert(model);
                }
                else
                {
                    Mapper.Map(request, model);
                    unitOfWork.GetRepository <LTC_SUBSIDYREC>().Update(model);
                }
                try
                {
                    unitOfWork.Save();
                    response.ResultCode = (int)EnumResponseStatus.Success;
                }
                catch (Exception ex) {
                    throw new Exception(ex.ToString());
                }
            }
            else
            {
                response.ResultCode    = (int)EnumResponseStatus.Success;
                response.ResultMessage = "申请人不能为空!";
            }
            return(response);
        }
Beispiel #2
0
        public IHttpActionResult Post(SubsidyView baseRequest)
        {
            baseRequest.CreateBy   = SecurityHelper.CurrentPrincipal.EmpNo;
            baseRequest.CreateDate = DateTime.Now;
            baseRequest.OrgId      = SecurityHelper.CurrentPrincipal.OrgId;


            var response = service.SaveSubsidy(baseRequest);

            return(Ok(response));
        }
Beispiel #3
0
        private LTC_SUBSIDYREC BuildModel(SubsidyView model)
        {
            LTC_SUBSIDYREC svModel = new LTC_SUBSIDYREC()
            {
                APPLYBY       = "Mofel",
                APPLYDATE     = DateTime.Parse("2016-06-06"),
                CREATEBY      = "Admin",
                CREATEDATE    = DateTime.Now,
                DESCRIPTION   = "Test",
                ITEMNAME      = "补助一",
                NEXTAPPLYBY   = "Dennis",
                NEXTAPPLYDATE = DateTime.Now.AddDays(30),
                ORGID         = "1010101",
                FEENO         = 93249802341,
                REGNO         = 104
            };

            return(svModel);
        }