//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel(channel_id, ActionEnum.Delete.ToString()); //检查权限 BLL.ArticleBll bll = new BLL.ArticleBll(); 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) { bll.Delete(id); } } JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}", this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success"); }
//保存排序 protected void btnSave_Click(object sender, EventArgs e) { BLL.ArticleBll bll = new BLL.ArticleBll(); 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, "SortID=" + sortId.ToString()); } JscriptMsg("保存排序成功啦!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}", this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success"); }
//设置操作 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { ChkAdminLevel(channel_id, ActionEnum.Edit.ToString()); //检查权限 int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value); BLL.ArticleBll bll = new BLL.ArticleBll(); Entity.Article model = bll.GetEntity(id); switch (e.CommandName.ToLower()) { case "ibtnred": if (model.IsRecommend == 1) bll.UpdateField(id, "IsRecommend=0"); else bll.UpdateField(id, "IsRecommend=1"); break; case "ibtnhot": if (model.IsHot == 1) bll.UpdateField(id, "IsHot=0"); else bll.UpdateField(id, "IsHot=1"); break; } this.RptBind("ID>0" + CombSqlTxt(this.channel_id, this.category_id, this.keywords, this.property), "SortID asc,AddTime desc"); }
private void RptBind(string _strWhere, string _orderby) { this.page = SysRequest.GetQueryInt("page", 1); this.ddlProperty.SelectedValue = this.property; this.txtKeywords.Text = this.keywords; BLL.ArticleBll bll = new BLL.ArticleBll(); this.rptList.DataSource = bll.GetPageList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}&page={4}", this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private void ShowInfo(int _id) { BLL.ArticleBll bll = new BLL.ArticleBll(); Entity.Article model = bll.GetEntity(_id); //ddlCategoryId.SelectedValue = model.category_id.ToString(); txtTitle.Text = model.Title; //txtCallIndex.Text = model.i; //~~~~~~~~~~~~~~~~~~~~~~调用别名 //txtForm.Text = model.From; //txtZhaiyao.Text = model.Summary;// .zhaiyao; txtImgUrl.Text = model.ImageURL;// .img_url; txtLinkUrl.Text = model.LinkURL;// .link_url; if (model.IsRecommend == 1) { cblItem.Items[0].Selected = true; } if (model.IsHot == 1) { cblItem.Items[1].Selected = true; } txtSortId.Text = model.SortID.ToString(); txtClick.Text = model.ClickCount.ToString(); txtContent.Value = model.Content; }
private bool DoAdd() { bool result = true; BLL.ArticleBll bll = new BLL.ArticleBll(); Entity.Article model = new Entity.Article(); model.ChannelID = this.channel_id; model.Title = txtTitle.Text.Trim(); model.LinkURL = txtLinkUrl.Text.Trim(); model.ImageURL = txtImgUrl.Text.Trim(); model.SortID = int.Parse(txtSortId.Text.Trim()); model.ClickCount = int.Parse(txtClick.Text.Trim()); model.Content = txtContent.Value; model.IsRecommend = 0; model.IsHot = 0; if (cblItem.Items[0].Selected == true) { model.IsRecommend = 1; } if (bll.Add(model) < 1) { result = false; } return result; }
private bool DoEdit(int _id) { bool result = true; BLL.ArticleBll bll = new BLL.ArticleBll(); Entity.Article model = bll.GetEntity(_id); model.ChannelID = this.channel_id; model.Title = txtTitle.Text.Trim(); model.LinkURL = txtLinkUrl.Text.Trim(); model.ImageURL = txtImgUrl.Text.Trim(); //model.Author = txtAuthor.Text.Trim(); //model.From = txtForm.Text.Trim(); //model.Summary = Utils.DropHTML(txtZhaiyao.Text, 250); model.SortID = int.Parse(txtSortId.Text.Trim()); model.ClickCount = int.Parse(txtClick.Text.Trim()); model.Content = txtContent.Value; model.IsRecommend = 0; if (cblItem.Items[0].Selected == true) { model.IsRecommend = 1; } if (!bll.Update(model)) { result = false; } return result; }
private void ShowInfo(int _id) { BLL.ArticleBll bll = new BLL.ArticleBll(); Entity.Article model = bll.GetEntity(_id); ddlCategoryId.SelectedValue = model.CategoryID.ToString(); txtTitle.Text = model.Title; //txtImgUrl.Text = model.ImageURL;// .img_url; txtLinkUrl.Text = model.LinkURL;// .link_url; if (model.IsRecommend == 1) { cblItem.Items[0].Selected = true; } if (model.IsHot == 1) { cblItem.Items[1].Selected = true; } txtSortId.Text = model.SortID.ToString(); txtClick.Text = model.ClickCount.ToString(); txtContent.Value = model.Content; }
private bool DoEdit(int _id) { bool result = true; BLL.ArticleBll bll = new BLL.ArticleBll(); Entity.Article model = bll.GetEntity(_id); model.ChannelID = this.channel_id; model.Title = txtTitle.Text.Trim(); model.LinkURL = txtLinkUrl.Text.Trim(); //model.ImageURL = txtImgUrl.Text.Trim(); model.SortID = int.Parse(txtSortId.Text.Trim()); model.ClickCount = int.Parse(txtClick.Text.Trim()); model.Content = txtContent.Value; model.CategoryID = int.Parse(ddlCategoryId.SelectedValue); model.IsRecommend = 0; model.IsHot = 0; if (cblItem.Items[0].Selected == true) { model.IsRecommend = 1; } if (cblItem.Items[1].Selected == true) { model.IsHot = 1; } if (!bll.Update(model)) { result = false; } return result; }
private bool DoAdd() { bool result = true; BLL.ArticleBll bll = new BLL.ArticleBll(); Entity.Article model = new Article(); ; model.ChannelID = this.channel_id; model.Title = txtTitle.Text.Trim(); // model.ChannelID = int.Parse(ddlCategoryId.SelectedValue); model.LinkURL = txtLinkUrl.Text.Trim(); model.ImageURL = txtImgUrl.Text.Trim(); model.Author = txtAuthor.Text.Trim(); model.From = txtForm.Text.Trim(); //自动提取摘要 if (txtZhaiyao.Text.Trim() != string.Empty) { model.Summary = Utils.DropHTML(txtZhaiyao.Text, 250); } else { model.Summary = Utils.DropHTML(txtContent.Value, 250); } //model.seo_title = txtSeoTitle.Text.Trim(); //model.seo_keywords = txtSeoKeywords.Text.Trim(); //model.seo_description = txtSeoDescription.Text.Trim(); //model.sort_id = int.Parse(txtSortId.Text.Trim()); model.ClickCount = int.Parse(txtClick.Text.Trim()); model.Content = txtContent.Value; model.IsRecommend = 0; model.IsHot = 0; if (cblItem.Items[0].Selected == true) { model.IsRecommend = 1; } if (cblItem.Items[1].Selected == true) { model.IsHot = 1; } if (bll.Add(model) < 1) { result = false; } return result; }
private void ShowInfo(int _id) { BLL.ArticleBll bll = new BLL.ArticleBll(); Entity.Article model = bll.GetEntity(_id); //ddlCategoryId.SelectedValue = model.category_id.ToString(); txtTitle.Text = model.Title; txtAuthor.Text = model.Author; txtForm.Text = model.From; txtZhaiyao.Text = model.Summary;// .zhaiyao; txtImgUrl.Text = model.ImageURL;// .img_url; txtLinkUrl.Text = model.LinkURL;// .link_url; if (model.IsRecommend == 1) { cblItem.Items[0].Selected = true; } if (model.IsHot == 1) { cblItem.Items[1].Selected = true; } txtSortId.Text = model.SortID.ToString(); txtClick.Text = model.ClickCount.ToString(); txtContent.Value = model.Content; /* seo options txtSeoTitle.Text = model.seo_title; txtSeoKeywords.Text = model.seo_keywords; txtSeoDescription.Text = model.seo_description;*/ }