settitle.aspx.cs

来自「这也是关于论坛的一个源代码」· CS 代码 · 共 508 行 · 第 1/2 页

CS
508
字号
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Foosun.CMS;
using Foosun.CMS.Common;
using Foosun.Model;

public partial class manage_survey_setTitle : Foosun.Web.UI.ManagePage
{
    public manage_survey_setTitle()
    {
        Authority_Code = "S004";
    }
    Survey sur = new Survey();
    rootPublic rd = new rootPublic();
    protected void Page_Load(object sender, EventArgs e)
    {
        #region 初始代码
        this.PageNavigator1.OnPageChange += new PageChangeHandler(PageNavigator1_PageChange);
        Response.CacheControl = "no-cache"; //清除缓存
        if (!IsPostBack)  //判断页面是否重载
        {
            //判断用户是否登录
            copyright.InnerHtml = CopyRight;   //获取版权信息
            if (SiteID == "0")
            {
                param_id.InnerHtml = "<a href=\"setParam.aspx\" class=\"list_link\">系统参数设置</a>&nbsp;┊&nbsp;";
            }
            VoteTitleManage(1); //初始分页数据
            //选择类别(新增主题时)
            try
            {
                DataTable dt = sur.sel_7();
                this.vote_ClassName.DataTextField = "ClassName";
                this.vote_ClassName.DataValueField = "VID";
                this.vote_ClassName.DataSource = dt;
                this.vote_ClassName.DataBind();
                //修改
                this.ClassnameE.DataTextField = "ClassName";
                this.ClassnameE.DataValueField = "VID";
                this.ClassnameE.DataSource = dt;
                this.ClassnameE.DataBind();
            }
            catch { }

            string type = Request.QueryString["type"];
            switch (type)
            {
                case "edit":
                    this.Authority_Code = "S005";
                    this.CheckAdminAuthority();
                    setTitleEdit();
                    break;
                case "delone":
                    this.Authority_Code = "S005";
                    this.CheckAdminAuthority();
                    setTitleDel();
                    break;
            }
        }
        #endregion
    }

    /// <summary>
    /// 分页
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="PageIndex"></param>

    protected void PageNavigator1_PageChange(object sender, int PageIndex)
    {
        VoteTitleManage(PageIndex);//管理页面分页查询
    }

    /// <summary>
    /// 修改初始页面信息
    /// </summary>
    ///code by chenzhaohui 

    void setTitleEdit()
    {
        try
        {
            int TID = int.Parse(Request.QueryString["ID"]);
            DataTable dt = sur.sel_8(TID);
            if (dt.Rows.Count > 0)
            {
                this.ClassnameE.Text = dt.Rows[0]["VID"].ToString();
                this.TitleE.Text = dt.Rows[0]["Title"].ToString();
                this.TypeE.Text = dt.Rows[0]["Type"].ToString();
                this.MaxNumE.Text = dt.Rows[0]["MaxNum"].ToString();
                this.DisModelE.Text = dt.Rows[0]["DisMode"].ToString();
                this.StartTimeE.Text = dt.Rows[0]["StartDate"].ToString();
                this.EndTimeE.Text = dt.Rows[0]["EndDate"].ToString();
                this.StyleE.Text = dt.Rows[0]["ItemMode"].ToString();
                this.isStepsE.Text = dt.Rows[0]["isSteps"].ToString();
            }
            else
            {
                PageError("未知错误,异常错误", "setTitle.aspx");
            }
        }
        catch { }
    }

    /// <summary>
    /// 删除单个
    /// </summary>
    /// code by chenzhaohui

    void setTitleDel()
    {
        int TID = int.Parse(Request.QueryString["ID"]);
        if (TID <= 0)
        {
            PageError("错误的参数传递!", "");
        }
        else
        {

            bool v1 = sur.Del_Str_titleSql(TID);
            bool v2 = sur.Del_Str_itemSql_1(TID);
            bool v3 = sur.Del_Str_stepSql(TID);
            bool v4 = sur.Del_Str_manageSql(TID);

            if (v1 && v2 && v3 && v4)
            {
                rd.SaveUserAdminLogs(1, 1, UserNum, "删除投票主题", "删除成功");
                PageRight("删除成功。", "setTitle.aspx");
            }
            else
            {
                PageError("意外错误:未知错误", "");
            }
        }
    }

    /// <summary>
    /// 管理列表
    /// </summary>
    /// <param name="PageIndex"></param>
    /// code by chenzhaohui

    protected void VoteTitleManage(int PageIndex)//显示投票类别管理页面
    {
        #region 查询条件语句判断
        string KeyWord = Foosun.Common.Input.Filter(this.KeyWord.Text.Trim());//取得关键字的内容
        string type = this.DdlKwdType.SelectedValue;//取得选择的类型
        int i = 0, j = 0;
        int num = 20;//从参数设置里取得每页显示记录的条数
        DataTable dt = null;

        if (KeyWord != "" && KeyWord != null)//如果关键字处内容不为空,则按下面选择语句进行条件判断并传值
        {
            switch (type)
            {
                case "choose":
                    dt = Foosun.CMS.Pagination.GetPage("manage_survey_setTitle_1_aspx", PageIndex, num, out i, out j, null);//不跟条件进行查询,显示全部内容                   
                    break;
                case "title":
                    SQLConditionInfo st = new SQLConditionInfo("@Title", "%" + KeyWord + "%");
                    dt = Foosun.CMS.Pagination.GetPage("manage_survey_setTitle_2_aspx", PageIndex, num, out i, out j, st);//按照主题名查询相关内容                   
                    break;
                case "class":
                    DataTable dt1 = new DataTable();
                    dt1 = sur.sel_9(KeyWord);
                    if (dt1 != null)
                    {
                        if (dt1.Rows.Count > 0)
                        {
                            for (int l = 0; l < dt1.Rows.Count; l++)
                            {
                                int Vid = int.Parse(dt1.Rows[l]["VID"].ToString());
                                SQLConditionInfo st1 = new SQLConditionInfo("@VID", "%" + Vid + "%");
                                dt = Foosun.CMS.Pagination.GetPage("manage_survey_setTitle_3_aspx", PageIndex, num, out i, out j, st1);//按照类名查询                              
                            }
                        }
                        else
                        {
                            dt = Foosun.CMS.Pagination.GetPage("manage_survey_setTitle_1_aspx", PageIndex, num, out i, out j, null);
                        }
                    }
                    else
                    {
                        dt = Foosun.CMS.Pagination.GetPage("manage_survey_setTitle_1_aspx", PageIndex, num, out i, out j, null);
                    }
                    break;
                case "num":
                    SQLConditionInfo st2 = new SQLConditionInfo("@MaxNum", "%" + KeyWord + "%");
                    dt = Foosun.CMS.Pagination.GetPage("manage_survey_setTitle_4_aspx", PageIndex, num, out i, out j, st2);//按照最多数查询
                    break;
                case "starttime":
                    SQLConditionInfo st3 = new SQLConditionInfo("@StartDate", "%" + KeyWord + "%");
                    dt = Foosun.CMS.Pagination.GetPage("manage_survey_setTitle_5_aspx", PageIndex, num, out i, out j, st3);//按照开始时间查询
                    break;
                case "endtime":
                    SQLConditionInfo st4 = new SQLConditionInfo("@EndDate", "%" + KeyWord + "%");
                    dt = Foosun.CMS.Pagination.GetPage("manage_survey_setTitle_6_aspx", PageIndex, num, out i, out j, st4);//按照结束时间查询
                    break;
                case "itemmodel":
                    SQLConditionInfo st5 = new SQLConditionInfo("@ItemMode", "%" + KeyWord + "%");
                    dt = Foosun.CMS.Pagination.GetPage("manage_survey_setTitle_7_aspx", PageIndex, num, out i, out j, st5); //按照排列方式查询
                    break;
                default:
                    dt = Foosun.CMS.Pagination.GetPage("manage_survey_setTitle_1_aspx", PageIndex, num, out i, out j, null);
                    break;
            }
        }
        else
        {
            dt = Foosun.CMS.Pagination.GetPage("manage_survey_setTitle_1_aspx", PageIndex, num, out i, out j, null);
        }
        #endregion

        this.PageNavigator1.PageCount = j;
        this.PageNavigator1.PageIndex = PageIndex;
        this.PageNavigator1.RecordCount = i;
        DataTable dts = sur.sel_VoteClassSql();
        if (dts == null)
        {
            NoContent.InnerHtml = Show_NoContent();
            this.PageNavigator1.Visible = false;
        }
        else
        {

            if (dt != null)//判断如果dt里面没有内容,将不会显示
            {
                if (dt.Rows.Count > 0)
                {
                    //添加列
                    dt.Columns.Add("voteClass", typeof(String));//调查类别
                    dt.Columns.Add("type", typeof(String));//项目类型
                    dt.Columns.Add("displayModel", typeof(String));//显示方式
                    dt.Columns.Add("js", typeof(String));//js调用
                    dt.Columns.Add("oPerate", typeof(String));//操作

                    for (int k = 0; k < dt.Rows.Count; k++)
                    {
                        int idv = int.Parse(dt.Rows[k]["VID"].ToString());
                        int idt = int.Parse(dt.Rows[k]["TID"].ToString());
                        int Type = int.Parse(dt.Rows[k]["Type"].ToString());//项目类型
                        int DisMode = int.Parse(dt.Rows[k]["DisMode"].ToString());//显示方式
                        //从调查类别表中取类别名
                        try
                        {
                            string VoteClassName = sur.sel_VoteClass_Sql(idv);//取得调查类别的值

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?