private void ShowInfo(int _id) { BLL.wx_book_category bll = new BLL.wx_book_category(); Model.wx_book_category model = bll.GetModel(_id); ddlParentId.SelectedValue = model.parent_id.ToString(); txtTitle.Text = model.title; txtSortId.Text = model.sort_id.ToString(); txtSeoTitle.Text = model.seo_title; txtSeoKeywords.Text = model.seo_keywords; txtSeoDescription.Text = model.seo_description; txtLinkUrl.Text = model.link_url; txtImgUrl.Text = model.img_url; if (model.img_url != null && model.img_url.Trim() != "") { imgUrl.ImageUrl = model.img_url; } txtContent.Text = model.class_content; txtImgICO.Text = model.ico_url; if (model.ico_url != null && model.ico_url.Trim() != "") { if (model.ico_url.Contains("/")) { imgIco.ImageUrl = model.ico_url; } else { imgIco.Style.Add("display", "none"); litImgIco.Text = "<span class=\"" + model.ico_url + "\"></span>"; } } model.albums = new wx_book_albums().GetModelList("classId=" + model.id); rptAlbumList.DataSource = model.albums; rptAlbumList.DataBind(); }
private bool DoEdit(int _id) { try { BLL.wx_book_category bll = new BLL.wx_book_category(); Model.wx_book_category model = bll.GetModel(_id); int parentId = int.Parse(ddlParentId.SelectedValue); model.title = txtTitle.Text.Trim(); //如果选择的父ID不是自己,则更改 if (parentId != model.id) { model.parent_id = parentId; } model.sort_id = int.Parse(txtSortId.Text.Trim()); model.seo_title = txtSeoTitle.Text; model.seo_keywords = txtSeoKeywords.Text; model.seo_description = txtSeoDescription.Text; model.link_url = txtLinkUrl.Text.Trim(); model.img_url = txtImgUrl.Text.Trim(); model.class_content = txtContent.Text.Trim(); model.ico_url = Request.Form["txtImgICO"].Trim();// txtImgICO.Text; #region 保存相册==================== //检查是否有自定义图片 if (model.albums != null) { model.albums.Clear(); } string[] albumArr = Request.Form.GetValues("hid_photo_name"); string[] remarkArr = Request.Form.GetValues("hid_photo_remark"); if (albumArr != null) { List <Model.wx_book_albums> ls = new List <Model.wx_book_albums>(); for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); int img_id = Utils.StrToInt(imgArr[0], 0); if (imgArr.Length == 3) { if (!string.IsNullOrEmpty(remarkArr[i])) { ls.Add(new Model.wx_book_albums { id = img_id, productId = id, original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[i] }); } else { ls.Add(new Model.wx_book_albums { id = img_id, productId = id, original_path = imgArr[1], thumb_path = imgArr[2] }); } } } model.albums = ls; } #endregion if (bll.Update(model)) { AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改预订目分类:" + model.title); //记录日志 return(true); } } catch { return(false); } return(false); }