/// <summary> /// 得集合 /// 11.16 kevin /// </summary> /// <returns></returns> public List<ShowShop.Model.Product.Productclass> GetAll() { string sql = "select * from yxs_productclass"; List<ShowShop.Model.Product.Productclass> classList = new List<ShowShop.Model.Product.Productclass>(); using (SqlDataReader reader = ChangeHope.DataBase.SQLServerHelper.ExecuteReader(sql)) { while (reader.Read()) { ShowShop.Model.Product.Productclass model = new ShowShop.Model.Product.Productclass(); model.ID = (int)reader["cid"]; model.Fatherid = Convert.ToInt32(reader["fatherid"]); model.Name = (string)reader["name"]; model.Sort = Convert.ToInt32(reader["sort"]); model.Description = reader["description"] == null ? "" : reader["description"].ToString(); model.Parentpath = (string)reader["parentpath"]; classList.Add(model); } } return classList; }
/// <summary> /// 返回数据 /// </summary> /// <param name="row"></param> /// <returns></returns> public ShowShop.Model.Product.Productclass GetModel(System.Data.DataRow row) { ShowShop.Model.Product.Productclass model = new ShowShop.Model.Product.Productclass(); if (row != null) { model.ID = int.Parse(row["cid"].ToString()); model.Name = row["name"].ToString(); model.Fatherid = int.Parse(row["fatherid"].ToString()); model.Sort = int.Parse(row["sort"].ToString()); model.Description = row["description"].ToString(); model.Parentpath = row["parentpath"].ToString(); return model; } else { return null; } }
private void Save() { ShowShop.BLL.Product.Productclass data = new ShowShop.BLL.Product.Productclass(); ShowShop.Model.Product.Productclass model = new ShowShop.Model.Product.Productclass(); model.ID = ChangeHope.Common.StringHelper.StringToInt(this.ddlTheirclass.SelectedValue); model.Fatherid = ChangeHope.Common.StringHelper.StringToInt(this.hffatherid.Value); model.Name = this.txtName.Text; model.Description = this.txtDescription.Text; model.Sort = ChangeHope.Common.StringHelper.StringToInt(this.txtSort.Text); // model.Isrecommend = ChangeHope.Common.StringHelper.StringToInt(this.rdolstIsRecommend.SelectedValue); model.Parentpath = this.hfparentpath.Value; //model.Contenttemplate = this.txtContentPageTemplate.Text; //model.Listtemplate = this.txtListPageTemplate.Text; //model.Sectiontemplate = this.txtWebPagePath.Text; //model.ProductTypeId = Convert.ToInt32(this.ddlProductType.SelectedValue); if (model.ID > 0) { ShowShop.Common.PromptInfo.Popedom("001001004", "对不起,您没有权限进行编辑"); data.Update(model); this.ltlMsg.Text = "操作成功, 已保存该信息."; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; } else { ShowShop.Common.PromptInfo.Popedom("001001002", "对不起,您没有权限进行新增"); data.Add(model); this.ltlMsg.Text = "操作成功,已保存该信息."; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; } }