//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); TPortalClass.JpTemplate JpTemplate = new TPortalClass.JpTemplate(); string ls_tip = "删除成功!"; for (int i = 0; i < rptList.Items.Count; i++) { //int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); string id = ((HiddenField)rptList.Items[i].FindControl("hidId")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { JpTemplate.url = id; JpTemplate.Delete(); } } string pageUrl = JpCommon.CombUrlTxt("list_template.aspx", "page={0}&rnd={1}&tclass={2}", "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtclass.Text + ""); //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "删除", "批量删除模板记录", Session["uid"].ToString(), Session["uname"].ToString()); Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>"); }
public void GetTemplateData() { String url = ""; if (Request.QueryString["tclass"] != null) url = Request.QueryString["id"].ToString(); TPortalClass.JpTemplate Template = new TPortalClass.JpTemplate(url); this.txthy_type.SelectedValue = Template.tclass; this.txthy_templateurl.Text = Template.url; this.lblhy_templateurl.Text = Template.url; this.txthy_template.Text = Template.description; }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { if (this.Session["uid"].ToString() == "") this.Response.Redirect("../login.aspx"); string ls_tip = "保存成功!"; //新文档时 TPortalClass.JpTemplate JpTemplate = new TPortalClass.JpTemplate(); JpTemplate.tclass = this.txthy_type.SelectedValue; JpTemplate.url = this.txthy_templateurl.Text; JpTemplate.description = this.txthy_template.Text; if (this.txtop.Value == "add") { if(JpTemplate.IsExist()) { this.Response.Write("<script>alert('该模版已经存在!')</script>"); return; } //写系统日志 TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "新增", "新增模板记录[id:" + this.txthy_templateurl.Text + "]", Session["uid"].ToString(), Session["uname"].ToString()); JpTemplate.Insert(); } else { //写系统日志 TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "修改", "修改模板记录[id:" + this.txthy_templateurl.Text + "]", Session["uid"].ToString(), Session["uname"].ToString()); JpTemplate.Update(); } Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>"); }
private void TmpBind() { TPortalClass.JpTemplate JpTemplate = new TPortalClass.JpTemplate(); this.ddltmp_col.Items.Clear(); this.ddltmp_col.Items.Add(new ListItem("--请选择栏目模板--", "")); DataTable dt = JpTemplate.GetTemplates("0"); foreach (DataRow dr in dt.Rows) { string Id = dr["url"].ToString(); string Title = dr["description"].ToString().Trim() + " [" + Id + "]"; this.ddltmp_col.Items.Add(new ListItem(Title, Id)); } this.ddltmp_art.Items.Clear(); this.ddltmp_art.Items.Add(new ListItem("--请选择文章模板--", "")); dt.Clear(); dt = JpTemplate.GetTemplates("1"); foreach (DataRow dr in dt.Rows) { string Id = dr["url"].ToString(); string Title = dr["description"].ToString().Trim() + " [" + Id + "]"; this.ddltmp_art.Items.Add(new ListItem(Title, Id)); } }
private void RptBind() { if (this.Request.QueryString["page"] != null) this.page = int.Parse(this.Request.QueryString["page"].ToString()); else this.page = 1; string tclass = ""; if (Request.QueryString["tclass"] != null) tclass = Request.QueryString["tclass"].ToString(); this.txtclass.Text = tclass; this.txtKeywords.Text = this.keywords; txtPageNum.Text = this.pageSize.ToString(); txtPage.Text = this.page.ToString(); TPortalClass.JpTemplate JpTemplate = new TPortalClass.JpTemplate(); DataTable dt = JpTemplate.GetTemplates(tclass, this.txtKeywords.Text); this.totalCount = dt.Rows.Count; DataTable tempTable = dt.Clone(); for (int i = (this.page - 1) * this.pageSize; i < this.page * this.pageSize; i++) { if (i > dt.Rows.Count - 1) break; DataRow dr = tempTable.NewRow(); for (int j = 0; j < dt.Columns.Count; j++) { dr[dt.Columns[j].ColumnName] = dt.Rows[i][j]; } tempTable.Rows.Add(dr); } rptList.DataSource = tempTable; rptList.DataBind(); //翻页 //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__"); TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); string pageUrl = JpCommon.CombUrlTxt("list_template.aspx", "page={0}&rnd={1}&keywords={2}&tclass={3}", "__id__", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtKeywords.Text + "", "" + this.txtclass.Text + ""); PageContent.InnerHtml = JpCommon.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }