/// <summary> /// 设置存款方式(获取银行卡号) /// </summary> /// <param name="method_id">存款方式ID</param> /// <param name="number">银行卡号</param> public void GetModel(int method_id, ref string number) { model = dal.GetModel(method_id); if (model != null) { number = model.account_number; } }
/// <summary> /// 获取存款信息 /// </summary> /// <param name="depositId">存款编号</param> /// <returns></returns> public string GetDepositInfo(int?depositId) { string method_id = string.Empty; model = dal.GetModel((int)depositId); if (model != null) { return("\"depositId\":\"" + model.method_id + "\",\"bank_location\":\"" + QGYHelper.FormatCode.FormatUrlEncode(model.bank_location) + "\",\"account_name\":\"" + QGYHelper.FormatCode.FormatUrlEncode(model.account_name) + "\",\"routing_number\":\"" + QGYHelper.FormatCode.FormatUrlEncode(model.routing_number) + "\",\"account_number\":\"" + QGYHelper.FormatCode.FormatUrlEncode(model.account_number) + "\""); } else { return(""); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(QAMZN.Model.tb_user_depositmethod model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update tb_user_depositmethod set "); strSql.Append("bank_location=@bank_location,"); strSql.Append("account_name=@account_name,"); strSql.Append("routing_number=@routing_number,"); strSql.Append("account_number=@account_number,"); strSql.Append("user_id=@user_id,"); strSql.Append("createtime=@createtime"); strSql.Append(" where method_id=@method_id"); SqlParameter[] parameters = { new SqlParameter("@bank_location", SqlDbType.VarChar, 50), new SqlParameter("@account_name", SqlDbType.VarChar, 50), new SqlParameter("@routing_number", SqlDbType.VarChar, 50), new SqlParameter("@account_number", SqlDbType.VarChar, 50), new SqlParameter("@user_id", SqlDbType.Int, 4), new SqlParameter("@createtime", SqlDbType.DateTime), new SqlParameter("@method_id", SqlDbType.Int, 4) }; parameters[0].Value = model.bank_location; parameters[1].Value = model.account_name; parameters[2].Value = model.routing_number; parameters[3].Value = model.account_number; parameters[4].Value = model.user_id; parameters[5].Value = model.createtime; parameters[6].Value = model.method_id; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public QAMZN.Model.tb_user_depositmethod DataRowToModel(DataRow row) { QAMZN.Model.tb_user_depositmethod model = new QAMZN.Model.tb_user_depositmethod(); if (row != null) { if (row["method_id"] != null && row["method_id"].ToString() != "") { model.method_id = int.Parse(row["method_id"].ToString()); } if (row["bank_location"] != null) { model.bank_location = row["bank_location"].ToString(); } if (row["account_name"] != null) { model.account_name = row["account_name"].ToString(); } if (row["routing_number"] != null) { model.routing_number = row["routing_number"].ToString(); } if (row["account_number"] != null) { model.account_number = row["account_number"].ToString(); } if (row["user_id"] != null && row["user_id"].ToString() != "") { model.user_id = int.Parse(row["user_id"].ToString()); } if (row["createtime"] != null && row["createtime"].ToString() != "") { model.createtime = DateTime.Parse(row["createtime"].ToString()); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public QAMZN.Model.tb_user_depositmethod GetModel(int method_id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 method_id,bank_location,account_name,routing_number,account_number,user_id,createtime from tb_user_depositmethod "); strSql.Append(" where method_id=@method_id"); SqlParameter[] parameters = { new SqlParameter("@method_id", SqlDbType.Int, 4) }; parameters[0].Value = method_id; QAMZN.Model.tb_user_depositmethod model = new QAMZN.Model.tb_user_depositmethod(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(QAMZN.Model.tb_user_depositmethod model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into tb_user_depositmethod("); strSql.Append("bank_location,account_name,routing_number,account_number,user_id,createtime)"); strSql.Append(" values ("); strSql.Append("@bank_location,@account_name,@routing_number,@account_number,@user_id,@createtime)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@bank_location", SqlDbType.VarChar, 50), new SqlParameter("@account_name", SqlDbType.VarChar, 50), new SqlParameter("@routing_number", SqlDbType.VarChar, 50), new SqlParameter("@account_number", SqlDbType.VarChar, 50), new SqlParameter("@user_id", SqlDbType.Int, 4), new SqlParameter("@createtime", SqlDbType.DateTime) }; parameters[0].Value = model.bank_location; parameters[1].Value = model.account_name; parameters[2].Value = model.routing_number; parameters[3].Value = model.account_number; parameters[4].Value = model.user_id; parameters[5].Value = model.createtime; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }