protected void Page_Load(object sender, EventArgs e) { if (!EX_Admin.Power("property_list", "属性规格列表")) { PageReturnMsg = PageNoPowerMsg(); } tid = RequestTool.RequestInt("tid", 133); key = RequestTool.RequestSafeString("key"); tag = RequestTool.RequestSafeString("tag"); PageSize = RequestTool.getpageSize(25); string where = "parentid = 0 and Type_id_ProPertyType = " + tid + ""; if (key != "") { where += " and (Name like lbsql{'%" + key + "%'} or Code like lbsql{'%" + key + "%'})"; } if (tag != "") { if (tag == "none") { where += " and (Tag = '' or Tag is null)"; } else { where += " and Tag = lbsql{'" + tag + "'}"; } } models = B_Lebi_ProPerty.GetList(where, "Sort desc", PageSize, page); types = B_Lebi_Type.GetList("Class='ProPertyType'", "Sort desc"); int recordCount = B_Lebi_ProPerty.Counts(where); PageString = Pager.GetPaginationString("?page={0}&tid=" + tid + "&tag=" + tag + "&key=" + key + "", page, PageSize, recordCount); tmodel = B_Lebi_Type.GetModel(tid); tags = B_Lebi_ProPerty_Tag.GetList("Type_id_ProPertyType = " + tid + " and Supplier_id = 0", "Sort desc"); }
/// <summary> /// 安全方式绑定对象表单 /// </summary> public Lebi_Type SafeBindForm(Lebi_Type model) { if (HttpContext.Current.Request["id"] != null) { model.id = Shop.Tools.RequestTool.RequestInt("id", 0); } if (HttpContext.Current.Request["Name"] != null) { model.Name = Shop.Tools.RequestTool.RequestSafeString("Name"); } if (HttpContext.Current.Request["Class"] != null) { model.Class = Shop.Tools.RequestTool.RequestSafeString("Class"); } if (HttpContext.Current.Request["Sort"] != null) { model.Sort = Shop.Tools.RequestTool.RequestInt("Sort", 0); } if (HttpContext.Current.Request["Description"] != null) { model.Description = Shop.Tools.RequestTool.RequestSafeString("Description"); } if (HttpContext.Current.Request["Color"] != null) { model.Color = Shop.Tools.RequestTool.RequestSafeString("Color"); } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Lebi_Type model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update [Lebi_Type] set "); strSql.Append("Name= @Name,"); strSql.Append("Class= @Class,"); strSql.Append("Sort= @Sort,"); strSql.Append("Description= @Description,"); strSql.Append("Color= @Color"); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@Name", SqlDbType.NVarChar, 50), new SqlParameter("@Class", SqlDbType.NVarChar, 50), new SqlParameter("@Sort", SqlDbType.Int, 4), new SqlParameter("@Description", SqlDbType.NVarChar, 400), new SqlParameter("@Color", SqlDbType.NVarChar, 10) }; parameters[0].Value = model.id; parameters[1].Value = model.Name; parameters[2].Value = model.Class; parameters[3].Value = model.Sort; parameters[4].Value = model.Description; parameters[5].Value = model.Color; SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters); }
/// <summary> /// 得到一个对象实体 by SQLpara /// </summary> public Lebi_Type GetModel(SQLPara para) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from [Lebi_Type] "); if (para.Where != "") { strSql.Append(" where " + para.Where + ""); } Lebi_Type model = new Lebi_Type(); 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.Class = ds.Tables[0].Rows[0]["Class"].ToString(); if (ds.Tables[0].Rows[0]["Sort"].ToString() != "") { model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString()); } model.Description = ds.Tables[0].Rows[0]["Description"].ToString(); model.Color = ds.Tables[0].Rows[0]["Color"].ToString(); return(model); } else { return(null); } }
protected void Page_Load(object sender, EventArgs e) { if (!Power("supplier_property", "属性规格")) { PageReturnMsg = PageNoPowerMsg(); } Lebi_ProPerty check = B_Lebi_ProPerty.GetModel(pid); if (check == null) { pid = B_Lebi_ProPerty.GetList("Supplier_id = " + CurrentSupplier.id + " and parentid = 0", "").FirstOrDefault().id; } PageSize = RequestTool.getpageSize(25); pid = RequestTool.RequestInt("pid", 0); key = RequestTool.RequestString("key"); pmodel = B_Lebi_ProPerty.GetModel(pid); string where = "parentid=" + pid; if (key != "") { where += " and (Name like lbsql{'%" + key + "%'} or Code like lbsql{'%" + key + "%'})"; } models = B_Lebi_ProPerty.GetList(where, "Sort desc", PageSize, page); int recordCount = B_Lebi_ProPerty.Counts(where); PageString = Shop.Bussiness.Pager.GetPaginationString("?page={0}&pid=" + pid + "&key=" + key + "", page, PageSize, recordCount); tmodel = B_Lebi_Type.GetModel(pmodel.Type_id_ProPertyType); }
public static string TypeName(int id, string lang) { Lebi_Type model = B_Lebi_Type.GetModel(id); if (model != null) { if (model.Color != "") { return("<font style=\"color:" + model.Color + "\">" + Language.Tag(model.Name, lang) + "</font>"); } else { return(Language.Tag(model.Name, lang)); } } return(""); }
/// <summary> /// 返回类型名称 /// </summary> /// <param name="id"></param> /// <returns></returns> public static string TypeName(int id) { Lebi_Type model = B_Lebi_Type.GetModel(id); if (model != null) { if (model.Color != "") { return("<font style=\"color:" + model.Color + "\">" + model.Name + "</font>"); } else { return(model.Name); } } return(""); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Lebi_Type model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [Lebi_Type]("); strSql.Append("[id],[Name],[Class],[Sort],[Description],[Color])"); strSql.Append(" values ("); strSql.Append("@id,@Name,@Class,@Sort,@Description,@Color)"); OleDbParameter[] parameters = { new OleDbParameter("@id", model.id), new OleDbParameter("@Name", model.Name), new OleDbParameter("@Class", model.Class), new OleDbParameter("@Sort", model.Sort), new OleDbParameter("@Description", model.Description), new OleDbParameter("@Color", model.Color) }; AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters); return(1); }
/// <summary> /// 对象实体绑定数据 /// </summary> public Lebi_Type ReaderBind(IDataReader dataReader) { Lebi_Type model = new Lebi_Type(); object ojb; ojb = dataReader["id"]; if (ojb != null && ojb != DBNull.Value) { model.id = (int)ojb; } model.Name = dataReader["Name"].ToString(); model.Class = dataReader["Class"].ToString(); ojb = dataReader["Sort"]; if (ojb != null && ojb != DBNull.Value) { model.Sort = (int)ojb; } model.Description = dataReader["Description"].ToString(); model.Color = dataReader["Color"].ToString(); return(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Lebi_Type model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [Lebi_Type]("); strSql.Append("id,Name,Class,Sort,Description,Color)"); strSql.Append(" values ("); strSql.Append("@id,@Name,@Class,@Sort,@Description,@Color)"); SqlParameter[] parameters = { new SqlParameter("@id", model.id), new SqlParameter("@Name", model.Name), new SqlParameter("@Class", model.Class), new SqlParameter("@Sort", model.Sort), new SqlParameter("@Description", model.Description), new SqlParameter("@Color", model.Color) }; SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters); return(1); }
protected void Page_Load(object sender, EventArgs e) { if (!EX_Admin.Power("property_add", "添加属性规格") || !EX_Admin.Power("property_edit", "编辑属性规格")) { PageReturnMsg = PageNoPowerMsg(); } PageSize = RequestTool.getpageSize(25); pid = RequestTool.RequestInt("pid", 0); key = RequestTool.RequestString("key"); pmodel = B_Lebi_ProPerty.GetModel(pid); string where = "parentid=" + pid; if (key != "") { where += " and (Name like lbsql{'%" + key + "%'} or Code like lbsql{'%" + key + "%'})"; } models = B_Lebi_ProPerty.GetList(where, "Sort desc", PageSize, page); int recordCount = B_Lebi_ProPerty.Counts(where); PageString = Pager.GetPaginationString("?page={0}&pid=" + pid + "&key=" + key + "", page, PageSize, recordCount); tmodel = B_Lebi_Type.GetModel(pmodel.Type_id_ProPertyType); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Lebi_Type model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update [Lebi_Type] set "); strSql.Append("[Name]=@Name,"); strSql.Append("[Class]=@Class,"); strSql.Append("[Sort]=@Sort,"); strSql.Append("[Description]=@Description,"); strSql.Append("[Color]=@Color"); strSql.Append(" where id=" + model.id); OleDbParameter[] parameters = { new OleDbParameter("@Name", model.Name), new OleDbParameter("@Class", model.Class), new OleDbParameter("@Sort", model.Sort), new OleDbParameter("@Description", model.Description), new OleDbParameter("@Color", model.Color) }; AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters); }
/// <summary> /// 得到一个对象实体 by id /// </summary> public Lebi_Type GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from [Lebi_Type] "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Lebi_Type model = new Lebi_Type(); 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.Class = ds.Tables[0].Rows[0]["Class"].ToString(); if (ds.Tables[0].Rows[0]["Sort"].ToString() != "") { model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString()); } model.Description = ds.Tables[0].Rows[0]["Description"].ToString(); model.Color = ds.Tables[0].Rows[0]["Color"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public static void Update(Lebi_Type model) { D_Lebi_Type.Instance.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public static int Add(Lebi_Type model) { return(D_Lebi_Type.Instance.Add(model)); }
/// <summary> /// 安全方式绑定表单数据 /// </summary> public static Lebi_Type SafeBindForm(Lebi_Type model) { return(D_Lebi_Type.Instance.SafeBindForm(model)); }