public string FP50301(int pageSize) { string consultantUserSN = session["userSN"].ToString(); //string consultantUserSN = "U00003"; using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { var linqData = (from c in dbma1.VP503001s where c.consultantUserSN == consultantUserSN orderby c.acceptReserveDate descending select c).Take(pageSize).ToList(); return(string.Format("{{\"crDataList\":{0},\"maxDatetime\":\"{1}\"}}", C101.FC10107(linqData), DateTime.Now)); } }
//“0”:成功; “1”:交易密码错误; "2":姓名错误 public string FM060301(string phone, string name, decimal changeAmount, string changeReasonType, string pwd, string note) { using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { //查看密码是否正确 int operatorSN = Convert.ToInt32(session["internalUserId"].ToString()); var data = dbma1.internal_users.Where(c => c.internal_user_id == operatorSN && c.pwd == pwd).FirstOrDefault(); if (data == null) { return("{\"sucStatus\":\"1\"}"); } var u000 = dbma1.U000s.Where(c => c.phone == phone).First(); string userSN = u000.userSN; //姓名是否正确 if (u000.name.Trim() != name) { return("{\"sucStatus\":\"2\"}"); } //更新余额表 F000 F000 f000 = dbma1.F000s.Where(c => c.userSN == userSN).First(); f000.balance += changeAmount; //添加调账表 F007 F007 f007 = new F007(); f007.changeAccountSN = C101.FC10102("F007", 7, "UF"); f007.userSN = userSN; f007.phone = phone; f007.name = name; f007.changeAmount = changeAmount; f007.changeReasonType = changeReasonType; f007.note = note; f007.changeDate = DateTime.Now; dbma1.F007s.InsertOnSubmit(f007); //添加收支明细表 F003 F003 f003 = new F003(); f003.revenueExpenditureSN = C101.FC10102("F003", 8, "UA"); f003.generetorUserSN = userSN; f003.generateDate = DateTime.Now; f003.type = changeReasonType; f003.revenue = changeAmount; f003.expenditure = 0; f003.balance = f000.balance; f003.referSN = f007.changeAccountSN; dbma1.F003s.InsertOnSubmit(f003); //添加后台修改记录 B00 B000 b000 = new B000(); b000.bgOperateSN = C101.FC10102("B000", 5, "B"); b000.tableName = "B005"; b000.pkSN = f007.changeAccountSN; b000.actionTypeSN = "B0G"; b000.operatorSN = operatorSN; b000.operateDate = DateTime.Now; dbma1.B000s.InsertOnSubmit(b000); dbma1.SubmitChanges(); dbma1.SubmitChanges(); return(string.Format("{{\"sucStatus\":\"0\",\"SN\":\"{0}\",\"date\":{1}}}", f007.changeAccountSN, C101.FC10107(DateTime.Now))); } }
public string FP80306() { //判断是否登录 if (session["userSN"] == null) { return("notLogin"); } string userSN = session["userSN"].ToString(); using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { U000 u000 = dbma1.U000s.Where(c => c.userSN == userSN).First(); //获取用户名 string userName = u000.name; //获取短信费用 decimal shortMessageFee = Convert.ToDecimal(dbma1.A028s.First().shortMessageCost); //获取手机号码 string phone = u000.phone; //获取原邮箱 string email = dbma1.U002s.Where(c => c.userSN == userSN).First().email; //获取通知设定 var u003 = (from c in dbma1.U003s where c.userSN == userSN select new { c.billGenerate_shortMessage, c.billGenerate_email, c.overdue_shortMessage, c.overdue_email, c.receiveReserve_shortMessage, c.receiveReserve_email }).First(); return(string.Format("{{\"userName\":\"{0}\",\"shortMessageFee\":\"{1}\",\"phone\":\"{2}\",\"email\":\"{3}\",\"messageConfig\":{4},\"userSN\":\"{5}\"}}", userName, shortMessageFee, phone, email, C101.FC10107(u003), userSN)); } }
/// <summary> /// 获取投资方详细信息 /// </summary> public string FP20108(string investorUserSN) { using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { var investorData = (from c in dbma1.VP801001s where c.userSN == investorUserSN select new { c.userSN, c.birthday, c.gender, c.registeredResidence, c.idCard, c.email, c.maritalStatusType, c.enterpriseType, c.hiredate, c.workTel, c.post, c.enterpriseSwitchboard, c.enterpriseWebsite, c.investMainType, c.financingMain, c.maxMortgageRate, c.guaranteeType, c.investProvince, c.investCity, c.minInvestMoneyAmount, c.minInterestRate, c.minInvestDays, c.maxInvestDays, c.collateralDemand }).First(); var investStatus = dbma1.VP104011s.Where(c => c.investorUserSN == investorUserSN).First(); string res = string.Format("{{\"investorData\":{0},\"investCaseAmount\":{1},\"investMoneyAmount\":{2}}}", C101.FC10107(investorData), investStatus.investCaseAmount, investStatus.InvestMoneyAmount); return(res); } }
/// <summary> /// 获取uip /// </summary> public string FP80200() { if (session["userSN"] == null) { return("notLogin"); } string userSN = session["userSN"].ToString(); using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { string provinceData = C201.FC20121(dbma1).Replace("[", "").Replace("]", ""); string marital = C201.FC20100(dbma1).Replace("[", "").Replace("]", ""); string enterpriseType = C201.FC20104(dbma1).Replace("[", "").Replace("]", ""); string investMain = 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 healthStatus = C201.FC20101(dbma1).Replace("[", "").Replace("]", ""); //string creditStatusType = C201.FC20105(dbma1).Replace("[", "").Replace("]", ""); string industryType = C201.FC20113(dbma1).Replace("[", "").Replace("]", ""); string cityData = C201.FC20148(dbma1); U002 u002 = dbma1.U002s.Where(c => c.userSN == userSN).First(); //当前成长值 decimal currentGroupValue = Convert.ToInt32(dbma1.F006s.Where(c => c.userSN == userSN).Sum(c => c.groupUpValue)); var userInfo = new { No = u002.userSN, Name = u002.name, Sex = u002.gender, BirthDay = u002.birthday, CardID = u002.idCard.Substring(0, 6) + "*", Mobile = u002.phone, CardAddress = u002.registeredResidence, MyGrow = currentGroupValue }; string userInfoStr = C101.FC10107(userInfo); var investParams = dbma1.A023s.First(); var financingParams = dbma1.A024s.First(); var consultantParams = dbma1.A025s.First(); var purchaseParams = dbma1.A026s.First(); var sellParams = dbma1.A027s.First(); var PawnRate = new { Min = investParams.minMorgageRate, Max = investParams.maxMorgageRate }; var InvestAmt = new { Min = investParams.minInvestMoneyAmount, Max = investParams.maxInvestMoneyAmount }; var DayRate = new { Min = investParams.minDailyRate, Max = investParams.maxDailyRate }; var InvestLimit = new { Min = investParams.minInvestDays, Max = investParams.maxInvestDays }; var BayAmt = new { Min = purchaseParams.minPurchasePrice, Max = purchaseParams.maxPurchasePrice }; //var MTIn = new {Min = null,Max = null}; //var MTOut = new {Min = null,Max = null}; //var MCIn = new { Min = null, MAx = null }; var TAsset = new { Min = financingParams.minTotalAssets, Max = financingParams.maxTotalAssets }; var TBorrow = new { Min = financingParams.minTotalLiability, Max = financingParams.maxTotalLiability }; var CAsset = new { Min = financingParams.minTotalAssets, Max = financingParams.maxTotalAssets }; 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 TBorrowStr = C101.FC10107(TBorrow); string CAssetStr = C101.FC10107(CAsset); U001 u001 = dbma1.U001s.Where(c => c.userSN == userSN).First(); string investApplyStatus = u001.creditRightInvestApplyStauts == 2 ? "1" : "0"; string financingApplyStatus = u001.creditRightFinancingApplyStatus == 2 ? "1" : "0"; string sellApplyStatus = u001.assetsSellingApplyStatus == 2 ? "1" : "0"; string purchaseApplyStatus = u001.assetsPurchaseApplyStatus == 2 ? "1" : "0"; string consultantApplyStatus = u001.consultantApplyStatus == 2 ? "1" : "0"; if (u001.consultantApplyStatus == 0) { consultantApplyStatus = "0"; } else if (u001.consultantApplyStatus == 1) { consultantApplyStatus = "2"; } else if (u001.consultantApplyStatus == 2) { consultantApplyStatus = "1"; } else if (u001.consultantApplyStatus == 3) { consultantApplyStatus = "0"; } string CreditInvestStr = "\"\""; string CreditBorrowStr = "\"\""; string AssetsSalesStr = "\"\""; string AssetsBuyStr = "\"\""; string AdviserServerStr = "\"\""; //投资 if (investApplyStatus == "1") { var userLinq = dbma1.P102s.Where(c => c.investorUserSN == userSN); //债权总额 decimal crMoneyAmount = (from c in dbma1.P102s where c.investorUserSN == userSN //&& c.closeCaseDate == null select new { c.investMoneyAmount }).ToList().Sum(r => r.investMoneyAmount); //债权数量 int crAmount = (from c in dbma1.P102s where c.investorUserSN == userSN //&& c.closeCaseDate == null select c).Count(); //投资收益 decimal investEarnings = (from c in userLinq from o in c.P103s where c.closeCaseDate != null select new { earnings = (o.repayDate - c.investDate).Days * c.dailyRate * c.investMoneyAmount }).ToList().Sum(c => c.earnings); var CreditInvest = new { TotalPrice = crMoneyAmount, TotalNum = crAmount, TotalIncome = investEarnings }; CreditInvestStr = C101.FC10107(CreditInvest); } //融资 if (financingApplyStatus == "1") { //正在融资 int financingAmount = (from c in dbma1.P200s where c.publisherUserSN == userSN && c.cancelDate == null && !dbma1.P102s.Any(o => o.creditRightSN == c.creditRightSN) select c).Count(); //正在还款 int repayingAmount = (from c in dbma1.P102s where c.financierUserSN == userSN && c.closeCaseDate == null select c).Count(); //即将逾期 //即将逾期天数 int aboutToOverdueDays = 30; int aboutToOverdueAmount = (from c in dbma1.P102s where c.financierUserSN == userSN && c.closeCaseDate == null && DateTime.Now.AddDays(aboutToOverdueDays) > c.deadlineDate && DateTime.Now <= c.deadlineDate select c).Count(); var CreditBorrow = new { Borrowing = financingAmount, Paying = repayingAmount, Overdue = aboutToOverdueAmount }; CreditBorrowStr = C101.FC10107(CreditBorrow); } //资产出售 if (sellApplyStatus == "1") { //已发布 int publishAssetsAmount = (from c in dbma1.VP401001s where c.publisherUserSN == userSN select c).Count(); //预约中 //int reservingAssetsAmount = (from c in dbma1.P400s // where c.receiverUserSN == userSN // && c.senderCancelReserveDate == null // && c.receiverRefuseReserveDate == null // && !c.P401s.Any() // select c).Count(); int reservingAssetsAmount = (from c in dbma1.VP402011s where c.receiverUserSN == userSN select c).Count(); //已成交 //int purchasedAssetsAmount = dbma1.P401s.Where(c => c.sellerUserSN == userSN).Count(); int purchasedAssetsAmount = (from c in dbma1.VP404001s where c.sellerUserSN == userSN && c.sellerDeleteDate == null select c).Count(); var AssetsSales = new { Publish = publishAssetsAmount, Booking = reservingAssetsAmount, Close = purchasedAssetsAmount }; AssetsSalesStr = C101.FC10107(AssetsSales); } //资产购买 if (purchaseApplyStatus == "1") { //预约中 //int reservingAssetsAmount = (from c in dbma1.P400s // where c.senderUserSN == userSN // && c.senderCancelReserveDate == null // && c.receiverRefuseReserveDate == null // && !c.P401s.Any() // select c).Count(); int reservingAssetsAmount = (from c in dbma1.VP402011s where c.senderUserSN == userSN select c).Count(); //已成交 //int purchasedAssetsAmount = dbma1.P401s.Where(c => c.purchaserUserSN == userSN).Count(); int purchasedAssetsAmount = (from c in dbma1.VP404001s where c.purchaserUserSN == userSN && c.purchaserDeleteDate == null select c).Count(); var AssetsBuy = new { Booking = reservingAssetsAmount, Close = purchasedAssetsAmount }; AssetsBuyStr = C101.FC10107(AssetsBuy); } //财务管理 if (consultantApplyStatus == "1") { //预约中 int reserveAmount = (from c in dbma1.VP502001s where c.consultantUserSN == userSN select c).Count(); //服务中 int servicingAmount = (from c in dbma1.VP503001s where c.consultantUserSN == userSN select c).Count(); //已结案 int servicedAmount = (from c in dbma1.VP504021s where c.consultantUserSN == userSN select c).Count(); ////已成交 //int investAmount = (from c in dbma1.P500s.Where(c => c.consultantUserSN == userSN && c.auditStatus != null) // join o in dbma1.P101s on c.reserveSN equals o.reserveSN // join p in dbma1.P102s on o.creditRightReserveSN equals p.reserveSN // select c).Count(); var AdviserServer = new { Booking = reserveAmount, Serving = servicingAmount, Close = servicedAmount }; AdviserServerStr = C101.FC10107(AdviserServer); } //财务管理 decimal balanceV = dbma1.F000s.Where(c => c.userSN == userSN).First().balance; decimal usedV = Convert.ToDecimal ( (from c in dbma1.F003s where c.generetorUserSN == userSN && c.expenditure != null select c.expenditure).Sum() ); int needPayBillAmount = (from c in dbma1.F001s where c.payerUserSN == userSN && !dbma1.F002s.Any(o => o.billSN == c.billSN) select c).Count(); var cwData = new { RemainVB = balanceV, UsedVB = usedV, Payable = needPayBillAmount }; string FinaceStr = C101.FC10107(cwData); //成长值 string GrowUpInfoStr = GrowUp(dbma1, userSN, currentGroupValue); //安全管理 int temp = 0; if (dbma1.U000s.Where(c => c.userSN == userSN).First().ifChangePwd == true) { temp++; } if (dbma1.U003s.Where(c => c.userSN == userSN).First().ifChangeTransactPwd == true) { temp++; } if (u002.ifChangeEmail == true) { temp++; } string level = string.Empty; if (temp == 0 || temp == 1) { level = "低"; } else if (temp == 2) { level = "中"; } else { level = "高"; } var SafeManage = new { Leval = level, Mobile = u002.phone, Email = u002.email == null ? "" : u002.email }; string SafeManageStr = C101.FC10107(SafeManage); //服务费 var SvrFee = new { Invest = investParams.openServerCost, Borrow = financingParams.openServerCost, AssetSale = sellParams.openServerCost, AssetBuy = purchaseParams.openServerCost, Adviser = consultantParams.openServerCost }; string SvrFeeStr = C101.FC10107(SvrFee); //账单逾期及停止服务 A028 a028 = dbma1.A028s.First(); var SvrStopTip = new { Day = a028.serverStopDays, Rate = a028.serverStopRate }; var OverdueTip = new { Day = Convert.ToInt32(a028.needPayDays), Rate = a028.overdueRateDaily }; string SvrStopTipStr = C101.FC10107(SvrStopTip); string OverdueTipStr = C101.FC10107(OverdueTip); //注册奖励V币数 decimal SentScore = Convert.ToInt32(dbma1.A031s.First().regPresentV); //账单情况 string billStatus; //无未付账单 if (needPayBillAmount == 0) { billStatus = "0"; } else { var linq = (from c in dbma1.F001s where c.payerUserSN == userSN && !dbma1.F002s.Any(o => o.billSN == c.billSN) && (DateTime.Now - c.generateDate).Days >= OverdueTip.Day select c).FirstOrDefault(); //付款未超过规定时间 if (linq == null) { billStatus = "1"; } //付款超过规定时间 else { billStatus = "2"; } } //是否已经领取V币 string ifGetV = (from c in dbma1.F004s where c.userSN == userSN && c.rewardType.Trim() == "注册赠送" select c).FirstOrDefault() == null ? "1" : "0"; string res; res = string.Format("{{\"SltConfigData\":[{0},{1},{2},{3},{4},{5},{6},{7},{8}],\"PawnRate\":{9},\"InvestAmt\":{10},\"DayRate\":{11},\"InvestLimit\":{12},\"BayAmt\":{13},\"TAsset\":{14},\"TBorrow\":{15},\"CAsset\":{16},\"CreditInvest\":{17},\"CreditBorrow\":{18},\"AssetsSales\":{19},\"AssetsBuy\":{20},\"AdviserServer\":{21},\"Finace\":{22},\"GrowUpInfo\":{23},\"SafeManage\":{24},\"SvrFee\":{25},\"SvrStopTip\":{26},\"OverdueTip\":{27},\"SentScore\":\"{28}\",\"investApplyStatus\":\"{29}\",\"financingApplyStatus\":\"{30}\",\"sellApplyStatus\":\"{31}\",\"purchaseApplyStatus\":\"{32}\",\"consultantApplyStatus\":\"{33}\",\"investStatus\":\"{34}\",\"financingStatus\":\"{35}\",\"sellStatus\":\"{36}\",\"purchaseStatus\":\"{37}\",\"consultantStatus\":\"{38}\",\"ifGetV\":\"{39}\",\"UserInfo\":{40},\"billStatus\":\"{41}\",\"cityData\":{42}}}", provinceData, marital, enterpriseType, investMain, guaranteeType, assetsType, degreeType, healthStatus, industryType, PawnRateStr, InvestAmtStr, DayRateStr, InvestLimitStr, BayAmtStr, TAssetStr, TBorrowStr, CAssetStr, CreditInvestStr, CreditBorrowStr, AssetsSalesStr, AssetsBuyStr, AdviserServerStr, FinaceStr, GrowUpInfoStr, SafeManageStr, SvrFeeStr, SvrStopTipStr, OverdueTipStr, SentScore, investApplyStatus, financingApplyStatus, sellApplyStatus, purchaseApplyStatus, consultantApplyStatus, u001.creditRightInvestStatus, u001.creditRightFinancingStatus, u001.assetsSellingStatus, u001.assetsPruchaseStatus, u001.consultantStatus, ifGetV, userInfoStr, billStatus, cityData); return(res); } }
public string FM020210(int pageFrom, int pageSize, string sortStr) { using (DBBC1DataContext dbbc1 = new DBBC1DataContext()) { var dataList = Sort(dbbc1, sortStr).Skip(pageFrom).Take(pageSize).ToList(); //服务状态 string serverStatusListStr = GetServerStatusList(dataList); return(string.Format("{{\"dataList\":{0},\"serverStatusList\":{1}}}", C101.FC10107(dataList), serverStatusListStr)); } }
/// <summary> /// 获取选择顾问列表 /// </summary> public string FP10210(string crSN, string sortStr) { string investorUserSN = session["userSN"].ToString(); string orderStr = string.Empty; string[] sortStrSplit = sortStr.Split(','); for (int i = 1; i < (sortStrSplit.Length - 1); i++) { string[] sortStrSplitSplit = sortStrSplit[i].Split('#'); if ((i != 1)) { orderStr += ","; } orderStr += sortStrSplitSplit[0] == "1" ? " successCaseAmount" : " caseAmount"; orderStr += sortStrSplitSplit[1] == "A" ? "" : " desc"; } using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { List <SelectConsultantList> consultantList = null; string sqlStr = string.Format("select VP509011.consultantUserSN,VP509011.serviceProvince,VP509011.serviceCity,VP509011.caseAmount,VP509011.successCaseAmount,A.qualificationSN from VP509011 left join (select consultantUserSN,qualificationSN from P104 where investorUserSN = '{0}' and creditRightSN = '{1}') as A on VP509011.consultantUserSN = A.consultantUserSN", investorUserSN, crSN); if (orderStr == string.Empty) { consultantList = dbma1.ExecuteQuery <SelectConsultantList>(sqlStr).ToList(); } else { sqlStr = string.Format("{0} order by {1}", sqlStr, orderStr); consultantList = dbma1.ExecuteQuery <SelectConsultantList>(sqlStr).ToList(); } //发布费用 A023 a023 = dbma1.A023s.First(); decimal?fee = a023.consultantReserveCost; //账户余额 F000 f000 = dbma1.F000s.Where(c => c.userSN == investorUserSN).First(); decimal balance = f000.balance; return(string.Format("{{\"balance\":\"{0}\",\"fee\":\"{1}\",\"consultantDataList\":{2}}}", balance, fee, C101.FC10107(consultantList))); } }
/// <summary> /// 获取隐藏融资方信息 /// </summary> public string FP10105(string financierUserSN) { using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { //案例情况 var caseStatus = dbma1.P102s.Where(c => c.financierUserSN == financierUserSN); int caseAmount = caseStatus.Count(); decimal?caseMoneyAmount = caseAmount == 0 ? 0 : caseStatus.Sum(c => c.investMoneyAmount); //当前债务情况 var debtStatus = dbma1.P102s.Where(c => c.financierUserSN == financierUserSN && c.closeCaseDate == null); int debtAmount = 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; int currentOverdueAmount = 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; int historyOverdueAmount = historyOverdueStatus.Count(); //注册时间 DateTime regDatetime = dbma1.U000s.Where(c => c.userSN == financierUserSN).First().registerDate; string regDatetimeStr = C101.FC10107(regDatetime); //基本信息 var financierBasicData = (from c in dbma1.VP801001s where c.userSN == financierUserSN select new { c.userSN, c.birthday, c.gender, c.registeredResidence, idCard = c.idCard.Substring(0, 6), c.maritalStatusType, c.procreateStatus, c.healthyStatusType, c.ifBasicLivingAllowance, c.graduateSchool, c.degreeType, c.enterpriseType, c.hiredate, c.post, c.monthlyTotalIncome, c.monthlyTotalExpenditure, c.monthlyNetIncome, c.totalAssets, c.totalDebt, netAssests = c.totalAssets - c.totalDebt, c.ifCourtImplementation, c.creditStatus }).First(); string financierBasicDataStr = C101.FC10107(financierBasicData); string res = string.Format("{{\"financierBasicData\":{0},\"caseAmount\":{1},\"caseMoneyAmount\":{2},\"debtAmount\":{3},\"debtMoneyAmount\":{4},\"currentOverdueAmount\":{5},\"currentOverdueMoneyAmount\":{6},\"historyOverdueAmount\":{7},\"regDatetime\":{8}}}", financierBasicDataStr, caseAmount, caseMoneyAmount, debtAmount, debtMoneyAmount, currentOverdueAmount, currentOverdueMoneyAmount, historyOverdueAmount, regDatetimeStr); return(res); } }
public string FP90201(int pageSize) { //判断是否登录 if (session["userSN"] == null) { return("notLogin"); } string userSN = session["userSN"].ToString(); using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { string userName = dbma1.U000s.Where(c => c.userSN == userSN).First().name; A028 a028 = dbma1.A028s.First(); int needPayDays = Convert.ToInt32(a028.needPayDays); decimal overdueRateDaily = Convert.ToDecimal(a028.overdueRateDaily); var billList = (from c in dbma1.F001s where c.payerUserSN == userSN && !c.F002s.Any() orderby c.generateDate descending select new { c.billSN, c.businessSN, c.billType, c.MoneyAmount, c.generateDate, needPayDate = c.generateDate.AddDays(needPayDays), lateFee = (DateTime.Now - c.generateDate).Days > needPayDays ? c.MoneyAmount * overdueRateDaily * ((DateTime.Now - c.generateDate).Days - needPayDays) : 0 }).Take(pageSize).ToList(); return(string.Format("{{\"dataList\":{0},\"maxDatetime\":\"{1}\",\"userName\":\"{2}\",\"userSN\":\"{3}\"}}", C101.FC10107(billList), DateTime.Now, userName, userSN)); } }
/// <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(); } }
public string FP90202(string billSN, string pwd) { string userSN = session["userSN"].ToString(); //string userSN = "U00001"; using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { //有效性检查(1、已经付款) var data1 = dbma1.F002s.Where(c => c.billSN == billSN).FirstOrDefault(); if (data1 != null) { return("true"); } //验证交易密码是否正确 string transPwd = dbma1.U003s.Where(c => c.userSN == userSN).First().transactPwd; if (C101.FC10104(pwd, transPwd) == false) { return("false"); } //从余额中扣除服务费 F000 A028 a028 = dbma1.A028s.First(); int needPayDays = Convert.ToInt32(a028.needPayDays); decimal overdueRateDaily = Convert.ToDecimal(a028.overdueRateDaily); F001 f001 = dbma1.F001s.Where(c => c.billSN == billSN).First(); decimal moneyAmount = Convert.ToDecimal(f001.MoneyAmount); decimal lateFee = Convert.ToDecimal((DateTime.Now - f001.generateDate).Days > needPayDays ? f001.MoneyAmount * overdueRateDaily * ((DateTime.Now - f001.generateDate).Days - needPayDays) : 0); decimal fee = moneyAmount + lateFee; F000 f000 = dbma1.F000s.Where(c => c.userSN == userSN).First(); if (f000.balance < fee) { return("false"); } f000.balance -= fee; //加入收支明细表中 F003 string F003max33SN = C101.FC10102("F003", 8, "UA"); F003 f003 = new F003(); f003.revenueExpenditureSN = F003max33SN; f003.generetorUserSN = userSN; f003.generateDate = DateTime.Now; f003.type = "资产出售账单"; f003.expenditure = fee; f003.balance = f000.balance; dbma1.F003s.InsertOnSubmit(f003); //加入付款表 F001 string F002max33SN = C101.FC10102("F002", 6, "QA"); F002 f002 = new F002(); f002.paySN = F002max33SN; f002.billSN = billSN; f002.payMoneyAmount = fee; f002.payDate = DateTime.Now; dbma1.F002s.InsertOnSubmit(f002); //加入成长值表 F006 string F006Max33SN = C101.FC10102("F006", 7, "UD"); F006 f006 = new F006(); f006.groupUpSN = F006Max33SN; f006.userSN = userSN; f006.businessSN = F002max33SN; f006.businessType = "账单付款"; f006.transactionMoneyAmount = fee; f006.groupUpValue = fee; f006.acquireDate = DateTime.Now; dbma1.F006s.InsertOnSubmit(f006); dbma1.SubmitChanges(); return("true"); } }
//0:成功; 1:岗位已经删除 public string FM100401(string roleSN) { using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { //岗位已经删除 var dataVarify = dbma1.B004s.Where(c => c.roleTypeSN == roleSN && c.deleteDate == null).FirstOrDefault(); if (dataVarify == null) { return("{\"status\":\"1\"}"); } //属于该岗位的用户 var data1 = from c in dbma1.B003s.Where(c => c.roleTypeSN == roleSN && c.deleteDate == null) from o in dbma1.internal_users.Where(o => o.internal_user_id == c.internalUserSN) select new { o.work_num, o.name, o.gender, o.department_name, o.jobs, o.internal_user_id, o.fk_user_group_id }; var dataUse = (from c in data1 join p in dbma1.user_groups on c.fk_user_group_id equals p.user_group_id into g from p in g.DefaultIfEmpty() select new { c.work_num, c.name, c.gender, c.department_name, c.jobs, p.user_group_name, c.internal_user_id }).ToList(); //未分配岗位的用户 var dataNotUse = (from o in dbma1.internal_users.Where(o => !dbma1.B003s.Where(c => c.deleteDate == null && c.internalUserSN == o.internal_user_id).Any()) join p in dbma1.user_groups on o.fk_user_group_id equals p.user_group_id into g from p in g.DefaultIfEmpty() select new { o.work_num, o.name, o.gender, o.department_name, o.jobs, p.user_group_name, o.internal_user_id }).ToList(); return(string.Format("{{\"status\":\"0\",\"dataUse\":{0},\"dataNotUse\":{1}}}", C101.FC10107(dataUse), C101.FC10107(dataNotUse))); } }
/// <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"); } }
public string FP70101() { //判断是否登录 if (session["userSN"] == null) { return("notLogin"); } string userSN = session["userSN"].ToString(); using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { //用户名 string userName = dbma1.U000s.Where(c => c.userSN == userSN).First().name; //vip等级设置 A029 a029 = dbma1.A029s.First(); string a029Str = C101.FC10107(a029); //当前成长值 decimal currentGroupValue = Convert.ToInt32(dbma1.F006s.Where(c => c.userSN == userSN).Sum(c => c.groupUpValue)); //当前vip等级及奖励率 string vipLevel = string.Empty; decimal rewardRate; if (currentGroupValue < a029.vip1_originateValue) { vipLevel = "0"; rewardRate = 0; } else if (currentGroupValue < a029.vip2_originateValue) { vipLevel = "1"; rewardRate = a029.vip1_rewardRate; } else if (currentGroupValue < a029.vip3_originateValue) { vipLevel = "2"; rewardRate = a029.vip2_rewardRate; } else if (currentGroupValue < a029.vip4_originateValue) { vipLevel = "3"; rewardRate = a029.vip3_rewardRate; } else if (currentGroupValue < a029.vip5_originateValue) { vipLevel = "4"; rewardRate = a029.vip4_rewardRate; } else if (currentGroupValue < a029.vip6_originateValue) { vipLevel = "5"; rewardRate = a029.vip5_rewardRate; } else if (currentGroupValue < a029.vip7_originateValue) { vipLevel = "6"; rewardRate = a029.vip6_rewardRate; } else { vipLevel = "7"; rewardRate = a029.vip7_rewardRate; } //已奖励的V币 int rewardV = Convert.ToInt32 ( (from c in dbma1.F004s where c.userSN == userSN && c.rewardType == "充值奖励" select c.rewardAmount).Sum() ); return(string.Format("{{\"userName\":\"{0}\",\"vipConfig\":{1},\"currentGroupValue\":\"{2}\",\"vipLevel\":\"{3}\",\"rewardRate\":\"{4}\",\"rewardV\":\"{5}\",\"userSN\":\"{6}\"}}", userName, a029Str, currentGroupValue, vipLevel, rewardRate, rewardV, userSN)); } }
/// <summary> /// 获得顾问隐藏后信息 /// </summary> public string FP10211(string consultantUserSN, int ifVisiable) { using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { string consultantBasicDataStr = null; //传递隐藏信息 if (ifVisiable == 0) { //基本信息 var consultantBasicData = (from c in dbma1.VP801001s where c.userSN == consultantUserSN select new { c.userSN, c.birthday, c.gender, c.registeredResidence, idCard = c.idCard.Substring(0, 6), c.maritalStatusType, c.procreateStatus, c.graduateSchool, c.degreeType, c.industryType, c.enterpriseType, c.serviceProvince, c.serviceCity, c.investigate, c.assetsEvaluate, c.badLoanCollect, c.creditRightGuarantee, c.consultantDetails }).First(); consultantBasicDataStr = C101.FC10107(consultantBasicData); } else { //基本信息 var consultantBasicData = (from c in dbma1.VP801001s where c.userSN == consultantUserSN select new { c.userSN, c.name, c.birthday, c.gender, c.registeredResidence, idCard = c.idCard.Substring(0, 6), c.phone, c.email, c.maritalStatusType, c.procreateStatus, c.currentAddressProvince, c.currentAddressCity, c.currentAddressDetails, c.graduateSchool, c.degreeType, c.industryType, c.enterpriseType, c.serviceProvince, c.serviceCity, c.investigate, c.assetsEvaluate, c.badLoanCollect, c.creditRightGuarantee, c.consultantDetails }).First(); consultantBasicDataStr = C101.FC10107(consultantBasicData); } //注册时间 DateTime regDatetime = dbma1.U000s.Where(c => c.userSN == consultantUserSN).First().registerDate; string regDatetimeStr = C101.FC10107(regDatetime); //案例数量 int caseAmount = (from c in dbma1.P500s where c.consultantUserSN == consultantUserSN select c).Count(); //成功案例 int successCaseAmount = (from c in dbma1.P102s join o in dbma1.P103s.Where(oo => oo.ifOverdue == false) on c.investSN equals o.investSN join p in dbma1.P500s.Where(pp => pp.consultantUserSN == consultantUserSN && pp.auditStatus == true) on c.reserveSN equals p.reserveSN select c).Count(); //当前坏账 int currentBadLoanCaseAmount = (from c in dbma1.P500s.Where(cc => cc.consultantUserSN == consultantUserSN && cc.auditStatus != false) join o in dbma1.P102s.Where(oo => oo.closeCaseDate == null && oo.deadlineDate.Date < DateTime.Now.Date) on c.reserveSN equals o.reserveSN select c).Count(); //历史坏账 int historyBadLoanCaseAmount = (from c in dbma1.P102s join o in dbma1.P103s.Where(oo => oo.ifOverdue == true) on c.investSN equals o.investSN join p in dbma1.P500s.Where(pp => pp.consultantUserSN == consultantUserSN && pp.auditStatus != false) on c.reserveSN equals p.reserveSN select c).Count(); //坏账数量 int badLoanCaseAmount = currentBadLoanCaseAmount + historyBadLoanCaseAmount; return(string.Format("{{\"consultantBasicData\":{0},\"regDatetime\":{1},\"caseAmount\":\"{2}\",\"successCaseAmount\":\"{3}\",\"badLoanCaseAmount\":\"{4}\",\"currentBadLoanCaseAmount\":\"{5}\"}}", consultantBasicDataStr, regDatetimeStr, caseAmount, successCaseAmount, badLoanCaseAmount, currentBadLoanCaseAmount)); } }
/// <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> /// 获得顾问隐藏的信息 /// 0:操作失败 不返回失败原因;1:操作成功;2;操作失败 失败原因余额不足 /// </summary> public string FP10213(string pwd, string consultantUserSN, string crSN) { string investorUserSN = session["userSN"].ToString(); //string investorUserSN = "U00002"; using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { //检查有效性(1、没有被投资。2、债权已经被取消或者拒绝) var data1 = dbma1.P102s.Where(c => c.creditRightSN == crSN).FirstOrDefault(); var data2 = (from c in dbma1.P203s where c.creditRightSN == crSN && c.senderCancelReserveDate == null && c.receiverRefuseReserveDate == null select c).FirstOrDefault(); var data3 = (from c in dbma1.P100s where c.creditRightSN == crSN && c.senderCancelReserveDate == null && c.receiverRefuseReserveDate == null select c).FirstOrDefault(); if (data1 != null || (data2 == null && data3 == null)) { return("0"); } ///验证交易密码是否正确 string transPwd = dbma1.U003s.Where(c => c.userSN == investorUserSN).First().transactPwd; if (C101.FC10104(pwd, transPwd) == false) { return("0"); } //从余额中扣除服务费 F000 A023 a023 = dbma1.A023s.First(); decimal fee = Convert.ToDecimal(a023.consultantReserveCost); F000 f000 = dbma1.F000s.Where(c => c.userSN == investorUserSN).First(); if (f000.balance < fee) { return("2"); } f000.balance -= fee; //加入收支明细表中 F003 string F003max33SN = C101.FC10102("F003", 8, "UA"); F003 f003 = new F003(); f003.revenueExpenditureSN = F003max33SN; f003.generetorUserSN = investorUserSN; f003.generateDate = DateTime.Now; f003.type = "顾问预约"; f003.expenditure = fee; f003.balance = f000.balance; dbma1.F003s.InsertOnSubmit(f003); //获取隐藏信息 var consultantBasicData = (from c in dbma1.VP801001s where c.userSN == consultantUserSN select new { c.name, idCard = c.idCard.Substring(0, 6), c.phone, c.email, c.currentAddressProvince, c.currentAddressCity, c.currentAddressDetails }).First(); string consultantBasicDataStr = C101.FC10107(consultantBasicData); //添加一条投资方查看顾问信息资格表记录,P104 string max33SN = AddRecord(dbma1, investorUserSN, consultantUserSN, crSN); //加入成长值表 F006 string F006Max33SN = C101.FC10102("F006", 7, "UD"); F006 f006 = new F006(); f006.groupUpSN = F006Max33SN; f006.userSN = investorUserSN; f006.businessSN = max33SN; f006.businessType = "顾问预约"; f006.transactionMoneyAmount = fee; f006.groupUpValue = fee; f006.acquireDate = DateTime.Now; dbma1.F006s.InsertOnSubmit(f006); dbma1.SubmitChanges(); return(string.Format("{{\"status\":\"{0}\",\"consultantHideData\":{1}}}", 1, consultantBasicDataStr)); } }
//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 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(); } }
public string FINIT(int pageSize) { string pawnStr = string.Empty; string dataListStr = string.Empty; using (DBBC1DataContext dbbc1 = new DBBC1DataContext()) { //数据 var dataList = dbbc1.B200s.Take(pageSize).ToList(); dataListStr = C101.FC10107(dataList); using (DBBS1DataContext dbbs1 = new DBBS1DataContext()) { //uip pawnStr = C102.FC20108(dbbs1); //服务状态 string serverStatusListStr = GetServerStatusList(dataList); return(string.Format("{{\"dataList\":{0},\"serverStatusList\":{1},\"pawn\":{2}}}", C101.FC10107(dataList), serverStatusListStr, pawnStr)); } } }
public string FP10208(string crSN, string consultantUserSN) { string investorUserSN = session["userSN"].ToString(); //string investorUserSN = "U00002"; using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { //基本信息 var consultantBasicData = (from c in dbma1.VP801001s where c.userSN == consultantUserSN select new { c.userSN, c.name, c.birthday, c.gender, c.registeredResidence, idCard = c.idCard.Substring(0, 6), c.phone, c.email, c.maritalStatusType, c.procreateStatus, c.currentAddressProvince, c.currentAddressCity, c.currentAddressDetails, c.graduateSchool, c.degreeType, c.industryType, c.enterpriseType, c.serviceProvince, c.serviceCity, c.investigate, c.assetsEvaluate, c.badLoanCollect, c.creditRightGuarantee, c.consultantDetails }).First(); string consultantBasicDataStr = C101.FC10107(consultantBasicData); //注册时间 DateTime regDatetime = dbma1.U000s.Where(c => c.userSN == consultantUserSN).First().registerDate; string regDatetimeStr = C101.FC10107(regDatetime); //案例数量 int caseAmount = (from c in dbma1.P500s where c.consultantUserSN == consultantUserSN select c).Count(); //成功案例 int successCaseAmount = (from c in dbma1.P102s join o in dbma1.P103s.Where(oo => oo.ifOverdue == false) on c.investSN equals o.investSN join p in dbma1.P500s.Where(pp => pp.consultantUserSN == consultantUserSN && pp.auditStatus == true) on c.reserveSN equals p.reserveSN select c).Count(); //当前坏账 int currentBadLoanCaseAmount = (from c in dbma1.P500s.Where(cc => cc.consultantUserSN == consultantUserSN && cc.auditStatus != false) join o in dbma1.P102s.Where(oo => oo.closeCaseDate == null && oo.deadlineDate.Date < DateTime.Now.Date) on c.reserveSN equals o.reserveSN select c).Count(); //历史坏账 int historyBadLoanCaseAmount = (from c in dbma1.P102s join o in dbma1.P103s.Where(oo => oo.ifOverdue == true) on c.investSN equals o.investSN join p in dbma1.P500s.Where(pp => pp.consultantUserSN == consultantUserSN && pp.auditStatus != false) on c.reserveSN equals p.reserveSN select c).Count(); //坏账数量 int badLoanCaseAmount = currentBadLoanCaseAmount + historyBadLoanCaseAmount; //报价 decimal quotePricePercent = (from c in dbma1.P101s where c.senderUserSN == investorUserSN && c.receiverUserSN == consultantUserSN && c.creditRightSN == crSN && c.senderCancelReserveDate == null select c).OrderByDescending(c => c.sendTime).First().costPercent; decimal financingMoneyAmount = (from c in dbma1.P200s where c.creditRightSN == crSN select c).First().financingAmount; decimal quotePrice = financingMoneyAmount * quotePricePercent; return(string.Format("{{\"consultantBasicData\":{0},\"regDatetime\":{1},\"caseAmount\":\"{2}\",\"successCaseAmount\":\"{3}\",\"badLoanCaseAmount\":\"{4}\",\"currentBadLoanCaseAmount\":\"{5}\",\"quotePrice\":\"{6}\"}}", consultantBasicDataStr, regDatetimeStr, caseAmount, successCaseAmount, badLoanCaseAmount, currentBadLoanCaseAmount, quotePrice)); } }
public void FP90110(string billNo, decimal amount, string ifSuc, string ipsBillNo, string bankBillNo, string userSN) { using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { //获得vip奖励比率 //decimal rewardRate = 1; decimal rewardRate = C201.FC20152(dbma1, userSN); //充值记录表 F005 F005 f005 = dbma1.F005s.Where(c => c.rechargeSN == billNo).First(); f005.ifSuccess = ifSuc == "Y" ? true : false; f005.ipsBillNo = ipsBillNo; f005.bankBillNo = bankBillNo; if (ifSuc == "Y") { //充值写入余额表 F000 F000 f000 = dbma1.F000s.Where(c => c.userSN == userSN).First(); f000.balance += amount; //充值写入流水明细表 F003 F003 f003_1 = new F003(); f003_1.revenueExpenditureSN = C101.FC10102("F003", 8, "UA"); f003_1.generetorUserSN = userSN; f003_1.generateDate = DateTime.Now; f003_1.type = "账户充值"; f003_1.revenue = amount; f003_1.balance = f000.balance; f003_1.referSN = f005.rechargeSN; dbma1.F003s.InsertOnSubmit(f003_1); if (rewardRate > 0) { //奖励表 F004 F004 f004 = new F004(); f004.rewardSN = C101.FC10102("F004", 7, "UB"); f004.userSN = userSN; f004.rewardAmount = amount * rewardRate; f004.rewardDate = DateTime.Now; f004.referSN = billNo; f004.rewardType = "充值奖励"; dbma1.F004s.InsertOnSubmit(f004); //奖励写入余额表 F000 f000.balance += Convert.ToDecimal(f004.rewardAmount); //奖励写入流水明细表 F003 F003 f003_2 = new F003(); f003_2.revenueExpenditureSN = C101.FC10102("F003", 8, "UA"); f003_2.generetorUserSN = userSN; f003_2.generateDate = DateTime.Now; f003_2.type = "充值奖励"; f003_2.revenue = f004.rewardAmount; f003_2.balance = f000.balance; f003_2.referSN = f004.rewardSN; dbma1.F003s.InsertOnSubmit(f003_2); } } dbma1.SubmitChanges(); } }
public string FINIT(int pageSize) { using (DBBC1DataContext dbbc1 = new DBBC1DataContext()) { //数据 var dataList = dbbc1.B100s.Take(pageSize).ToList(); //服务状态 string serverStatusListStr = GetServerStatusList(dataList); return(string.Format("{{\"dataList\":{0},\"serverStatusList\":{1}}}", C101.FC10107(dataList), serverStatusListStr)); } }
public string FM0204INIT(int pageSize) { using (DBBC1DataContext dbbc1 = new DBBC1DataContext()) { //数据 var dataList = dbbc1.B400s.Take(pageSize).ToList(); using (DBBS1DataContext dbbs1 = new DBBS1DataContext()) { //服务状态 string serverStatusListStr = GetServerStatusList(dataList); //申请状态 string applyStatusListStr = GetApplyStatusList(dbbs1, dataList); return(string.Format("{{\"dataList\":{0},\"serverStatusList\":{1},\"applyStatusList\":{2}}}", C101.FC10107(dataList), serverStatusListStr, applyStatusListStr)); } } }
/// <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)); } }