Example #1
0
        /// <summary>
        /// 显示借款人、抵押物信息
        /// </summary>
        /// <param name="loaner"></param>
        /// <param name="riskId"></param>
        private void ShowLoanerInfo(li_loaners loaner, int riskId)
        {
            if (loaner == null)
            {
                return;
            }
            //借款人信息
            sp_loaner_name.InnerText           = loaner?.dt_users.real_name;
            sp_loaner_gender.InnerText         = loaner?.dt_users.sex;
            sp_loaner_job.InnerText            = loaner?.job;
            sp_loaner_working_at.InnerText     = loaner?.working_at;
            sp_loaner_tel.InnerText            = loaner?.dt_users.telphone;
            sp_loaner_id_card_number.InnerText = loaner?.dt_users.id_card_number;
            //企业信息
            if (loaner?.li_loaner_companies != null)
            {
                sp_company_name.InnerText               = loaner.li_loaner_companies.name;
                sp_company_business_scope.InnerText     = loaner.li_loaner_companies.business_scope;
                sp_company_business_status.InnerText    = loaner.li_loaner_companies.business_status;
                sp_company_registered_capital.InnerText = loaner.li_loaner_companies.registered_capital;
                sp_company_setup_time.InnerText         = loaner.li_loaner_companies.setup_time.ToString("yyyy年MM月dd日");
            }

            if (loaner != null)
            {
                rptList.DataSource = Loan.LoadMortgageList(loaner.id, riskId, false);
                rptList.DataBind();
            }
        }
Example #2
0
        /// <summary>
        /// 显示借款人、抵押物信息
        /// </summary>
        /// <param name="loaner_id"></param>
        private void ShowLoanerInfo(li_loaners loaner)
        {
            if (loaner == null)
            {
                return;
            }
            //借款人信息
            sp_loaner_name.InnerText           = loaner.dt_users.real_name;
            sp_loaner_gender.InnerText         = loaner.dt_users.sex;
            sp_loaner_job.InnerText            = loaner.job;
            sp_loaner_working_at.InnerText     = loaner.working_at;
            sp_loaner_tel.InnerText            = loaner.dt_users.telphone;
            sp_loaner_id_card_number.InnerText = loaner.dt_users.id_card_number;
            //企业信息
            if (rbl_project_type.SelectedValue == ((int)Agp2pEnums.LoanTypeEnum.Company).ToString() && loaner.li_loaner_companies != null)
            {
                sp_company_name.InnerText               = loaner.li_loaner_companies.name;
                sp_company_business_scope.InnerText     = loaner.li_loaner_companies.business_scope;
                sp_company_business_status.InnerText    = loaner.li_loaner_companies.business_status;
                sp_company_registered_capital.InnerText = loaner.li_loaner_companies.registered_capital;
                sp_company_setup_time.InnerText         = loaner.li_loaner_companies.setup_time.ToString("yyyy年MM月dd日");
            }

            var allMortgages = Loan.LoadMortgageList(Utils.StrToInt(ddlLoaner.SelectedValue, 0), this.risk_id);

            rptList.DataSource = allMortgages.ToList().Where(m => m != null && m.enable);
            rptList.DataBind();
        }
Example #3
0
        public static string ApplyLoaner(short age, string nativePlace, string job, string workingCompany, string educationalBackground, int maritalStatus, string income)
        {
            var context  = new Agp2pDataContext();
            var userInfo = GetUserInfoByLinq(context);

            HttpContext.Current.Response.TrySkipIisCustomErrors = true;
            if (userInfo == null)
            {
                HttpContext.Current.Response.StatusCode = (int)HttpStatusCode.Unauthorized;
                return("请先登录");
            }

            try
            {
                var loaner = context.li_loaners.FirstOrDefault(l => l.dt_users.id == userInfo.id);
                if (loaner != null)
                {
                    loaner.age                    = age;
                    loaner.native_place           = nativePlace;
                    loaner.job                    = job;
                    loaner.working_at             = "";
                    loaner.working_company        = workingCompany;
                    loaner.educational_background = educationalBackground;
                    loaner.marital_status         = (byte)maritalStatus;
                    loaner.income                 = income;
                    loaner.status                 = (int)Agp2pEnums.LoanerStatusEnum.Pending;
                    loaner.last_update_time       = DateTime.Now;
                }
                else
                {
                    loaner = new li_loaners()
                    {
                        user_id                = userInfo.id,
                        age                    = age,
                        native_place           = nativePlace,
                        job                    = job,
                        working_at             = "",
                        working_company        = workingCompany,
                        educational_background = educationalBackground,
                        marital_status         = (byte)maritalStatus,
                        income                 = income,
                        status                 = (int)Agp2pEnums.LoanerStatusEnum.Pending,
                        last_update_time       = DateTime.Now
                    };
                    context.li_loaners.InsertOnSubmit(loaner);
                }
                context.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return("ok");
        }
Example #4
0
        private bool DoAdd()
        {
            // 查找用户
            var users = context.dt_users.Where(u => u.real_name == txtName.Text || u.user_name == txtName.Text).Take(2);

            if (!users.Any())
            {
                JscriptMsg("不存在该用户", "", "Error");
                return(false);
            }
            if (users.Count() > 1)
            {
                JscriptMsg("此姓名匹配了多个用户,请输入会员账号(手机号)来匹配", "", "Error");
                return(false);
            }
            var model = new li_loaners
            {
                dt_users = users.First(),
                //name = txtName.Text.Trim(),
                //tel = txtTel.Text.Trim(),
                age = Convert.ToInt16(txtAge.Text.Trim()),
                //gender = Convert.ToByte(rblGender.SelectedValue),
                //cencus = txtCencus.Text.Trim(),
                native_place    = txtCencus.Text.Trim(),
                job             = txtJob.Text.Trim(),
                working_at      = txtWorkingAt.Text.Trim(),
                working_company = txtWorkingUnit.Text.Trim(),
                //id_card_number = txtIdCardNumber.Text.Trim(),
                //email = txtEmail.Text.Trim(),
                educational_background = txtEducationalBackground.Text.Trim(),
                marital_status         = Convert.ToByte(rblMaritalStatus.SelectedValue),
                income           = txtIncome.Text.Trim(),
                last_update_time = DateTime.Now,
                lawsuit          = txtLawsuit.Text.Trim(),
                quota            = Utils.StrToInt(txtQuota.Text.Trim(), 0),
                status           = Utils.StrToInt(rblStatus.SelectedValue, 0)
            };

            context.li_loaners.InsertOnSubmit(model);
            LoadAlbum(model, Agp2pEnums.AlbumTypeEnum.IdCard);

            try
            {
                context.SubmitChanges();
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加借贷人:" + model.dt_users.real_name); //记录日志
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #5
0
        private void UpdateLoanerCompanyInfo(li_loaners loaner)
        {
            var company = loaner.li_loaner_companies;

            if (chkBindCompany.Checked)
            {
                if (company == null)
                {
                    company = new li_loaner_companies
                    {
                        name                = txtCompanyName.Text,
                        business_lawsuit    = txtBusinessLawsuit.Text,
                        business_scope      = txtBusinessScope.Text,
                        business_status     = txtBusinessStatus.Text,
                        registered_capital  = txtRegisteredCapital.Text,
                        setup_time          = Convert.ToDateTime(txtSetupTime.Text),
                        remark              = txtCompanyRemark.Text,
                        manager             = txtManager.Text,
                        business_belong     = txtBusinessBelong.Text,
                        address             = txtCaddress.Text,
                        business_license_no = txtBusinessLicenseNo.Text,
                        organization_no     = txtOrganizationNo.Text
                    };
                    loaner.li_loaner_companies = company;
                    context.li_loaner_companies.InsertOnSubmit(company);
                }
                else
                {
                    company.name                = txtCompanyName.Text;
                    company.business_lawsuit    = txtBusinessLawsuit.Text;
                    company.business_scope      = txtBusinessScope.Text;
                    company.business_status     = txtBusinessStatus.Text;
                    company.registered_capital  = txtRegisteredCapital.Text;
                    company.setup_time          = Convert.ToDateTime(txtSetupTime.Text);
                    company.remark              = txtCompanyRemark.Text;
                    company.manager             = txtManager.Text;
                    company.business_belong     = txtBusinessBelong.Text;
                    company.address             = txtCaddress.Text;
                    company.business_license_no = txtBusinessLicenseNo.Text;
                    company.organization_no     = txtOrganizationNo.Text;
                }
            }
            else if (company != null)
            {
                /*if (company.li_loaners.Count == 1)
                 *  context.li_loaner_companies.DeleteOnSubmit(company);*/
                loaner.li_loaner_companies = null;
            }
        }
Example #6
0
 private void LoadAlbum(li_loaners model, Agp2pEnums.AlbumTypeEnum type)
 {
     string[] albumArr  = Request.Form.GetValues("hid_photo_name");
     string[] remarkArr = Request.Form.GetValues("hid_photo_remark");
     context.li_albums.DeleteAllOnSubmit(context.li_albums.Where(a => a.loaner == model.id && a.type == (int)type));
     if (albumArr != null)
     {
         var preAdd = albumArr.Zip(remarkArr, (album, remark) =>
         {
             var albumSplit = album.Split('|');
             return(new li_albums
             {
                 original_path = albumSplit[1],
                 thumb_path = albumSplit[2],
                 remark = remark,
                 add_time = DateTime.Now,
                 li_loaners = model,
                 type = (byte)type
             });
         });
         context.li_albums.InsertAllOnSubmit(preAdd);
     }
 }
Example #7
0
        /// <summary>
        /// 重写虚方法,此方法将在Init事件前执行
        /// </summary>
        protected override void ShowPage()
        {
            Init += Project_Init; //加入IInit事件

            project_id = DTRequest.GetQueryInt("project_id");
            page       = Math.Max(1, DTRequest.GetQueryInt("page"));
            buyClaimId = DTRequest.GetQueryInt("buyClaimId");

            if (project_id <= 0)
            {
                return;
            }
            projectModel = context.li_projects.FirstOrDefault(p => p.id == project_id);
            if (projectModel == null)
            {
                //HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")));
                HttpContext.Current.Response.Redirect(linkurl("404"));
                return;
            }
            li_claims preBuyClaim = null;

            if (buyClaimId != 0)
            {
                preBuyClaim = context.li_claims.SingleOrDefault(c => c.id == buyClaimId);
                if (preBuyClaim == null)
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")));
                    return;
                }
            }
            Investable = new Investable {
                NeedTransferClaim = preBuyClaim, Project = projectModel
            };

            // 浏览次数 + 1
            projectModel.click += 1;
            context.SubmitChanges();

            var pr = GetProjectInvestmentProgress(projectModel);

            //剩余金额
            investmentBalance = pr.GetInvestmentBalance();
            //风控信息
            risk = projectModel.li_risks;
            //借款人
            loaner = risk.li_loaners;
            //借款人企业
            loaner_company = risk.li_loaners?.li_loaner_companies;
            //抵押物
            mortgages = projectModel.li_risks.li_risk_mortgage.Select(rm => rm.li_mortgages).ToList();

            invsetorCount      = projectModel.GetInvestedUserCount();
            projectSum         = projectModel.financing_amount;
            projectDescription = projectModel.title;

            //还款计划
            repayment_tasks = projectModel.li_repayment_tasks
                              .Where(task => task.only_repay_to == null)
                              .OrderBy(rt => rt.should_repay_time)
                              .ToList();

            if (Investable.NeedTransferClaim != null)
            {
                var ratio = Investable.NeedTransferClaim.principal / projectModel.financing_amount;
                repayment_tasks = repayment_tasks.Select(src => new li_repayment_tasks
                {
                    repay_principal = Math.Round(src.repay_principal * ratio, 2),
                    repay_interest  = Investable.NeedTransferClaim.Parent.GetProfitingSectionDays(src,
                                                                                                  (claimBeforeProfitingDays, claimProfitingDays, claimInvalidDays) =>
                                                                                                  Math.Round(src.repay_interest * ratio * claimInvalidDays / (claimBeforeProfitingDays + claimProfitingDays + claimInvalidDays), 2)),
                    should_repay_time = src.should_repay_time,
                    term = src.term
                }).ToList();
            }
        }
Example #8
0
        void Page_Init(object sender, EventArgs e)
        {
            var user = GetUserInfoByLinq();

            if (user == null)
            {
                step = LoanApplyStep.Unlogin;
            }
            else
            {
                user_id   = user.id;
                user_name = user.user_name;
                //查看是否已为借款人
                Agp2pDataContext context = new Agp2pDataContext();
                loaner = context.li_loaners.SingleOrDefault(l => l.user_id == user.id);
                if (loaner == null)
                {
                    step          = LoanApplyStep.UnApplyAsLoaner;
                    loaner_name   = user.real_name;
                    loaner_mobile = user.mobile;
                }
                else
                {
                    //借款人信息
                    loaner_id  = loaner.id;
                    loaner_age = loaner.age.ToString();
                    loaner_educational_background = loaner.educational_background;
                    loaner_income          = loaner.income;
                    loaner_job             = loaner.job;
                    loaner_marital_status  = loaner.marital_status.ToString();
                    loaner_mobile          = loaner.dt_users.mobile;
                    loaner_name            = loaner.dt_users.real_name;
                    loaner_native_place    = loaner.native_place;
                    loaner_working_at      = loaner.working_at;
                    loaner_working_company = loaner.working_company;

                    if (loaner.status != (int)Agp2pEnums.LoanerStatusEnum.Normal)
                    {
                        step = LoanApplyStep.ApplyAsLoanerAuditting;
                        return;
                    }

                    //查看是否有在审批中的借款申请
                    project = context.li_projects.FirstOrDefault(p => p.li_risks.li_loaners.dt_users.id == user.id &&
                                                                 p.status <= (int)Agp2pEnums.ProjectStatusEnum.FinancingApplicationChecking);
                    if (project != null)
                    {
                        step = LoanApplyStep.ProjectAuditting; //显示正在审批步骤
                        project_category_id         = project.category_id;
                        project_amount              = (int)project.financing_amount;
                        project_loan_usage          = project.li_risks.loan_usage;
                        project_source_of_repayment = project.li_risks.source_of_repayment;
                        project_loaner_content      = project.li_risks.loaner_content;
                        quota_use = loaner.quota - (int)project.financing_amount;
                    }
                    else
                    {
                        //查询已审核通过的借款
                        var projectAll = context.li_projects.Where(p =>
                                                                   p.li_risks.li_loaners.dt_users.id == user.id &&
                                                                   (int)Agp2pEnums.ProjectStatusEnum.FinancingApplicationSuccess <= p.status &&
                                                                   p.status != (int)Agp2pEnums.ProjectStatusEnum.FinancingFail);
                        //查询可用额度
                        if (projectAll.Any())
                        {
                            step      = LoanApplyStep.ProjectApplyCompleted;
                            quota_use = loaner.quota - (int)projectAll.Sum(p => p.financing_amount);
                        }
                        else
                        {
                            step      = LoanApplyStep.UnApplyProject;
                            quota_use = loaner.quota;
                        }
                    }
                }
            }
        }
Example #9
0
        private void UpdateLoanerInfo(int userId, DateTime lastUpdateTime)
        {
            var loanerInfo = context.li_loaners.SingleOrDefault(l => l.user_id == userId);

            if (chkIsLoaner.Checked)
            {
                if (loanerInfo == null)
                {
                    loanerInfo = new li_loaners
                    {
                        age     = Convert.ToInt16(txtAge.Text),
                        user_id = userId,
                        educational_background = txtEducationalBackground.Text,
                        income           = txtIncome.Text,
                        job              = txtJob.Text,
                        last_update_time = lastUpdateTime,
                        working_at       = txtWorkingAt.Text,
                        marital_status   = Convert.ToByte(rblMaritalStatus.SelectedValue),
                        native_place     = txtCencus.Text,
                        working_company  = txtWorkingUnit.Text
                    };
                    context.li_loaners.InsertOnSubmit(loanerInfo);

                    if (chkBindCompany.Checked)
                    {
                        var loanerCompany = new li_loaner_companies
                        {
                            name                = txtCompanyName.Text,
                            business_lawsuit    = txtBusinessLawsuit.Text,
                            business_scope      = txtBusinessScope.Text,
                            business_status     = txtBusinessStatus.Text,
                            registered_capital  = txtRegisteredCapital.Text,
                            setup_time          = Convert.ToDateTime(txtSetupTime.Text),
                            remark              = txtCompanyRemark.Text,
                            manager             = txtManager.Text,
                            business_belong     = txtBusinessBelong.Text,
                            address             = txtCaddress.Text,
                            business_license_no = txtBusinessLicenseNo.Text,
                            organization_no     = txtOrganizationNo.Text
                        };
                        loanerInfo.li_loaner_companies = loanerCompany;
                        context.li_loaner_companies.InsertOnSubmit(loanerCompany);
                    }
                }
                else
                {
                    loanerInfo.age     = Convert.ToInt16(txtAge.Text);
                    loanerInfo.user_id = userId;
                    loanerInfo.educational_background = txtEducationalBackground.Text;
                    loanerInfo.income           = txtIncome.Text;
                    loanerInfo.job              = txtJob.Text;
                    loanerInfo.last_update_time = lastUpdateTime;
                    loanerInfo.working_at       = txtWorkingAt.Text;
                    loanerInfo.marital_status   = Convert.ToByte(rblMaritalStatus.SelectedValue);
                    loanerInfo.native_place     = txtCencus.Text;
                    loanerInfo.working_company  = txtWorkingUnit.Text;

                    UpdateLoanerCompanyInfo(loanerInfo);
                }
            }
            else if (loanerInfo != null)
            {
                var c = loanerInfo.li_loaner_companies;
                if (c != null)
                {
                    context.li_loaner_companies.DeleteOnSubmit(c);
                }
                context.li_loaners.DeleteOnSubmit(loanerInfo);
            }
        }