/// <summary> /// 得到一个对象实体 by SQLpara /// </summary> public Lebi_Supplier_Bank GetModel(SQLPara para) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from [Lebi_Supplier_Bank] "); if (para.Where != "") { strSql.Append(" where " + para.Where + ""); } Lebi_Supplier_Bank model = new Lebi_Supplier_Bank(); DataSet ds = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString(), para.Para); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } model.Name = ds.Tables[0].Rows[0]["Name"].ToString(); model.Code = ds.Tables[0].Rows[0]["Code"].ToString(); model.UserName = ds.Tables[0].Rows[0]["UserName"].ToString(); if (ds.Tables[0].Rows[0]["Supplier_id"].ToString() != "") { model.Supplier_id = int.Parse(ds.Tables[0].Rows[0]["Supplier_id"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 编辑付款账号 /// </summary> public void Bank_Edit() { if (!Power("supplier_bank_list", "收款账号")) { AjaxNoPower(); return; } int id = RequestTool.RequestInt("id", 0); bool addflag = false; Lebi_Supplier_Bank model = B_Lebi_Supplier_Bank.GetModel("id = " + id + " and Supplier_id = " + CurrentSupplier.id + ""); if (model == null) { addflag = true; model = new Lebi_Supplier_Bank(); } model = B_Lebi_Supplier_Bank.SafeBindForm(model); if (addflag) { model.Supplier_id = CurrentSupplier.id; B_Lebi_Supplier_Bank.Add(model); id = B_Lebi_Supplier_Bank.GetMaxId(); Log.Add("添加收款账号", "Bank", id.ToString(), CurrentSupplier, model.Name); } else { B_Lebi_Supplier_Bank.Update(model); Log.Add("编辑收款账号", "Bank", id.ToString(), CurrentSupplier, model.Name); } string result = "{\"msg\":\"OK\", \"id\":\"" + id + "\"}"; Response.Write(result); }
/// <summary> /// 得到一个对象实体 by id /// </summary> public Lebi_Supplier_Bank GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from [Lebi_Supplier_Bank] "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Lebi_Supplier_Bank model = new Lebi_Supplier_Bank(); DataSet ds = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } model.Name = ds.Tables[0].Rows[0]["Name"].ToString(); model.Code = ds.Tables[0].Rows[0]["Code"].ToString(); model.UserName = ds.Tables[0].Rows[0]["UserName"].ToString(); if (ds.Tables[0].Rows[0]["Supplier_id"].ToString() != "") { model.Supplier_id = int.Parse(ds.Tables[0].Rows[0]["Supplier_id"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Lebi_Supplier_Bank model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update [Lebi_Supplier_Bank] set "); strSql.Append("Name= @Name,"); strSql.Append("Code= @Code,"); strSql.Append("UserName= @UserName,"); strSql.Append("Supplier_id= @Supplier_id"); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@Name", SqlDbType.NVarChar, 100), new SqlParameter("@Code", SqlDbType.NVarChar, 100), new SqlParameter("@UserName", SqlDbType.NVarChar, 50), new SqlParameter("@Supplier_id", SqlDbType.Int, 4) }; parameters[0].Value = model.id; parameters[1].Value = model.Name; parameters[2].Value = model.Code; parameters[3].Value = model.UserName; parameters[4].Value = model.Supplier_id; SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Lebi_Supplier_Bank model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [Lebi_Supplier_Bank]("); strSql.Append("Name,Code,UserName,Supplier_id)"); strSql.Append(" values ("); strSql.Append("@Name,@Code,@UserName,@Supplier_id)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Name", model.Name), new SqlParameter("@Code", model.Code), new SqlParameter("@UserName", model.UserName), new SqlParameter("@Supplier_id", model.Supplier_id) }; object obj = SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters); if (obj == null) { return(1); } else { return(Convert.ToInt32(obj)); } }
//获取提现账户信息 public static string GetBank(int user_id, int id) { string ret = ""; Lebi_Supplier_Bank model = B_Lebi_Supplier_Bank.GetModel("user_id = " + user_id + " and id = " + id + ""); if (model != null) { ret = model.Name + "," + model.Code + "," + model.UserName; } return(ret); }
protected void Page_Load(object sender, EventArgs e) { if (!Power("supplier_bank_list", "付款账号")) { WindowNoPower(); } int id = RequestTool.RequestInt("id", 0); model = B_Lebi_Supplier_Bank.GetModel("id = " + id + " and Supplier_id = " + CurrentSupplier.id + ""); if (model == null) { model = new Lebi_Supplier_Bank(); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Lebi_Supplier_Bank model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [Lebi_Supplier_Bank]("); strSql.Append("[Name],[Code],[UserName],[Supplier_id])"); strSql.Append(" values ("); strSql.Append("@Name,@Code,@UserName,@Supplier_id)"); OleDbParameter[] parameters = { new OleDbParameter("@Name", model.Name), new OleDbParameter("@Code", model.Code), new OleDbParameter("@UserName", model.UserName), new OleDbParameter("@Supplier_id", model.Supplier_id) }; AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters); return(1); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Lebi_Supplier_Bank model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update [Lebi_Supplier_Bank] set "); strSql.Append("[Name]=@Name,"); strSql.Append("[Code]=@Code,"); strSql.Append("[UserName]=@UserName,"); strSql.Append("[Supplier_id]=@Supplier_id"); strSql.Append(" where id=" + model.id); OleDbParameter[] parameters = { new OleDbParameter("@Name", model.Name), new OleDbParameter("@Code", model.Code), new OleDbParameter("@UserName", model.UserName), new OleDbParameter("@Supplier_id", model.Supplier_id) }; AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters); }
/// <summary> /// 对象实体绑定数据 /// </summary> public Lebi_Supplier_Bank ReaderBind(IDataReader dataReader) { Lebi_Supplier_Bank model = new Lebi_Supplier_Bank(); object ojb; ojb = dataReader["id"]; if (ojb != null && ojb != DBNull.Value) { model.id = (int)ojb; } model.Name = dataReader["Name"].ToString(); model.Code = dataReader["Code"].ToString(); model.UserName = dataReader["UserName"].ToString(); ojb = dataReader["Supplier_id"]; if (ojb != null && ojb != DBNull.Value) { model.Supplier_id = (int)ojb; } return(model); }
/// <summary> /// 安全方式绑定对象表单 /// </summary> public Lebi_Supplier_Bank SafeBindForm(Lebi_Supplier_Bank model) { if (HttpContext.Current.Request["Name"] != null) { model.Name = Shop.Tools.RequestTool.RequestSafeString("Name"); } if (HttpContext.Current.Request["Code"] != null) { model.Code = Shop.Tools.RequestTool.RequestSafeString("Code"); } if (HttpContext.Current.Request["UserName"] != null) { model.UserName = Shop.Tools.RequestTool.RequestSafeString("UserName"); } if (HttpContext.Current.Request["Supplier_id"] != null) { model.Supplier_id = Shop.Tools.RequestTool.RequestInt("Supplier_id", 0); } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public static void Update(Lebi_Supplier_Bank model) { D_Lebi_Supplier_Bank.Instance.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public static int Add(Lebi_Supplier_Bank model) { return(D_Lebi_Supplier_Bank.Instance.Add(model)); }
/// <summary> /// 安全方式绑定表单数据 /// </summary> public static Lebi_Supplier_Bank SafeBindForm(Lebi_Supplier_Bank model) { return(D_Lebi_Supplier_Bank.Instance.SafeBindForm(model)); }