public string FP8010100() { //判断是否登录 if (session["userSN"] == null) { return("notLogin"); } using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { //获取uip string provinceData = C201.FC20121(dbma1).Replace("[", "").Replace("]", ""); string kinRelationType = C201.FC20103(dbma1).Replace("[", "").Replace("]", ""); string maritalStatusType = C201.FC20100(dbma1).Replace("[", "").Replace("]", ""); string enterpriseType = C201.FC20104(dbma1).Replace("[", "").Replace("]", ""); string investMainType = C201.FC20106(dbma1).Replace("[", "").Replace("]", ""); string guaranteeType = C201.FC20117(dbma1).Replace("[", "").Replace("]", ""); string assetsType = C201.FC20108(dbma1).Replace("[", "").Replace("]", ""); string degreeType = C201.FC20102(dbma1).Replace("[", "").Replace("]", ""); string healthyStatusType = C201.FC20101(dbma1).Replace("[", "").Replace("]", ""); //string creditStatusType = C201.FC20105(dbma1).Replace("[", "").Replace("]", ""); string industryType = C201.FC20113(dbma1).Replace("[", "").Replace("]", ""); A023 a023 = dbma1.A023s.First(); A024 a024 = dbma1.A024s.First(); A026 a026 = dbma1.A026s.First(); var PawnRate = new { Min = a023.minMorgageRate, Max = a023.maxMorgageRate }; var InvestAmt = new { Min = a023.minInvestMoneyAmount, Max = a023.maxInvestMoneyAmount }; var DayRate = new { Min = a023.minDailyRate, Max = a023.maxDailyRate }; var InvestLimit = new { Min = a023.minInvestDays, Max = a023.maxInvestDays }; var BayAmt = new { Min = a026.minPurchasePrice, Max = a026.maxPurchasePrice }; var TAsset = new { Min = a024.minTotalAssets, Max = a024.maxTotalAssets }; var TLiability = new { Min = a024.maxTotalLiability, Max = a024.maxTotalLiability }; var CAsset = new { Min = a024.minNetAssets, Max = a024.maxNetAssets }; string PawnRateStr = C101.FC10107(PawnRate); string InvestAmtStr = C101.FC10107(InvestAmt); string DayRateStr = C101.FC10107(DayRate); string InvestLimitStr = C101.FC10107(InvestLimit); string BayAmtStr = C101.FC10107(BayAmt); string TAssetStr = C101.FC10107(TAsset); string TLiabilityStr = C101.FC10107(TLiability); string CAssetStr = C101.FC10107(CAsset); //获取用户信息-债权投资 string userSN = session["userSN"].ToString(); //string userSN = "U00001"; string userData = GetUserData(dbma1, userSN); return(string.Format("{{\"uip\":{{\"SltConfigData\":[{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}],\"PawnRate\":{10},\"InvestAmt\":{11},\"DayRate\":{12},\"InvestLimit\":{13},\"BayAmt\":{14},\"TAsset\":{15},\"TLiability\":{16},\"CAsset\":{17}}},\"userData\":{18},\"userSN\":\"{19}\"}}", provinceData, kinRelationType, maritalStatusType, enterpriseType, investMainType, guaranteeType, assetsType, degreeType, healthyStatusType, industryType, PawnRateStr, InvestAmtStr, DayRateStr, InvestLimitStr, BayAmtStr, TAssetStr, TLiabilityStr, CAssetStr, userData, userSN)); } }
public string FP802010207(string financingSvrData, string pwd) { string userSN = session["userSN"].ToString(); //string userSN = "U00004"; U002 financingSvrObj = C101.FC10108(financingSvrData, typeof(U002)) as U002; using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { //密码是否正确 if (C201.FC20146(dbma1, userSN, pwd) == false) { return("0"); } //扣款 A024 a024 = dbma1.A024s.First(); if (C201.FC20147(dbma1, userSN, Convert.ToDecimal(a024.openServerCost), "融资申请", null) == false) { return("0"); } //更新用户信息基本表 U002 FinancingSvrUpdateU002(dbma1, financingSvrObj, userSN); //更新服务表 U001 FinancingSvrUpdateU001(dbma1, userSN); //加入成长值表 F006 string F006Max33SN = C101.FC10102("F006", 7, "UD"); F006 f006 = new F006(); f006.groupUpSN = F006Max33SN; f006.userSN = userSN; f006.businessSN = userSN; f006.businessType = "融资申请"; f006.transactionMoneyAmount = Convert.ToDecimal(a024.openServerCost); f006.groupUpValue = a024.openServerCost; f006.acquireDate = DateTime.Now; dbma1.F006s.InsertOnSubmit(f006); dbma1.SubmitChanges(); return("1"); } }
public string FP20111() { string financierUserSN = session["userSN"].ToString(); //string financierUserSN = "U00001"; using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { //发布费用 A024 a024 = dbma1.A024s.First(); decimal?publishFee = a024.financePublishCost; //账户余额 F000 f000 = dbma1.F000s.Where(c => c.userSN == financierUserSN).First(); decimal balance = f000.balance; return(string.Format("{{\"publishFee\":\"{0}\",\"balance\":\"{1}\"}}", publishFee, balance)); } }
/// <summary> /// 投资 /// </summary> public void FP10204(string financierUserSN, string crSN, decimal investMoneyAmount, DateTime investDate, DateTime dealineDate, string repaymentTypeSN, decimal dailyRate) { using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { //检查有效性(1、未被投资。2、债权未取消或者拒绝.) var data1 = dbma1.P102s.Where(c => c.creditRightSN == crSN).FirstOrDefault(); if (data1 != null) { return; } string reserveSN; var reserveCrP203 = (from c in dbma1.P203s where c.creditRightSN == crSN && c.senderCancelReserveDate == null && c.receiverRefuseReserveDate == null select c).FirstOrDefault(); if (reserveCrP203 == null) { var reserveCrP100 = (from c in dbma1.P100s where c.creditRightSN == crSN && c.senderCancelReserveDate == null && c.receiverRefuseReserveDate == null select c).FirstOrDefault(); //债权已被取消或者拒绝 if (reserveCrP100 == null) { return; } reserveSN = reserveCrP100.reserveSN; } else { reserveSN = reserveCrP203.reserveSN; } string investorUserSN = session["userSN"].ToString(); string max33 = C101.FC10102("P102", 6, "C"); P102 p102 = new P102(); p102.investSN = max33; p102.reserveSN = reserveSN; p102.investorUserSN = investorUserSN; p102.financierUserSN = financierUserSN; p102.creditRightSN = crSN; p102.investMoneyAmount = investMoneyAmount; p102.investDate = investDate; p102.deadlineDate = dealineDate; p102.repaymentTypeSN = repaymentTypeSN; p102.dailyRate = dailyRate; p102.verifyInvestDate = DateTime.Now; dbma1.P102s.InsertOnSubmit(p102); //产生账单 A024 a024 = dbma1.A024s.First(); decimal feeRate = Convert.ToDecimal(a024.serviceRateDaily); decimal minRate = Convert.ToDecimal(a024.minServiceRateTotel); decimal maxRate = Convert.ToDecimal(a024.maxServiceRateTotel); int loanDays = (dealineDate - investDate).Days; int loanMonth = loanDays / 30 + (loanDays % 30 == 0 ? 0 : 1); decimal serverRate = Convert.ToDecimal(feeRate * Convert.ToDecimal(loanMonth)); serverRate = serverRate < minRate ? minRate : serverRate; serverRate = serverRate > maxRate ? maxRate : serverRate; string F001max33SN = C101.FC10102("F001", 6, "L"); F001 f001 = new F001(); f001.billSN = F001max33SN; f001.payerUserSN = financierUserSN; f001.businessSN = crSN; f001.billType = "债权融资"; f001.MoneyAmount = serverRate * investMoneyAmount * 10000; f001.generateDate = DateTime.Now; dbma1.F001s.InsertOnSubmit(f001); //融资方历史信息 U002 u002 = dbma1.U002s.Where(c => c.userSN == financierUserSN).First(); P105 p105 = new P105(); string max33SN = C101.FC10102("P105", 7, "CB"); //案例情况 var caseStatus = dbma1.P102s.Where(c => c.financierUserSN == financierUserSN); short caseAmount = Convert.ToInt16(caseStatus.Count()); decimal caseMoneyAmount = caseAmount == 0 ? 0 : caseStatus.Sum(c => c.investMoneyAmount); //当前债务情况 var debtStatus = dbma1.P102s.Where(c => c.financierUserSN == financierUserSN && c.closeCaseDate == null); short debtAmount = Convert.ToInt16(debtStatus.Count()); decimal debtMoneyAmount = debtAmount == 0 ? 0 : debtStatus.Sum(c => c.investMoneyAmount); //当前逾期情况 var currentOverdueStatus = from c in dbma1.P102s where c.financierUserSN == financierUserSN && c.closeCaseDate == null && DateTime.Now > c.deadlineDate select c; short currentOverdueAmount = Convert.ToInt16(currentOverdueStatus.Count()); decimal currentOverdueMoneyAmount = currentOverdueAmount == 0 ? 0 : currentOverdueStatus.Sum(c => c.investMoneyAmount); //历史逾期数量 var historyOverdueStatus = from c in dbma1.P102s from p in c.P103s where c.financierUserSN == financierUserSN && c.deadlineDate < p.repayDate && c.investSN == p.investSN select c; short historyOverdueAmount = Convert.ToInt16(historyOverdueStatus.Count()); p105.financierHistoryInfoSN = max33SN; p105.creditRightSN = crSN; p105.investSN = max33; p105.historyDate = DateTime.Now; p105.userSN = u002.userSN; p105.name = u002.name; p105.birthday = u002.birthday; p105.gender = u002.gender; p105.registeredResidence = u002.registeredResidence; p105.idCard = u002.idCard; p105.phone = u002.phone; p105.email = u002.email; p105.maritalStatusTypeSN = u002.maritalStatusTypeSN; p105.procreateStatus = u002.procreateStatus; p105.healthyStatusTypeSN = u002.healthyStatusTypeSN; p105.ifBasicLivingAllowance = u002.ifBasicLivingAllowance; p105.currentAddressProvinceSN = u002.currentAddressProvinceSN; p105.currentAddressCitySN = u002.currentAddressCitySN; p105.currentAddressDetails = u002.currentAddressDetails; p105.graduateSchool = u002.graduateSchool; p105.degreeTypeSN = u002.degreeTypeSN; p105.degreeCard = u002.degreeCard; p105.friendName = u002.friendName; p105.friendPhone = u002.friendPhone; p105.spouseName = u002.spouseName; p105.spousePhone = u002.spousePhone; p105.spouseIdCard = u002.spouseIdCard; p105.spouseEnterprise = u002.spouseEnterprise; p105.kinName = u002.kinName; p105.kinRelationshipTypeSN = u002.kinRelationshipTypeSN; p105.kinPhone = u002.kinPhone; p105.kinIdCard = u002.kinIdCard; p105.kinEnterprise = u002.kinEnterprise; p105.workEnterprise = u002.workEnterprise; p105.enterpriseTypeSN = u002.enterpriseTypeSN; p105.hiredate = u002.hiredate; p105.workTel = u002.workTel; p105.post = u002.post; p105.enterpriseSwitchboard = u002.enterpriseSwitchboard; p105.enterpriseWebsite = u002.enterpriseWebsite; p105.colleageName = u002.colleageName; p105.colleagePhone = u002.colleagePhone; p105.monthlyTotalIncome = u002.monthlyTotalIncome; p105.monthlyTotalExpenditure = u002.monthlyTotalExpenditure; p105.monthlyNetIncome = u002.monthlyNetIncome; p105.totalAssets = u002.totalAssets; p105.totalDebt = u002.totalDebt; p105.ifCourtImplementation = u002.ifCourtImplementation; p105.creditStatus = u002.creditStatus; p105.caseAmount = caseAmount; p105.caseMoneyAmount = caseMoneyAmount; p105.currentDebtAmount = debtAmount; p105.debtMoneyAmount = debtMoneyAmount; p105.currentOverdue = currentOverdueAmount; p105.overdueMoneyAmount = currentOverdueMoneyAmount; p105.historyOverdueAmount = historyOverdueAmount; dbma1.P105s.InsertOnSubmit(p105); dbma1.SubmitChanges(); U003 u003 = dbma1.U003s.Where(c => c.userSN == financierUserSN).First(); //如有邮箱提醒 if (u003.billGenerate_email == true) { SendBillEmail(dbma1, financierUserSN, crSN, f001.billSN, Convert.ToDecimal(f001.MoneyAmount)); } //如有短信提醒 if (u003.billGenerate_shortMessage == true) { SendBillSM(dbma1, financierUserSN, crSN, f001.billSN, Convert.ToDecimal(f001.MoneyAmount)); } dbma1.SubmitChanges(); } }
/// <summary> /// 融资方发出预约 /// </summary> public string FP20109(string pwd, string investorUserSN, string crSN) { using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { string financierUserSN = session["userSN"].ToString(); //string financierUserSN = "U00001"; //检查有效性(1、债权没有被取消。2、债权没有被预约) var data1 = dbma1.P200s.Where(c => c.creditRightSN == crSN && c.cancelDate != null).FirstOrDefault(); var data2 = dbma1.P203s.Where(c => c.creditRightSN == crSN && c.senderCancelReserveDate == null && c.receiverRefuseReserveDate == null).FirstOrDefault(); var data3 = dbma1.P100s.Where(c => c.creditRightSN == crSN && c.senderCancelReserveDate == null && c.receiverRefuseReserveDate == null).FirstOrDefault(); if (data1 != null || data2 != null || data3 != null) { return("false"); } //验证交易密码是否正确 string transPwd = dbma1.U003s.Where(c => c.userSN == financierUserSN).First().transactPwd; if (C101.FC10104(pwd, transPwd) == false) { return("false"); } //从余额中扣除服务费 F000 A024 a024 = dbma1.A024s.First(); decimal investorRecommendCost = Convert.ToDecimal(a024.investorRecommendCost); F000 f000 = dbma1.F000s.Where(c => c.userSN == financierUserSN).First(); if (f000.balance < investorRecommendCost) { return("false"); } f000.balance -= investorRecommendCost; //加入收支明细表中 F003 string F003max33SN = C101.FC10102("F003", 8, "UA"); F003 f003 = new F003(); f003.revenueExpenditureSN = F003max33SN; f003.generetorUserSN = financierUserSN; f003.generateDate = DateTime.Now; f003.type = "投资方推荐"; f003.expenditure = investorRecommendCost; f003.balance = f000.balance; dbma1.F003s.InsertOnSubmit(f003); //债权预约表添加记录 P203 string max33SN = C101.FC10102("P203", 7, "F"); P203 p203 = new P203(); p203.reserveSN = max33SN; p203.senderUserSN = financierUserSN; p203.receiverUserSN = investorUserSN; p203.creditRightSN = crSN; p203.sendDate = DateTime.Now; dbma1.P203s.InsertOnSubmit(p203); //加入成长值表 F006 string F006Max33SN = C101.FC10102("F006", 7, "UD"); F006 f006 = new F006(); f006.groupUpSN = F006Max33SN; f006.userSN = financierUserSN; f006.businessSN = max33SN; f006.businessType = "投资方推荐"; f006.transactionMoneyAmount = investorRecommendCost; f006.groupUpValue = investorRecommendCost; f006.acquireDate = DateTime.Now; dbma1.F006s.InsertOnSubmit(f006); dbma1.SubmitChanges(); U003 u003 = dbma1.U003s.Where(c => c.userSN == investorUserSN).First(); //如有邮箱提醒 if (u003.billGenerate_email == true) { SendByEmail(dbma1, investorUserSN, crSN); } //如有短信提醒 if (u003.billGenerate_shortMessage == true) { SendBySM(dbma1, investorUserSN, crSN); } dbma1.SubmitChanges(); return("true"); } }
/// <summary> /// 发布债权 /// </summary> public string FP20103(string financingData, string pawnData, string enterpriseData, string pwd) { using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { string userSN = session["userSN"].ToString(); //验证交易密码是否正确 string transPwd = dbma1.U003s.Where(c => c.userSN == userSN).First().transactPwd; if (C101.FC10104(pwd, transPwd) == false) { return("false"); } //从余额中扣除服务费 F000 A024 a024 = dbma1.A024s.First(); decimal publishFee = Convert.ToDecimal(a024.financePublishCost); F000 f000 = dbma1.F000s.Where(c => c.userSN == userSN).First(); if (f000.balance < publishFee) { return("false"); } f000.balance -= publishFee; //加入收支明细表中 F003 string max33SN = C101.FC10102("F003", 8, "UA"); F003 f003 = new F003(); f003.revenueExpenditureSN = max33SN; f003.generetorUserSN = userSN; f003.generateDate = DateTime.Now; f003.type = "债权发布"; f003.expenditure = publishFee; f003.balance = f000.balance; dbma1.F003s.InsertOnSubmit(f003); //债权 P200 p200 = Comm.C101.FC10108(financingData, typeof(P200)) as P200; p200.creditRightSN = C101.FC10102("P200", 6, "E"); p200.publisherUserSN = userSN; //p200.publisherUserSN = "U00001"; p200.publishDate = DateTime.Now; dbma1.P200s.InsertOnSubmit(p200); //抵押物 if (pawnData != "null") { P201 p201 = Comm.C101.FC10108(pawnData, typeof(P201)) as P201; p201.assetsSN = C101.FC10102("P201", 6, "FA"); p201.creditRightSN = p200.creditRightSN; dbma1.P201s.InsertOnSubmit(p201); } //企业 if (enterpriseData != "null") { P202 p202 = Comm.C101.FC10108(enterpriseData, typeof(P202)) as P202; p202.enterpriseSN = C101.FC10102("P202", 6, "FB"); p202.creditRightSN = p200.creditRightSN; dbma1.P202s.InsertOnSubmit(p202); } //加入成长值表 F006 string F006Max33SN = C101.FC10102("F006", 7, "UD"); F006 f006 = new F006(); f006.groupUpSN = F006Max33SN; f006.userSN = userSN; f006.businessSN = p200.creditRightSN; f006.businessType = "债权发布"; f006.transactionMoneyAmount = publishFee; f006.groupUpValue = publishFee; f006.acquireDate = DateTime.Now; dbma1.F006s.InsertOnSubmit(f006); dbma1.SubmitChanges(); var creditRight = dbma1.VP201001s.Where(c => c.creditRightSN == p200.creditRightSN).First(); return(C101.FC10107(creditRight)); } }