Exemplo n.º 1
0
        public void TestMethod3()
        {
            #region 付款条款
            //新增
            PaymentSearchDTO searchdto = new PaymentSearchDTO();
            testservice.GetPaymentList(searchdto);
            PaymentOperateDTO adddto = new PaymentOperateDTO();
            adddto.PayName = "单元测试付款条款名称";
            var addresult = testservice.AddPayment(adddto);

            var resultlist1 = testservice.GetPaymentList(searchdto);;
            var target      = resultlist1.Where(m => m.PayName == "单元测试付款条款名称").FirstOrDefault();
            Assert.IsNotNull(target);

            //修改
            adddto.PayID   = target.PayID;
            adddto.PayName = "修改单元测试付款条款名称";
            adddto.UpType  = 1;
            var updateresult = testservice.UpdatePayment(adddto);
            var resultlist2  = testservice.GetPaymentList(searchdto);
            target = resultlist2.Where(m => m.PayName == "修改单元测试付款条款名称").FirstOrDefault();
            Assert.IsNotNull(target);

            //删除
            PaymentSearchDTO deletedto = new PaymentSearchDTO();
            deletedto.PayID = target.PayID;
            var deleteresult = testservice.DeletePayment(deletedto);
            var resultlist3  = testservice.GetPaymentList(searchdto);
            target = resultlist3.Where(m => m.PayID == target.PayID).FirstOrDefault();
            Assert.IsNull(target);
            #endregion
        }
Exemplo n.º 2
0
        public HttpResponseMessage DeletePayment(string PaymentSearchDTO)
        {
            PaymentSearchDTO dto = TransformHelper.ConvertBase64JsonStringToDTO <PaymentSearchDTO>(PaymentSearchDTO);

            ResultDTO <object> actionresult = new ResultDTO <object>();

            try
            {
                actionresult.SubmitResult = _IBaseInfoServices.DeletePayment(dto);
            }
            catch (DbUpdateException)
            {
                actionresult.SubmitResult = false;
                actionresult.Message      = "此条信息已使用不可删除!";
            }
            catch (Exception ex)
            {
                actionresult.SubmitResult = false;
                actionresult.Message      = ex.Message;
            }

            HttpResponseMessage result = new HttpResponseMessage
            {
                Content = new StringContent(JsonConvert.SerializeObject(actionresult),
                                            System.Text.Encoding.GetEncoding("UTF-8"),
                                            "application/json")
            };

            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 导出付款条款
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ActionResult ExportPayment(PaymentSearchDTO dto)
        {
            string result = null;

            List <PaymentResultDTO> pp = null;

            pp = BaseInfoProvider.GetPaymentList(dto);

            string        strTemplateFile = Server.MapPath(@"~/TempLate/PaymentTemplate.xlsx");
            string        strGenarateDir  = Server.MapPath(@"~/TempFile");
            string        strGenarateFile = Guid.NewGuid().ToString("N") + ".xlsx";
            string        strExportFile   = strGenarateDir + "\\" + strGenarateFile;
            List <object> ratelist        = new List <object>();

            pp.ForEach(g =>
            {
                Models.Model.Excel.ExcelPayment er = new Models.Model.Excel.ExcelPayment();
                er.状态         = g.PayStatusStr;
                er.付款条款       = g.PayName;
                er.OracleName = g.OracleName;
                er.开始日期       = g.PayStartTime.HasValue ? g.PayStartTime.Value.ToString("yyyy-MM-dd") : null;
                er.结束日期       = g.PayEndTime.HasValue ? g.PayEndTime.Value.ToString("yyyy-MM-dd") : null;
                ratelist.Add(er);
            });

            if (Common.ExcelHelper.Export(strTemplateFile, strGenarateDir, strGenarateFile, ratelist, "Sheet1"))
            {
                result = strGenarateFile;
            }

            return(Json(result));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 查询付款条款信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ActionResult GetPaymentList(PaymentSearchDTO dto)
        {
            List <PaymentResultDTO> result = null;

            result = BaseInfoProvider.GetPaymentList(dto);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 得到所有付款条款信息
        /// </summary>
        /// <returns></returns>
        public static List <PaymentResultDTO> GetPaymentList(PaymentSearchDTO dto)
        {
            List <PaymentResultDTO> result = null;

            result = GetAPI <List <PaymentResultDTO> >(WebConfiger.MasterDataServicesUrl + "Payment?PaymentSearchDTO=" + TransformHelper.ConvertDTOTOBase64JsonString(dto));

            return(result);
        }
Exemplo n.º 6
0
        public HttpResponseMessage GetPaymentList(string PaymentSearchDTO)
        {
            PaymentSearchDTO        dto          = TransformHelper.ConvertBase64JsonStringToDTO <PaymentSearchDTO>(PaymentSearchDTO);
            List <PaymentResultDTO> actionresult = new List <PaymentResultDTO>();

            actionresult = _IBaseInfoServices.GetPaymentList(dto);

            HttpResponseMessage result = new HttpResponseMessage
            {
                Content = new StringContent(JsonConvert.SerializeObject(actionresult),
                                            System.Text.Encoding.GetEncoding("UTF-8"),
                                            "application/json")
            };

            return(result);
        }
Exemplo n.º 7
0
        public List <Payment> GetPayments(PaymentSearchDTO ps)
        {
            var list = (from p in this.Get()
                        where (ps.PaymentID == null || p.ID == ps.PaymentID) &&
                        (ps.PersonID == null ||
                         (p.PersonID != null && p.PersonID == ps.PersonID) ||
                         (p.Loan != null && p.Loan.LoanRequest.PersonID == ps.PersonID) ||
                         (p.LoanItem != null && p.LoanItem.Loan.LoanRequest.PersonID == ps.PersonID)) &&
                        (ps.PaymentTypeCode == null || p.PaymentTypeCode == ps.PaymentTypeCode) &&
                        ((ps.SettingCode == null) || p.Loan.SettingCode == ps.SettingCode) &&
                        (ps.FromAmount == null || p.Amount >= ps.FromAmount.Value && p.Amount <= ps.ToAmount.Value) &&
                        (ps.FromDate == null || p.PaymentDateTime >= ps.FromDate.Value && p.PaymentDateTime <= ps.ToDate.Value)
                        orderby p.ID
                        select p).ToList();

            return(list);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 删除付款条款信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ActionResult DeletePayment(PaymentSearchDTO dto)
        {
            ResultData <object> result = new ResultData <object>();
            UserLoginDTO        user   = (UserLoginDTO)Session["UserLoginInfo"];

            dto.ModifyUser = user.FullName;
            try
            {
                result = BaseInfoProvider.DeletePayment(dto);
            }
            catch (Exception ex)
            {
                result.SubmitResult = false;
                result.Message      = ex.Message;
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 9
0
        /// <summary>
        /// 得到所有付款条款信息
        /// </summary>
        /// <returns></returns>
        public List <PaymentResultDTO> GetPaymentList(PaymentSearchDTO dto)
        {
            List <PaymentResultDTO> result = null;
            var tcdmse = SingleQueryObject.GetObj();
            var pp     = tcdmse.master_PaymentInfo.AsNoTracking().Where(p => p.PayID != null);

            if (dto.DistributorID != null)
            {
                pp = pp.Where(p => p.master_DistributorPayInfo.Any(m => m.DistributorID == dto.DistributorID));
            }
            if (!string.IsNullOrEmpty(dto.SearchText))
            {
                pp = pp.Where(p => (p.PayName.Contains(dto.SearchText) ||
                                    (p.OracleName.Contains(dto.SearchText))));
            }

            result = Mapper.Map <List <master_PaymentInfo>, List <PaymentResultDTO> >(pp.ToList());

            return(result);
        }
Exemplo n.º 10
0
        public void TestMethod1()
        {
            //付款条款
            //新增
            PaymentSearchDTO searchdto = new PaymentSearchDTO();
            var searchdtostr           = TransformHelper.ConvertDTOTOBase64JsonString(searchdto);

            testcontroller.GetPaymentList(searchdtostr);
            PaymentOperateDTO adddto = new PaymentOperateDTO();

            adddto.PayName = "单元测试付款条款名称";
            var addresult   = JsonConvert.DeserializeObject <ResultDTO <object> >(testcontroller.AddPayment(adddto).Content.ReadAsStringAsync().Result);
            var resultlist1 = JsonConvert.DeserializeObject <List <PaymentResultDTO> >(testcontroller.GetPaymentList(searchdtostr).Content.ReadAsStringAsync().Result);
            var target      = resultlist1.Where(m => m.PayName == "单元测试付款条款名称").FirstOrDefault();

            Assert.IsNotNull(target);

            //修改
            adddto.PayID   = target.PayID;
            adddto.PayName = "修改单元测试付款条款名称";
            adddto.UpType  = 1;
            var updateresult = JsonConvert.DeserializeObject <ResultDTO <object> >(testcontroller.UpdatePayment(adddto).Content.ReadAsStringAsync().Result);
            var resultlist2  = JsonConvert.DeserializeObject <List <PaymentResultDTO> >(testcontroller.GetPaymentList(searchdtostr).Content.ReadAsStringAsync().Result);

            target = resultlist2.Where(m => m.PayName == "修改单元测试付款条款名称").FirstOrDefault();
            Assert.IsNotNull(target);

            //删除
            PaymentSearchDTO deletedto = new PaymentSearchDTO();

            deletedto.PayID = target.PayID;
            var deletedtostr = TransformHelper.ConvertDTOTOBase64JsonString(deletedto);
            var deleteresult = JsonConvert.DeserializeObject <ResultDTO <object> >(testcontroller.DeletePayment(deletedtostr).Content.ReadAsStringAsync().Result);
            var resultlist3  = JsonConvert.DeserializeObject <List <PaymentResultDTO> >(testcontroller.GetPaymentList(searchdtostr).Content.ReadAsStringAsync().Result);

            target = resultlist3.Where(m => m.PayID == target.PayID).FirstOrDefault();
            Assert.IsNull(target);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 删除付款条款信息
        /// </summary>
        /// <returns></returns>
        public bool DeletePayment(PaymentSearchDTO dto)
        {
            bool result = false;

            using (var tcdmse = new Entities.TCDMS_MasterDataEntities())
            {
                var pp = tcdmse.master_PaymentInfo.Where(p => p.PayID == dto.PayID).FirstOrDefault();
                if (pp == null)
                {
                    throw new Exception("此条信息不存在!");
                }
                tcdmse.master_PaymentInfo.Remove(pp);
                // 记录日志
                this.AddLog(tcdmse, new LogData
                {
                    CurrentLogType = LogType.DELETE,
                    LogDetails     = "删除付款条款" + pp.PayName,
                    OpratorName    = dto.ModifyUser
                });
                result = tcdmse.SaveChanges() > 0;
            }

            return(result);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 删除付款条款信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public static ResultData <object> DeletePayment(PaymentSearchDTO dto)
        {
            ResultData <object> blResult = DeleteAPI <ResultData <object> >(WebConfiger.MasterDataServicesUrl + "Payment?PaymentSearchDTO=" + TransformHelper.ConvertDTOTOBase64JsonString(dto));

            return(blResult);
        }