示例#1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public M_Bid_records GetModel(int bid_records_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 bid_records_id,borrower_registerid,targetid,loan_number,annual_interest_rate,current_period,investment_amount,value_date,investment_maturity,invest_time,invest_state,flow_return,repayment_amount,repayment_period,investor_registerid,payment_status from hx_Bid_records ");
            strSql.Append(" where bid_records_id=@bid_records_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@bid_records_id", SqlDbType.Int, 4)
            };
            parameters[0].Value = bid_records_id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
示例#2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(M_Bid_records model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into hx_Bid_records(");
            strSql.Append("borrower_registerid,targetid,loan_number,annual_interest_rate,current_period,investment_amount,value_date,investment_maturity,invest_time,invest_state,flow_return,repayment_amount,repayment_period,investor_registerid,payment_status,withoutinterest,invitationcode,OrdId,JiaxiNum,BonusAmt)");
            strSql.Append(" values (");
            strSql.Append("@borrower_registerid,@targetid,@loan_number,@annual_interest_rate,@current_period,@investment_amount,@value_date,@investment_maturity,@invest_time,@invest_state,@flow_return,@repayment_amount,@repayment_period,@investor_registerid,@payment_status,@withoutinterest,@invitationcode,@OrdId,@JiaxiNum,@BonusAmt)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@borrower_registerid",  SqlDbType.Int,        4),
                new SqlParameter("@targetid",             SqlDbType.Int,        4),
                new SqlParameter("@loan_number",          SqlDbType.Decimal,   18),
                new SqlParameter("@annual_interest_rate", SqlDbType.Decimal,   17),
                new SqlParameter("@current_period",       SqlDbType.Int,        4),
                new SqlParameter("@investment_amount",    SqlDbType.Decimal,   17),
                new SqlParameter("@value_date",           SqlDbType.DateTime),
                new SqlParameter("@investment_maturity",  SqlDbType.DateTime),
                new SqlParameter("@invest_time",          SqlDbType.DateTime),
                new SqlParameter("@invest_state",         SqlDbType.Int,        4),
                new SqlParameter("@flow_return",          SqlDbType.Int,        4),
                new SqlParameter("@repayment_amount",     SqlDbType.Decimal,   17),
                new SqlParameter("@repayment_period",     SqlDbType.DateTime),
                new SqlParameter("@investor_registerid",  SqlDbType.Int,        4),
                new SqlParameter("@payment_status",       SqlDbType.Int,        4),
                new SqlParameter("@withoutinterest",      SqlDbType.Decimal,   17),
                new SqlParameter("@invitationcode",       SqlDbType.VarChar,   50),
                new SqlParameter("@OrdId",                SqlDbType.Decimal,   20),
                new SqlParameter("@JiaxiNum",             SqlDbType.Decimal,   20),
                new SqlParameter("@BonusAmt",             SqlDbType.Decimal, 20)
            };
            parameters[0].Value  = model.borrower_registerid;
            parameters[1].Value  = model.targetid;
            parameters[2].Value  = model.loan_number;
            parameters[3].Value  = model.annual_interest_rate;
            parameters[4].Value  = model.current_period;
            parameters[5].Value  = model.investment_amount;
            parameters[6].Value  = model.value_date;
            parameters[7].Value  = model.investment_maturity;
            parameters[8].Value  = model.invest_time;
            parameters[9].Value  = model.invest_state;
            parameters[10].Value = model.flow_return;
            parameters[11].Value = model.repayment_amount;
            parameters[12].Value = model.repayment_period;
            parameters[13].Value = model.investor_registerid;
            parameters[14].Value = model.payment_status;
            parameters[15].Value = model.withoutinterest;
            parameters[16].Value = model.invitationcode;
            parameters[17].Value = model.OrdId;
            parameters[18].Value = model.JiaxiNum;
            parameters[19].Value = model.BonusAmt;


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

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

            if (row != null)
            {
                if (row["bid_records_id"] != null && row["bid_records_id"].ToString() != "")
                {
                    model.bid_records_id = int.Parse(row["bid_records_id"].ToString());
                }
                if (row["borrower_registerid"] != null && row["borrower_registerid"].ToString() != "")
                {
                    model.borrower_registerid = int.Parse(row["borrower_registerid"].ToString());
                }
                if (row["targetid"] != null && row["targetid"].ToString() != "")
                {
                    model.targetid = int.Parse(row["targetid"].ToString());
                }
                if (row["loan_number"] != null && row["loan_number"].ToString() != "")
                {
                    model.loan_number = decimal.Parse(row["loan_number"].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["current_period"] != null && row["current_period"].ToString() != "")
                {
                    model.current_period = int.Parse(row["current_period"].ToString());
                }
                if (row["investment_amount"] != null && row["investment_amount"].ToString() != "")
                {
                    model.investment_amount = decimal.Parse(row["investment_amount"].ToString());
                }
                if (row["value_date"] != null && row["value_date"].ToString() != "")
                {
                    model.value_date = DateTime.Parse(row["value_date"].ToString());
                }
                if (row["investment_maturity"] != null && row["investment_maturity"].ToString() != "")
                {
                    model.investment_maturity = DateTime.Parse(row["investment_maturity"].ToString());
                }
                if (row["invest_time"] != null && row["invest_time"].ToString() != "")
                {
                    model.invest_time = DateTime.Parse(row["invest_time"].ToString());
                }
                if (row["invest_state"] != null && row["invest_state"].ToString() != "")
                {
                    model.invest_state = int.Parse(row["invest_state"].ToString());
                }
                if (row["flow_return"] != null && row["flow_return"].ToString() != "")
                {
                    model.flow_return = int.Parse(row["flow_return"].ToString());
                }
                if (row["repayment_amount"] != null && row["repayment_amount"].ToString() != "")
                {
                    model.repayment_amount = decimal.Parse(row["repayment_amount"].ToString());
                }
                if (row["repayment_period"] != null && row["repayment_period"].ToString() != "")
                {
                    model.repayment_period = DateTime.Parse(row["repayment_period"].ToString());
                }
                if (row["investor_registerid"] != null && row["investor_registerid"].ToString() != "")
                {
                    model.investor_registerid = int.Parse(row["investor_registerid"].ToString());
                }
                if (row["payment_status"] != null && row["payment_status"].ToString() != "")
                {
                    model.payment_status = int.Parse(row["payment_status"].ToString());
                }
            }
            return(model);
        }
示例#4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(M_Bid_records model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update hx_Bid_records set ");
            strSql.Append("borrower_registerid=@borrower_registerid,");
            strSql.Append("targetid=@targetid,");
            strSql.Append("loan_number=@loan_number,");
            strSql.Append("annual_interest_rate=@annual_interest_rate,");
            strSql.Append("current_period=@current_period,");
            strSql.Append("investment_amount=@investment_amount,");
            strSql.Append("value_date=@value_date,");
            strSql.Append("investment_maturity=@investment_maturity,");
            strSql.Append("invest_time=@invest_time,");
            strSql.Append("invest_state=@invest_state,");
            strSql.Append("flow_return=@flow_return,");
            strSql.Append("repayment_amount=@repayment_amount,");
            strSql.Append("repayment_period=@repayment_period,");
            strSql.Append("investor_registerid=@investor_registerid,");
            strSql.Append("payment_status=@payment_status");
            strSql.Append(" where bid_records_id=@bid_records_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@borrower_registerid",  SqlDbType.Int,        4),
                new SqlParameter("@targetid",             SqlDbType.Int,        4),
                new SqlParameter("@loan_number",          SqlDbType.Decimal,   18),
                new SqlParameter("@annual_interest_rate", SqlDbType.Decimal,   17),
                new SqlParameter("@current_period",       SqlDbType.Int,        4),
                new SqlParameter("@investment_amount",    SqlDbType.Decimal,   17),
                new SqlParameter("@value_date",           SqlDbType.DateTime),
                new SqlParameter("@investment_maturity",  SqlDbType.DateTime),
                new SqlParameter("@invest_time",          SqlDbType.DateTime),
                new SqlParameter("@invest_state",         SqlDbType.Int,        4),
                new SqlParameter("@flow_return",          SqlDbType.Int,        4),
                new SqlParameter("@repayment_amount",     SqlDbType.Decimal,   17),
                new SqlParameter("@repayment_period",     SqlDbType.DateTime),
                new SqlParameter("@investor_registerid",  SqlDbType.Int,        4),
                new SqlParameter("@payment_status",       SqlDbType.Int,        4),
                new SqlParameter("@bid_records_id",       SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.borrower_registerid;
            parameters[1].Value  = model.targetid;
            parameters[2].Value  = model.loan_number;
            parameters[3].Value  = model.annual_interest_rate;
            parameters[4].Value  = model.current_period;
            parameters[5].Value  = model.investment_amount;
            parameters[6].Value  = model.value_date;
            parameters[7].Value  = model.investment_maturity;
            parameters[8].Value  = model.invest_time;
            parameters[9].Value  = model.invest_state;
            parameters[10].Value = model.flow_return;
            parameters[11].Value = model.repayment_amount;
            parameters[12].Value = model.repayment_period;
            parameters[13].Value = model.investor_registerid;
            parameters[14].Value = model.payment_status;
            parameters[15].Value = model.bid_records_id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(M_Bid_records model)
 {
     return(dal.Update(model));
 }
示例#6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(M_Bid_records model)
 {
     return(dal.Add(model));
 }
示例#7
0
        /// <summary>
        /// 投资 ,调用此方法之前必须做冻结 (M_td_frozen) 操作
        /// </summary>
        /// <param name="p">必须参数 OrdId,invest_time,investment_amount,investment_amount,targetid</param>
        /// <param name="usrCustId">up.UsrCustId</param>
        /// <param name="borrUsrCustId">dt.Rows[0]["BorrUsrCustId"].ToString()</param>
        /// <param name="isinterest">0 代金券   1 加息劵</param>
        /// <param name="vocheramttemp">优惠金额</param>
        /// <param name="rewardsids">附带参数,用于代金券或加息劵编号</param>
        /// <param name="frozenidNo">冻结号</param>
        /// <param name="isWeb">是否是网页端生成</param>
        /// <returns></returns>
        public static M_InitiativeTender InitiativeTender(M_Bid_records p, string usrCustId, string borrUsrCustId, int isinterest, decimal vocheramttemp, string rewardsids, string frozenidNo, bool isWeb = true)
        {
            M_InitiativeTender m = new M_InitiativeTender();

            m.Version       = "20";
            m.CmdId         = "InitiativeTender";
            m.MerCustId     = Utils.GetMerCustID();
            m.OrdId         = p.OrdId.ToString();
            m.OrdDate       = p.invest_time.ToString("yyyyMMdd");
            m.TransAmt      = p.investment_amount.ToString("0.00");
            m.UsrCustId     = usrCustId;
            m.MaxTenderRate = "0.20";
            TenderJosnPro mtp = new TenderJosnPro();

            mtp.BorrowerCustId = borrUsrCustId;
            //mtp.BorrowerAmt =decimal.Parse(dt.Rows[0]["borrowing_balance"].ToString()).ToString("0.00");
            mtp.BorrowerAmt = p.investment_amount.ToString("0.00");
            // mtp.BorrowerRate = decimal.Parse( dt.Rows[0]["loan_management_fee"].ToString()).ToString("0.00");
            mtp.BorrowerRate  = "1.00"; //风控范围
            mtp.ProId         = p.targetid.ToString();
            m.BorrowerDetails = "[" + FastJSON.toJOSN(mtp) + "]";

            #region 此处判断优惠类型
            if (isinterest == 0)  //代金券
            {
                TenderAccPro reqExt = new TenderAccPro();
                reqExt.AcctId    = Utils.GetMERDT();
                reqExt.VocherAmt = vocheramttemp.ToString("0.00");
                if (rewardsids.Length > 0)
                {
                    m.ReqExt = "{" + "\"Vocher\":" + FastJSON.toJOSN(reqExt) + "}";
                }
            }
            #endregion
            m.IsFreeze    = "Y";
            m.FreezeOrdId = frozenidNo;
            //Mt.RetUrl = "http://localhost:17745/investment_success_" + targetid.ToString() + ".html";
            m.RetUrl = Utils.GetRe_url((isWeb ? "" : "Home/") + "investment_success" + (isWeb ? "_" : "/") + p.targetid.ToString() + (isWeb ? ".html" : ""));
            //Mt.RetUrl = Utils.GetRe_url("Home/investment_success/" + targetid.ToString());
            m.BgRetUrl = Utils.GetRe_url("Thirdparty/BG_investment_success");
            // Mt.BgRetUrl = Utils.GetRe_url("666Thirdparty/BG_investment_success");
            m.MerPriv = rewardsids;
            LogInfo.WriteLog("优惠券使用的id:" + rewardsids);

            StringBuilder chkVal = new StringBuilder();
            chkVal.Append(m.Version);
            chkVal.Append(m.CmdId);
            chkVal.Append(m.MerCustId);
            chkVal.Append(m.OrdId);
            chkVal.Append(m.OrdDate);
            chkVal.Append(m.TransAmt);
            chkVal.Append(m.UsrCustId);
            chkVal.Append(m.MaxTenderRate);
            chkVal.Append(m.BorrowerDetails);
            chkVal.Append(m.IsFreeze);
            chkVal.Append(m.FreezeOrdId);
            chkVal.Append(m.RetUrl);
            chkVal.Append(m.BgRetUrl);
            chkVal.Append(m.MerPriv);
            chkVal.Append(m.ReqExt);
            string chkv = chkVal.ToString();
            LogInfo.WriteLog(chkv);

            //私钥文件的位置(这里是放在了站点的根目录下)
            string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetMerPr();
            //需要指定提交字符串的长度
            int           len        = Encoding.UTF8.GetBytes(chkv).Length;
            StringBuilder sbChkValue = new StringBuilder(256);
            //加签
            int ret = DllInterop.SignMsg(Utils.GetMerId(), merKeyFile, chkv, len, sbChkValue);
            m.ChkValue = sbChkValue.ToString();
            LogInfo.WriteLog("加签字符:" + ret.ToString() + "投标chkv字符:" + chkv);
            LogInfo.WriteLog("投标提交表单报文:" + FastJSON.toJOSN(m));
            if (ret == 0)
            {
                return(m);
            }
            return(null);
        }