//更新服务表 U001 private void ConcultantSvrUpdateU001(DBMA1DataContext dbma1, string userSN) { U001 u001 = dbma1.U001s.Where(c => c.userSN == userSN).First(); u001.consultantApplyStatus = 1; u001.applyConsultantDate = DateTime.Now; u001.openConsultantDate = DateTime.Now; u001.consultantStatus = true; }
//更新服务表 U001 private void PurchaseSvrUpdateU001(DBMA1DataContext dbma1, string userSN) { U001 u001 = dbma1.U001s.Where(c => c.userSN == userSN).First(); u001.assetsPurchaseApplyStatus = 2; u001.applyAssetsPurchaseDate = DateTime.Now; u001.openAssetsPurchaseDate = DateTime.Now; u001.assetsPruchaseStatus = true; }
//更新服务表 U001 private void SellSvrUpdateU001(DBMA1DataContext dbma1, string userSN) { U001 u001 = dbma1.U001s.Where(c => c.userSN == userSN).First(); u001.assetsSellingApplyStatus = 2; u001.applyAssetsSellingDate = DateTime.Now; u001.openAssetsSellingDate = DateTime.Now; u001.assetsSellingStatus = true; }
//更新服务表 U001 private void FinancingSvrUpdateU001(DBMA1DataContext dbma1, string userSN) { U001 u001 = dbma1.U001s.Where(c => c.userSN == userSN).First(); u001.creditRightFinancingApplyStatus = 2; u001.applyCreditRightFinancingDate = DateTime.Now; u001.openCreditRightFinancingDate = DateTime.Now; u001.creditRightFinancingStatus = true; }
//更新服务表 U001 private void InvestSvrUpdateU001(DBMA1DataContext dbma1, string userSN) { U001 u001 = dbma1.U001s.Where(c => c.userSN == userSN).First(); u001.creditRightInvestApplyStauts = 2; u001.applyCreditRightInvestDate = DateTime.Now; u001.openCreditRightInvestmentDate = DateTime.Now; u001.creditRightInvestStatus = true; }
//插入服务表 U001 private void InsertIntoU001(DBMA1DataContext dbma1, string max33SN) { U001 u001 = new U001(); u001.userSN = max33SN; u001.creditRightInvestApplyStauts = 0; u001.creditRightFinancingApplyStatus = 0; u001.consultantApplyStatus = 0; u001.assetsPurchaseApplyStatus = 0; u001.assetsSellingApplyStatus = 0; dbma1.U001s.InsertOnSubmit(u001); }
//获取服务状态列表 private string GetServerStatusList(IEnumerable <B400> dataList) { //服务状态 List <bool?> serverStatusList = new List <bool?>(); using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { foreach (var temp in dataList) { U001 u001 = dbma1.U001s.Where(c => c.userSN == temp.userSN).First(); serverStatusList.Add(u001.consultantStatus); } } return(C101.FC10107(serverStatusList)); }
//获取服务状态列表 private string GetServerStatusList(IEnumerable <B200> dataList) { //服务状态 List <bool?> serverStatusList = new List <bool?>(); using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { foreach (var b200 in dataList) { U001 u001 = dbma1.U001s.Where(c => c.userSN == b200.userSN).First(); serverStatusList.Add(u001.creditRightInvestStatus); } } return(C101.FC10107(serverStatusList)); }
public string LoadSvr(string whichSvr) { var userSNSession = session["userSN"]; if (userSNSession == null) { return("{\"isLogin\":\"false\"}"); } else { using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { U001 u001 = dbma1.U001s.Where(c => c.userSN == userSNSession.ToString()).First(); bool isAvailable = false; switch (whichSvr) { case "1": isAvailable = u001.creditRightInvestStatus == true ? true : false; break; case "2": isAvailable = u001.creditRightFinancingStatus == true ? true : false; break; case "5": isAvailable = u001.consultantStatus == true ? true : false; break; case "3": isAvailable = u001.assetsSellingStatus == true ? true : false; break; case "4": isAvailable = u001.assetsPruchaseStatus == true ? true : false; break; } return(string.Format("{{\"isLogin\":\"true\",\"isAvailable\":\"{0}\"}}", isAvailable.ToString())); } } }
public string FM020409(string userSN, string act, string auditNote) { using (DBMA1DataContext dbma1 = new DBMA1DataContext()) { int?operatorSN = Convert.ToInt32(session["internalUserId"].ToString()); //int? operatorSN = 1032; //更新U006 U006 u006 = (from c in dbma1.U006s where c.userSN == userSN orderby c.applyDate descending select c).First(); u006.auditStatus = Convert.ToInt16(act == "1" ? "2" : "3"); u006.auditDate = DateTime.Now; u006.auditerUserSN = operatorSN; u006.auditNote = auditNote; //更新U001 U001 u001 = dbma1.U001s.Where(c => c.userSN == userSN).First(); u001.consultantApplyStatus = Convert.ToInt16(act == "1" ? "2" : "3"); //添加B000 B000 b000 = new B000(); b000.bgOperateSN = C101.FC10102("B000", 5, "B"); b000.tableName = "B005"; b000.pkSN = u006.recordSN; b000.actionTypeSN = act == "1" ? "B0E" : "B0F"; b000.operatorSN = Convert.ToInt32(operatorSN); b000.operateDate = DateTime.Now; dbma1.B000s.InsertOnSubmit(b000); string name = dbma1.internal_users.Where(c => c.internal_user_id == Convert.ToInt32(operatorSN)).First().name; dbma1.SubmitChanges(); return(name); } }
/// <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); } }