settitle.aspx.cs

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

CS
508
字号
                            dt.Rows[k]["voteClass"] = VoteClassName;//将查找出来的值传给调查类别栏
                        }
                        catch { }
                        switch (Type)
                        {
                            case 0:
                                dt.Rows[k]["type"] = "单选";
                                break;
                            case 1:
                                dt.Rows[k]["type"] = "多选";
                                break;
                        }
                        switch (DisMode)
                        {
                            case 0:
                                dt.Rows[k]["displayModel"] = "柱形图";
                                break;
                            default:
                                dt.Rows[k]["displayModel"] = "柱形图";
                                break;
                        }
                        dt.Rows[k]["Title"] = "<a href='settitle.aspx?type=edit&id=" + idt + "' class='list_link' title='点击查看详情或修改'>" + dt.Rows[k]["Title"].ToString() + "</a>";
                        dt.Rows[k]["js"] = "<a href=\"javascript:getjsCode(" + idt + ");\" class=\"list_link\">代码</a>";
                        dt.Rows[k]["oPerate"] = "<a href=\"settitle.aspx?type=edit&id=" + idt + "\"  class=\"list_link\" title=\"修改此项\"><img src=\"../../sysImages/" + Foosun.Config.UIConfig.CssPath() + "/sysico/edit.gif\" border=\"0\" alt=\"修改此项\" /></a><a href=\"setTitle.aspx?type=delone&id=" + idt + "\"  class=\"list_link\" title=\"删除此项\" onclick=\"{if(confirm('确认删除吗?')){return true;}return false;}\"><img src=\"../../sysImages/" + Foosun.Config.UIConfig.CssPath() + "/sysico/del.gif\" border=\"0\" alt=\"删除此项\" /></a><input type='checkbox' name='vote_checkbox' id='vote_checkbox' value=\"" + idt + "\"/>";
                    }
                }
                else
                {
                    NoContent.InnerHtml = Show_NoContent();
                    this.PageNavigator1.Visible = false;
                }
            }
            else
            {
                NoContent.InnerHtml = Show_NoContent();
                this.PageNavigator1.Visible = false;
            }
            DataList1.DataSource = dt;
            DataList1.DataBind();
        }
    }
    /// <summary>
    /// 查询
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// code by chenzhaohui

    protected void BtnSearch_Click(object sender, EventArgs e)
    {
        VoteTitleManage(1);
    }

    /// <summary>
    /// 批量删除
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// code by chenzhaohui

    protected void DelP_Click(object sender, EventArgs e)
    {
        this.Authority_Code = "S005";
        this.CheckAdminAuthority();
        string vote_checkbox = Request.Form["vote_checkbox"];
        if (vote_checkbox == null || vote_checkbox == String.Empty)
        {
            PageError("请先选择批量操作的内容!", "");
        }
        else
        {
            String[] CheckboxArray = vote_checkbox.Split(',');
            vote_checkbox = null;
            for (int i = 0; i < CheckboxArray.Length; i++)
            {
                if (sur.Del_Vote_Sql_2(CheckboxArray[i]) != 0 && sur.Del_Str_itemSql_2(CheckboxArray[i]) != 0 && sur.Del_Str_stepSql_3(CheckboxArray[i]) != 0 && sur.Del_Str_manageSql_2(CheckboxArray[i]) != 0)
                {
                    rd.SaveUserAdminLogs(1, 1, UserNum, "批量删除投票主题", "删除成功");
                }
            }
            PageRight("删除数据成功,请返回继续操作!", "setTitle.aspx");
        }
    }

    /// <summary>
    /// 新增加
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// code by chenzhaohui


    protected void Savetitle_ServerClick(object sender, EventArgs e)
    {
        this.Authority_Code = "S005";
        this.CheckAdminAuthority();
        if (Page.IsValid)//判断页面是否通过验证
        {
            //取得投票参数设置添加中的表单信息
            string Str_Classname = this.vote_ClassName.SelectedValue;//调查类别
            string Str_Title = Foosun.Common.Input.Filter(this.Title.Text);//类别名称
            string Str_TypeSelect = this.TypeSelect.SelectedValue;//项目类型
            string Str_MaxselectNum = Foosun.Common.Input.Filter(this.MaxselectNum.Text);//最多选项个数
            string Str_DisModel = this.DisModel.SelectedValue;//显示方式
            string Str_Starttime = Foosun.Common.Input.Filter(this.Starttime.Text);//开始时间
            string Str_Endtime = Foosun.Common.Input.Filter(this.Endtime.Text);//结束时间
            string Str_SortStyle = this.SortStyle.SelectedValue;//排列方式
            string Str_isSteps = this.isSteps.Text;//是否允许多步投票

            //检查是否有已经存在的类别名称
            if (sur.sel_10(Str_Title) != 0)
            {
                PageError("对不起,该主题已经存在", "setTitle.aspx?type=add");
            }
            //检查主题名是否为空
            if (Str_Title == null || Str_Title == string.Empty)
            {
                PageError("对不起,主题名称不能为空,请返回继续添加", "setTitle.aspx");
            }
            //检查选项数是否为数字型
            if (Str_TypeSelect == "0")//如果是单选,则选项数最多为1
            {
                Str_MaxselectNum = "1";
            }
            else//否则,是多选,则若输入不是数字,则出错,反之成功
            {
                if (!Foosun.Common.Input.IsInteger(Str_MaxselectNum))
                {
                    PageError("对不起,选项数只能为数字型,请返回继续添加", "setTitle.aspx");
                }
                else
                {
                    //将输入的值赋给最多选项数
                    Str_MaxselectNum = Foosun.Common.Input.Filter(this.MaxselectNum.Text);
                }
            }
            //检查日期是否合法
            if (Foosun.Common.Input.ChkDate(Str_Starttime) == false && Foosun.Common.Input.ChkDate(Str_Endtime) == false)
            {
                PageError("对不起,日期格式不正确,请返回继续添加", "setTitle.aspx");
            }
            //向数据库中写入添加的类别信息

            //载入数据-刷新页面
            if (sur.Add_Str_InSql_2(Str_Classname, Str_Title, Str_TypeSelect, Str_MaxselectNum, Str_DisModel, Str_Starttime, Str_Endtime, Str_SortStyle, Str_isSteps, "0") != 0)
            {
                rd.SaveUserAdminLogs(1, 1, UserNum, "问卷调查系统新增主题", "问卷调查系统新增主题成功");
                PageRight("问卷调查系统新增主题成功", "setTitle.aspx");
            }
            else
            {
                PageError("意外错误:未知错误.或许是没找到记录!", "shortcut_list.aspx");
            }

        }
    }

    /// <summary>
    /// 修改
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// code by chenzhaohui

    protected void Editsave_ServerClick(object sender, EventArgs e)
    {
        this.Authority_Code = "S005";
        this.CheckAdminAuthority();
        if (Page.IsValid)//判断页面是否通过验证
        {
            int TID = int.Parse(Request.QueryString["ID"]);
            //取得修改中的表单信息
            string Str_ClassNameE = Foosun.Common.Input.Filter(this.ClassnameE.Text.Trim());
            string Str_TitleE = Foosun.Common.Input.Filter(this.TitleE.Text.Trim());
            string Str_TypeE = Foosun.Common.Input.Filter(this.TypeE.Text.Trim());
            string Str_MaxNumE = Foosun.Common.Input.Filter(this.MaxNumE.Text.Trim());
            string Str_DisModelE = Foosun.Common.Input.Filter(this.DisModelE.Text.Trim());
            string Str_StartTimeE = Foosun.Common.Input.Filter(this.StartTimeE.Text.Trim());
            string Str_EndTimeE = Foosun.Common.Input.Filter(this.EndTimeE.Text.Trim());
            string Str_StyleE = Foosun.Common.Input.Filter(this.StyleE.Text.Trim());
            string Str_isSteps = Foosun.Common.Input.Filter(this.isStepsE.Text.Trim());

            if (Str_TitleE == null || Str_TitleE == string.Empty)
            {
                PageError("对不起,主题名称不能为空,请返回继续添加", "setTitle.aspx");
            }
            //检查选项数是否为数字型
            if (!Foosun.Common.Input.IsInteger(Str_MaxNumE))
            {
                PageError("对不起,选项数只能为数字型,请返回继续添加", "setTitle.aspx");
            }
            //检查日期是否合法
            if (Foosun.Common.Input.ChkDate(Str_StartTimeE) == false && Foosun.Common.Input.ChkDate(Str_EndTimeE) == false)
            {
                PageError("对不起,日期格式不正确,请返回继续添加", "setTitle.aspx");
            }
            //刷新页面
            if (sur.Update_Str_UpdateSqls(Str_ClassNameE, Str_TitleE, Str_TypeE, Str_MaxNumE, Str_DisModelE, Str_StartTimeE, Str_EndTimeE, Str_StyleE, Str_isSteps, TID) != 0)
            {
                rd.SaveUserAdminLogs(1, 1, UserNum, "问卷调查系统修改主题", "修改成功");
                PageRight("修改成功", "setTitle.aspx");
            }
            else
            {
                PageError("意外错误:未知错误,可能是没找到记录", "");
            }

        }
    }

    /// <summary>
    /// 删除全部
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// code by chenzhaohui

    protected void DelAll_Click(object sender, EventArgs e)
    {
        this.Authority_Code = "S005";
        this.CheckAdminAuthority();
        if (sur.Del_8() == 0)
        {
            PageError("意外错误:未知错误,可能是没找到记录。", "");
        }
        else
        {
            rd.SaveUserAdminLogs(1, 1, UserNum, "删除全部投票主题成功", "删除全部成功");
            PageRight("删除全部成功。", "setTitle.aspx");
        }
    }

    /// <summary>
    /// 无内容提示
    /// </summary>
    /// <returns></returns>
    /// code by chenzhaohui

    string Show_NoContent()
    {
        string type = Request.QueryString["type"];
        string nos = "";
        if (type != "add" && type != "edit")
        {
            nos = "<table border=0 width='98%' align=center cellpadding=5 cellspacing=1 class='table'>";
            nos = nos + "<tr class='TR_BG_list'>";
            nos = nos + "<td class='navi_link'>当前没有满足条件的主题!</td>";
            nos = nos + "</tr>";
            nos = nos + "</table>";
        }
        return nos;
    }
}

⌨️ 快捷键说明

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