示例#1
0
        //获取债权转让列表
        public void GetZQZRCanTransferList()
        {
            int    pageSize  = GlobalUtils.PageSize;
            int    pageIndex = Tool.SafeConvert.ToInt32(Context.Request.Form["pageIndex"], 1);
            string pStatus   = WEBRequest.GetFormString("status");

            if (pageIndex < 1)
            {
                pageIndex = 1;
            }
            Guid userid = WebUserAuth.UserId.HasValue ? WebUserAuth.UserId.Value : Guid.Empty;

            if (userid == Guid.Empty)
            {
                PrintJson("0", "您还未登录!");
                return;
            }

            int outputStatus = 0;

            if (pStatus == "CanTran")
            {
                #region 可转让标
                int count = 0;
                List <NegotiableInfo>    list     = new TuanDai.PortalSystem.BLL.SubScriberansferBLL().GetNegotiableList(userid, 3, pageIndex, pageSize, out outputStatus, out count);
                List <NegotiableInfoExt> dataList = new List <NegotiableInfoExt>();

                if (outputStatus == -1)
                {
                    PrintJson("0", "有发净股标或者逾期垫付未还");
                }
                else
                {
                    foreach (NegotiableInfo item in list)
                    {
                        NegotiableInfoExt extItem = new NegotiableInfoExt();
                        extItem.ProjectId         = item.ProjectId;
                        extItem.Id                = item.Id;
                        extItem.Title             = item.Title;
                        extItem.TotalRefundMonths = item.TotalRefundMonths;
                        extItem.RefundedMonths    = item.RefundedMonths;
                        extItem.TypeName          = ToolStatus.ConvertProjectType(item.Type);
                        extItem.DueInAmount       = ToolStatus.ConvertLowerMoney(item.Amount + item.InterestAmout);
                        extItem.PreCycDateStr     = item.PreCycDate.ToString("yyyy-MM-dd");
                        extItem.TenderModeName    = GetTenderMode(item.TenderMode);
                        extItem.InterestRate      = ToolStatus.DeleteZero(item.InterestRate);
                        extItem.RepaymentType     = ToolStatus.ConvertRepaymentType(item.RepaymentType);
                        dataList.Add(extItem);
                    }
                }
                if (count == 0)
                {
                    PrintJson("0", "没有找到数据");
                    return;
                }
                int pageCount = GetPageCount(count, pageSize);
                var objData   = new { result = "1", msg = "", pageCount = pageCount, list = dataList };
                PrintJson(objData);
                #endregion
            }
            else if (pStatus == "Traning")
            {
                #region 转让中
                int transferCount = 0;
                List <SubScribeTransferInfo> tempList = new TuanDai.PortalSystem.BLL.SubScriberansferBLL().GetSubScribeTransferList(userid, 1, pageSize, pageIndex, out transferCount);
                if (transferCount == 0)
                {
                    PrintJson("0", "没有找到数据");
                    return;
                }
                int pageCount = GetPageCount(transferCount, pageSize);
                List <SubScribeTransferInfoExt> dataList = new List <SubScribeTransferInfoExt>();
                foreach (SubScribeTransferInfo item in tempList)
                {
                    SubScribeTransferInfoExt extItem = new SubScribeTransferInfoExt();
                    extItem.ProjectId         = item.ProjectId;
                    extItem.Id                = item.Id;
                    extItem.Title             = item.Title;
                    extItem.SumTransferAmount = ToolStatus.ConvertLowerMoney(item.sumTransferAmount);
                    extItem.ProgressStr       = Convert.ToDouble(item.Progress).ToString("f1");
                    extItem.LastTimeStr       = item.remainTime;
                    extItem.AddDate           = item.AddDate;
                    extItem.TotalAmountStr    = ToolStatus.ConvertLowerMoney(item.TotalAmount);
                    DateTime EndTransferDate = DateTime.Parse(item.AddDate.ToString("yyyy-MM-dd") + " 23:59:59");
                    if (DateTime.Now > EndTransferDate)
                    {
                        extItem.LastSecond = 0;
                    }
                    else
                    {
                        extItem.LastSecond = Convert.ToInt32((EndTransferDate - DateTime.Now).TotalSeconds);
                    }
                    dataList.Add(extItem);
                }
                var objData = new { result = "1", msg = "", pageCount = pageCount, list = dataList };
                PrintJson(objData);
                #endregion
            }
            else
            {
                #region 已完成
                int transferCount = 0;
                List <SubScribeTransferInfo> tempList = new TuanDai.PortalSystem.BLL.SubScriberansferBLL().GetSubScribeTransferList(userid, 2, pageSize, pageIndex, out transferCount);
                if (transferCount == 0)
                {
                    PrintJson("0", "没有找到数据");
                    return;
                }
                int pageCount = GetPageCount(transferCount, pageSize);
                List <SubScribeTransferInfoExt> dataList = new List <SubScribeTransferInfoExt>();
                foreach (SubScribeTransferInfo item in tempList)
                {
                    SubScribeTransferInfoExt extItem = new SubScribeTransferInfoExt();
                    extItem.ProjectId         = item.ProjectId;
                    extItem.Id                = item.Id;
                    extItem.Title             = item.Title;
                    extItem.SumTransferAmount = ToolStatus.ConvertLowerMoney(item.sumTransferAmount);
                    extItem.ProgressStr       = Convert.ToDouble(item.Progress).ToString("f1");
                    dataList.Add(extItem);
                }
                var objData = new { result = "1", msg = "", pageCount = pageCount, list = dataList };
                PrintJson(objData);
                #endregion
            }
        }
示例#2
0
        //加载转让信息
        public void InitApplicationTransfer()
        {
            //TuanDB.JunTeEntities dbRead = TuanDB.JunTeEntities.Read();
            Guid subscribeId = Guid.Empty;

            Guid.TryParse(Context.Request["id"], out subscribeId);
            Guid userId = WebUserAuth.UserId.Value;

            //TuanDB.Subscribe subscribeEntity = dbRead.Subscribe.FirstOrDefault(p => p.Id == subscribeId && p.SubscribeUserId == userId);

            var subscribeEntity = new SubscribeBLL().GetSubscribeById(subscribeId);

            if (subscribeEntity == null)
            {
                PrintJson("0", "数据异常");
                return;
            }
            ProjectBLL        bll           = new ProjectBLL();
            ProjectDetailInfo projectEntity = bll.GetProjectDetailInfo(subscribeEntity.ProjectId.Value);

            //Project projectEntity = dbRead.Project.FirstOrDefault(p => p.Id == subscribeEntity.ProjectId);
            if (projectEntity == null)
            {
                PrintJson("0", "数据异常");
                return;
            }

            InitApplicationtransferInfo initApplicationtransferEntity = new InitApplicationtransferInfo();

            initApplicationtransferEntity.Title             = projectEntity.Title;
            initApplicationtransferEntity.TypeName          = ToolStatus.ConvertProjectType(projectEntity.Type ?? 0);
            initApplicationtransferEntity.InterestRate      = projectEntity.InterestRate ?? 0;
            initApplicationtransferEntity.RepaymentTypeName = ToolStatus.ConvertRepaymentType(projectEntity.RepaymentType ?? 0);
            initApplicationtransferEntity.Deadline          = projectEntity.Deadline ?? 0;
            initApplicationtransferEntity.LowerUnit         = projectEntity.LowerUnit ?? 0;
            initApplicationtransferEntity.SubscribeShares   = subscribeEntity.SubscribeShares ?? 0;
            initApplicationtransferEntity.Amount            = "0";
            initApplicationtransferEntity.InterestAmount    = "0";
            //var subscribeDetailList = dbRead.SubscribeDetail.Where(p => p.SubscribeId == subscribeId);
            var subscribeDetailList = new SubscribeDetailBLL().GetSubscribeDetailListBySubscribeId(subscribeId);

            if (subscribeDetailList.Count() > 0)
            {
                initApplicationtransferEntity.Amount         = ToolStatus.ConvertLowerMoney(subscribeDetailList.Sum(p => p.Amount));
                initApplicationtransferEntity.InterestAmount = ToolStatus.ConvertLowerMoney(subscribeDetailList.Sum(p => p.InterestAmout.Value));
            }
            initApplicationtransferEntity.RefundedMonths    = subscribeEntity.RefundedMonths ?? 0;
            initApplicationtransferEntity.TotalRefundMonths = subscribeEntity.TotalRefundMonths ?? 0;
            initApplicationtransferEntity.PreCycDate        = subscribeEntity.PreCycDate.HasValue ? subscribeEntity.PreCycDate.Value.ToString("yyyy-MM-dd") : "";

            string sql = string.Empty;

            if (projectEntity.RepaymentType == 1)//到期还本息
            {
                sql = "SELECT dateDiff(day,@BeginDate,getdate())-1";
            }
            else
            {
                sql = "SELECT dateDiff(day,dbo.f_GetRepaymentAdvance_Date(@BeginDate,@Month),getdate())";
            }
            var para = new Dapper.DynamicParameters();

            para.Add("@BeginDate", subscribeEntity.AddDate);
            para.Add("@Month", subscribeEntity.RefundedMonths);
            initApplicationtransferEntity.Days = PublicConn.QuerySingle <int>(sql, ref para);
            //using (SqlConnection connection = new SqlConnection(TuanDai.Config.BaseConfig.ConnectionString))
            //{
            //    connection.Open();
            //     int day = connection.Query<int>(sql, new { BeginDate = subscribeEntity.AddDate, Month = subscribeEntity.RefundedMonths }).First();
            //    connection.Close();
            //    connection.Dispose();
            //    initApplicationtransferEntity.Days = day;
            //}

            initApplicationtransferEntity.result = 1;
            PrintJson(initApplicationtransferEntity);
        }
示例#3
0
        /// <summary>
        /// 获取我的借款记录列表
        /// </summary>
        public void GetMyLoanShowList()
        {
            int    pagesize  = GlobalUtils.PageSize;
            int    pageindex = Tool.SafeConvert.ToInt32(Context.Request.Form["pageIndex"], 1);
            int    status    = Tool.SafeConvert.ToInt32(Context.Request.Form["statusStr"], 0);
            string userId    = Tool.SafeConvert.ToString(Context.Request.Form["userId"]);
            Guid   uId       = WebUserAuth.UserId.Value;

            if (uId == Guid.Empty)
            {
                if (string.IsNullOrEmpty(userId))
                {
                    uId = Guid.NewGuid();
                }
                else
                {
                    uId = Guid.Parse(userId);
                }
            }
            if (pageindex < 1)
            {
                pageindex = 1;
            }

            StringBuilder     sb          = new StringBuilder();
            int               totalcount  = 0;
            ProjectBLL        bll         = new ProjectBLL();
            WXMyLoanList_Info myLoanModel = bll.WXGetMyLoanList(uId, status, pageindex, pagesize, out totalcount);

            if (myLoanModel != null && myLoanModel.List.Count() > 0)
            {
                int index     = 1;
                int pageCount = GetPageCount(totalcount, pagesize);//总页数

                sb.Append("{\"result\":\"1\",\"totalcount\":\"" + totalcount + "\",\"pagecount\":\"" + pageCount + "\",\"list\":[");
                foreach (WXSubMyLoanList_Info temp in myLoanModel.List)
                {
                    sb.Append("{\"Id\":\"" + temp.ProjectId + "\",\"Title\":\"" + temp.Title + "\",\"ProjectType\":\"" + ToolStatus.ConvertProjectType(temp.Type)
                              + "\",\"Amount\":\"" + Tool.MoneyHelper.ConvertDetailWanMoney(temp.Amount) + "\",\"HaveBorrowedAmount\":\"" + Tool.MoneyHelper.ConvertDetailWanMoney(temp.HaveBorrowedAmount)
                              + "\",\"ProcessStr\":\"" + borrowLog.GetProcessStr(temp) + "\",\"MonthsStr\":\"" + borrowLog.GetMonthsStr(temp)
                              + "\",\"PrincipalInterest\":\"" + Tool.MoneyHelper.ConvertDetailWanMoney(myLoanModel.PrincipalInterest)
                              + "\",\"LinkUrl\":\"" + borrowLog.GetLinkUrl(temp)
                              + "\",\"CircleCss\":\"" + borrowLog.GetCircleCss(temp)
                              + "\",\"AddDate\":\"" + Convert.ToDateTime(temp.AddDate).ToString("yyyy-MM-dd")
                              + "\",\"DeadlineStr\":\"" + borrowLog.GetDeadlineStr(temp)
                              + "\",\"InterestRate\":\"" + ToolStatus.DeleteZero(temp.InterestRate));

                    if (index == myLoanModel.List.Count())
                    {
                        sb.Append("\"}]}");
                    }
                    else
                    {
                        sb.Append("\"},");
                    }
                    index++;
                }
            }
            else
            {
                sb.Append("{\"result\":\"0\",\"totalcount\":\"" + totalcount + "\",\"pagecount\":\"0\"}");
            }
            this.Context.Response.Write(sb.ToString());
            this.Context.Response.End();
        }