private bool DoEdit(int _id) { bool result = false; BLL.article bll = new BLL.article(); Model.article model = bll.GetModel(_id); //model.channel_id = this.channel_id; //model.category_id = SFUtils.StrToInt(ddlCategoryId.SelectedValue, 0); model.call_index = txtCallIndex.Text.Trim(); model.title = txtTitle.Text.Trim(); model.link_url = txtLinkUrl.Text.Trim(); //model.img_url = txtImgUrl.Text; model.seo_title = txtSeoTitle.Text.Trim(); model.seo_keywords = txtSeoKeywords.Text.Trim(); model.seo_description = txtSeoDescription.Text.Trim(); //内容摘要提取内容前255个字符 if (string.IsNullOrEmpty(txtZhaiyao.Text.Trim())) { model.zhaiyao = SFUtils.DropHTML(txtContent.Value, 255); } else { model.zhaiyao = SFUtils.DropHTML(txtZhaiyao.Text, 255); } model.content = txtContent.Value; model.sort_id = SFUtils.StrToInt(txtSortId.Text.Trim(), 99); model.click = int.Parse(txtClick.Text.Trim()); model.status = SFUtils.StrToInt(rblStatus.SelectedValue, 0); model.is_msg = 0; model.is_top = 0; model.is_red = 0; model.is_hot = 0; model.is_slide = 0; if (cblItem.Items[0].Selected == true) { model.is_msg = 1; } if (cblItem.Items[1].Selected == true) { model.is_top = 1; } if (cblItem.Items[2].Selected == true) { model.is_red = 1; } if (cblItem.Items[3].Selected == true) { model.is_hot = 1; } if (cblItem.Items[4].Selected == true) { model.is_slide = 1; } model.add_time = SFUtils.StrToDateTime(txtAddTime.Text.Trim()); model.update_time = DateTime.Now; model.fields = SetFieldValues(this.channel_id); //扩展字段赋值 #region 保存相册==================== //检查是否有自定义图片 //if (txtImgUrl.Text.Trim() == "") //{ // model.img_url = hidFocusPhoto.Value; //} 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.article_albums> ls = new List <Model.article_albums>(); for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); int img_id = SFUtils.StrToInt(imgArr[0], 0); if (imgArr.Length == 3) { if (!string.IsNullOrEmpty(remarkArr[i])) { ls.Add(new Model.article_albums { id = img_id, article_id = _id, original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[i] }); } else { ls.Add(new Model.article_albums { id = img_id, article_id = _id, original_path = imgArr[1], thumb_path = imgArr[2] }); } } } model.albums = ls; } #endregion #region 保存附件==================== if (model.attach != null) { model.attach.Clear(); } string[] attachIdArr = Request.Form.GetValues("hid_attach_id"); string[] attachFileNameArr = Request.Form.GetValues("hid_attach_filename"); string[] attachFilePathArr = Request.Form.GetValues("hid_attach_filepath"); string[] attachFileSizeArr = Request.Form.GetValues("hid_attach_filesize"); string[] attachPointArr = Request.Form.GetValues("txt_attach_point"); if (attachIdArr != null && attachFileNameArr != null && attachFilePathArr != null && attachFileSizeArr != null && attachPointArr != null && attachIdArr.Length > 0 && attachFileNameArr.Length > 0 && attachFilePathArr.Length > 0 && attachFileSizeArr.Length > 0 && attachPointArr.Length > 0) { List <Model.article_attach> ls = new List <Model.article_attach>(); for (int i = 0; i < attachFileNameArr.Length; i++) { int attachId = SFUtils.StrToInt(attachIdArr[i], 0); int fileSize = SFUtils.StrToInt(attachFileSizeArr[i], 0); string fileExt = SFUtils.GetFileExt(attachFilePathArr[i]); int _point = SFUtils.StrToInt(attachPointArr[i], 0); ls.Add(new Model.article_attach { id = attachId, article_id = _id, file_name = attachFileNameArr[i], file_path = attachFilePathArr[i], file_size = fileSize, file_ext = fileExt, point = _point, }); } model.attach = ls; } #endregion #region 保存会员组价格============== //List<Model.user_group_price> priceList = new List<Model.user_group_price>(); //for (int i = 0; i < rptPrice.Items.Count; i++) //{ // int hidPriceId = 0; // if (!string.IsNullOrEmpty(((HiddenField)rptPrice.Items[i].FindControl("hidePriceId")).Value)) // { // hidPriceId = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hidePriceId")).Value); // } // int hidGroupId = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hideGroupId")).Value); // decimal _price = Convert.ToDecimal(((TextBox)rptPrice.Items[i].FindControl("txtGroupPrice")).Text.Trim()); // priceList.Add(new Model.user_group_price { id = hidPriceId, article_id = _id, group_id = hidGroupId, price = _price }); //} //model.group_price = priceList; #endregion if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "频道内容:" + model.title); //记录日志 result = true; } return(result); }