public void rptList2_Bind(int strparentId) { DataSet ds = new Cms.BLL.C_integral_product().GetList(""); if (ds.Tables[0].Rows.Count > 0) { this.rptList1.DataSource = ds; this.rptList1.DataBind(); } }
public void DataBind(int id) { Cms.Model.C_integral_product model = new Cms.BLL.C_integral_product().GetModel(id); this.parentId.SelectedValue = model.typeId.ToString(); //所属栏目、分类ID #region 基本信息 this.isHidden.SelectedValue = model.isHidden.ToString(); //显示状态 if (model.isTop.ToString() == "1") { cblItem.Items[0].Selected = true; //1 置顶 } if (model.isRecommend.ToString() == "1") { cblItem.Items[1].Selected = true; //1 推荐 } if (model.isHot.ToString() == "1") { cblItem.Items[2].Selected = true; //1 属于热门 } if (model.isActive.ToString() == "1") { cblItem.Items[3].Selected = true; //1 属于评论 } this.Title.Text = model.name.ToString(); //标题 this.photoUrl.Text = model.litpic.ToString(); //缩略图 this.photoUrlImg.ImageUrl = model.litpic.ToString(); this.orderNumber.Text = model.sortId.ToString(); //排序 this.updateTime.Text = string.Format("{0:yyyy-MM-dd HH:mm:ss}", model.createdTime); //添加时间 this.intro.Text = model.intro.ToString(); //简介 this.content.Value = model.content.ToString(); //内容 this.sales.Text = model.sales.ToString(); price.Text = Convert.ToDecimal(model.price).ToString("0.00"); marketPrice.Text = Convert.ToDecimal(model.marketPrice).ToString("0.00"); integral.Text = model.integral.ToString(); stock.Text = model.stock.ToString(); marketIntegral.Text = model.marketIntegral.ToString(); this.starTime.Text = string.Format("{0:yyyy-MM-dd HH:mm:ss}", model.starTime); this.typeId.SelectedValue = model.typeId.ToString(); this.limitNumber.Text = model.limitNumber.ToString(); #endregion #region 相册============================== //不是相册图片就绑定 string filename = model.litpic.Substring(model.litpic.LastIndexOf("/") + 1); //绑定图片相册 hidFocusPhoto.Value = model.litpic; //封面图片 List <Cms.Model.c_product_albums> list = new List <Cms.Model.c_product_albums>(); list = new Cms.BLL.c_product_albums().DataTableToList(Cms.DBUtility.DbHelperSQL.Query("select * from c_product_albums where productId=" + id).Tables[0]); rptAlbumList.DataSource = list; rptAlbumList.DataBind(); #endregion }
protected void btnDelete_Click(object sender, EventArgs e) { Repeater rptList = new Repeater(); rptList = this.rptList1; foreach (RepeaterItem item in rptList.Items) { //获取选择框 CheckBox check = item.FindControl("Check_Select") as CheckBox; if (check.Checked) { HiddenField field = item.FindControl("Fielddocid") as HiddenField; int id = int.Parse(field.Value); //删除文档的同时删除静态文档 string title = new Cms.BLL.C_integral_product().GetModel(id).name.ToString(); new Cms.BLL.C_product().Delete(id); adminUser.AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除:产品信息" + title); //记录日志 } } JscriptMsg("删除信息成功!", "list.aspx", "Success"); }
protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("Fielddocid")).Value); Cms.Model.C_integral_product model = new Cms.BLL.C_integral_product().GetModel(id); LinkButton lb = (LinkButton)e.Item.FindControl("lbedit"); switch (e.CommandName) { case "lbtnIsMsg": if (model.isActive == 1) { this.updateSate(id, "isActive=0"); } else { this.updateSate(id, "isActive=1"); } break; case "lbtnIsTop": if (model.isTop == 1) { this.updateSate(id, "isTop=0"); } else { this.updateSate(id, "isTop=1"); } break; case "lbtnIsRed": if (model.isRecommend == 1) { this.updateSate(id, "isRecommend=0"); } else { this.updateSate(id, "isRecommend=1"); } break; case "lbtnIsHot": if (model.isHot == 1) { this.updateSate(id, "isHot=0"); } else { this.updateSate(id, "isHot=1"); } break; case "lbtnIsSlide": if (model.isHidden == 1) { this.updateSate(id, "isHidden=0"); } else { this.updateSate(id, "isHidden=1"); } break; } }
public void DataUpdate(int id) { Cms.Model.C_integral_product model = new Cms.BLL.C_integral_product().GetModel(id); #region 基本信息 model.id = id; model.typeId = Convert.ToInt32(this.parentId.SelectedValue); //所属栏目、分类ID model.isHidden = Convert.ToInt32(this.isHidden.SelectedValue); //显示状态 model.isTop = 0; //0 不置顶 model.isRecommend = 0; //0 不推荐 model.isHot = 0; //不属于热门 model.isActive = 0; if (cblItem.Items[0].Selected == true) { model.isTop = 1;//1 置顶 } if (cblItem.Items[1].Selected == true) { model.isRecommend = 1;//1 推荐 } if (cblItem.Items[2].Selected == true) { model.isHot = 1;//1 属于热门 } if (cblItem.Items[3].Selected == true) { model.isActive = 1; //1 属于评论 } model.name = this.Title.Text.Trim(); //标题 if (this.photoUrl.Text == "") { model.litpic = "/img/noPic.jpg"; } else { model.litpic = this.photoUrl.Text; //缩略图 } model.sortId = Convert.ToInt32(this.orderNumber.Text.Trim()); //排序 model.createdTime = Utils.StrToDateTime(updateTime.Text.Trim()); //添加时间 model.intro = this.intro.Text; //简介 model.content = this.content.Value; //内容 model.sales = Convert.ToInt32(sales.Text.Trim()); model.price = Convert.ToDecimal(price.Text.Trim()); model.marketPrice = Convert.ToDecimal(marketPrice.Text.Trim()); model.integral = Convert.ToInt32(integral.Text); model.stock = Convert.ToInt32(stock.Text); model.marketIntegral = Convert.ToInt32(marketIntegral.Text); model.starTime = Utils.StrToDateTime(starTime.Text.Trim()); model.typeId = Convert.ToInt32(this.typeId.SelectedValue); model.limitNumber = Convert.ToInt32(this.limitNumber.Text); #endregion if (new Cms.BLL.C_integral_product().Update(model)) { adminUser.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), model.name); //记录日志 #region 保存相册==================== //检查是否有自定义图片 if (photoUrl.Text.Trim() == "") { model.litpic = hidFocusPhoto.Value; } string[] albumArr = Request.Form.GetValues("hid_photo_name"); string[] remarkArr = Request.Form.GetValues("hid_photo_remark"); if (albumArr != null && albumArr.Length > 0) { List <Cms.Model.c_product_albums> ls = new List <Cms.Model.c_product_albums>(); Cms.Model.c_product_albums modelAlbums = new Cms.Model.c_product_albums(); for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); if (imgArr.Length == 3) { modelAlbums.original_path = imgArr[1]; modelAlbums.thumb_path = imgArr[2]; if (!string.IsNullOrEmpty(remarkArr[i])) { modelAlbums.remark = remarkArr[i]; } else { } modelAlbums.productId = model.id; } new Cms.BLL.c_product_albums().Add(modelAlbums); } } #endregion JscriptMsg("修改信息成功!", "integralList.aspx", "Success"); } else { JscriptMsg("修改信息失败!", "edit.aspx?action=edit", "Error"); } }