Example #1
0
        protected void InitFormData()
        {
            Guid userId = WebUserAuth.UserId.Value;

            vipInfo = MUserVipInfoBLL.GetUserVipInfoById(WebUserAuth.UserId.Value);
            if (vipInfo == null)
            {
                vipInfo       = new MUserVipInfo();
                vipInfo.Level = 1;
            }

            NextReturnDay = GetNextReturnMoneyDay(userId);

            fundModel = new FundAccountBLL().GetFundAccountInfoById(userId);

            //待收本息加上复投宝的
            Tuple <decimal, decimal> ftbDueIn = GetFTBDueInAmountInterest(userId);

            fundModel.DueInPAndI  = (fundModel.DueInPAndI ?? 0) + ftbDueIn.Item1 + ftbDueIn.Item2;
            fundModel.DueOutPAndI = (fundModel.DueOutPAndI ?? 0) + fundModel.CurrentPreAdvance;

            #region 减去智享计划部分
            string sql      = @"SELECT  
                         sum(sd.Amount )+
                         sum(sd.InterestAmout )+
                         sum(ISNULL(sd.TuandaiRedPacket,0) )+
                        sum(ISNULL(sd.PublisherRedPacket,0))  
                        FROM dbo.SubscribeDetail sd with(nolock) 
                        inner join Project p with(nolock) on sd.ProjectId = p.Id
                        WHERE isnull(sd.InvestType,0)!=1 and sd.SubscribeUserId=@UserId  and sd.CycDate>getdate() and p.Type=37 ";
            var    dyParams = new Dapper.DynamicParameters();
            dyParams.Add("@UserId", userId);
            decimal p2pZxDueInAndI = TuanDaiDB.QuerySingle <decimal>(TdConfig.ApplicationName, "/BD/zxread", sql, ref dyParams);
            fundModel.DueInPAndI = fundModel.DueInPAndI - p2pZxDueInAndI;
            sql = @"SELECT  
                         sum(sd.Amount )+
                         sum(sd.InterestAmout )+
                         sum(ISNULL(sd.TuandaiRedPacket,0) )+
                        sum(ISNULL(sd.PublisherRedPacket,0))  
                        FROM dbo.SubscribeDetail sd with(nolock) 
                        inner join Project p with(nolock) on sd.ProjectId = p.Id
                        WHERE isnull(sd.InvestType,0)!=1 and sd.BorrowerUserId=@UserId  and sd.CycDate>getdate() and p.Type=37 ";
            decimal p2pZxDueOutPAndI = TuanDaiDB.QuerySingle <decimal>(TdConfig.ApplicationName, "/BD/zxread", sql, ref dyParams);
            fundModel.DueOutPAndI = fundModel.DueOutPAndI - p2pZxDueOutPAndI;
            #endregion

            decimal weWaitInvestAmount = GetWePlanWaitInvestment(userId);
            fundModel.FreezeAcount = fundModel.FreezeAcount + weWaitInvestAmount;  //冻结资金加上We待投

            pageModel = new PageMoneyModel();
            if (fundModel != null)
            {
                pageModel.P2PSumAmount = (fundModel.AviMoney ?? 0) + (fundModel.DueInPAndI ?? 0)
                                         + (fundModel.BorrowerOut ?? 0) + (fundModel.DueConfirmWithdrawDeposit ?? 0)
                                         + (fundModel.RewardMoney ?? 0) + (fundModel.FreezeAcount ?? 0);
            }

            pageModel.P2PAviAmount = fundModel.AviMoney ?? 0;
            pageModel.P2PDueIn     = fundModel.DueInPAndI ?? 0;
        }
Example #2
0
        //获取借款人信息
        protected void GetBorrowUserInfo()
        {
            string sqlbow = "select RealName,TelNo,Address as BankCity from dbo.project_NSD with(nolock) where ProjectId=@ProjectId";

            Dapper.DynamicParameters parm = new Dapper.DynamicParameters();
            parm.Add("@ProjectId", model.Id);

            this.borrowerUserInfo = TuanDaiDB.QueryFirstOrDefault <UserBasicInfoInfo>(TdConfig.ApplicationName, TdConfig.DBRead, sqlbow, ref parm);
        }
Example #3
0
        public int GetOrderCount(Guid productid)
        {
            int result = 0;
            var args   = new Dapper.DynamicParameters();

            args.Add("@productId", productid);
            string sqlText = "select Count(0) from We_Order with(nolock) where statusid in (0,1,2,4) and ProductId=@productId";

            result = TuanDaiDB.ExecuteScalar <int>(TdConfig.ApplicationName, TdConfig.DBRead, sqlText, ref args);
            return(result);
        }
Example #4
0
        /// <summary>
        /// 获取订单记录 GetOrderList
        /// </summary>
        /// <param name="productid">产品Id</param>
        /// <param name="pageIndex">当前页数</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>返回订单列表</returns>
        public List <WeOrderInfo> GetOrderList(Guid productid, int pageIndex, int pageSize)
        {
            var args = new Dapper.DynamicParameters();

            args.Add("@productId", productid);
            args.Add("@pageIndex", pageIndex);
            args.Add("@pageSize", pageSize);
            string             sqlText = @"select UserName,NickName,TelNo,Amount,OrderDate,RepeatInvestType,DeviceType from (
                        select u.UserName,u.NickName,u.TelNo,o.Amount,o.OrderDate,ROW_NUMBER() over(order by o.OrderDate desc) as rownum,
                        isnull(RepeatInvestType,0) as RepeatInvestType,o.DeviceType,o.statusid
                        from We_Order o with(nolock) 
                        left join UserBasicInfo u with(nolock) on o.UserId=u.Id  where  o.productId=@productId) t 
                        where t.statusid in (0,1,2,4) and t.rownum>(@pageIndex-1)*@pageSize  and t.rownum<=@pageIndex*@pageSize";
            List <WeOrderInfo> list    = TuanDaiDB.Query <WeOrderInfo>(TdConfig.ApplicationName, TdConfig.DBRead, sqlText, ref args);

            return(list);
        }
Example #5
0
        /// <summary>
        /// 出让历史记录
        /// </summary>
        private void HistoryItems()
        {
            var p = new Dapper.DynamicParameters();

            p.Add("@projectid", projectId.Value);
            ProjectStatistics Statisticsmodel = TuanDaiDB.Query <ProjectStatistics>(TdConfig.ApplicationName, TdConfig.DBRead, "exec p_v_ProjectStatistics @projectid", ref p).First();

            oneMonthSuccess    = Statisticsmodel.oneMonthSuccess;
            sixMonthSuccess    = Statisticsmodel.sixMonthSuccess;
            twelveMonthSuccess = Statisticsmodel.twelveMonthSuccess;
            oneMonthCys        = Statisticsmodel.oneMonthCys;
            sixMonthCys        = Statisticsmodel.sixMonthCys;
            twelveMonthCys     = Statisticsmodel.twelveMonthCys;
            oneMonthOver       = Statisticsmodel.oneMonthOver;
            sixMonthOver       = Statisticsmodel.sixMonthOver;
            twelveMonthOver    = Statisticsmodel.twelveMonthOver;
            oneMonthBadrate    = calcrate(oneMonthSuccess, oneMonthOver);
            sixMonthBadrate    = calcrate(sixMonthSuccess, sixMonthOver);
            twelveMonthBadrate = calcrate(twelveMonthSuccess, twelveMonthOver);
        }
Example #6
0
        private bool GetData()
        {
            UserBLL userbll = new UserBLL();

            //获取项目信息
            model = bll.WXGetMyLoanDetail(this.projectId.Value, WebUserAuth.UserId.Value);

            if (model == null)
            {
                Response.Redirect(GlobalUtils.MTuanDaiURL + "/Member/Repayment/borrowLog.aspx");
                return(false);
            }
            //需提前还款时才做查询数据
            if (model.IsPrepayment)
            {
                WebSettingInfo set = new WebSettingBLL().GetWebSettingInfo("3F902315-6986-44FF-9F00-9D420C07FCDA");
                if (set != null && DateTime.Parse(set.Param4Value) >= model.AddDate)
                {
                    ProjectBLL projectbll = new ProjectBLL();
                    projectbll.WXGetPrepaymentActualAmountAndBalance(WebUserAuth.UserId.Value, this.projectId.Value,
                                                                     ref actualAmount, ref AviMoney);
                }
                else
                {
                    var whereParams = new DynamicParameters();
                    whereParams.Add("@projectId", projectId);
                    whereParams.Add("@DueOutMoney", 0, DbType.Double, ParameterDirection.Output);

                    TuanDaiDB.Execute(TdConfig.ApplicationName, TdConfig.DBRead, "p_ShowDueOutOfProject_ZC", ref whereParams, CommandType.StoredProcedure);
                    actualAmount = (decimal)whereParams.Get <double>("@DueOutMoney");
                }

                AviMoney = userbll.GetUserAviMoney(WebUserAuth.UserId.Value);
            }
            GetRepayedMsg(model.ProjectId);
            return(true);
        }
Example #7
0
        protected void InitFormData()
        {
            pageModel = new PageMoneyModel();
            //GetUserAddInterest();
            UserBLL bll = new UserBLL();

            userModel = bll.GetUserBasicInfoModelById(userId);
            if (userModel != null && !string.IsNullOrWhiteSpace(userModel.HeadImage))
            {
                headImage = userModel.HeadImage;
            }
            GetAccountInfo(userId);
            GetDQLCFundData(userId);

            string read = Tool.CookieHelper.GetCookie("ReadUserPrizeFlag");

            if (!string.IsNullOrEmpty(read))
            {
                isShowPrizeBoxIco = !(read == "ReadPass");
            }
            else
            {
                isShowPrizeBoxIco = bll.GetUnReceiveCount(userId) > 0;
            }


            //获取用户收益
            //GetProfitStatistics(userId);
            UserVipModel = GetNewVipUserInfo();

            //待收本息加上复投宝的
            Tuple <decimal, decimal> ftbDueIn = GetFTBDueInAmountInterest(userId);

            accountModel.DueInPAndI = accountModel.DueInPAndI + ftbDueIn.Item1 + ftbDueIn.Item2;

            decimal weWaitInvestAmount = GetWePlanWaitInvestment(userId);

            accountModel.FreezeAcount = accountModel.FreezeAcount + weWaitInvestAmount;  //冻结资金加上We待投

            if (accountModel != null)
            {
                pageModel.P2PSumAmount = (accountModel.AviMoney) + (accountModel.DueInPAndI)
                                         + (accountModel.BorrowerOut) + (accountModel.DueConfirmWithdrawDeposit)
                                         + (accountModel.RewardMoney) + (accountModel.FreezeAcount);
            }
            if (!GlobalUtils.IsOpenSubscribeApi)
            {
                pageModel.P2PSumAmount += dqAccountModel.TotalAmount;
            }

            decimal p2pZxDueIn      = new ZXWXSelectBLL().GetDueDaiShow(userId, "37"); //p2p智享待收
            decimal dqZxDueInFromZx = new ZXWXSelectBLL().GetDueDaiShow(userId, "38"); //定期智享待收从智享数据库取

            decimal?dqZxDueInFromDq = 0;                                               //定期智享待收从定期数据库取
            string  sql             = "select  isnull(DueINAmount,0)+isnull(DueInInterest,0) from dbo.FundAccountInfo_zx with(nolock) where UserId=@UserId";
            var     para            = new Dapper.DynamicParameters();

            para.Add("@UserId", userId);
            dqZxDueInFromDq = TuanDaiDB.QueryFirstOrDefault <decimal?>(TdConfig.ApplicationName, "/BD/dqread", sql, ref para);

            pageModel.P2PAviAmount = accountModel.AviMoney;
            pageModel.P2PDueIn     = accountModel.DueInPAndI - p2pZxDueIn;

            pageModel.DQDueIn     = dqAccountModel.DueInPAndI - (dqZxDueInFromDq ?? 0);
            pageModel.DQAviAmount = dqAccountModel.AviMoney;
            pageModel.DQSumAmount = dqAccountModel.TotalAmount;

            GetPersonalNotice();


            zxDueInMoney = p2pZxDueIn + dqZxDueInFromZx;
        }