/// <summary> /// 更新一条数据 /// </summary> public void Update(Lebi_Express model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update [Lebi_Express] set "); strSql.Append("Name= @Name,"); strSql.Append("Width= @Width,"); strSql.Append("Height= @Height,"); strSql.Append("Status= @Status,"); strSql.Append("Sort= @Sort,"); strSql.Append("Background= @Background,"); strSql.Append("Transport_id= @Transport_id,"); strSql.Append("Pos= @Pos"); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@Name", SqlDbType.NVarChar, 50), new SqlParameter("@Width", SqlDbType.NVarChar, 10), new SqlParameter("@Height", SqlDbType.NVarChar, 10), new SqlParameter("@Status", SqlDbType.Int, 4), new SqlParameter("@Sort", SqlDbType.Int, 4), new SqlParameter("@Background", SqlDbType.NVarChar, 50), new SqlParameter("@Transport_id", SqlDbType.Int, 4), new SqlParameter("@Pos", SqlDbType.NText) }; parameters[0].Value = model.id; parameters[1].Value = model.Name; parameters[2].Value = model.Width; parameters[3].Value = model.Height; parameters[4].Value = model.Status; parameters[5].Value = model.Sort; parameters[6].Value = model.Background; parameters[7].Value = model.Transport_id; parameters[8].Value = model.Pos; SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters); }
protected void Page_Load(object sender, EventArgs e) { id = RequestTool.RequestInt("id", 0); if (id == 0) { if (!EX_Admin.Power("express_add", "添加模板")) { WindowNoPower(); } } else { if (!EX_Admin.Power("express_edit", "编辑模板")) { WindowNoPower(); } } model = B_Lebi_Express.GetModel(id); if (model == null) { model = new Lebi_Express(); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Lebi_Express model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [Lebi_Express]("); strSql.Append("[Name],[Width],[Height],[Status],[Sort],[Background],[Transport_id],[Pos])"); strSql.Append(" values ("); strSql.Append("@Name,@Width,@Height,@Status,@Sort,@Background,@Transport_id,@Pos)"); OleDbParameter[] parameters = { new OleDbParameter("@Name", model.Name), new OleDbParameter("@Width", model.Width), new OleDbParameter("@Height", model.Height), new OleDbParameter("@Status", model.Status), new OleDbParameter("@Sort", model.Sort), new OleDbParameter("@Background", model.Background), new OleDbParameter("@Transport_id", model.Transport_id), new OleDbParameter("@Pos", model.Pos) }; AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters); return(1); }
/// <summary> /// 安全方式绑定对象表单 /// </summary> public Lebi_Express SafeBindForm(Lebi_Express model) { if (HttpContext.Current.Request["Name"] != null) { model.Name = Shop.Tools.RequestTool.RequestSafeString("Name"); } if (HttpContext.Current.Request["Width"] != null) { model.Width = Shop.Tools.RequestTool.RequestSafeString("Width"); } if (HttpContext.Current.Request["Height"] != null) { model.Height = Shop.Tools.RequestTool.RequestSafeString("Height"); } if (HttpContext.Current.Request["Status"] != null) { model.Status = Shop.Tools.RequestTool.RequestInt("Status", 0); } if (HttpContext.Current.Request["Sort"] != null) { model.Sort = Shop.Tools.RequestTool.RequestInt("Sort", 0); } if (HttpContext.Current.Request["Background"] != null) { model.Background = Shop.Tools.RequestTool.RequestSafeString("Background"); } if (HttpContext.Current.Request["Transport_id"] != null) { model.Transport_id = Shop.Tools.RequestTool.RequestInt("Transport_id", 0); } if (HttpContext.Current.Request["Pos"] != null) { model.Pos = Shop.Tools.RequestTool.RequestSafeString("Pos"); } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public static void Update(Lebi_Express model) { D_Lebi_Express.Instance.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public static int Add(Lebi_Express model) { return(D_Lebi_Express.Instance.Add(model)); }
/// <summary> /// 安全方式绑定表单数据 /// </summary> public static Lebi_Express SafeBindForm(Lebi_Express model) { return(D_Lebi_Express.Instance.SafeBindForm(model)); }