private void RptBind(string strWhere, string orderby) { if (!int.TryParse(Request.Params["page"] as string, out this.page)) { this.page = 0; } Spread.BLL.Article bll = new Spread.BLL.Article(); //获得总条数 this.pcount = bll.GetCount(strWhere); if (this.pcount > 0) { this.lbtnDel.Enabled = true; } else { this.lbtnDel.Enabled = false; } if (this.classId > 0) { this.ddlClassId.SelectedValue = this.classId.ToString(); this.ddlClassId.Enabled = false; } this.txtKeywords.Text = this.keywords; this.ddlProperty.SelectedValue = this.property; this.rptList.DataSource = bll.GetPageList(this.pagesize, this.page, strWhere, orderby); this.rptList.DataBind(); }
/// <summary> /// 初始化 /// </summary> private void info() { Spread.BLL.Goods bllGoods = new Spread.BLL.Goods(); Spread.BLL.Article bllArticle = new Spread.BLL.Article(); DataTable dt = bllGoods.GetList(6, "IsHot=1 ", "ID ASC").Tables[0]; Article = bllArticle.GetList(6, " ", "a.AddTime DESC").Tables[0]; Goods = dt; }
private void Info() { Spread.BLL.Article bllArticle = new Spread.BLL.Article(); if (Id > 0) { DataTable dt = bllArticle.GetList(1, "Id=" + Id + "", "ID ASC").Tables[0]; if (dt.Rows.Count > 0) { lbtitle.Text = dt.Rows[0]["Title"].ToString(); lbMenu.Text = " > <a class=\"col-01\" href=\"/Content.aspx?id=" + dt.Rows[0]["ID"].ToString() + "\">" + dt.Rows[0]["Title"].ToString() + "</a>"; this.Article = dt; } } }
public string MenuInfo() { StringBuilder html = new StringBuilder(); Spread.BLL.Article bllArticle = new Spread.BLL.Article(); DataTable dt = bllArticle.GetList(10, "ClassId=31", "ID Desc").Tables[0]; if (dt.Rows.Count > 0) { html.Append("<ul>"); for (int i = 0; i < dt.Rows.Count; i++) { html.Append("<li> <a href=\"/Content.aspx?id=" + dt.Rows[i]["ID"].ToString() + "\">" + dt.Rows[i]["Title"].ToString() + "</a>"); html.Append("</li>"); } } return html.ToString(); }
/// <summary> /// 初始化 /// </summary> private void info() { Spread.BLL.Article_type bllArticletype = new Spread.BLL.Article_type(); Spread.BLL.Article bllArticle = new Spread.BLL.Article(); Count = bllArticle.GetCount("ClassId=" + type + ""); Article = bllArticle.GetList("ClassId=" + type + "").Tables[0]; DataTable dt = bllArticletype.GetList(6, " ", "Id ASC").Tables[0]; strMenu += "<ul class=\"cf\">"; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["Id"].ToString() == type) { strMenu += "<li class=\"cur\"><a href=\"Default.aspx?page=1&type=" + dt.Rows[i]["ID"] + "\" >" + dt.Rows[i]["Title"] + "</a></li>"; } else { strMenu += "<li ><a href=\"Default.aspx?page=1&type=" + dt.Rows[i]["ID"] + "\" >" + dt.Rows[i]["Title"] + "</a></li>"; } } strMenu += "</ul>"; }
//赋值操作 private void ShowInfo(int _id) { Spread.BLL.Article bll = new Spread.BLL.Article(); Spread.Model.Article model = bll.GetModel(_id); txtTitle.Text = model.Title; txtAuthor.Text = model.Author; txtForm.Text = model.Form; ddlClassId.SelectedValue = model.ClassId.ToString(); txtImgUrl.Text = model.ImgUrl; FCKeditor.Value = model.Content; txtClick.Text = model.Click.ToString(); if (model.IsMsg == true) { cblItem.Items[0].Selected = true; } if (model.IsTop == true) { cblItem.Items[1].Selected = true; } if (model.IsRed == true) { cblItem.Items[2].Selected = true; } if (model.IsHot == true) { cblItem.Items[3].Selected = true; } if (model.IsSlide == true) { cblItem.Items[4].Selected = true; } }
//保存 protected void btnSave_Click(object sender, EventArgs e) { Spread.BLL.Article bll = new Spread.BLL.Article(); Spread.Model.Article model = bll.GetModel(this.Id); model.Title = txtTitle.Text.Trim(); model.Author = txtAuthor.Text.Trim(); model.Form = txtForm.Text.Trim(); model.ClassId = int.Parse(ddlClassId.SelectedValue); model.ImgUrl = txtImgUrl.Text.Trim(); model.Content = FCKeditor.Value; model.Click = int.Parse(txtClick.Text.Trim()); model.IsMsg = false; model.IsTop = false; model.IsRed = false; model.IsHot = false; model.IsSlide = false; if (cblItem.Items[0].Selected == true) { model.IsMsg = true; } if (cblItem.Items[1].Selected == true) { model.IsTop = true; } if (cblItem.Items[2].Selected == true) { model.IsRed = true; } if (cblItem.Items[3].Selected == true) { model.IsHot = true; } if (cblItem.Items[4].Selected == true) { model.IsSlide = true; } bll.Update(model); Response.Write("<script>alert('文章编辑成功啦!!!!!')</script>"); }
//删除 protected void lbtnDel_Click(object sender, EventArgs e) { chkLoginLevel("delArticle"); Spread.BLL.Article bll = new Spread.BLL.Article(); //批量删除 for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((Label)rptList.Items[i].FindControl("lb_id")).Text); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id"); if (cb.Checked) { bll.Delete(id); } } JscriptPrint("批量删除成功啦!", "List.aspx?" + CombUrlTxt(this.classId, this.keywords, this.property) + "page=0", "Success"); }
//设置操作 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { int id = Convert.ToInt32(((Label)e.Item.FindControl("lb_id")).Text); Spread.BLL.Article bll = new Spread.BLL.Article(); Spread.Model.Article model = bll.GetModel(id); switch (e.CommandName.ToLower()) { case "ibtnmsg": if (model.IsMsg ==true) bll.UpdateField(id, "IsMsg=false"); else bll.UpdateField(id, "IsMsg=true"); break; case "ibtntop": if (model.IsTop == true) bll.UpdateField(id, "IsTop=false"); else bll.UpdateField(id, "IsTop=true"); break; case "ibtnred": if (model.IsRed == true) bll.UpdateField(id, "IsRed=false"); else bll.UpdateField(id, "IsRed=true"); break; case "ibtnhot": if (model.IsHot == true) bll.UpdateField(id, "IsHot=false"); else bll.UpdateField(id, "IsHot=true"); break; case "ibtnslide": if (model.IsSlide == true) bll.UpdateField(id, "IsSlide=false"); else bll.UpdateField(id, "IsSlide=true"); break; } RptBind("Id>0" + this.CombSqlTxt(this.classId, this.keywords, this.property), "AddTime desc"); }