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); } }
private void GetContractInfo(string key) { string contactno = 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); //借款人信息 UserEnterpriseInfo userEnterprise = new Common.Contract().GetBorrowerGuaranteeEnterprise(proModel.UserId.Value, proModel.AddDate.Value, proModel.Type ?? 0); 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 = "东莞市俊特团贷网络信息服务有限公司"; } } //印章小图片 this.AssureModel.image = new Common.Contract().GetSmallImage(this.AssureModel.image); RepaymentTypeDesc = new Common.Contract().GetRepaymentTypeDesc(proModel.RepaymentType ?? 0); if (WebUserAuth.UserId == publisherModel.Id) { this.subBasicModel.RealName = StringHandler.MaskStartPre(subBasicModel.RealName, 1); //出借人 this.subBasicModel.IdentityCard = StringHandler.MaskCardNo(subBasicModel.IdentityCard); //出借人身份证号 } else { this.publisherModel.RealName = StringHandler.MaskStartPre(publisherModel.RealName, 1); //借款 人 this.publisherModel.IdentityCard = StringHandler.MaskCardNo(publisherModel.IdentityCard); //借款人身份证号 } }
private void GetContractInfo(string key) { string contactno = key; this.submodel = new SubscribeBLL().GetSubscribeInfoContractNo(contactno); if (submodel.AddDate < Convert.ToDateTime("2016-3-11")) { companyName = "广东俊特团贷网络信息服务股份有限公司"; } else { companyName = "东莞团贷网互联网科技服务有限公司"; } if (submodel.AddDate.Value <= DateTime.Parse("2015-07-31")) { Response.Redirect(string.Format("/Contract/ContractJzdb.aspx?key={0}&type=mobileapp", key)); return; } Dapper.DynamicParameters param = new Dapper.DynamicParameters(); param = new Dapper.DynamicParameters(); param.Add("@ProjectId", submodel.ProjectId); param.Add("@curUserId", WebUserAuth.UserId); string strSQL = "select Count(1) from project(nolock) where Id=@ProjectId and UserId=@curUserId"; bool isExist = PublicConn.QuerySingle <int>(strSQL, ref param) > 0; if (this.submodel.SubscribeUserId != WebUserAuth.UserId && !isExist) { HttpContext.Current.Response.Write("对不起,您没有权限查看此合同。"); HttpContext.Current.Response.End(); return; } this.subBasicModel = userbll.GetUserBasicInfoModelById(submodel.SubscribeUserId.Value); //投资人信息 this.proModel = projectbll.GetProjectDetailInfo(submodel.ProjectId.Value); this.publisherModel = userbll.GetUserBasicInfoModelById(proModel.UserId.Value); //借款人信息 this.SharesPercent = (publisherModel.NumberOfShares * 10000m / 100000000m * 100m).ToString("0.00"); this.PrincipalInterest = submodel.Amount.Value + submodel.InterestAmount.Value; AssureModel = new Common.Contract().GetAssureOrganizationByProjectId(proModel.Id); //印章小图片 this.AssureModel.image = new Common.Contract().GetSmallImage(this.AssureModel.image); RepaymentTypeDesc = new Common.Contract().GetRepaymentTypeDesc(proModel.RepaymentType ?? 0); if (WebUserAuth.UserId == publisherModel.Id) { this.subBasicModel.RealName = StringHandler.MaskStartPre(subBasicModel.RealName, 1); //出借人 this.subBasicModel.IdentityCard = StringHandler.MaskCardNo(subBasicModel.IdentityCard); //出借人身份证号 } else { this.publisherModel.RealName = StringHandler.MaskStartPre(publisherModel.RealName, 1); //借款 人 this.publisherModel.IdentityCard = StringHandler.MaskCardNo(publisherModel.IdentityCard); //借款人身份证号 } }
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(); }
private void GetContractInfo(string key) { string contactno = key; this.submodel = new SubscribeBLL().GetSubscribeInfoContractNo(contactno); if (submodel.AddDate < Convert.ToDateTime("2016-3-11")) { companyName = "广东俊特团贷网络信息服务股份有限公司"; } else { companyName = "东莞团贷网互联网科技服务有限公司"; } Dapper.DynamicParameters param = new Dapper.DynamicParameters(); param = new Dapper.DynamicParameters(); param.Add("@projectId", submodel.ProjectId); param.Add("@curUserId", WebUserAuth.UserId); string strSQL = "select Count(1) from project where Id=@projectId and UserId=@curUserId"; bool isExist = PublicConn.QuerySingle <int>(strSQL, ref param) > 0; if (this.submodel.SubscribeUserId != WebUserAuth.UserId && !isExist) { HttpContext.Current.Response.Write("对不起,您没有权限查看此合同。"); HttpContext.Current.Response.End(); return; } this.subBasicModel = userbll.GetUserBasicInfoModelById(submodel.SubscribeUserId.Value); //投资人信息 this.proModel = projectbll.GetProjectDetailInfo(submodel.ProjectId.Value); this.publisherModel = userbll.GetUserBasicInfoModelById(proModel.UserId.Value); //借款人信息 ProjectsmEntity = new Common.Contract().GetProjectSM(proModel.Id); //获取私募宝信息 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 = "东莞市俊特团贷网络信息服务有限公司"; } } //印章小图片 this.AssureModel.image = new Common.Contract().GetSmallImage(this.AssureModel.image); RepaymentTypeDesc = new Common.Contract().GetRepaymentTypeDesc(proModel.RepaymentType ?? 0); if (WebUserAuth.UserId == publisherModel.Id) { this.subBasicModel.RealName = StringHandler.MaskStartPre(subBasicModel.RealName, 1); //出借人 this.subBasicModel.IdentityCard = StringHandler.MaskCardNo(subBasicModel.IdentityCard); //出借人身份证号 } else { this.publisherModel.RealName = StringHandler.MaskStartPre(publisherModel.RealName, 1); //借款 人 this.publisherModel.IdentityCard = StringHandler.MaskCardNo(publisherModel.IdentityCard); //借款人身份证号 } }
private void GetContractInfo(string key) { bool isUndertake = false; //是否承接人 string contactno = key; this.submodel = new SubscribeBLL().GetSubscribeInfoContractNo(contactno); companyName = "东莞团贷网互联网科技服务有限公司"; Dapper.DynamicParameters param = new Dapper.DynamicParameters(); param = new Dapper.DynamicParameters(); param.Add("@BorrowerUserId", submodel.BorrowerUserId); param.Add("@curUserId", WebUserAuth.UserId); string strSQL = "select Count(1) from project where UserId=@BorrowerUserId and UserId=@curUserId"; bool isExist = PublicConn.QuerySingle <int>(strSQL, ref param) > 0; if (this.submodel.SubscribeUserId != WebUserAuth.UserId && !isExist) { string sql = @"SELECT c.* FROM ( SELECT b.* FROM dbo.Subscribe a RIGHT JOIN dbo.t_SubScribeTransfer b ON a.id=b.m_FromSubscribeId WHERE a.ContractNo=@ContractNo) M INNER JOIN dbo.Subscribe c ON c.TranId=M.M_id WHERE c.SubscribeUserId=@SubscribeUserId"; param = new Dapper.DynamicParameters(); param.Add("@ContractNo", contactno); param.Add("@SubscribeUserId", WebUserAuth.UserId); var mSubscribe = PublicConn.QuerySingle <SubscribeInfo>(sql, ref param); if (mSubscribe == null)//判断是否是承接人查看借款人与转让人的合同 { HttpContext.Current.Response.Write("对不起,您没有权限查看此合同。"); HttpContext.Current.Response.End(); return; } isUndertake = true; } this.subBasicModel = userbll.GetUserBasicInfoModelById(submodel.SubscribeUserId.Value); //投资人信息 this.proModel = projectbll.GetProjectDetailInfo(submodel.ProjectId.Value); this.publisherModel = userbll.GetUserBasicInfoModelById(proModel.UserId.Value); //借款人信息 AssureModel = new AssureOrganizationInfo(); this.AssureModel.FullName = "东莞市志诚非融资性担保有限公司"; this.AssureModel.image = "http://image.tuandai.com/User/UserUpload/201508/20150825145522_3283.png"; //印章小图片 this.AssureModel.image = new Common.Contract().GetSmallImage(this.AssureModel.image); RepaymentTypeDesc = new Common.Contract().GetRepaymentTypeDesc(proModel.RepaymentType ?? 0); if (WebUserAuth.UserId == publisherModel.Id) { this.subBasicModel.RealName = StringHandler.MaskStartPre(subBasicModel.RealName, 1); //出借人 this.subBasicModel.IdentityCard = StringHandler.MaskCardNo(subBasicModel.IdentityCard); //出借人身份证号 } else { this.publisherModel.RealName = StringHandler.MaskStartPre(publisherModel.RealName, 1); //借款 人 this.publisherModel.IdentityCard = StringHandler.MaskCardNo(publisherModel.IdentityCard); //借款人身份证号 } if (isUndertake) { this.subBasicModel.RealName = StringHandler.MaskStartPre(subBasicModel.RealName, 1); //出借人 this.subBasicModel.IdentityCard = StringHandler.MaskCardNo(subBasicModel.IdentityCard); //出借人身份证号 this.publisherModel.RealName = StringHandler.MaskStartPre(publisherModel.RealName, 1); //借款 人 this.publisherModel.IdentityCard = StringHandler.MaskCardNo(publisherModel.IdentityCard); //借款人身份证号 } }
//获取用户信用档案 private void GetBorrowerData() { userCreditInfo = bll.WXGetUserCreditInfo(model.UserId.Value); //特殊处理 Guid tempBorrowUserId = Guid.Parse("73810E55-E2D4-4F40-8FF9-F0A23F909A75"); if (borrowerUserInfo.Id == tempBorrowUserId) { Guid tempProjectId = Guid.Parse("EA7A69C1-38B4-4073-A69D-CFBE2944B4E3"); ProjectDetailInfo tempProjectModel = bll.GetProjectDetailInfo(tempProjectId); userCreditInfo.DueOutPAndI = userCreditInfo.DueOutPAndI - ((tempProjectModel.TotalAmount ?? 0) + (tempProjectModel.TotalInterest ?? 0) - (tempProjectModel.RefundInterest ?? 0) - (tempProjectModel.RefundCaptital ?? 0)); //LogHelper.WriteLog("待还本息特殊处理", "", tempProjectModel.TotalAmount.Value.ToString()); // SysLogHelper.WriteTraceLog("待还本息特殊处理", tempProjectModel.TotalAmount.Value.ToString()); } string sql = @" SELECT @prepaymentTime=count(CASE WHEN IsRepayAdvance=1 THEN 1 ELSE NULL END ), @sumTime=count(CASE WHEN Status=6 THEN 1 ELSE NULL END ) FROM Project (NOLOCK) where Type=6 and UserId=@userId ; SELECT @OverdueCount=COUNT(0) FROM (SELECT ProjectId,periods FROM dbo.OverDueRecord with(nolock) WHERE PublisherUserId=@userId and isnull(IsHide,0)=0 GROUP BY ProjectId,periods)t; select @OverdueAdvanceTime=COUNT(0) from (SELECT DISTINCT m_Period,m_ProjectId FROM dbo.t_AdvanceDetail(NOLOCK) where m_BorrowUserid=@UserId ) A; SELECT @TotalOverdue=(ISNULL(SUM(ActualCost),0)+ISNULL(SUM(ActualInterest),0)) FROM dbo.OverDueRecord(NOLOCK) WHERE PublisherUserId=@userId AND IsBorrow=0 and isnull(IsHide,0)=0 "; var dyParams = new Dapper.DynamicParameters(); dyParams.Add("@userId", model.UserId); dyParams.Add("@prepaymentTime", 0, DbType.Int32, ParameterDirection.Output, 20); dyParams.Add("@sumTime", 0, DbType.Int32, ParameterDirection.Output, 20); dyParams.Add("@OverdueCount", 0, DbType.Int32, ParameterDirection.Output, 20); dyParams.Add("@OverdueAdvanceTime", 0, DbType.Int32, ParameterDirection.Output, 20); dyParams.Add("@TotalOverdue", 0, DbType.Decimal, ParameterDirection.Output, 20); PublicConn.ExecuteTD(PublicConn.DBWriteType.Read, sql, ref dyParams); PrepaymentTime = dyParams.Get <int>("@prepaymentTime"); int sumTime = dyParams.Get <int>("@sumTime"); OnTimepayTime = sumTime - PrepaymentTime; overdueNum = dyParams.Get <int>("@OverdueCount"); OverdueAdvanceTime = dyParams.Get <int>("@OverdueAdvanceTime"); TotalOverdue = dyParams.Get <decimal>("@TotalOverdue"); //垫付次数大于逾期次数,显示逾期次数,否则是逾期垫付次数。 if (overdueNum < OverdueAdvanceTime) { OverdueAdvanceTime = overdueNum; } #region 会员等级 2016-04-16 string strSQL = @"declare @PreNetWorth numeric(18, 2)=0 SELECT @PreNetWorth=ISNULL(PreNetWorth,0) FROM dbo.MUserVipInfo WITH(NOLOCK) WHERE UserId=@UserId SELECT Level FROM dbo.MVipLevel WITH(NOLOCK) WHERE MinNetWorth<=@PreNetWorth AND MaxNetWorth>@PreNetWorth "; string level = string.Empty; DynamicParameters whereParams = new DynamicParameters(); whereParams.Add("@UserId", this.model.UserId); level = PublicConn.QueryVipSingle <string>(strSQL, ref whereParams); if (DateTime.Now < DateTime.Parse("2018-01-01 02:00:00") && level == "9") { level = "8"; } VipLevel = "V" + (level ?? "1");//会员等级 #endregion string sqlText = @"select a.FullName,a.image from UserInEnterpriseProject_ZC u left join AssureOrganization a on u.EnterpriseUserId=a.UserId where ProjectId=@projectId"; var para = new DynamicParameters(); para.Add("@projectId", model.Id); assureModel = PublicConn.QuerySingle <AssureOrganizationInfo>(sqlText, ref para); }
/// <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 } }
private void GetContractInfo(string key) { bool isUndertake = false; //是否承接人 string contactno = key; this.submodel = new SubscribeBLL().GetSubscribeInfoContractNo(contactno); if (submodel.AddDate < Convert.ToDateTime("2016-3-11")) { companyName = "广东俊特团贷网络信息服务股份有限公司"; } else { companyName = "东莞团贷网互联网科技服务有限公司"; } Dapper.DynamicParameters param = null; param = new Dapper.DynamicParameters(); param.Add("@BorrowerUserId", submodel.BorrowerUserId); param.Add("@curUserId", WebUserAuth.UserId); string strSQL = "select Count(1) from project where UserId=@BorrowerUserId and UserId=@curUserId"; bool isExist = PublicConn.QuerySingle <int>(strSQL, ref param) > 0; if (this.submodel.SubscribeUserId != WebUserAuth.UserId && !isExist) { string sql = @"SELECT c.* FROM ( SELECT b.* FROM dbo.Subscribe a RIGHT JOIN dbo.t_SubScribeTransfer b ON a.id=b.m_FromSubscribeId WHERE a.ContractNo=@ContractNo) M INNER JOIN dbo.Subscribe c ON c.TranId=M.M_id WHERE c.SubscribeUserId=@SubscribeUserId"; param = new Dapper.DynamicParameters(); param.Add("@ContractNo", contactno); param.Add("@SubscribeUserId", WebUserAuth.UserId); var mSubscribe = PublicConn.QuerySingle <SubscribeInfo>(sql, ref param); if (mSubscribe == null)//判断是否是承接人查看借款人与转让人的合同 { HttpContext.Current.Response.Write("对不起,您没有权限查看此合同。"); HttpContext.Current.Response.End(); return; } isUndertake = true; } this.subBasicModel = userbll.GetUserBasicInfoModelById(submodel.SubscribeUserId.Value); //投资人信息 this.proModel = projectbll.GetProjectDetailInfo(submodel.ProjectId.Value); this.publisherModel = userbll.GetUserBasicInfoModelById(proModel.UserId.Value); //借款人信息 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 { if (proModel.Guarantors.ToText() == "") { assureModel = new AssureOrganizationInfo(); } 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 = "东莞市俊特团贷网络信息服务有限公司"; } } } //印章小图片 this.assureModel.image = new Common.Contract().GetSmallImage(this.assureModel.image); RepaymentTypeDesc = new Common.Contract().GetRepaymentTypeDesc(proModel.RepaymentType ?? 0); if (WebUserAuth.UserId == publisherModel.Id) { this.subBasicModel.RealName = StringHandler.MaskStartPre(subBasicModel.RealName, 1); //出借人 this.subBasicModel.IdentityCard = StringHandler.MaskCardNo(subBasicModel.IdentityCard); //出借人身份证号 } else { this.publisherModel.RealName = StringHandler.MaskStartPre(publisherModel.RealName, 1); //借款 人 this.publisherModel.IdentityCard = StringHandler.MaskCardNo(publisherModel.IdentityCard); //借款人身份证号 } if (isUndertake) { this.subBasicModel.RealName = StringHandler.MaskStartPre(subBasicModel.RealName, 1); //出借人 this.subBasicModel.IdentityCard = StringHandler.MaskCardNo(subBasicModel.IdentityCard); //出借人身份证号 this.publisherModel.RealName = StringHandler.MaskStartPre(publisherModel.RealName, 1); //借款 人 this.publisherModel.IdentityCard = StringHandler.MaskCardNo(publisherModel.IdentityCard); //借款人身份证号 } }