123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- using iNethinkCMS.BLL;
- using iNethinkCMS.Command;
- using iNethinkCMS.Helper;
- using iNethinkCMS.Model;
- using iNethinkCMS.Web.UI;
- using System;
- using System.Data;
- using System.Web.UI.HtmlControls;
- using System.Web.UI.WebControls;
- namespace iNethinkCMS.Web.plugs.digg
- {
- public class digg_manage : Admin_BasePage
- {
- private BLL_iNethinkCMS_Plugs_Digg bll = new BLL_iNethinkCMS_Plugs_Digg();
- private Model_iNethinkCMS_Plugs_Digg model = new Model_iNethinkCMS_Plugs_Digg();
- private BLL_iNethinkCMS_Special bll_special = new BLL_iNethinkCMS_Special();
- private string vNavInfo = "当前位置:";
- private string vAct = "";
- private int vPage = 1;
- private int vID;
- private string vSQL = "";
- private string vKeyType = "";
- private string vKey = "";
- protected HtmlForm form_digg_manage;
- protected HtmlGenericControl navInfoID;
- protected DropDownList sKeyType;
- protected TextBox sKey;
- protected Button Button_Search;
- protected HtmlGenericControl mainID;
- protected HtmlTableRow iNoInfo;
- protected Repeater Repeater;
- protected DropDownList exportSID;
- protected Button Button_Export;
- protected HtmlGenericControl pagelist;
- protected void Page_Load(object sender, EventArgs e)
- {
- base.CheckUserPower("a");
- this.vAct = ((base.Request.QueryString["Act"] != null) ? base.Request.QueryString["Act"] : "");
- if (base.Request.QueryString["Page"] != null && base.Request.QueryString["Page"].Trim() != "" && !int.TryParse(base.Request.QueryString["Page"], out this.vPage))
- {
- this.vPage = 1;
- }
- this.vKeyType = ((base.Request.QueryString["sKeyType"] != null) ? base.Request.QueryString["sKeyType"] : "");
- this.vKey = ((base.Request.QueryString["sKey"] != null) ? base.Request.QueryString["sKey"] : "");
- this.vKey = this.vKey.Replace("'", "");
- if (base.Request.QueryString["ID"] != null && base.Request.QueryString["ID"].Trim() != "" && !int.TryParse(base.Request.QueryString["ID"], out this.vID))
- {
- base.Response.Write("ID Error");
- base.Response.End();
- }
- if (this.vKey.Length > 0)
- {
- if (this.vKeyType == "ID")
- {
- if (Command_Validate.IsNumber(this.vKey))
- {
- this.vSQL += this.vKeyType + " = " + this.vKey;
- }
- else
- {
- this.vKey = "";
- }
- }
- else
- {
- this.vSQL = string.Concat(new string[]
- {
- this.vSQL,
- this.vKeyType,
- " Like '%",
- this.vKey,
- "%'"
- });
- }
- }
- this.mainID.Visible = false;
- string a = this.vAct;
- if (a == "delete")
- {
- this.Fun_Delete(this.vID);
- return;
- }
- this.navInfoID.InnerText = this.vNavInfo + "投票管理";
- this.mainID.Visible = true;
- if (!base.IsPostBack)
- {
- this.BindDropdownList_Special(this.exportSID);
- this.sKeyType.SelectedValue = this.vKeyType;
- this.sKey.Text = this.vKey;
- }
- this.PageListInfo();
- }
- protected void PageListInfo()
- {
- int num = int.Parse(this.siteConfig.PageListNum);
- int recordCount = this.bll.GetRecordCount(this.vSQL);
- this.Repeater.DataSource = this.bll.GetListByPage(this.vSQL, "ID Desc", (this.vPage - 1) * num, this.vPage * num);
- this.Repeater.DataBind();
- string innerHtml = "";
- if (recordCount > 0)
- {
- innerHtml = WebUI_PageList.GetPagingInfo_Manage((int)Math.Ceiling((double)recordCount / (double)num), recordCount, this.vPage, num);
- }
- this.pagelist.InnerHtml = innerHtml;
- this.iNoInfo.Visible = (recordCount == 0);
- }
- protected void Button_Search_Click(object sender, EventArgs e)
- {
- base.Response.Redirect(string.Concat(new string[]
- {
- base.Request.Path,
- "?skeytype=",
- this.sKeyType.SelectedValue,
- "&skey=",
- this.sKey.Text
- }));
- }
- protected void Button_Export_Click(object sender, EventArgs e)
- {
- string selectedValue = this.exportSID.SelectedValue;
- if (selectedValue == "0")
- {
- MessageBox.Show(this, "请选择相应的专题!");
- return;
- }
- string text = "Select [ID] AS 编号,[Title] AS 标题,[DiggNumber] AS 投票分值 From [iNethinkCMS_Content] A Where [Display] = 1";
- if (selectedValue != "0")
- {
- text += " And SID = " + selectedValue;
- }
- text += " Order by [DiggNumber] Desc";
- XLSHelper.DataTableExportExcel(SQLHelper.Query(text).Tables[0], "[" + this.exportSID.SelectedItem + "]投票排名信息");
- }
- protected void Fun_Delete(int byID)
- {
- this.model = this.bll.GetModel(byID);
- SQLHelper.ExecuteSql(string.Concat(new object[]
- {
- "Update [iNethinkCMS_Content] Set [DiggNumber] = [DiggNumber] - ",
- this.model.DiggPoint,
- " Where [ID] = ",
- this.vID
- }));
- if (this.bll.Delete(byID))
- {
- base.Response.Redirect(base.Request.UrlReferrer.AbsoluteUri);
- }
- }
- protected void BindDropdownList_Special(DropDownList byDropDownList)
- {
- DataTable dataTable = this.bll_special.GetList(0, "[Display] = 1", "OrderNum Desc").Tables[0];
- for (int i = 0; i < dataTable.Rows.Count; i++)
- {
- byDropDownList.Items.Add(new ListItem(dataTable.Rows[i]["SpecialName"].ToString(), dataTable.Rows[i]["ID"].ToString()));
- }
- }
- }
- }
|