//1:修改成功;0:操作失败 不返回结果:2:验证码不正确; public int FP80310(string IC, string newPwd) { string userSN = session["userSN"].ToString(); //string userSN = "U00001"; using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { string phone = dbma1.U000s.Where(c => c.userSN == userSN).First().phone; //检测验证码 if (IfIdentifyingCodeCorrect(dbma1, phone, IC, "修改交易密码") == false) { return(2); } //修改交易密码 string newPwdMd5 = C101.FC10103(newPwd); U003 u003 = dbma1.U003s.Where(c => c.userSN == userSN).First(); u003.transactPwd = newPwdMd5; u003.ifChangeTransactPwd = true; dbma1.SubmitChanges(); return(1); } }
public void FP40205(string reserveSN, decimal purcharsePrice) { string userSN = session["userSN"].ToString(); using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { //有效性检查(1、已被取消或者拒绝。2、已被购买) var data1 = dbma1.P400s.Where(c => c.reserveSN == reserveSN && (c.senderCancelReserveDate != null || c.receiverRefuseReserveDate != null)).FirstOrDefault(); var data2 = dbma1.P401s.Where(c => c.reserveSN == reserveSN).FirstOrDefault(); if (data1 != null || data2 != null) { return; } //加入资产购买表 P401 string max33SN = C101.FC10102("P401", 6, "J"); P400 p400 = dbma1.P400s.Where(c => c.reserveSN == reserveSN).First(); P401 p401 = new P401(); p401.purchaseSN = max33SN; p401.reserveSN = reserveSN; p401.purchaserUserSN = userSN; p401.sellerUserSN = p400.receiverUserSN; p401.assetsSN = p400.assetsSN; p401.purchasePrice = purcharsePrice; p401.purchaseDate = DateTime.Now; dbma1.P401s.InsertOnSubmit(p401); //加入账单表 F001 decimal serviceRate = Convert.ToDecimal(dbma1.A027s.First().serviceRate); string F001max33SN = C101.FC10102("F001", 6, "L"); F001 f001 = new F001(); f001.billSN = F001max33SN; f001.payerUserSN = p400.receiverUserSN; f001.businessSN = p400.assetsSN; f001.billType = "资产出售"; f001.MoneyAmount = purcharsePrice * serviceRate * 10000; f001.generateDate = DateTime.Now; dbma1.F001s.InsertOnSubmit(f001); dbma1.SubmitChanges(); U003 u003 = dbma1.U003s.Where(c => c.userSN == p400.receiverUserSN).First(); //如有邮箱提醒 if (u003.billGenerate_email == true) { BillSendByEmail(dbma1, p400.receiverUserSN, p400.assetsSN); } //如有短信提醒 if (u003.billGenerate_shortMessage == true) { BillSendBySM(dbma1, p400.receiverUserSN, p400.assetsSN); } dbma1.SubmitChanges(); } }
//插入安全管理表 U003 private void InsertIntoU003(DBMA1DataContext dbma1, string max33SN, string pwd) { U003 u003 = new U003(); u003.userSN = max33SN; u003.transactPwd = IFL.Comm.C101.FC10103(pwd); dbma1.U003s.InsertOnSubmit(u003); }
public void FP80312(string name, string value) { string userSN = session["userSN"].ToString(); //string userSN = "U00001"; using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { U003 u003 = dbma1.U003s.Where(c => c.userSN == userSN).First(); switch (name) { case "AccountSMS": u003.billGenerate_shortMessage = value == "1" ? true : false; break; case "AccountEmail": u003.billGenerate_email = value == "1" ? true : false; break; case "TimeOutSMS": u003.overdue_shortMessage = value == "1" ? true : false; break; case "TimeOutEmail": u003.overdue_email = value == "1" ? true : false; break; case "BookSMS": u003.receiveReserve_shortMessage = value == "1" ? true : false; break; case "BookEmail": u003.receiveReserve_email = value == "1" ? true : false; break; } dbma1.SubmitChanges(); } }
//0:成功。1:密码错误。2:余额不足。 3:资产已被取消。4:资产已被预约 public string FP40201(string assetsSN, string pwd) { string userSN = session["userSN"].ToString(); using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { //有效性检查(1、已被取消。2、已被预约) var data1 = dbma1.P300s.Where(c => c.assetsSN == assetsSN && c.cancelDate != null).FirstOrDefault(); var data2 = dbma1.P400s.Where(c => c.assetsSN == assetsSN && c.senderCancelReserveDate == null && c.receiverRefuseReserveDate == null).FirstOrDefault(); if (data1 != null) { return("3"); } if (data2 != null) { return("4"); } //密码是否正确 if (C201.FC20146(dbma1, userSN, pwd) == false) { return("1"); } //余额是否充足 decimal assetsReserveFee = Convert.ToDecimal(dbma1.A026s.First().assetsReserveCost); //扣款 if (C201.FC20147(dbma1, userSN, assetsReserveFee, "资产预约", null) == false) { return("2"); } //加入资产预约表 P400 string sellerUserSN = dbma1.P300s.Where(c => c.assetsSN == assetsSN).First().publisherUserSN; string max33SN = C101.FC10102("P400", 7, "H"); P400 p400 = new P400(); p400.reserveSN = max33SN; p400.senderUserSN = userSN; p400.receiverUserSN = sellerUserSN; p400.assetsSN = assetsSN; p400.reserveDate = DateTime.Now; dbma1.P400s.InsertOnSubmit(p400); //加入成长值表 F006 F006 f006 = new F006(); f006.groupUpSN = C101.FC10102("F006", 7, "UD"); f006.userSN = userSN; f006.businessSN = max33SN; f006.businessType = "资产预约"; f006.transactionMoneyAmount = assetsReserveFee; f006.groupUpValue = assetsReserveFee; f006.acquireDate = DateTime.Now; dbma1.F006s.InsertOnSubmit(f006); dbma1.SubmitChanges(); U003 u003 = dbma1.U003s.Where(c => c.userSN == sellerUserSN).First(); //如有邮箱提醒 if (u003.billGenerate_email == true) { ReserveSendByEmail(dbma1, sellerUserSN, assetsSN); } //如有短信提醒 if (u003.billGenerate_shortMessage == true) { ReserveSendBySM(dbma1, sellerUserSN, assetsSN); } dbma1.SubmitChanges(); return("0"); } }
/// <summary> /// 投资方债权预约 /// </summary> public string FP10107(string pwd, string crSN, string financierUserSN) { string investorSN = session["userSN"].ToString(); //string investorSN = "U00002"; using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { //预约失效 if (dbma1.VP101001s.Where(c => c.creditRightSN == crSN).FirstOrDefault() == null) { return("false"); } //验证交易密码是否正确 string transPwd = dbma1.U003s.Where(c => c.userSN == investorSN).First().transactPwd; if (C101.FC10104(pwd, transPwd) == false) { return("false"); } //从余额中扣除服务费 F000 A023 a023 = dbma1.A023s.First(); decimal reserveFee = Convert.ToDecimal(a023.financingReserveCost); F000 f000 = dbma1.F000s.Where(c => c.userSN == investorSN).First(); if (f000.balance < reserveFee) { return("false"); } f000.balance -= reserveFee; //加入收支明细表中 F003 string F003max33SN = C101.FC10102("F003", 8, "UA"); F003 f003 = new F003(); f003.revenueExpenditureSN = F003max33SN; f003.generetorUserSN = investorSN; f003.generateDate = DateTime.Now; f003.type = "债权预约"; f003.expenditure = reserveFee; f003.balance = f000.balance; dbma1.F003s.InsertOnSubmit(f003); //预约 string max33SN = C101.FC10102("P100", 7, "A"); P100 p100 = new P100(); p100.reserveSN = max33SN; p100.senderUserSN = investorSN; p100.receiverUserSN = financierUserSN; p100.creditRightSN = crSN; p100.sendDate = DateTime.Now; dbma1.P100s.InsertOnSubmit(p100); //加入成长值表 F006 string F006Max33SN = C101.FC10102("F006", 7, "UD"); F006 f006 = new F006(); f006.groupUpSN = F006Max33SN; f006.userSN = investorSN; f006.businessSN = max33SN; f006.businessType = "债权预约"; f006.transactionMoneyAmount = reserveFee; f006.groupUpValue = reserveFee; f006.acquireDate = DateTime.Now; dbma1.F006s.InsertOnSubmit(f006); dbma1.SubmitChanges(); U003 u003 = dbma1.U003s.Where(c => c.userSN == financierUserSN).First(); //如有邮箱提醒 if (u003.billGenerate_email == true) { SendByEmail(dbma1, financierUserSN, crSN); } //如有短信提醒 if (u003.billGenerate_shortMessage == true) { SendBySM(dbma1, financierUserSN, crSN); } dbma1.SubmitChanges(); return("true"); } }
/// <summary> /// 确认预约财务顾问 /// </summary> public void FP10301(string consultantUserSN, string crSN, decimal quotePricePercent) { string investorUserSN = session["userSN"].ToString(); //string investorUserSN = "U00002"; using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { //检查有效性(1、没有被投资。) var data1 = dbma1.P102s.Where(c => c.creditRightSN == crSN).FirstOrDefault(); if (data1 != null) { return; } //获取reserveSN string crReserveSN = string.Empty; var linqData1 = (from c in dbma1.P203s where c.creditRightSN == crSN && c.senderCancelReserveDate == null && c.receiverRefuseReserveDate == null select c).FirstOrDefault(); if (linqData1 == null) { var linqData2 = (from c in dbma1.P100s where c.creditRightSN == crSN && c.senderCancelReserveDate == null && c.receiverRefuseReserveDate == null select c).FirstOrDefault(); if (linqData2 == null) { return; } crReserveSN = linqData2.reserveSN; } else { crReserveSN = linqData1.reserveSN; } string max33SN = C101.FC10102("P101", 7, "B"); P101 p101 = new P101(); p101.reserveSN = max33SN; p101.creditRightReserveSN = crReserveSN; p101.senderUserSN = investorUserSN; p101.receiverUserSN = consultantUserSN; p101.creditRightSN = crSN; p101.costPercent = quotePricePercent; p101.sendTime = DateTime.Now; dbma1.P101s.InsertOnSubmit(p101); dbma1.SubmitChanges(); U003 u003 = dbma1.U003s.Where(c => c.userSN == consultantUserSN).First(); //如有邮箱提醒 if (u003.billGenerate_email == true) { SendByEmail(dbma1, consultantUserSN, investorUserSN); } //如有短信提醒 if (u003.billGenerate_shortMessage == true) { SendBySM(dbma1, consultantUserSN, investorUserSN); } dbma1.SubmitChanges(); } }
/// <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"); } }