private void GetContractInfo(string key) { string contactno = this.key; this.submodel = new SubscribeBLL().GetSubscribeInfoContractNo(contactno); if (submodel.AddDate < Convert.ToDateTime("2016-3-11")) { companyName = "广东俊特团贷网络信息服务股份有限公司"; } else { companyName = "东莞团贷网互联网科技服务有限公司"; } this.subBasicModel = userbll.GetUserBasicInfoModelById(submodel.SubscribeUserId.Value); //基本信息 this.proModel = projectbll.GetProjectDetailInfo(submodel.ProjectId.Value); //标信息 this.publisherModel = userbll.GetUserBasicInfoModelById(proModel.UserId.Value); var Params = new Dapper.DynamicParameters(); Params.Add("@ProjectId", proModel.Id); string selSQL = @"select * from fq_ItemSetsProject with(nolock) where ProjectId=@ProjectId"; itemProjectInfo = PublicConn.QuerySingle <Fq_ItemSetsProjectInfo>(selSQL, ref Params); RepaymentTypeDesc = ToolStatus.ConvertRepaymentType(proModel.RepaymentType.Value); if (WebUserAuth.UserId == publisherModel.Id) { this.subBasicModel.RealName = StringHandler.MaskStartPre(subBasicModel.RealName, 1); //出借人 this.subBasicModel.IdentityCard = StringHandler.MaskCardNo(subBasicModel.IdentityCard); //出借人身份证号 } else { this.itemProjectInfo.RealName = StringHandler.MaskStartPre(itemProjectInfo.RealName, 1); //借款人 this.itemProjectInfo.IdentityCard = StringHandler.MaskCardNo(itemProjectInfo.IdentityCard); //出借人身份证号 } UserEnterpriseInfo userEnterprise = new Common.Contract().GetBorrowerGuaranteeEnterprise(proModel.UserId.Value, proModel.AddDate.Value, proModel.Type.Value); if (userEnterprise != null) { assureModel = new Common.Contract().GetAssureOrganizationByUserId(userEnterprise.UserId); } else { int gid = 0; int.TryParse(proModel.Guarantors, out gid); assureModel = new Common.Contract().GetAssureOrganizationById(gid); if (gid == 1 && DateTime.Now < DateTime.Parse("2013-11-27")) { assureModel.FullName = "东莞市俊特团贷网络信息服务有限公司"; } } //印章小图片 if (assureModel != null) { this.assureModel.image = this.GetSmallImage(this.assureModel.image); } }
protected string GetRepaymentTypeDesc(int repaymentType) { string repaymentTypeDesc = string.Empty; if (repaymentType == 1) { repaymentTypeDesc = "乙方须借款到期一次性归还全部借款本金及利息"; } else if (repaymentType == 2) { repaymentTypeDesc = "乙方须每月付息一次,借款到期一次性归还全部借款本金及剩余部分利息"; } else if (repaymentType == 4) { repaymentTypeDesc = "乙方须出借时支付利息,借款到期一次性归还全部借款本金"; } else { repaymentTypeDesc = ToolStatus.ConvertRepaymentType(repaymentType); } return(repaymentTypeDesc); }
private void GetContractInfo(string key) { string contactno = this.key; this.submodel = new SubscribeBLL().GetSubscribeInfoContractNo(contactno); if (submodel.AddDate < Convert.ToDateTime("2016-3-11")) { companyName = "广东俊特团贷网络信息服务股份有限公司"; } else { companyName = "东莞团贷网互联网科技服务有限公司"; } this.subBasicModel = userbll.GetUserBasicInfoModelById(submodel.SubscribeUserId.Value); this.proModel = projectbll.GetProjectDetailInfo(submodel.ProjectId.Value); //标信息 this.publisherModel = userbll.GetUserBasicInfoModelById(proModel.UserId.Value); //获取发布人信息 //普惠借款人基本信息 string sql = "select * from fq_ItemSetsProject with(nolock) where ProjectId=@ProjectId"; var dyParams = new Dapper.DynamicParameters(); dyParams.Add("@ProjectId", proModel.Id); itemProjectInfo = PublicConn.QuerySingle <Fq_ItemSetsProjectInfo>(sql, ref dyParams); RepaymentTypeDesc = ToolStatus.ConvertRepaymentType(proModel.RepaymentType.Value); if (WebUserAuth.UserId == publisherModel.Id) { this.subBasicModel.RealName = StringHandler.MaskStartPre(subBasicModel.RealName, 1); //出借人 this.subBasicModel.IdentityCard = StringHandler.MaskCardNo(subBasicModel.IdentityCard); //出借人身份证号 } else { this.itemProjectInfo.RealName = StringHandler.MaskStartPre(itemProjectInfo.RealName, 1); //借款人 this.itemProjectInfo.IdentityCard = StringHandler.MaskCardNo(itemProjectInfo.IdentityCard); //出借人身份证号 } UserEnterpriseInfo userEnterprise = GetBorrowerGuaranteeEnterprise(proModel.UserId.Value, proModel.AddDate.Value); if (userEnterprise != null) { // this.assureModel = this.db.AssureOrganization.FirstOrDefault(p => p.UserId == userEnterprise.UserId); string sql1 = "select * from AssureOrganization with(nolock) where UserId=@UserId"; var dyParams1 = new Dapper.DynamicParameters(); dyParams1.Add("@UserId", userEnterprise.UserId); PublicConn.QuerySingle <AssureOrganizationInfo>(sql1, ref dyParams1); } else { if (!string.IsNullOrEmpty(proModel.Guarantors)) { int gid = 0; int.TryParse(proModel.Guarantors, out gid); string sql2 = "select * from AssureOrganization with(nolock) where Id=@Id"; var dyParams2 = new Dapper.DynamicParameters(); dyParams2.Add("@Id", gid); assureModel = PublicConn.QuerySingle <AssureOrganizationInfo>(sql2, ref dyParams2); } } //印章小图片 if (assureModel != null) { this.assureModel.image = this.GetSmallImage(this.assureModel.image); } // string orgsql = " select c.RealName from dbo.fq_ItemSetsProject as a with(nolock) inner join dbo.Fq_OrgItemSets as b with(nolock) on a.itemid = b.id inner join UserBasicInfo as c with(nolock) on b.orgid = c.id where projectid = @projectid"; //args = new SqlParameter[] { new SqlParameter("projectid", proModel.Id) }; //org = db.ExecuteStoreQuery<Org>(orgsql, args).FirstOrDefault(); }
//加载转让信息 public void InitApplicationTransfer() { //TuanDB.JunTeEntities dbRead = TuanDB.JunTeEntities.Read(); Guid subscribeId = Guid.Empty; Guid.TryParse(Context.Request["id"], out subscribeId); Guid userId = WebUserAuth.UserId.Value; //TuanDB.Subscribe subscribeEntity = dbRead.Subscribe.FirstOrDefault(p => p.Id == subscribeId && p.SubscribeUserId == userId); var subscribeEntity = new SubscribeBLL().GetSubscribeById(subscribeId); if (subscribeEntity == null) { PrintJson("0", "数据异常"); return; } ProjectBLL bll = new ProjectBLL(); ProjectDetailInfo projectEntity = bll.GetProjectDetailInfo(subscribeEntity.ProjectId.Value); //Project projectEntity = dbRead.Project.FirstOrDefault(p => p.Id == subscribeEntity.ProjectId); if (projectEntity == null) { PrintJson("0", "数据异常"); return; } InitApplicationtransferInfo initApplicationtransferEntity = new InitApplicationtransferInfo(); initApplicationtransferEntity.Title = projectEntity.Title; initApplicationtransferEntity.TypeName = ToolStatus.ConvertProjectType(projectEntity.Type ?? 0); initApplicationtransferEntity.InterestRate = projectEntity.InterestRate ?? 0; initApplicationtransferEntity.RepaymentTypeName = ToolStatus.ConvertRepaymentType(projectEntity.RepaymentType ?? 0); initApplicationtransferEntity.Deadline = projectEntity.Deadline ?? 0; initApplicationtransferEntity.LowerUnit = projectEntity.LowerUnit ?? 0; initApplicationtransferEntity.SubscribeShares = subscribeEntity.SubscribeShares ?? 0; initApplicationtransferEntity.Amount = "0"; initApplicationtransferEntity.InterestAmount = "0"; //var subscribeDetailList = dbRead.SubscribeDetail.Where(p => p.SubscribeId == subscribeId); var subscribeDetailList = new SubscribeDetailBLL().GetSubscribeDetailListBySubscribeId(subscribeId); if (subscribeDetailList.Count() > 0) { initApplicationtransferEntity.Amount = ToolStatus.ConvertLowerMoney(subscribeDetailList.Sum(p => p.Amount)); initApplicationtransferEntity.InterestAmount = ToolStatus.ConvertLowerMoney(subscribeDetailList.Sum(p => p.InterestAmout.Value)); } initApplicationtransferEntity.RefundedMonths = subscribeEntity.RefundedMonths ?? 0; initApplicationtransferEntity.TotalRefundMonths = subscribeEntity.TotalRefundMonths ?? 0; initApplicationtransferEntity.PreCycDate = subscribeEntity.PreCycDate.HasValue ? subscribeEntity.PreCycDate.Value.ToString("yyyy-MM-dd") : ""; string sql = string.Empty; if (projectEntity.RepaymentType == 1)//到期还本息 { sql = "SELECT dateDiff(day,@BeginDate,getdate())-1"; } else { sql = "SELECT dateDiff(day,dbo.f_GetRepaymentAdvance_Date(@BeginDate,@Month),getdate())"; } var para = new Dapper.DynamicParameters(); para.Add("@BeginDate", subscribeEntity.AddDate); para.Add("@Month", subscribeEntity.RefundedMonths); initApplicationtransferEntity.Days = PublicConn.QuerySingle <int>(sql, ref para); //using (SqlConnection connection = new SqlConnection(TuanDai.Config.BaseConfig.ConnectionString)) //{ // connection.Open(); // int day = connection.Query<int>(sql, new { BeginDate = subscribeEntity.AddDate, Month = subscribeEntity.RefundedMonths }).First(); // connection.Close(); // connection.Dispose(); // initApplicationtransferEntity.Days = day; //} initApplicationtransferEntity.result = 1; PrintJson(initApplicationtransferEntity); }
//获取债权转让列表 public void GetZQZRCanTransferList() { int pageSize = GlobalUtils.PageSize; int pageIndex = Tool.SafeConvert.ToInt32(Context.Request.Form["pageIndex"], 1); string pStatus = WEBRequest.GetFormString("status"); if (pageIndex < 1) { pageIndex = 1; } Guid userid = WebUserAuth.UserId.HasValue ? WebUserAuth.UserId.Value : Guid.Empty; if (userid == Guid.Empty) { PrintJson("0", "您还未登录!"); return; } int outputStatus = 0; if (pStatus == "CanTran") { #region 可转让标 int count = 0; List <NegotiableInfo> list = new TuanDai.PortalSystem.BLL.SubScriberansferBLL().GetNegotiableList(userid, 3, pageIndex, pageSize, out outputStatus, out count); List <NegotiableInfoExt> dataList = new List <NegotiableInfoExt>(); if (outputStatus == -1) { PrintJson("0", "有发净股标或者逾期垫付未还"); } else { foreach (NegotiableInfo item in list) { NegotiableInfoExt extItem = new NegotiableInfoExt(); extItem.ProjectId = item.ProjectId; extItem.Id = item.Id; extItem.Title = item.Title; extItem.TotalRefundMonths = item.TotalRefundMonths; extItem.RefundedMonths = item.RefundedMonths; extItem.TypeName = ToolStatus.ConvertProjectType(item.Type); extItem.DueInAmount = ToolStatus.ConvertLowerMoney(item.Amount + item.InterestAmout); extItem.PreCycDateStr = item.PreCycDate.ToString("yyyy-MM-dd"); extItem.TenderModeName = GetTenderMode(item.TenderMode); extItem.InterestRate = ToolStatus.DeleteZero(item.InterestRate); extItem.RepaymentType = ToolStatus.ConvertRepaymentType(item.RepaymentType); dataList.Add(extItem); } } if (count == 0) { PrintJson("0", "没有找到数据"); return; } int pageCount = GetPageCount(count, pageSize); var objData = new { result = "1", msg = "", pageCount = pageCount, list = dataList }; PrintJson(objData); #endregion } else if (pStatus == "Traning") { #region 转让中 int transferCount = 0; List <SubScribeTransferInfo> tempList = new TuanDai.PortalSystem.BLL.SubScriberansferBLL().GetSubScribeTransferList(userid, 1, pageSize, pageIndex, out transferCount); if (transferCount == 0) { PrintJson("0", "没有找到数据"); return; } int pageCount = GetPageCount(transferCount, pageSize); List <SubScribeTransferInfoExt> dataList = new List <SubScribeTransferInfoExt>(); foreach (SubScribeTransferInfo item in tempList) { SubScribeTransferInfoExt extItem = new SubScribeTransferInfoExt(); extItem.ProjectId = item.ProjectId; extItem.Id = item.Id; extItem.Title = item.Title; extItem.SumTransferAmount = ToolStatus.ConvertLowerMoney(item.sumTransferAmount); extItem.ProgressStr = Convert.ToDouble(item.Progress).ToString("f1"); extItem.LastTimeStr = item.remainTime; extItem.AddDate = item.AddDate; extItem.TotalAmountStr = ToolStatus.ConvertLowerMoney(item.TotalAmount); DateTime EndTransferDate = DateTime.Parse(item.AddDate.ToString("yyyy-MM-dd") + " 23:59:59"); if (DateTime.Now > EndTransferDate) { extItem.LastSecond = 0; } else { extItem.LastSecond = Convert.ToInt32((EndTransferDate - DateTime.Now).TotalSeconds); } dataList.Add(extItem); } var objData = new { result = "1", msg = "", pageCount = pageCount, list = dataList }; PrintJson(objData); #endregion } else { #region 已完成 int transferCount = 0; List <SubScribeTransferInfo> tempList = new TuanDai.PortalSystem.BLL.SubScriberansferBLL().GetSubScribeTransferList(userid, 2, pageSize, pageIndex, out transferCount); if (transferCount == 0) { PrintJson("0", "没有找到数据"); return; } int pageCount = GetPageCount(transferCount, pageSize); List <SubScribeTransferInfoExt> dataList = new List <SubScribeTransferInfoExt>(); foreach (SubScribeTransferInfo item in tempList) { SubScribeTransferInfoExt extItem = new SubScribeTransferInfoExt(); extItem.ProjectId = item.ProjectId; extItem.Id = item.Id; extItem.Title = item.Title; extItem.SumTransferAmount = ToolStatus.ConvertLowerMoney(item.sumTransferAmount); extItem.ProgressStr = Convert.ToDouble(item.Progress).ToString("f1"); dataList.Add(extItem); } var objData = new { result = "1", msg = "", pageCount = pageCount, list = dataList }; PrintJson(objData); #endregion } }
/// <summary> /// 获取合同信息 /// add by huangbinglai /// 20160326 /// </summary> /// <param name="key">合同编号</param> private void GetContractInfo(string key) { string contactno = this.key; this.submodel = new SubscribeBLL().GetSubscribeInfoContractNo(contactno); string sql = @"select * from project where UserId=@UserId and Id=@Id"; Dapper.DynamicParameters dyParams = new Dapper.DynamicParameters(); dyParams.Add("@UserId", WebUserAuth.UserId); dyParams.Add("@Id", submodel.ProjectId); ProjectDetailInfo projectModel = PublicConn.QuerySingle <ProjectDetailInfo>(sql, ref dyParams); if (this.submodel.SubscribeUserId != WebUserAuth.UserId && projectModel == null) { HttpContext.Current.Response.Write("对不起,您没有权限查看此合同。"); HttpContext.Current.Response.End(); } if (submodel.AddDate < Convert.ToDateTime("2016-3-11")) { companyName = "广东俊特团贷网络信息服务股份有限公司"; } else { companyName = "东莞团贷网互联网科技服务有限公司"; } this.subBasicModel = userbll.GetUserBasicInfoModelById(submodel.SubscribeUserId.Value); //获取承接人信息 this.proModel = projectbll.GetProjectDetailInfo(submodel.ProjectId.Value); //标信息 this.publisherModel = userbll.GetUserBasicInfoModelById(proModel.UserId.Value); //获取发布人信息 sql = @"select u.OrgTypeId,u.OrgId,ISNULL(o.SubTypeId,0) AS SubTypeId from fq_UserApply u INNER JOIN fq_Organization o ON u.OrgId=o.OrgId where u.ProjectId=@ProjectId"; dyParams = new Dapper.DynamicParameters(); dyParams.Add("@ProjectId", submodel.ProjectId); mOrgInfo = PublicConn.QuerySingle <OrgInfo>(sql, ref dyParams); if (mOrgInfo.OrgTypeId == 5)//分期乐 { if (mOrgInfo.SubTypeId == 3) { #region 小树时代 xssdmodel = new xssdcontract(); xssdmodel.ProContactNo = contactno; //合同 if (proModel.UserId == WebUserAuth.UserId) //借款人查看 { xssdmodel.InvestUserName = StringHandler.MaskStartPre(subBasicModel.RealName, 1); //出借人 xssdmodel.InvestCardNo = StringHandler.MaskCardNo(subBasicModel.IdentityCard); //出借人身份证号 xssdmodel.OrgName = publisherModel.RealName; //机构名称 xssdmodel.OrgCode = publisherModel.IdentityCard; //机构编码 } else { xssdmodel.InvestUserName = subBasicModel.RealName; //出借人 xssdmodel.InvestCardNo = subBasicModel.IdentityCard; //出借人身份证号 xssdmodel.OrgName = publisherModel.RealName; // StringHandler.MaskStartPre(publisherModel.RealName, 1); //机构名称 xssdmodel.OrgCode = publisherModel.IdentityCard; // StringHandler.MaskCardNo(publisherModel.IdentityCard); //机构编码 } Dapper.DynamicParameters para1 = new Dapper.DynamicParameters(); para1.Add("@OrgId", publisherModel.Id); sql = "select OrgLegalPerson from fq_Organization where OrgId=@OrgId"; string OrgLegalPerson = PublicConn.QuerySingle <string>(sql, ref para1); xssdmodel.OrgLegalPerson = string.IsNullOrEmpty(OrgLegalPerson) ? "" : proModel.UserId == WebUserAuth.UserId ? OrgLegalPerson : StringHandler.MaskStartPre(OrgLegalPerson, 1); //机构法定代表人 xssdmodel.Grade = proModel.Grade; xssdmodel.SubContractNo = submodel.ContractNo; xssdmodel.Amount = submodel.Amount.Value.ToString("N"); //借款金额小写 xssdmodel.InterestAmount = submodel.InterestAmount.Value.ToString("N"); //借款利息小写 xssdmodel.DeadLine = proModel.Deadline.Value.ToString(); //借款期限 decimal PerAmount = Math.Round((submodel.Amount.Value + submodel.InterestAmount.Value) / proModel.Deadline.Value, 2); xssdmodel.PerAmount = PerAmount.ToString("N"); //每月回款金额 xssdmodel.Rate = proModel.InterestRate.Value.ToString(); //利率 //最后回款时间 sql = "select MAX(CycDate) CycDate from SubscribeDetail where SubscribeId=@SubscribeId"; Dapper.DynamicParameters para2 = new Dapper.DynamicParameters(); para2.Add("@SubscribeId", submodel.Id); DateTime?MAXDate = PublicConn.QuerySingle <DateTime?>(sql, ref para2); DateTime LastDate = MAXDate ?? DateTime.Now.AddMonths(proModel.Deadline ?? 0); xssdmodel.ExpireYear = LastDate.Year.ToString(); xssdmodel.ExpireMonth = LastDate.Month.ToString(); xssdmodel.ExpireDay = LastDate.Day.ToString(); xssdmodel.BorrowSignYear = submodel.AddDate.Value.Year.ToString();//签字日期 xssdmodel.BorrowSignMonth = submodel.AddDate.Value.Month.ToString(); xssdmodel.BorrowSignDay = submodel.AddDate.Value.Day.ToString(); #endregion } else if (mOrgInfo.SubTypeId == 5) { #region 你我金融 kldmodel = new Kldcontract(); kldmodel.ProContactNo = contactno; if (proModel.UserId == WebUserAuth.UserId) //借款人查看 { kldmodel.InvestUserName = StringHandler.MaskStartPre(subBasicModel.RealName, 1); //出借人 kldmodel.InvestCardNo = StringHandler.MaskCardNo(subBasicModel.IdentityCard); //出借人身份证号 kldmodel.OrgName = publisherModel.RealName; //机构名称 kldmodel.OrgCode = publisherModel.IdentityCard; //机构编码 } else { kldmodel.InvestUserName = subBasicModel.RealName; //出借人 kldmodel.InvestCardNo = subBasicModel.IdentityCard; //出借人身份证号 kldmodel.OrgName = publisherModel.RealName; // StringHandler.MaskStartPre(publisherModel.RealName, 1); //机构名称 kldmodel.OrgCode = publisherModel.IdentityCard; // StringHandler.MaskCardNo(publisherModel.IdentityCard); //机构编码 } Dapper.DynamicParameters para2 = new Dapper.DynamicParameters(); para2.Add("@OrgId", publisherModel.Id); sql = "select OrgLegalPerson from fq_Organization where OrgId=@OrgId"; string OrgLegalPerson = PublicConn.QuerySingle <string>(sql, ref para2); kldmodel.OrgLegalPerson = string.IsNullOrEmpty(OrgLegalPerson) ? "" : proModel.UserId == WebUserAuth.UserId ? OrgLegalPerson : StringHandler.MaskStartPre(OrgLegalPerson, 1); //机构法定代表人 kldmodel.Grade = proModel.Grade; kldmodel.SubContractNo = submodel.ContractNo; kldmodel.Amount = submodel.Amount.Value.ToString("N"); //借款金额小写 kldmodel.InterestAmount = submodel.InterestAmount.Value.ToString("N"); //借款利息小写 kldmodel.DeadLine = proModel.Deadline.Value.ToString(); //借款期限 decimal PerAmount = Math.Round((submodel.Amount.Value + submodel.InterestAmount.Value) / proModel.Deadline.Value, 2); kldmodel.PerAmount = PerAmount.ToString("N"); //每月回款金额 kldmodel.Rate = proModel.InterestRate.Value.ToString(); //利率 kldmodel.ReturnType = convertType(submodel.RepaymentType); var para = new SqlParameter[] { new SqlParameter("projectid", submodel.ProjectId) }; sql = "select max(CycDate) from SubscribeDetail where SubscribeId=@subscribeId"; para2 = new Dapper.DynamicParameters(); para2.Add("@subscribeId", submodel.Id); DateTime?maxCycDate = PublicConn.QuerySingle <DateTime?>(sql, ref para2); //最后回款时间 DateTime LastDate = maxCycDate.HasValue ? maxCycDate.Value : DateTime.Now.AddMonths(proModel.Deadline ?? 0); kldmodel.ExpireYear = LastDate.Year.ToString(); kldmodel.ExpireMonth = LastDate.Month.ToString(); kldmodel.ExpireDay = LastDate.Day.ToString(); kldmodel.BorrowSignYear = submodel.AddDate.Value.Year.ToString();//签字日期 kldmodel.BorrowSignMonth = submodel.AddDate.Value.Month.ToString(); kldmodel.BorrowSignDay = submodel.AddDate.Value.Day.ToString(); #endregion } else if (mOrgInfo.SubTypeId == 4) { #region 快来贷 kldmodel = new Kldcontract(); kldmodel.ProContactNo = contactno; if (proModel.UserId == WebUserAuth.UserId) //借款人查看 { kldmodel.InvestUserName = StringHandler.MaskStartPre(subBasicModel.RealName, 1); //出借人 kldmodel.InvestCardNo = StringHandler.MaskCardNo(subBasicModel.IdentityCard); //出借人身份证号 kldmodel.OrgName = publisherModel.RealName; //机构名称 kldmodel.OrgCode = publisherModel.IdentityCard; //机构编码 } else { kldmodel.InvestUserName = subBasicModel.RealName; //出借人 kldmodel.InvestCardNo = subBasicModel.IdentityCard; //出借人身份证号 kldmodel.OrgName = publisherModel.RealName; // StringHandler.MaskStartPre(publisherModel.RealName, 1); //机构名称 kldmodel.OrgCode = publisherModel.IdentityCard; // StringHandler.MaskCardNo(publisherModel.IdentityCard); //机构编码 } Dapper.DynamicParameters para2 = new Dapper.DynamicParameters(); para2.Add("@OrgId", publisherModel.Id); sql = "select OrgLegalPerson from fq_Organization where OrgId=@OrgId"; string OrgLegalPerson = PublicConn.QuerySingle <string>(sql, ref para2); kldmodel.OrgLegalPerson = string.IsNullOrEmpty(OrgLegalPerson) ? "" : proModel.UserId == WebUserAuth.UserId ? OrgLegalPerson : StringHandler.MaskStartPre(OrgLegalPerson, 1); //机构法定代表人 kldmodel.Grade = proModel.Grade; kldmodel.SubContractNo = submodel.ContractNo; kldmodel.Amount = submodel.Amount.Value.ToString("N"); //借款金额小写 kldmodel.InterestAmount = submodel.InterestAmount.Value.ToString("N"); //借款利息小写 kldmodel.DeadLine = proModel.Deadline.Value.ToString(); //借款期限 decimal PerAmount = Math.Round((submodel.Amount.Value + submodel.InterestAmount.Value) / proModel.Deadline.Value, 2); kldmodel.PerAmount = PerAmount.ToString("N"); //每月回款金额 kldmodel.Rate = proModel.InterestRate.Value.ToString(); //利率 kldmodel.ReturnType = convertType(submodel.RepaymentType); sql = "select max(CycDate) from SubscribeDetail where SubscribeId=@subscribeId"; para2 = new Dapper.DynamicParameters(); para2.Add("@subscribeId", submodel.Id); DateTime?maxCycDate = PublicConn.QuerySingle <DateTime?>(sql, ref para2); //最后回款时间 DateTime LastDate = maxCycDate.HasValue ? maxCycDate.Value : DateTime.Now.AddMonths(proModel.Deadline ?? 0); kldmodel.ExpireYear = LastDate.Year.ToString(); kldmodel.ExpireMonth = LastDate.Month.ToString(); kldmodel.ExpireDay = LastDate.Day.ToString(); kldmodel.BorrowSignYear = submodel.AddDate.Value.Year.ToString();//签字日期 kldmodel.BorrowSignMonth = submodel.AddDate.Value.Month.ToString(); kldmodel.BorrowSignDay = submodel.AddDate.Value.Day.ToString(); if (string.IsNullOrEmpty(proModel.Guarantors) || proModel.Guarantors.ToInt(0) <= 0) { HttpContext.Current.Response.Write("对不起,该项目未指定担保机构,不能查看合同!"); HttpContext.Current.Response.End(); return; } #endregion } if (mOrgInfo.SubTypeId.ToString().IsIn("4", "5")) { UserEnterpriseInfo userEnterprise = new Common.Contract().GetBorrowerGuaranteeEnterprise(proModel.UserId.Value, proModel.AddDate.Value, proModel.Type.Value); if (userEnterprise != null) { assureModel = new Common.Contract().GetAssureOrganizationByUserId(userEnterprise.UserId); } else { //当未指定担保机构时则退出 allen 2015-05-07 if (string.IsNullOrEmpty(proModel.Guarantors) || proModel.Guarantors.ToInt(0) <= 0) { HttpContext.Current.Response.Write("对不起,该项目未指定担保机构,不能查看合同!"); HttpContext.Current.Response.End(); return; } int gid = 0; int.TryParse(proModel.Guarantors, out gid); assureModel = new Common.Contract().GetAssureOrganizationById(gid); if (gid == 1 && DateTime.Now < DateTime.Parse("2013-11-27")) { assureModel.FullName = "东莞市俊特团贷网络信息服务有限公司"; } } //印章小图片 assureModel.image = new Common.Contract().GetSmallImage(assureModel.image); kldmodel.Assure = assureModel != null ? assureModel.FullName : "东莞市志诚非融资性担保有限公司"; } } else//分期宝 { #region 分期宝 fqbmodel = new fqbcontract(); fqbmodel.ProContactNo = contactno; //合同 if (proModel.UserId == WebUserAuth.UserId) //借款人查看 { fqbmodel.CreditorName = StringHandler.MaskStartPre(subBasicModel.RealName, 1); //出借人 fqbmodel.CreditorCardNo = StringHandler.MaskCardNo(subBasicModel.IdentityCard); //出借人身份证号 fqbmodel.DebtorName = publisherModel.RealName; //借款人 fqbmodel.DebtorCardNo = publisherModel.IdentityCard; //借款人身份证号 } else { fqbmodel.CreditorName = subBasicModel.RealName; //出借人 fqbmodel.CreditorCardNo = subBasicModel.IdentityCard; //出借人身份证号 fqbmodel.DebtorName = StringHandler.MaskStartPre(publisherModel.RealName, 1); //借款 人 fqbmodel.DebtorCardNo = StringHandler.MaskCardNo(publisherModel.IdentityCard); //借款人身份证号 } Dapper.DynamicParameters para = new Dapper.DynamicParameters(); para.Add("@projectid", submodel.ProjectId); sql = @"DECLARE @IsPrivateAccounts BIT=0 --是否私账,默认公账 SELECT @IsPrivateAccounts=ISNULL(b.IsPrivateAccounts,0) FROM dbo.fq_UserApply(nolock) a INNER JOIN dbo.fq_Organization(nolock) b ON a.OrgId=b.OrgId WHERE a.ProjectId=@projectid IF @IsPrivateAccounts=0 BEGIN SELECT u.RealName as OrgName,o.ProductName FROM fq_UserApply a with(nolock) INNER JOIN fq_OrgProduct(nolock) o ON a.ProductId = o.Id INNER JOIN dbo.UserBasicInfo(nolock) u ON a.OrgId = u.Id where a.ProjectId=@projectid END ELSE BEGIN SELECT u.ShortName as OrgName,o.ProductName FROM fq_UserApply a with(nolock) INNER JOIN fq_OrgProduct(nolock) o ON a.ProductId = o.Id INNER JOIN dbo.fq_Organization(nolock) u ON a.OrgId = u.OrgId where a.ProjectId=@projectid END"; var OrgInfo = PublicConn.QuerySingle <FqbOrg>(sql, ref para); fqbmodel.Assure = OrgInfo.OrgName;//担保人 fqbmodel.OrgName = OrgInfo.OrgName; fqbmodel.ProductName = OrgInfo.ProductName; fqbmodel.Amount = proModel.Amount.Value.ToString("N"); fqbmodel.BorrowMoney = submodel.Amount.Value.ToString("N"); //借款金额小写 fqbmodel.BorrowMoneyCn = ChineseNum.GetUpperMoney(double.Parse(submodel.Amount.Value.ToString())); //借款金额大写 fqbmodel.DeadLine = proModel.Deadline.Value.ToString(); //借款期限 fqbmodel.Rate = proModel.InterestRate.Value.ToString(); //利率 // dic["OverRate1"] = debtorModel.OverRate.Value.ToString();//逾期利率 fqbmodel.OverRate = fqbmodel.Rate; fqbmodel.Address = "广东省东莞市南城区"; //签署地 fqbmodel.RepaymentTypeName = ToolStatus.ConvertRepaymentType(proModel.RepaymentType ?? 0); fqbmodel.BorrowSignYear = submodel.AddDate.Value.Year.ToString(); //签字日期 fqbmodel.BorrowSignMonth = submodel.AddDate.Value.Month.ToString(); fqbmodel.BorrowSignDay = submodel.AddDate.Value.Day.ToString(); #endregion } }