protected void Page_Load(object sender, EventArgs e) { if (!int.TryParse(Request.Params["Id"] as string, out this.Id)) { this.Id = 1; } switch (this.Id) { case 6: this.bodyId = " id=\"about\""; break; case 2: this.bodyId = " id=\"service\""; break; case 3: this.bodyId = " id=\"contact\""; break; default: this.bodyId = " id=\"home\""; break; } DtCms.BLL.Contents bll = new DtCms.BLL.Contents(); model = bll.GetModel(this.Id); }
private void RptBind(string strWhere, string orderby) { if (!int.TryParse(Request.Params["page"] as string, out this.page)) { this.page = 0; } DtCms.BLL.Contents bll = new DtCms.BLL.Contents(); //获得总条数 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.txtKeywords.Text = this.keywords; this.rptList.DataSource = bll.GetPageList(this.pagesize, this.page, strWhere, orderby); this.rptList.DataBind(); }
//赋值操作 private void ShowInfo(int _id) { DtCms.BLL.Contents bll = new DtCms.BLL.Contents(); DtCms.Model.Contents model = bll.GetModel(_id); txtTitle.Text = model.Title; ddlClassId.SelectedValue = model.ClassId.ToString(); txtSortId.Text = model.SortId.ToString(); FCKeditor.Value = model.Content; }
protected void Page_Load(object sender, EventArgs e) { DtCms.BLL.Contents bll = new DtCms.BLL.Contents(); model = bll.GetModel(6); DataTable dt = DtCms.DBUtility.DbHelperOleDb.Query("select * from Article order by AddTime desc").Tables[0]; this.videolist.DataSource = dt; this.videolist.DataBind(); }
//保存 protected void btnSave_Click(object sender, EventArgs e) { DtCms.BLL.Contents bll = new DtCms.BLL.Contents(); DtCms.Model.Contents model = new DtCms.Model.Contents(); model.Title = txtTitle.Text.Trim(); model.ClassId = int.Parse(ddlClassId.SelectedValue); model.Content = FCKeditor.Value; model.SortId = int.Parse(txtSortId.Text.Trim()); bll.Add(model); JscriptPrint("内容添加成功啦!", "Add.aspx?classId=" + ddlClassId.SelectedValue, "Success"); }
//保存 protected void btnSave_Click(object sender, EventArgs e) { DtCms.BLL.Contents bll = new DtCms.BLL.Contents(); DtCms.Model.Contents model = bll.GetModel(this.Id); model.Title = txtTitle.Text.Trim(); model.ClassId = int.Parse(ddlClassId.SelectedValue); model.Content = FCKeditor.Value; model.SortId = int.Parse(txtSortId.Text.Trim()); bll.Update(model); JscriptPrint("内容编辑成功啦!", "List.aspx", "Success"); }
/// <summary> /// 根据标签取得内容页内容 /// </summary> protected string GetContent(string callIndex) { if (string.IsNullOrEmpty(callIndex)) { return(""); } DtCms.BLL.Contents bll = new DtCms.BLL.Contents(); if (bll.Exists(callIndex)) { return(bll.GetModel(callIndex).Content); } return(""); }
//删除 protected void lbtnDel_Click(object sender, EventArgs e) { chkLoginLevel("delContents"); DtCms.BLL.Contents bll = new DtCms.BLL.Contents(); //批量删除 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) + "page=0", "Success"); }
public static string ViewTxtList(int top, int txtNum, string strWhere, string orderby, string txtUrl) { DtCms.BLL.Contents bll = new DtCms.BLL.Contents(); StringBuilder strTxt = new StringBuilder(); DataSet ds = bll.GetList(top, strWhere, orderby); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; strTxt.Append("<tr><td height=\"30\" align=\"left\" class=\"xuxian-heng\">▪ <a href=\"" + txtUrl + "?id=" + dr["Id"].ToString() + "\" title=\"" + dr["Title"].ToString() + "\">" + StringPlus.CutString(dr["Title"].ToString(), txtNum) + "</a></td></tr>\n"); } } return(strTxt.ToString()); }
/// <summary> /// 绑定Repeater控件数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Content_List_DataBind(object sender, EventArgs e) { Repeater _rpt = sender as Repeater; if (_rpt == null) { return; } DtCms.BLL.Contents bll = new DtCms.BLL.Contents(); //绑定数据 if (_rpt.PageSize > 0) { _rpt.DataSource = bll.GetPageList(_rpt.PageSize, _rpt.PageIndex, _rpt.Where, "SortId asc,Id desc"); } else { _rpt.DataSource = bll.GetList(_rpt.Top, _rpt.Where, "SortId asc,Id desc"); } _rpt.DataBind(); }