//保存排序 protected void btnSave_Click(object sender, EventArgs e) { ChkAdminLevel("category_" + this.category_name + "_list", OSEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.contents.article bll = new BLL.contents.article(); Repeater rptList = new Repeater(); switch (this.prolistview) { case "Txt": rptList = this.rptList1; break; default: rptList = this.rptList2; break; } for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); int sortId; if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId)) { sortId = 99; } bll.UpdateField(id, "sort_id=" + sortId.ToString()); } AddAdminLog(OSEnums.ActionEnum.Edit.ToString(), "保存" + this.category_name + "频道内容排序"); //记录日志 Response.Redirect(Utils.CombUrlTxt("article_list.aspx", "category_id={0}&keywords={1}&property={2}", this.category_id.ToString(), this.keywords, this.property)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //ProgressBar.Start(1); //for (int i = 0; i < 1000; i++) //{ // ProgressBar.Roll("共发布" + 1000 + "条信息,正在发布" + (i + 1) + "条。", ((i + 1) * 100 / 1000)); //} // ProgressBar.Start(2); // int j = 0; BLL.contents.article bll = new BLL.contents.article(); //列表 DataTable dt = bll.GetList(0, "category_id=" + this.category_id, "sort_id asc,add_time desc,id desc").Tables[0]; if (dt.Rows != null && dt.Rows.Count > 0) { ProgressBar.Start(1); CreatePageHtml(category_id, "/article_list.aspx?category_id=" + category_id, "../../html/list-" + category_id, dt.Rows.Count, 2); ProgressBar.Start(2); for (int i = 0; i < dt.Rows.Count; i++) { CreateIndexHtml("/detail.aspx?category_id=" + category_id + "&id=" + dt.Rows[i]["id"], "../../html/detail-" + category_id + "-" + dt.Rows[i]["id"] + ".html"); ProgressBar.Roll("共发布详情" + dt.Rows.Count + "条信息,正在发布" + (i + 1) + "条。", ((i + 1) * 100 / dt.Rows.Count)); } ////ProgressBar.Roll("发布信息成功,成功" + j + "个,失败" + (dt.Rows.Count - j) + "条。", 100); } } }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("link", OSEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; //成功数量 int errorCount = 0; //失败数量 BLL.contents.article bll = new BLL.contents.article(); Repeater rptList = new Repeater(); rptList = this.rptList1; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount++; } else { errorCount++; } } } AddAdminLog(OSEnums.ActionEnum.Edit.ToString(), "删除[搜索-"+this.keywords+"]频道内容成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 Response.Redirect(Utils.CombUrlTxt("search.aspx", "keywords={0}", this.keywords)); }
private void RptBind(string _strWhere, string _orderby) { this.page = OSRequest.GetQueryInt("page", 1); this.ddlProperty.SelectedValue = this.property; this.txtKeywords.Text = this.keywords; //图表或列表显示 BLL.contents.article bll = new BLL.contents.article(); switch (this.prolistview) { case "Txt": this.rptList1.Visible = false; this.rptList2.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList2.DataBind(); break; default: this.rptList2.Visible = false; this.rptList1.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList1.DataBind(); break; } //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("article_list.aspx", "category_id={0}&keywords={1}&property={2}&page={3}", category_id.ToString(), this.keywords, this.property, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel(category_name, OSEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; //成功数量 int errorCount = 0; //失败数量 BLL.contents.article bll = new BLL.contents.article(); Repeater rptList = new Repeater(); switch (this.prolistview) { case "Img": rptList = this.rptList1; break; case "Txt": rptList = this.rptList2; break; default: rptList = this.rptList1; break; } for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount++; } else { errorCount++; } } } AddAdminLog(OSEnums.ActionEnum.Edit.ToString(), "删除" + this.category_name + "频道内容成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 Response.Redirect(Utils.CombUrlTxt("article_list.aspx", "category_id={0}&keywords={1}&property={2}", this.category_id.ToString(), this.keywords, this.property)); }
public string GetColumn(int Id) { StringBuilder sb = new StringBuilder(); int count = new BLL.contents.article().GetCount("category_id=" + Id + "") > 0 ? new BLL.contents.article().GetCount("category_id=" + Id + "") : 0; model = bll.GetModel(Id); switch (model.model_id) { case 1: sb.Append("<a href=\"article/article_list.aspx?category_id=" + Id + "\" target=\"mainFrame\" >" + model.title + "</a>" + "<span class=\"column\">(" + count + ")</span>"); break; case 2: sb.Append("<a href=\"article/article_list.aspx?category_id=" + Id + "\" target=\"mainFrame\">" + model.title + "</a>" + "<span class=\"column\">(" + count + ")</span>"); break; case 3: sb.Append("<a href=\"article/article_list.aspx?category_id=" + Id + "\" target=\"mainFrame\" >" + model.title + "</a>" + "<span class=\"column\">(" + count + ")</span>"); break; case 4: sb.Append("<a href=\"article/article_list.aspx?category_id=" + Id + "\" target=\"mainFrame\" >" + model.title + "</a>" + "<span class=\"column\">(" + count + ")</span>"); break; case 0: sb.Append(model.title); break; } return sb.ToString(); }
public string GetColumn(int Id) { StringBuilder sb = new StringBuilder(); int count = new BLL.contents.article().GetCount("category_id=" + Id + "") > 0 ? new BLL.contents.article().GetCount("category_id=" + Id + "") : 0; model = bll.GetModel(Id); switch (model.model_id) { case 1: sb.Append("<a href=\"article/article_list.aspx?category_id=" + Id + "\" target=\"mainFrame\" >" + model.title + "</a>" + "<span class=\"column\">(" + count + ")</span>"); break; case 2: sb.Append("<a href=\"article/article_list.aspx?category_id=" + Id + "\" target=\"mainFrame\">" + model.title + "</a>" + "<span class=\"column\">(" + count + ")</span>"); break; case 3: sb.Append("<a href=\"article/article_list.aspx?category_id=" + Id + "\" target=\"mainFrame\" >" + model.title + "</a>" + "<span class=\"column\">(" + count + ")</span>"); break; case 4: sb.Append("<a href=\"article/article_list.aspx?category_id=" + Id + "\" target=\"mainFrame\" >" + model.title + "</a>" + "<span class=\"column\">(" + count + ")</span>"); break; case 0: sb.Append(model.title); break; } return(sb.ToString()); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("link", OSEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; //成功数量 int errorCount = 0; //失败数量 BLL.contents.article bll = new BLL.contents.article(); Repeater rptList = new Repeater(); rptList = this.rptList1; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount++; } else { errorCount++; } } } AddAdminLog(OSEnums.ActionEnum.Edit.ToString(), "删除[搜索-" + this.keywords + "]频道内容成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 Response.Redirect(Utils.CombUrlTxt("search.aspx", "keywords={0}", this.keywords)); }
public static string GetArticleNameUrl(int id) { string rStr = ""; BLL.contents.article bll = new BLL.contents.article(); DataSet ds = bll.GetList(1, " category_id=" + id, "sort_id,add_time"); if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { rStr += ds.Tables[0].Rows[0]["img_url"].ToString(); } return rStr; }
/// <summary> /// 栏目URL public string Url(string _key, int _id) { string _url = string.Empty; Model.contents.article model = new BLL.contents.article().GetModel(_id); if (model != null) { _url = new BasePage().linkurl(_key, model.category_id, _id); } return(_url.ToString()); }
/// <summary> /// 加载广告 /// </summary> /// <param name="id"></param> /// <returns></returns> public static string GetPageAdv(int id) { string rStr = ""; BLL.contents.article bll = new BLL.contents.article(); DataSet ds = bll.GetList(1, " category_id=" + id, "sort_id,add_time"); if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { rStr += " <a href=\"" + ds.Tables[0].Rows[0]["link_url"].ToString() + "\" target=\"_blank\"><img src=\"" + ds.Tables[0].Rows[0]["img_url"].ToString() + "\" width=\"514\" height=\"79\" /></a>"; } return(rStr); }
public static string GetPageTime(int id) { string rStr = ""; BLL.contents.article bll = new BLL.contents.article(); DataSet ds = bll.GetList(1, " category_id=" + id, "sort_id,add_time"); if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { rStr += ds.Tables[0].Rows[0]["add_time"].ToString(); } return(rStr); }
//拓展字段信息 public static string Files(int _id, string _file) { string f = ""; try { Model.contents.article model = new BLL.contents.article().GetModel(_id); if (model != null) { f = model.fields[_file]; } } catch { f = ""; } return f; }
/// <summary> /// 获取内容列表 /// </summary> /// <returns></returns> public static string GetArticleLst(int top, string strWhere, string order) { StringBuilder rStr = new StringBuilder(); BLL.contents.article bll = new BLL.contents.article(); DataTable dt = bll.GetList(top, strWhere, order).Tables[0]; if (dt != null && dt.Rows.Count > 0) { int num = 1; for (int i = 0; i < dt.Rows.Count; i++) { rStr.Append(" <a target=\"_blank\" href=\"" + dt.Rows[i]["link_url"] + "\">"); rStr.Append("url(" + dt.Rows[i]["img_url"] + ") top center no-repeat #e1e9eb"); rStr.Append("</a>"); num++; } } return rStr.ToString(); }
//拓展字段信息 public static string Files(int _id, string _file) { string f = ""; try { Model.contents.article model = new BLL.contents.article().GetModel(_id); if (model != null) { f = model.fields[_file]; } } catch { f = ""; } return(f); }
private void RptBind(string _strWhere, string _orderby) { this.page = OSRequest.GetQueryInt("page", 1); this.txtKeywords.Text = this.keywords; //图表或列表显示 BLL.contents.article bll = new BLL.contents.article(); this.rptList1.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList1.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("search.aspx", "keywords={0}&page={1}", this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
/// <summary> /// 获取内容列表 /// </summary> /// <returns></returns> public static string GetArticleLst(int top, string strWhere, string order) { StringBuilder rStr = new StringBuilder(); BLL.contents.article bll = new BLL.contents.article(); DataTable dt = bll.GetList(top, strWhere, order).Tables[0]; if (dt != null && dt.Rows.Count > 0) { int num = 1; for (int i = 0; i < dt.Rows.Count; i++) { rStr.Append(" <a target=\"_blank\" href=\"" + dt.Rows[i]["link_url"] + "\">"); rStr.Append("url(" + dt.Rows[i]["img_url"] + ") top center no-repeat #e1e9eb"); rStr.Append("</a>"); num++; } } return(rStr.ToString()); }
/// <summary> /// 加载摘要 /// </summary> /// <param name="id"></param> /// <returns></returns> public static string GetPageZhaiYao(int id, int count) { string rStr = ""; BLL.contents.article bll = new BLL.contents.article(); DataSet ds = bll.GetList(1, " category_id=" + id, "sort_id,add_time"); if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["zhaiyao"].ToString().Length > count) { rStr += rStr.Substring(0, count) + "..."; } else { rStr += ds.Tables[0].Rows[0]["zhaiyao"].ToString(); } } return(rStr); }
/// <summary> /// 加载广告 /// </summary> /// <param name="id"></param> /// <returns></returns> public static string GetPageAdv(int id) { string rStr = ""; BLL.contents.article bll = new BLL.contents.article(); DataSet ds = bll.GetList(1, " category_id=" + id, "sort_id,add_time"); if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { rStr += " <a href=\"" + ds.Tables[0].Rows[0]["link_url"].ToString() + "\" target=\"_blank\"><img src=\"" + ds.Tables[0].Rows[0]["img_url"].ToString() + "\" width=\"514\" height=\"79\" /></a>"; } return rStr; }
private void ShowInfo(int _id) { BLL.contents.article bll = new BLL.contents.article(); Model.contents.article model = bll.GetModel(_id); txtCallIndex.Text = model.call_index; txtTitle.Text = model.title; txtLinkUrl.Text = model.link_url; //不是相册图片就绑定 string filename = model.img_url.Substring(model.img_url.LastIndexOf("/") + 1); if (!filename.StartsWith("thumb_")) { txtImgUrl.Text = model.img_url; } txtSeoTitle.Text = model.seo_title; txtSeoKeywords.Text = model.seo_keywords; txtSeoDescription.Text = model.seo_description; txtZhaiyao.Text = model.zhaiyao; txtContent.Value = model.content; txtSortId.Text = model.sort_id.ToString(); txtClick.Text = model.click.ToString(); rblStatus.SelectedValue = model.status.ToString(); txtAddTime.Text = model.add_time.ToString("yyyy-MM-dd HH:mm:ss"); //if (model.is_msg == 1) //{ // cblItem.Items[0].Selected = true; //} if (model.is_top == 1) { cblItem.Items[0].Selected = true; } if (model.is_red == 1) { cblItem.Items[1].Selected = true; } //if (model.is_hot == 1) //{ // cblItem.Items[3].Selected = true; //} //if (model.is_slide == 1) //{ // cblItem.Items[4].Selected = true; //} //扩展字段赋值 List <Model.contents.article_attribute_field> ls1 = new BLL.contents.article_attribute_field().GetModelList(this.category_id, ""); foreach (Model.contents.article_attribute_field modelt1 in ls1) { switch (modelt1.control_type) { case "single-text": //单行文本 TextBox txtControl = FindControl("field_control_" + modelt1.name) as TextBox; if (txtControl != null && model.fields.ContainsKey(modelt1.name)) { if (modelt1.is_password == 1) { txtControl.Attributes.Add("value", model.fields[modelt1.name]); } else { txtControl.Text = model.fields[modelt1.name]; } } break; case "multi-text": //多行文本 goto case "single-text"; case "editor": //编辑器 HtmlTextArea txtAreaControl = FindControl("field_control_" + modelt1.name) as HtmlTextArea; if (txtAreaControl != null && model.fields.ContainsKey(modelt1.name)) { txtAreaControl.Value = model.fields[modelt1.name]; } break; case "images": //图片上传 goto case "single-text"; case "number": //数字 goto case "single-text"; case "checkbox": //复选框 CheckBox cbControl = FindControl("field_control_" + modelt1.name) as CheckBox; if (cbControl != null && model.fields.ContainsKey(modelt1.name)) { if (model.fields[modelt1.name] == "1") { cbControl.Checked = true; } else { cbControl.Checked = false; } } break; case "multi-radio": //多项单选 RadioButtonList rblControl = FindControl("field_control_" + modelt1.name) as RadioButtonList; if (rblControl != null && model.fields.ContainsKey(modelt1.name)) { rblControl.SelectedValue = model.fields[modelt1.name]; } break; case "multi-checkbox": //多项多选 CheckBoxList cblControl = FindControl("field_control_" + modelt1.name) as CheckBoxList; if (cblControl != null && model.fields.ContainsKey(modelt1.name)) { string[] valArr = model.fields[modelt1.name].Split(','); for (int i = 0; i < cblControl.Items.Count; i++) { cblControl.Items[i].Selected = false; //先取消默认的选中 foreach (string str in valArr) { if (cblControl.Items[i].Value == str) { cblControl.Items[i].Selected = true; } } } } break; } } //绑定图片相册 if (filename.StartsWith("thumb_")) { hidFocusPhoto.Value = model.img_url; //封面图片 } rptAlbumList.DataSource = model.albums; rptAlbumList.DataBind(); //绑定内容附件 rptAttachList.DataSource = model.attach; rptAttachList.DataBind(); }
private bool DoEdit(int _id) { bool result = false; BLL.contents.article bll = new BLL.contents.article(); Model.contents.article model = bll.GetModel(_id); 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 = Utils.DropHTML(txtContent.Value, 255); } else { model.zhaiyao = Utils.DropHTML(txtZhaiyao.Text, 255); } model.content = txtContent.Value; model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); model.click = int.Parse(txtClick.Text.Trim()); model.status = Utils.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[0].Selected == true) { model.is_top = 1; } if (cblItem.Items[1].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 = Utils.StrToDateTime(txtAddTime.Text.Trim()); model.update_time = DateTime.Now; model.fields = SetFieldValues(this.category_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.contents.article_albums> ls = new List <Model.contents.article_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.contents.article_albums { id = img_id, article_id = _id, original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[i] }); } else { ls.Add(new Model.contents.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 && attachIdArr.Length > 0 && attachFileNameArr.Length > 0 && attachFilePathArr.Length > 0 && attachFileSizeArr.Length > 0) { List <Model.contents.article_attach> ls = new List <Model.contents.article_attach>(); for (int i = 0; i < attachFileNameArr.Length; i++) { int attachId = Utils.StrToInt(attachIdArr[i], 0); int fileSize = Utils.StrToInt(attachFileSizeArr[i], 0); string fileExt = Utils.GetFileExt(attachFilePathArr[i]); // int _point = Utils.StrToInt(attachPointArr[i], 0); ls.Add(new Model.contents.article_attach { id = attachId, article_id = _id, file_name = attachFileNameArr[i], file_path = attachFilePathArr[i], file_size = fileSize, file_ext = fileExt, }); } model.attach = ls; } #endregion if (bll.Update(model)) { AddAdminLog(OSEnums.ActionEnum.Edit.ToString(), "修改" + this.category_name + "频道内容:" + model.title); //记录日志 result = true; } return(result); }
//设置操作 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { ChkAdminLevel("category_" + this.category_name + "_list", OSEnums.ActionEnum.Edit.ToString()); //检查权限 int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value); BLL.contents.article bll = new BLL.contents.article(); Model.contents.article model = bll.GetModel(id); switch (e.CommandName) { case "lbtnIsMsg": if (model.is_msg == 1) bll.UpdateField(id, "is_msg=0"); else bll.UpdateField(id, "is_msg=1"); break; case "lbtnIsTop": if (model.is_top == 1) bll.UpdateField(id, "is_top=0"); else bll.UpdateField(id, "is_top=1"); break; case "lbtnIsRed": if (model.is_red == 1) bll.UpdateField(id, "is_red=0"); else bll.UpdateField(id, "is_red=1"); break; case "lbtnIsHot": if (model.is_hot == 1) bll.UpdateField(id, "is_hot=0"); else bll.UpdateField(id, "is_hot=1"); break; case "lbtnIsSlide": if (model.is_slide == 1) bll.UpdateField(id, "is_slide=0"); else bll.UpdateField(id, "is_slide=1"); break; } RptBind("id>0 and category_id=" + category_id + CombSqlTxt(this.keywords, this.property), "sort_id asc,add_time desc,id desc"); }
/// <summary> /// 栏目URL public string Url(string _key,int _id) { string _url = string.Empty; Model.contents.article model = new BLL.contents.article().GetModel(_id); if (model != null) { _url = new BasePage().linkurl(_key, model.category_id,_id); } return _url.ToString(); }
/// <summary> /// 加载摘要 /// </summary> /// <param name="id"></param> /// <returns></returns> public static string GetPageZhaiYao(int id, int count) { string rStr = ""; BLL.contents.article bll = new BLL.contents.article(); DataSet ds = bll.GetList(1, " category_id=" + id, "sort_id,add_time"); if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["zhaiyao"].ToString().Length > count) { rStr += rStr.Substring(0, count) + "..."; } else { rStr += ds.Tables[0].Rows[0]["zhaiyao"].ToString(); } } return rStr; }
//设置操作 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { ChkAdminLevel("category_" + this.category_name + "_list", OSEnums.ActionEnum.Edit.ToString()); //检查权限 int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value); BLL.contents.article bll = new BLL.contents.article(); Model.contents.article model = bll.GetModel(id); switch (e.CommandName) { case "lbtnIsMsg": if (model.is_msg == 1) { bll.UpdateField(id, "is_msg=0"); } else { bll.UpdateField(id, "is_msg=1"); } break; case "lbtnIsTop": if (model.is_top == 1) { bll.UpdateField(id, "is_top=0"); } else { bll.UpdateField(id, "is_top=1"); } break; case "lbtnIsRed": if (model.is_red == 1) { bll.UpdateField(id, "is_red=0"); } else { bll.UpdateField(id, "is_red=1"); } break; case "lbtnIsHot": if (model.is_hot == 1) { bll.UpdateField(id, "is_hot=0"); } else { bll.UpdateField(id, "is_hot=1"); } break; case "lbtnIsSlide": if (model.is_slide == 1) { bll.UpdateField(id, "is_slide=0"); } else { bll.UpdateField(id, "is_slide=1"); } break; } RptBind("id>0 and category_id=" + category_id + CombSqlTxt(this.keywords, this.property), "sort_id asc,add_time desc,id desc"); }