Exemple #1
0
        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));
            }
        }
Exemple #2
0
        /// <summary>
        /// 债权融资页面初始化
        /// </summary>
        public string FP20101(int pageSize)
        {
            //判断是否登录
            if (session["userSN"] == null)
            {
                return("notLogin");
            }

            string userSN = session["userSN"].ToString();

            using (DBMA1DataContext dbma1 = new DBMA1DataContext())
            {
                //判断是否有权限并且是否有逾期账单
                var  data1         = dbma1.U001s.Where(c => c.userSN == userSN).First();
                bool ifBillOverdue = C201.FC20153(dbma1, userSN);
                if (data1.creditRightFinancingStatus != true || ifBillOverdue == true)
                {
                    return("{\"status\":\"false\"}");
                }

                //获取uip数据
                string provinceData        = C201.FC20121(dbma1).Replace("[", "").Replace("]", "");
                string guaranteeType       = C201.FC20117(dbma1).Replace("[", "").Replace("]", "");
                string assetsType          = C201.FC20151(dbma1).Replace("[", "").Replace("]", "");
                string creditStatusType    = C201.FC20105(dbma1).Replace("[", "").Replace("]", "");
                string industryType        = C201.FC20113(dbma1).Replace("[", "").Replace("]", "");
                string repaymentType       = C201.FC20114(dbma1).Replace("[", "").Replace("]", "");
                string capitalPurposeType  = C201.FC20115(dbma1).Replace("[", "").Replace("]", "");
                string repaymentSourceType = C201.FC20116(dbma1).Replace("[", "").Replace("]", "");
                string assetsSourceType    = C201.FC20109(dbma1).Replace("[", "").Replace("]", "");
                string useStatusType       = C201.FC20110(dbma1).Replace("[", "").Replace("]", "");
                string morgageType         = C201.FC20112(dbma1).Replace("[", "").Replace("]", "");
                string financierCancelReserveReasonType = C201.FC20130(dbma1).Replace("[", "").Replace("]", "");
                string financierRefuseReserveReasonType = C201.FC20131(dbma1).Replace("[", "").Replace("]", "");

                string financingParams = C201.FC20124(dbma1);
                //string res = string.Format("{{\"SltConfigData\":[{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10}],{11}}}", provinceData, guaranteeType, assetsType, creditStatusType, industryType, repaymentType, capitalPurposeType, repaymentSourceType, assetsSourceType, useStatusType, morgageType, financingParams);


                //获取已发布的债权
                string crListStr = GetCrFirst(dbma1, userSN, pageSize);

                string userName = dbma1.U000s.Where(c => c.userSN == userSN).First().name;

                string res = string.Format("{{\"status\":\"true\",\"uipData\":{{\"SltConfigData\":[{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12}],{13}}},\"crData\":{14},\"maxDatetime\":\"{15}\",\"userName\":\"{16}\",\"userSN\":\"{17}\"}}", provinceData, guaranteeType, assetsType, creditStatusType, industryType, repaymentType, capitalPurposeType, repaymentSourceType, assetsSourceType, useStatusType, morgageType, financierCancelReserveReasonType, financierRefuseReserveReasonType, financingParams, crListStr, DateTime.Now, userName, userSN);

                return(res);
            }
        }
Exemple #3
0
        /// <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);
            }
        }