Beispiel #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public M_borrowing_target GetModel(int targetid)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 targetid,borrower_registerid,loan_number,borrowing_title,borrowing_thumbnail,project_type_id,annual_interest_rate,borrowing_balance,life_of_loan,unit_day,release_date,value_date,month_payment_date,repayment_date,minimum,maxmum,companyid,guarantee_way_id,payment_options,start_time,end_time,service_charge,loan_management_fee,investors_management_fee,ordinary_overdue_management_fees,seriously_overdue_management_fees,ordinary_overdue_penalty,seriously_overdue_penalty,transfer_Expenses,fundraising_amount,tender_state,full_scale_loan,flow_return,recommend,sys_time,repaymentperiods,guarantee_fee,consultingAMT,guaranteeAMT,B_Rates,IsUse from hx_borrowing_target ");
            strSql.Append(" where targetid=@targetid");
            SqlParameter[] parameters =
            {
                new SqlParameter("@targetid", SqlDbType.Int, 4)
            };
            parameters[0].Value = targetid;

            M_borrowing_target model = new M_borrowing_target();
            DataSet            ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 根据期限获取借款标数据
        /// </summary>
        /// <param name="month">借款期限(1,3,6)</param>
        /// <returns></returns>
        private M_borrowing_target_ZhuoLu GetPartialTargetModel(int month)
        {
            B_borrowing_target        bllBorrowingTarget = new B_borrowing_target();
            M_borrowing_target_ZhuoLu targetLife;
            M_borrowing_target        target = bllBorrowingTarget.GetModel(Common.ConfigHelper.GetConfigInt("MonthTargetID_" + month));

            if (target != null && target.targetid != 0 && target.tender_state == 2 && target.end_time > DateTime.Now && target.fundraising_amount < target.borrowing_balance)//如果指定的标不存在,则使用规则查找符合要求的标
            {
                targetLife = new M_borrowing_target_ZhuoLu
                {
                    targetid             = target.targetid,
                    annual_interest_rate = target.annual_interest_rate,
                    borrowing_balance    = target.borrowing_balance,
                    borrowing_title      = target.borrowing_title,
                    fundraising_amount   = target.fundraising_amount,
                    life_of_loan         = target.life_of_loan
                };
            }
            else
            {
                targetLife = bllBorrowingTarget.GetModelByLifeLoan(month);
            }
            return(targetLife);
        }
Beispiel #3
0
        /// <summary>
        /// 项目投资利率计算
        /// </summary>
        /// <param name="targetid">标的ID</param>
        /// <param name="Amount">投资金额</param>
        ///<param name = "Lixi" > 加息券,默认为0 </ param >
        /// <returns></returns>
        public decimal InvCalc(int targetid, decimal Amount = 100.00M, double Lixi = 0)
        {
            decimal            dec = 0.00M;
            B_borrowing_target o   = new B_borrowing_target();
            M_borrowing_target m   = new M_borrowing_target();

            m = o.GetModel(targetid);
            InvestmentParameters mp = new InvestmentParameters();

            mp.Amount            = Amount;
            mp.Circle            = m.life_of_loan;
            mp.CircleType        = m.unit_day;
            mp.NominalYearRate   = double.Parse(m.annual_interest_rate.ToString()) + Lixi;
            mp.OverheadsRate     = 0f;
            mp.RepaymentMode     = m.payment_options;
            mp.RewardRate        = 0f;
            mp.IsThirtyDayMonth  = false;
            mp.InvestDate        = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
            mp.Investmentenddate = DateTime.Parse(m.repayment_date.ToString("yyyy-MM-dd"));
            mp.Payinterest       = m.month_payment_date;
            mp.InvestObject      = 1;
            dec = Calculationofinterest(mp);
            return(dec);
        }
Beispiel #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(M_borrowing_target model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into hx_borrowing_target(");
            strSql.Append("borrower_registerid,loan_number,borrowing_title,borrowing_thumbnail,project_type_id,annual_interest_rate,borrowing_balance,life_of_loan,unit_day,release_date,month_payment_date,repayment_date,minimum,maxmum,companyid,guarantee_way_id,payment_options,end_time,service_charge,loan_management_fee,investors_management_fee,ordinary_overdue_management_fees,seriously_overdue_management_fees,ordinary_overdue_penalty,seriously_overdue_penalty,transfer_Expenses,guarantee_fee,B_Rates,recommend,sys_time,IsUse)");
            strSql.Append(" values (");
            strSql.Append("@borrower_registerid,@loan_number,@borrowing_title,@borrowing_thumbnail,@project_type_id,@annual_interest_rate,@borrowing_balance,@life_of_loan,@unit_day,@release_date,@month_payment_date,@repayment_date,@minimum,@maxmum,@companyid,@guarantee_way_id,@payment_options,@end_time,@service_charge,@loan_management_fee,@investors_management_fee,@ordinary_overdue_management_fees,@seriously_overdue_management_fees,@ordinary_overdue_penalty,@seriously_overdue_penalty,@transfer_Expenses,@guarantee_fee,@B_Rates,@recommend,@sys_time,@IsUse)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@borrower_registerid",               SqlDbType.Int,         4),
                new SqlParameter("@loan_number",                       SqlDbType.Decimal,    18),
                new SqlParameter("@borrowing_title",                   SqlDbType.VarChar,   200),
                new SqlParameter("@borrowing_thumbnail",               SqlDbType.VarChar,   200),
                new SqlParameter("@project_type_id",                   SqlDbType.Int,         4),
                new SqlParameter("@annual_interest_rate",              SqlDbType.Decimal,    18),
                new SqlParameter("@borrowing_balance",                 SqlDbType.Decimal,    17),
                new SqlParameter("@life_of_loan",                      SqlDbType.Int,         4),
                new SqlParameter("@unit_day",                          SqlDbType.Int,         4),
                new SqlParameter("@release_date",                      SqlDbType.DateTime),

                new SqlParameter("@month_payment_date",                SqlDbType.Int,         4),
                new SqlParameter("@repayment_date",                    SqlDbType.DateTime),
                new SqlParameter("@minimum",                           SqlDbType.Decimal,    17),
                new SqlParameter("@maxmum",                            SqlDbType.Decimal,    17),
                new SqlParameter("@companyid",                         SqlDbType.Int,         4),
                new SqlParameter("@guarantee_way_id",                  SqlDbType.Int,         4),
                new SqlParameter("@payment_options",                   SqlDbType.Int,         4),
                new SqlParameter("@end_time",                          SqlDbType.DateTime),
                new SqlParameter("@service_charge",                    SqlDbType.Decimal,    18),
                new SqlParameter("@loan_management_fee",               SqlDbType.Decimal,    18),
                new SqlParameter("@investors_management_fee",          SqlDbType.Decimal,    18),
                new SqlParameter("@ordinary_overdue_management_fees",  SqlDbType.Decimal,    18),
                new SqlParameter("@seriously_overdue_management_fees", SqlDbType.Decimal,    18),
                new SqlParameter("@ordinary_overdue_penalty",          SqlDbType.Decimal,    18),
                new SqlParameter("@seriously_overdue_penalty",         SqlDbType.Decimal,    18),
                new SqlParameter("@transfer_Expenses",                 SqlDbType.Decimal,    18),
                new SqlParameter("@guarantee_fee",                     SqlDbType.Decimal,    18),
                new SqlParameter("@B_Rates",                           SqlDbType.Decimal,    18),
                new SqlParameter("@recommend",                         SqlDbType.Int,         4),
                new SqlParameter("@sys_time",                          SqlDbType.DateTime),
                new SqlParameter("@IsUse",                             SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.borrower_registerid;
            parameters[1].Value  = model.loan_number;
            parameters[2].Value  = model.borrowing_title;
            parameters[3].Value  = model.borrowing_thumbnail;
            parameters[4].Value  = model.project_type_id;
            parameters[5].Value  = model.annual_interest_rate;
            parameters[6].Value  = model.borrowing_balance;
            parameters[7].Value  = model.life_of_loan;
            parameters[8].Value  = model.unit_day;
            parameters[9].Value  = model.release_date;
            parameters[10].Value = model.month_payment_date;
            parameters[11].Value = model.repayment_date;
            parameters[12].Value = model.minimum;
            parameters[13].Value = model.maxmum;
            parameters[14].Value = model.companyid;
            parameters[15].Value = model.guarantee_way_id;
            parameters[16].Value = model.payment_options;
            parameters[17].Value = model.end_time;
            parameters[18].Value = model.service_charge;
            parameters[19].Value = model.loan_management_fee;
            parameters[20].Value = model.investors_management_fee;
            parameters[21].Value = model.ordinary_overdue_management_fees;
            parameters[22].Value = model.seriously_overdue_management_fees;
            parameters[23].Value = model.ordinary_overdue_penalty;
            parameters[24].Value = model.seriously_overdue_penalty;
            parameters[25].Value = model.transfer_Expenses;
            parameters[26].Value = model.guarantee_fee;
            parameters[27].Value = model.B_Rates;
            parameters[28].Value = model.recommend;
            parameters[29].Value = model.sys_time;
            parameters[30].Value = model.IsUse;


            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Beispiel #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public M_borrowing_target DataRowToModel(DataRow row)
        {
            M_borrowing_target model = new M_borrowing_target();

            if (row != null)
            {
                if (row["targetid"] != null && row["targetid"].ToString() != "")
                {
                    model.targetid = int.Parse(row["targetid"].ToString());
                }
                if (row["borrower_registerid"] != null && row["borrower_registerid"].ToString() != "")
                {
                    model.borrower_registerid = int.Parse(row["borrower_registerid"].ToString());
                }
                if (row["loan_number"] != null && row["loan_number"].ToString() != "")
                {
                    model.loan_number = decimal.Parse(row["loan_number"].ToString());
                }
                if (row["borrowing_title"] != null)
                {
                    model.borrowing_title = row["borrowing_title"].ToString();
                }
                if (row["borrowing_thumbnail"] != null)
                {
                    model.borrowing_thumbnail = row["borrowing_thumbnail"].ToString();
                }
                if (row["project_type_id"] != null && row["project_type_id"].ToString() != "")
                {
                    model.project_type_id = int.Parse(row["project_type_id"].ToString());
                }
                if (row["annual_interest_rate"] != null && row["annual_interest_rate"].ToString() != "")
                {
                    model.annual_interest_rate = decimal.Parse(row["annual_interest_rate"].ToString());
                }
                if (row["borrowing_balance"] != null && row["borrowing_balance"].ToString() != "")
                {
                    model.borrowing_balance = decimal.Parse(row["borrowing_balance"].ToString());
                }
                if (row["life_of_loan"] != null && row["life_of_loan"].ToString() != "")
                {
                    model.life_of_loan = int.Parse(row["life_of_loan"].ToString());
                }
                if (row["unit_day"] != null && row["unit_day"].ToString() != "")
                {
                    model.unit_day = int.Parse(row["unit_day"].ToString());
                }
                if (row["release_date"] != null && row["release_date"].ToString() != "")
                {
                    model.release_date = DateTime.Parse(row["release_date"].ToString());
                }
                if (row["value_date"] != null && row["value_date"].ToString() != "")
                {
                    model.value_date = DateTime.Parse(row["value_date"].ToString());
                }
                if (row["month_payment_date"] != null && row["month_payment_date"].ToString() != "")
                {
                    model.month_payment_date = int.Parse(row["month_payment_date"].ToString());
                }
                if (row["repayment_date"] != null && row["repayment_date"].ToString() != "")
                {
                    model.repayment_date = DateTime.Parse(row["repayment_date"].ToString());
                }
                if (row["minimum"] != null && row["minimum"].ToString() != "")
                {
                    model.minimum = decimal.Parse(row["minimum"].ToString());
                }
                if (row["maxmum"] != null && row["maxmum"].ToString() != "")
                {
                    model.maxmum = decimal.Parse(row["maxmum"].ToString());
                }
                if (row["companyid"] != null && row["companyid"].ToString() != "")
                {
                    model.companyid = int.Parse(row["companyid"].ToString());
                }
                if (row["guarantee_way_id"] != null && row["guarantee_way_id"].ToString() != "")
                {
                    model.guarantee_way_id = int.Parse(row["guarantee_way_id"].ToString());
                }
                if (row["payment_options"] != null && row["payment_options"].ToString() != "")
                {
                    model.payment_options = int.Parse(row["payment_options"].ToString());
                }



                if (row["start_time"] != null && row["start_time"].ToString() != "")
                {
                    model.start_time = DateTime.Parse(row["start_time"].ToString());
                }


                if (row["end_time"] != null && row["end_time"].ToString() != "")
                {
                    model.end_time = DateTime.Parse(row["end_time"].ToString());
                }
                if (row["service_charge"] != null && row["service_charge"].ToString() != "")
                {
                    model.service_charge = decimal.Parse(row["service_charge"].ToString());
                }
                if (row["loan_management_fee"] != null && row["loan_management_fee"].ToString() != "")
                {
                    model.loan_management_fee = decimal.Parse(row["loan_management_fee"].ToString());
                }
                if (row["investors_management_fee"] != null && row["investors_management_fee"].ToString() != "")
                {
                    model.investors_management_fee = decimal.Parse(row["investors_management_fee"].ToString());
                }
                if (row["ordinary_overdue_management_fees"] != null && row["ordinary_overdue_management_fees"].ToString() != "")
                {
                    model.ordinary_overdue_management_fees = decimal.Parse(row["ordinary_overdue_management_fees"].ToString());
                }
                if (row["seriously_overdue_management_fees"] != null && row["seriously_overdue_management_fees"].ToString() != "")
                {
                    model.seriously_overdue_management_fees = decimal.Parse(row["seriously_overdue_management_fees"].ToString());
                }
                if (row["ordinary_overdue_penalty"] != null && row["ordinary_overdue_penalty"].ToString() != "")
                {
                    model.ordinary_overdue_penalty = decimal.Parse(row["ordinary_overdue_penalty"].ToString());
                }
                if (row["seriously_overdue_penalty"] != null && row["seriously_overdue_penalty"].ToString() != "")
                {
                    model.seriously_overdue_penalty = decimal.Parse(row["seriously_overdue_penalty"].ToString());
                }
                if (row["transfer_Expenses"] != null && row["transfer_Expenses"].ToString() != "")
                {
                    model.transfer_Expenses = decimal.Parse(row["transfer_Expenses"].ToString());
                }
                if (row["fundraising_amount"] != null && row["fundraising_amount"].ToString() != "")
                {
                    model.fundraising_amount = decimal.Parse(row["fundraising_amount"].ToString());
                }
                if (row["tender_state"] != null && row["tender_state"].ToString() != "")
                {
                    model.tender_state = int.Parse(row["tender_state"].ToString());
                }
                if (row["full_scale_loan"] != null && row["full_scale_loan"].ToString() != "")
                {
                    model.full_scale_loan = int.Parse(row["full_scale_loan"].ToString());
                }
                if (row["flow_return"] != null && row["flow_return"].ToString() != "")
                {
                    model.flow_return = int.Parse(row["flow_return"].ToString());
                }
                if (row["recommend"] != null && row["recommend"].ToString() != "")
                {
                    model.recommend = int.Parse(row["recommend"].ToString());
                }
                if (row["sys_time"] != null && row["sys_time"].ToString() != "")
                {
                    model.sys_time = DateTime.Parse(row["sys_time"].ToString());
                }
                if (row["repaymentperiods"] != null && row["repaymentperiods"].ToString() != "")
                {
                    model.repayment_periods = int.Parse(row["repaymentperiods"].ToString());
                }

                if (row["guarantee_fee"] != null && row["guarantee_fee"].ToString() != "")
                {
                    model.guarantee_fee = decimal.Parse(row["guarantee_fee"].ToString());
                }

                if (row["consultingAMT"] != null && row["consultingAMT"].ToString() != "")
                {
                    model.consultingAMT = decimal.Parse(row["consultingAMT"].ToString());
                }


                if (row["guaranteeAMT"] != null && row["guaranteeAMT"].ToString() != "")
                {
                    model.guaranteeAMT = decimal.Parse(row["guaranteeAMT"].ToString());
                }

                if (row["B_Rates"] != null && row["B_Rates"].ToString() != "")
                {
                    model.B_Rates = decimal.Parse(row["B_Rates"].ToString());
                }

                if (row["sys_time"] != null && row["sys_time"].ToString() != "")
                {
                    model.sys_time = DateTime.Parse(row["sys_time"].ToString());
                }

                if (row["IsUse"] != null && row["IsUse"].ToString() != "")
                {
                    model.IsUse = int.Parse(row["IsUse"].ToString());
                }
            }
            return(model);
        }
Beispiel #6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(M_borrowing_target model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update hx_borrowing_target set ");
            strSql.Append("borrower_registerid=@borrower_registerid,");
            strSql.Append("loan_number=@loan_number,");
            strSql.Append("borrowing_title=@borrowing_title,");
            strSql.Append("borrowing_thumbnail=@borrowing_thumbnail,");
            strSql.Append("project_type_id=@project_type_id,");
            strSql.Append("annual_interest_rate=@annual_interest_rate,");
            strSql.Append("borrowing_balance=@borrowing_balance,");
            strSql.Append("life_of_loan=@life_of_loan,");
            strSql.Append("unit_day=@unit_day,");
            strSql.Append("release_date=@release_date,");

            strSql.Append("month_payment_date=@month_payment_date,");
            strSql.Append("repayment_date=@repayment_date,");
            strSql.Append("minimum=@minimum,");
            strSql.Append("maxmum=@maxmum,");
            strSql.Append("companyid=@companyid,");
            strSql.Append("guarantee_way_id=@guarantee_way_id,");
            strSql.Append("payment_options=@payment_options,");
            strSql.Append("end_time=@end_time,");
            strSql.Append("service_charge=@service_charge,");
            strSql.Append("loan_management_fee=@loan_management_fee,");
            strSql.Append("investors_management_fee=@investors_management_fee,");
            strSql.Append("ordinary_overdue_management_fees=@ordinary_overdue_management_fees,");
            strSql.Append("seriously_overdue_management_fees=@seriously_overdue_management_fees,");
            strSql.Append("ordinary_overdue_penalty=@ordinary_overdue_penalty,");
            strSql.Append("seriously_overdue_penalty=@seriously_overdue_penalty,");
            strSql.Append("transfer_Expenses=@transfer_Expenses,");
            strSql.Append("guarantee_fee=@guarantee_fee,");

            strSql.Append("B_Rates=@B_Rates,");
            strSql.Append("recommend=@recommend,");
            strSql.Append("sys_time=@sys_time, ");
            strSql.Append("IsUse=@IsUse ");



            strSql.Append(" where targetid=@targetid");
            SqlParameter[] parameters =
            {
                new SqlParameter("@borrower_registerid",               SqlDbType.Int,         4),
                new SqlParameter("@loan_number",                       SqlDbType.Decimal,    18),
                new SqlParameter("@borrowing_title",                   SqlDbType.VarChar,   200),
                new SqlParameter("@borrowing_thumbnail",               SqlDbType.VarChar,   200),
                new SqlParameter("@project_type_id",                   SqlDbType.Int,         4),
                new SqlParameter("@annual_interest_rate",              SqlDbType.Decimal,    18),
                new SqlParameter("@borrowing_balance",                 SqlDbType.Decimal,    17),
                new SqlParameter("@life_of_loan",                      SqlDbType.Int,         4),
                new SqlParameter("@unit_day",                          SqlDbType.Int,         4),
                new SqlParameter("@release_date",                      SqlDbType.DateTime),

                new SqlParameter("@month_payment_date",                SqlDbType.Int,         4),
                new SqlParameter("@repayment_date",                    SqlDbType.DateTime),
                new SqlParameter("@minimum",                           SqlDbType.Decimal,    17),
                new SqlParameter("@maxmum",                            SqlDbType.Decimal,    17),
                new SqlParameter("@companyid",                         SqlDbType.Int,         4),
                new SqlParameter("@guarantee_way_id",                  SqlDbType.Int,         4),
                new SqlParameter("@payment_options",                   SqlDbType.Int,         4),
                new SqlParameter("@end_time",                          SqlDbType.DateTime),
                new SqlParameter("@service_charge",                    SqlDbType.Decimal,    18),
                new SqlParameter("@loan_management_fee",               SqlDbType.Decimal,    18),
                new SqlParameter("@investors_management_fee",          SqlDbType.Decimal,    18),
                new SqlParameter("@ordinary_overdue_management_fees",  SqlDbType.Decimal,    18),
                new SqlParameter("@seriously_overdue_management_fees", SqlDbType.Decimal,    18),
                new SqlParameter("@ordinary_overdue_penalty",          SqlDbType.Decimal,    18),
                new SqlParameter("@seriously_overdue_penalty",         SqlDbType.Decimal,    18),
                new SqlParameter("@transfer_Expenses",                 SqlDbType.Decimal,    18),
                new SqlParameter("@guarantee_fee",                     SqlDbType.Decimal,    18),
                new SqlParameter("@B_Rates",                           SqlDbType.Decimal,    18),
                new SqlParameter("@recommend",                         SqlDbType.Int,         4),
                new SqlParameter("@sys_time",                          SqlDbType.DateTime),
                new SqlParameter("@IsUse",                             SqlDbType.Int,         4),
                new SqlParameter("@targetid",                          SqlDbType.Int, 4)
            };
            parameters[0].Value = model.borrower_registerid;
            parameters[1].Value = model.loan_number;
            parameters[2].Value = model.borrowing_title;
            parameters[3].Value = model.borrowing_thumbnail;
            parameters[4].Value = model.project_type_id;
            parameters[5].Value = model.annual_interest_rate;
            parameters[6].Value = model.borrowing_balance;
            parameters[7].Value = model.life_of_loan;
            parameters[8].Value = model.unit_day;
            parameters[9].Value = model.release_date;

            parameters[10].Value = model.month_payment_date;
            parameters[11].Value = model.repayment_date;
            parameters[12].Value = model.minimum;
            parameters[13].Value = model.maxmum;
            parameters[14].Value = model.companyid;
            parameters[15].Value = model.guarantee_way_id;
            parameters[16].Value = model.payment_options;
            parameters[17].Value = model.end_time;
            parameters[18].Value = model.service_charge;
            parameters[19].Value = model.loan_management_fee;
            parameters[20].Value = model.investors_management_fee;
            parameters[21].Value = model.ordinary_overdue_management_fees;
            parameters[22].Value = model.seriously_overdue_management_fees;
            parameters[23].Value = model.ordinary_overdue_penalty;
            parameters[24].Value = model.seriously_overdue_penalty;
            parameters[25].Value = model.transfer_Expenses;
            parameters[26].Value = model.guarantee_fee;
            parameters[27].Value = model.B_Rates;
            parameters[28].Value = model.recommend;
            parameters[29].Value = model.sys_time;
            parameters[30].Value = model.IsUse;
            parameters[31].Value = model.targetid;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(M_borrowing_target model)
 {
     return(dal.Update(model));
 }
Beispiel #8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(M_borrowing_target model)
 {
     return(dal.Add(model));
 }
Beispiel #9
0
        /// <summary>
        /// 邀请奖历 投资成功奖励
        /// </summary>
        /// <param name="dt"></param>
        protected internal void SendBonusForInviteAfterInvest(DataTable dt, string targetPlatform)
        //(int registerid, string invcode, int invcount, decimal investAmt, string userName, string borrowing_title, decimal bonusAmt)
        {
            if (dt.Rows.Count <= 0)
            {
                return;
            }
            //投资金额
            decimal investAmt      = decimal.Parse(dt.Rows[0]["investment_amount"].ToString());
            int     registerid     = int.Parse(dt.Rows[0]["investor_registerid"].ToString()); //投资人ID
            int     bid_records_id = int.Parse(dt.Rows[0]["bid_records_id"].ToString());
            int     life_of_loan   = int.Parse(dt.Rows[0]["life_of_loan"].ToString());
            int     unit_day       = int.Parse(dt.Rows[0]["unit_day"].ToString());

            if (unit_day != 1)
            {
                life_of_loan = 0;
            }
            string borrowing_title = dt.Rows[0]["borrowing_title"].ToString();
            string userName        = dt.Rows[0]["username"].ToString();
            string invcode         = dt.Rows[0]["invitationcode"].ToString();
            int    targetid        = int.Parse(dt.Rows[0]["targetid"].ToString());//标的ID
            //本次投标使用的奖励金额
            decimal bonusAmt           = decimal.Parse(dt.Rows[0]["bonusAmt"].ToString());
            B_bonus_account_water bbaw = new B_bonus_account_water();
            int invcount = B_usercenter.GetInvestCountByUserid(registerid);//投资次数

            string uid = registerid.ToString();

            LogInfo.WriteLog("投资人ID:" + registerid + "; /*邀请码*/:" + invcode);
            #region MyRegion  邀请奖历 投资成功奖励   暂不启用false  待重新梳理帐号fangjianmin
            if (invcode != null && invcode != "")// && false
            {
                DateTime dte     = DateTime.Now;
                string   codesql = "SELECT invcode,Invpeopleid,invpersonid,invtime from  hx_td_Userinvitation where invcode='" + invcode + "' and invpersonid=" + uid + " ";//查询本人是否已经被邀请注册过
                LogInfo.WriteLog("投资人ID:" + registerid + ";查询本人是否已经被邀请注册过:" + codesql);
                DataTable dtcode = DbHelperSQL.GET_DataTable_List(codesql);
                if (dtcode.Rows.Count > 0)
                {
                    int            uuid = int.Parse(dtcode.Rows[0]["Invpeopleid"].ToString()); //邀请用户id
                    B_member_table oy   = new B_member_table();
                    M_member_table py   = new M_member_table();
                    //获取 邀请用户身份渠道用户不执行
                    py = oy.GetModel(uuid);
                    if (py.useridentity != 4)
                    {
                        DateTime invtime = Convert.ToDateTime(dtcode.Rows[0]["invtime"].ToString()); //邀请时间

                        DateTime nowdate   = DateTime.Now;
                        DateTime startdate = new DateTime(2017, 1, 6, 0, 00, 00);
                        DateTime enddate   = new DateTime(2017, 3, 31, 23, 59, 59);
                        if ((nowdate > startdate && nowdate < enddate) && (invtime > startdate && invtime < enddate))
                        {
                            #region 1月6日活动,奖励邀请人首投满2000返现10元
                            if (!string.IsNullOrWhiteSpace(py.UsrCustId))
                            {
                                B_borrowing_target bbt = new B_borrowing_target();
                                M_borrowing_target mbt = new M_borrowing_target();
                                mbt = bbt.GetModel(targetid);
                                if (mbt.project_type_id != 6)//排除新手标
                                {
                                    string    log     = "用户" + registerid + "活动奖励邀请人首投满2000返现10元: ";
                                    decimal   amtc    = 0;
                                    DataTable dtstAmt = B_usercenter.GetInvestCountByUseridNew(registerid);
                                    if (dtstAmt.Rows.Count > 0)
                                    {
                                        log += "<br> 投资次数" + dtstAmt.Rows.Count + "次";
                                        if (dtstAmt.Rows.Count == 1)
                                        {
                                            amtc = decimal.Parse(dtstAmt.Rows[0]["InvCount_Amt"].ToString());
                                            log += "<br>投资金额" + amtc;
                                            if (amtc >= 2000)
                                            {
                                                hx_UserAct huact = InviteActCashNew(uuid, targetPlatform, amtc, 4, 1, 10, 5)[0];

                                                if (huact != null && huact.ActID != null)
                                                {
                                                    log += "<br>奖励发放成功";
                                                    #region MyRegion  奖励流水
                                                    string awardDescription = string.Format("邀请好友首投满2000成功,获得{0}{1}", Convert.ToDouble(huact.Amt.ToString()), GetBunusDescription(huact.RewTypeID));
                                                    AddBonusAccoutWater(huact.UserAct, uuid, decimal.Parse(huact.Amt.ToString()), awardDescription, registerid); //registerid 被邀请人 uuid邀请人
                                                    #endregion MyRegion  奖励流水

                                                    #region MyRegion  系统消息
                                                    string MContext = string.Format("尊敬的用户:邀请好友{0}首投{1}金额为{2},获得{3}{4}如有问题可咨询创利投的客服!", userName, borrowing_title, investAmt, decimal.Parse(huact.Amt.ToString()), GetBunusDescription(huact.RewTypeID));
                                                    AddSytemMessage(uuid, "邀请好友首投满2000成功奖励", MContext);
                                                    #endregion

                                                    #region 现金流水信息
                                                    if (huact.RewTypeID == 1)
                                                    {
                                                        B_usercenter o  = new B_usercenter();
                                                        decimal      di = o.GetUsridAvailable_balance(uuid);
                                                        //di = di + decimal.Parse(huact.Amt.ToString());
                                                        StringBuilder strSql = new StringBuilder();
                                                        strSql.Append("insert into hx_Capital_account_water(");
                                                        strSql.Append("membertable_registerid,income,expenditure,time_of_occurrence,account_balance,types_Finance,createtime,keyid,remarks)");
                                                        strSql.Append(" values (");
                                                        strSql.Append("" + uuid + "," + decimal.Parse(huact.Amt.ToString()) + ",0,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," + di + "," + (int)Enum.Parse(typeof(EnumTypesFinance), EnumTypesFinance.邀请奖励.ToString()) + ",'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',0,'" + awardDescription + "')");
                                                        DbHelperSQL.RunSql(strSql.ToString());
                                                        strSql.Clear();
                                                    }
                                                    #endregion
                                                }
                                            }
                                        }
                                    }
                                    LogInfo.WriteLog(log);
                                }
                            }
                            #endregion
                            #region 受邀好友首次成功投资给予活动奖励   常规邀请
                            //获取标的期限
                            life_of_loan = int.Parse(dt.Rows[0]["life_of_loan"].ToString());
                            unit_day     = int.Parse(dt.Rows[0]["unit_day"].ToString());
                            int lol = 0;
                            if (unit_day == 1)
                            {
                                lol = life_of_loan;
                            }
                            #region 邀请好友投资成功返现(奖励邀请人)
                            if (!string.IsNullOrWhiteSpace(py.UsrCustId))
                            {
                                hx_UserAct hut = InviteActBonus(uuid, targetPlatform, int.Parse(dtcode.Rows[0]["invpersonid"].ToString()), investAmt, 1, 4, 1, 0, 5, lol, "邀请好友投资成功返现")[0];//
                                if (hut != null && hut.ActID != null)
                                {
                                    #region MyRegion  奖励流水
                                    string awardDescription = string.Format("邀请好友投资成功,获得{0}{1}", Convert.ToDouble(hut.Amt.ToString()), GetBunusDescription(hut.RewTypeID));
                                    AddBonusAccoutWater(hut.UserAct, uuid, decimal.Parse(hut.Amt.ToString()), awardDescription, registerid); //registerid 被邀请人 uuid邀请人
                                    #endregion MyRegion  奖励流水

                                    #region MyRegion  系统消息
                                    string MContext = string.Format("尊敬的用户:邀请好友{0}投资{1}金额为{2},获得{3}{4}如有问题可咨询创利投的客服!", userName, borrowing_title, investAmt, hut.Amt.ToString(), GetBunusDescription(hut.RewTypeID));
                                    AddSytemMessage(uuid, "邀请好友投资成功奖励", MContext);
                                    #endregion

                                    #region 现金流水信息
                                    if (hut.RewTypeID == 1)
                                    {
                                        B_usercenter o  = new B_usercenter();
                                        decimal      di = o.GetUsridAvailable_balance(uuid);
                                        //di = di + decimal.Parse(hut.Amt.ToString());
                                        StringBuilder strSql = new StringBuilder();
                                        strSql.Append("insert into hx_Capital_account_water(");
                                        strSql.Append("membertable_registerid,income,expenditure,time_of_occurrence,account_balance,types_Finance,createtime,keyid,remarks)");
                                        strSql.Append(" values (");
                                        strSql.Append("" + uuid + "," + decimal.Parse(hut.Amt.ToString()) + ",0,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," + di + "," + (int)Enum.Parse(typeof(EnumTypesFinance), EnumTypesFinance.邀请奖励.ToString()) + ",'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',0,'" + awardDescription + "')");
                                        DbHelperSQL.RunSql(strSql.ToString());
                                        strSql.Clear();
                                    }
                                    #endregion
                                }
                            }
                            #endregion
                            #region 被邀请投资成功返现(奖励被邀请人)
                            int        byquuid = int.Parse(dtcode.Rows[0]["invpersonid"].ToString());
                            hx_UserAct byhut   = InviteActBonus(byquuid, targetPlatform, 0, investAmt, 1, 4, 1, 0, 5, lol, "被邀请投资返现")[0];//
                            if (byhut != null && byhut.ActID != null)
                            {
                                #region MyRegion  奖励流水
                                string awardDescription = string.Format("被邀请投资成功,获得{0}{1}", Convert.ToDouble(byhut.Amt.ToString()), GetBunusDescription(byhut.RewTypeID));
                                AddBonusAccoutWater(byhut.UserAct, byquuid, decimal.Parse(byhut.Amt.ToString()), awardDescription, registerid); //registerid 被邀请人 uuid邀请人
                                #endregion MyRegion  奖励流水

                                #region MyRegion  系统消息
                                string MContext = string.Format("尊敬的用户:被邀请投资{0}金额为{1},获得{2}{3}如有问题可咨询创利投的客服!", borrowing_title, investAmt, byhut.Amt.ToString(), GetBunusDescription(byhut.RewTypeID));
                                AddSytemMessage(byquuid, "被邀请投资成功奖励", MContext);
                                #endregion

                                #region 现金流水信息
                                if (byhut.RewTypeID == 1)
                                {
                                    B_usercenter o  = new B_usercenter();
                                    decimal      di = o.GetUsridAvailable_balance(byquuid);
                                    //di = di + decimal.Parse(byhut.Amt.ToString());
                                    StringBuilder strSql = new StringBuilder();
                                    strSql.Append("insert into hx_Capital_account_water(");
                                    strSql.Append("membertable_registerid,income,expenditure,time_of_occurrence,account_balance,types_Finance,createtime,keyid,remarks)");
                                    strSql.Append(" values (");
                                    strSql.Append("" + byquuid + "," + decimal.Parse(byhut.Amt.ToString()) + ",0,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," + di + "," + (int)Enum.Parse(typeof(EnumTypesFinance), EnumTypesFinance.邀请奖励.ToString()) + ",'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',0,'" + awardDescription + "')");
                                    DbHelperSQL.RunSql(strSql.ToString());
                                    strSql.Clear();
                                }
                                #endregion
                            }
                            #endregion
                            #endregion
                        }



                        #region 这里现金返现  ??? 投资金额为-1 作了单独处理。注册?? RewTypeID-1 ???
                        //hx_UserAct ua = InviteActBonus(uuid, int.Parse(dtcode.Rows[0]["invpersonid"].ToString()), -1M, 1, 4, 1, 0, 5)[0];//???
                        #endregion
                        //}
                        //else if (invcount > 1)
                        //{
                        //    #region 受邀用户续投奖励 邀请活动正常续投
                        //    int biyaoUsrid = int.Parse(dtcode.Rows[0]["invpersonid"].ToString());
                        //    decimal totAmt = B_usercenter.GetInviUserTotalAmt(uuid, biyaoUsrid);//????这里需要取出受邀用户奖总数
                        //    // hx_UserAct hut = aci.InviteActCash(uuid, biyaoUsrid, decimal.Parse(p.TransAmt), 4, 2, 1, totAmt, 5);
                        //    hx_UserAct hut = InviteActBonus(uuid, int.Parse(dtcode.Rows[0]["invpersonid"].ToString()), investAmt - bonusAmt, 1, 4, 1, totAmt, 5)[0];//????
                        //    if (hut != null && hut.ActID != null)
                        //    {
                        //        #region MyRegion  奖励流水
                        //        string awardDescription = string.Format("邀请好友续投成功获得{0}{1}", hut.Amt.ToString(), GetBunusDescription(hut.RewTypeID));
                        //        AddBonusAccoutWater(hut.UserAct, uuid, decimal.Parse(hut.Amt.ToString()), awardDescription, registerid); //registerid 被邀请人 uuid邀请人
                        //        #endregion MyRegion  奖励流水

                        //        #region MyRegion  系统消息
                        //        string MContext = string.Format("尊敬的用户:邀请好友续投{1}金额为{2},获得{3}{4}如有问题可咨询创利投的客服!", userName, borrowing_title, investAmt, hut.Amt.ToString(), GetBunusDescription(hut.RewTypeID));
                        //        AddSytemMessage(uuid, "邀请好友续投奖励", MContext);
                        //        #endregion

                        //        #region 现金奖励 资金流水信息
                        //        if (hut.RewTypeID == 1)
                        //        {
                        //            B_usercenter o = new B_usercenter();
                        //            decimal di = o.GetUsridAvailable_balance(uuid);
                        //            // di = di + decimal.Parse(hut.Amt.ToString());
                        //            StringBuilder strSql = new StringBuilder();
                        //            strSql.Append("insert into hx_Capital_account_water(");
                        //            strSql.Append("membertable_registerid,income,expenditure,time_of_occurrence,account_balance,types_Finance,createtime,keyid,remarks)");
                        //            strSql.Append(" values (");
                        //            strSql.Append("" + uuid + "," + decimal.Parse(hut.Amt.ToString()) + ",0,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," + di + "," + (int)Enum.Parse(typeof(EnumTypesFinance), EnumTypesFinance.邀请奖励.ToString()) + ",'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',0,'" + awardDescription + "')");
                        //            LogInfo.WriteLog("续投奖励流水语句:" + strSql.ToString());
                        //            DbHelperSQL.RunSql(strSql.ToString());
                        //            strSql.Clear();
                        //        }
                        //        #endregion
                        //    }
                        //    #endregion
                        //}

                        /*
                         *  DbHelperSQL.RunSql(" update hx_td_Userinvitation  set InvitesStates=1  where invcode='" + invcode + "' and invpersonid=" + uid + " and  InvitesStates=2 ");
                         *  LogInfo.WriteLog(" 后台更新数据邀请状态 update hx_td_Userinvitation  set InvitesStates=1  where invcode='" + invcode + "' and invpersonid=" + uid + " and  InvitesStates=2 ");
                         */
                    }
                }
            }
            #endregion
        }