////保存排序 //protected void btnSave_Click(object sender, EventArgs e) //{ // TPortalClass.HyCommon HyCommon = new TPortalClass.HyCommon(); // TPortalClass.HyCategory HyCategory = new TPortalClass.HyCategory(); // 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; // int sortId; // if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId)) // { // sortId = 99; // } // HyCategory.UpdateSort(id, sortId); // } // string pageUrl = HyCommon.CombUrlTxt("list_category.aspx", "page={0}&rnd={1}&cid={2}", // "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid_url.Text + ""); // //写系统日志 // HyCommon.WriteLog("保存排序", "批量保存类别排序号", Session["uid"].ToString(), Session["uname"].ToString()); // Response.Write("<script>alert('保存排序成功!');window.location='" + pageUrl + "';</script>"); //} //批量删除 protected void btnDelete_Click(object sender, EventArgs e) { TPortalClass.HyCommon HyCommon = new TPortalClass.HyCommon(); TPortalClass.HyCategory HyCategory = new TPortalClass.HyCategory(); 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) { //判断是否还有子类别,如果有子类别不能删除 DataTable dt_sub = HyCategory.GetAllSubColumns(id,"0"); if (dt_sub.Rows.Count > 0) { ls_tip = "有下一级类别的信息无法删除,请先删除下一级类别!"; } else { HyCategory.CID = id; HyCategory.Delete(); } } } string pageUrl = HyCommon.CombUrlTxt("list_category.aspx", "page={0}&rnd={1}&cid={2}", "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid_url.Text + ""); //写系统日志 HyCommon.WriteLog("删除", "批量删除类别记录", Session["uid"].ToString(), Session["uname"].ToString()); Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>"); }
private void RptBind() { if (this.Request.QueryString["page"] != null) this.page = int.Parse(this.Request.QueryString["page"].ToString()); else this.page = 1; if (this.Request.QueryString["cid"] != null) this.txtcid_url.Text = this.Request.QueryString["cid"].ToString(); //如果depid等于空,则返回按钮隐藏 if (this.Request.QueryString["cid"] == null || this.Request.QueryString["cid"] == "") { this.fhsjlb.Visible = false; } //this.txtKeywords.Text = this.keywords; txtPageNum.Text = this.pageSize.ToString(); txtPage.Text = this.page.ToString(); TPortalClass.HyCategory HyCategory = new TPortalClass.HyCategory(); DataTable dt = new DataTable(); if (this.txtcid_url.Text == "") { //列出一级类别 0001 dt = HyCategory.GetFirstlevCategory("0", page, pageSize); this.totalCount = HyCategory.GetFirstlevCategoryNum("0"); } else { //列出子级类别 00010001.... dt = HyCategory.GetSubCategory(this.txtcid_url.Text, "0", page, pageSize); this.totalCount = HyCategory.GetSubCategoryNum(this.txtcid_url.Text, "0"); } rptList.DataSource = dt; rptList.DataBind(); TPortalClass.HyCommon HyCommon = new TPortalClass.HyCommon(); string pageUrl = HyCommon.CombUrlTxt("list_category.aspx", "page={0}&rnd={1}&cid={2}", "__id__", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid_url.Text + ""); PageContent.InnerHtml = HyCommon.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private void DataPlay() { if (this.Request.QueryString["op"] != null) { this.txtop.Value = this.Request.QueryString["op"].ToString(); //新增还是修改 } if (this.Request.QueryString["cid"] != null) { this.txtcid.Value = this.Request.QueryString["cid"].ToString(); //类别ID TPortalClass.HyCategory HyCategory = new TPortalClass.HyCategory(); DataTable cdt = HyCategory.Getdocbyid(this.txtcid.Value); if (cdt.Rows.Count > 0) { this.lbltype.Text = cdt.Rows[0]["hy_cname"].ToString(); } } if (this.Request.QueryString["id"] != null) { this.txtid.Value = this.Request.QueryString["id"].ToString(); //文档ID } TPortalClass.HyContent HyContent = new TPortalClass.HyContent(); //新文档 if (this.txtop.Value == "add") { this.txtpubtime.Text = System.DateTime.Now.ToString("yyyy-MM-dd"); } //旧文档 if (this.txtop.Value == "modify") { DataTable dt = HyContent.Getdocbyid(int.Parse(this.txtid.Value)); if (dt.Rows.Count > 0) { this.txttitle.Text = dt.Rows[0]["hy_title"].ToString(); this.content1.Value = dt.Rows[0]["hy_contentcol"].ToString(); this.txtpubtime.Text = DateTime.Parse(dt.Rows[0]["hy_addTime"].ToString()).ToString("yyyy-MM-dd"); } } }