setitem.aspx.cs

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

CS
442
字号
                    int idi = int.Parse(dt.Rows[k]["iid"].ToString());
                    int ItemModee = int.Parse(dt.Rows[k]["ItemMode"].ToString());//选项模式
                    try
                    {
                        //从主题表中取主题名
                        string VoteTitleName = sur.VoteTitle_Sql_1(idt);//取得主题的值

                        dt.Rows[k]["title"] = VoteTitleName;//将查找出来的值传给调查主题栏
                    }
                    catch { }
                    switch (ItemModee)
                    {
                        case 1:
                            dt.Rows[k]["ItemModel"] = "文字描述模式";
                            break;
                        case 2:
                            dt.Rows[k]["ItemModel"] = "自主填写模式";
                            break;
                        case 3:
                            dt.Rows[k]["ItemModel"] = "图片模式";
                            break;
                        default:
                            dt.Rows[k]["ItemModel"] = "文字描述模式";
                            break;
                    }
                    dt.Rows[k]["ItemName"] = "<a href='setItem.aspx?type=edit&id=" + idi + "' class='list_link'>" + dt.Rows[k]["ItemName"].ToString() + "</a>";
                    dt.Rows[k]["oPerate"] = "<a href=\"setItem.aspx?type=edit&id=" + idi + "\"  class=\"list_link\" title=\"修改此项\"><img src=\"../../sysImages/" + Foosun.Config.UIConfig.CssPath() + "/sysico/edit.gif\" border=\"0\" alt=\"修改此项\" /></a><a href=\"setItem.aspx?type=delone&id=" + idi + "\"  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=\"" + idi + "\"/>";
                }
            }
            else
            {
                NoContent.InnerHtml = Show_NoContent();
                this.PageNavigator1.Visible = false;
            }
        }
        else
        {
            NoContent.InnerHtml = Show_NoContent();
            this.PageNavigator1.Visible = false;
        }
        DataList1.DataSource = dt;
        DataList1.DataBind();
    }
    //查询操作
    protected void BtnSearch_Click(object sender, EventArgs e)
    {
        VoteItemManage(1);
    }

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

    protected void Saveitem_ServerClick(object sender, EventArgs e)
    {
        if (Page.IsValid)//判断页面是否通过验证
        {
            //取得添加中的表单信息
            string Str_vote_CTName = this.vote_CTName.SelectedValue;//调查类别,主题
            string Str_ItemName = Foosun.Common.Input.Filter(this.ItemName.Text);//选项描述
            string Str_ItemValue = this.ItemValue.Text;//项目符号
            string Str_ItemMode = this.ItemMode.Text;//选项模式
            string Str_PicSrc = this.PicSrc.Text;//图片位置
            string Str_DisColor = Foosun.Common.Input.Filter(this.DisColor.Text);//颜色
            string Str_VoteCount = Foosun.Common.Input.Filter(this.VoteCount.Text);//票数
            string Str_ItemDetail = this.ItemDetail.Value;//详细说明

            //检查是否有已经存在的类别名称
            if (sur.Str_CheckSql(Str_ItemName) != 0)
            {
                PageError("对不起,该选项已经存在", "setItem.aspx");
            }
            //检查选项名不能为空
            if (Str_ItemName == null || Str_ItemName == string.Empty)
            {
                PageError("对不起,选项名不能为空!", "setItem.aspx");
            }
            //检查选项票数是否为数字型
            if (!Foosun.Common.Input.IsInteger(Str_VoteCount))
            {
                PageError("对不起,选项票数只能为数字型,请返回继续添加", "setItem.aspx");
            }
            //向数据库中写入添加的类别信息

            //载入数据-刷新页面
            if (sur.Add_Str_InSql(Str_vote_CTName, Str_ItemName, Str_ItemValue, Str_ItemMode, Str_PicSrc, Str_DisColor, Str_VoteCount, Str_ItemDetail, SiteID) != 0)
            {
                rd.SaveUserAdminLogs(1, 1, UserNum, "问卷调查系统新增选项", "问卷调查系统新增选项成功");
                PageRight("问卷调查系统新增选项成功", "setItem.aspx");
            }
            else
            {
                PageError("意外错误:未知错误", "shortcut_list.aspx");
            }

        }
    }

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

    protected void DelP_Click(object sender, EventArgs e)
    {
        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(CheckboxArray[i]) == 0)
                {
                    PageError("删除数据失败,请与管理联系!", "");
                    break;
                }
            }
            rd.SaveUserAdminLogs(1, 1, UserNum, "问卷调查系统批量删除选项", "删除数据成功");
            PageRight("删除数据成功,请返回继续操作!", "setItem.aspx");
        }
    }


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

    protected void DelAll_Click(object sender, EventArgs e)
    {
        if (sur.Del_Vote_Sql_1() == 0)
        {
            PageError("意外错误:未知错误", "");
        }
        else
        {
            rd.SaveUserAdminLogs(1, 1, UserNum, "问卷调查系统删除选项", "删除数据成功");
            PageRight("删除全部成功。", "setItem.aspx");
        }
    }

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

    protected void Editclick_ServerClick(object sender, EventArgs e)
    {
        if (Page.IsValid)//判断页面是否通过验证
        {
            int IID = int.Parse(Request.QueryString["ID"]);
            //取得修改中的表单信息
            string Str_classnameedit = Foosun.Common.Input.Filter(this.classnameedit.Text.Trim());
            string Str_itemnameedit = Foosun.Common.Input.Filter(this.itemnameedit.Text.Trim());
            string Str_valueedit = Foosun.Common.Input.Filter(this.valueedit.Text.Trim());
            string Str_itemmodele = Foosun.Common.Input.Filter(this.itemmodele.Text.Trim());
            string Str_picsurl = Foosun.Common.Input.Filter(this.picsurl.Text.Trim());
            string Str_discoloredit = Foosun.Common.Input.Filter(this.discoloredit.Text.Trim());
            string Str_pointqe = Foosun.Common.Input.Filter(this.pointqe.Text.Trim());
            string Str_discriptionitem = Foosun.Common.Input.Filter(this.discriptionitem.Value.Trim());

            if (Str_itemnameedit == null || Str_itemnameedit == string.Empty)
            {
                PageError("对不起,主题名称不能为空,请返回继续添加", "setItem.aspx");
            }
            //检查选项数是否为数字型
            if (!Foosun.Common.Input.IsInteger(Str_pointqe))
            {
                PageError("对不起,选项票数只能为数字型,请返回继续添加", "setItem.aspx");
            }
            //刷新页面
            if (sur.Update_Str_UpdateSql(Str_classnameedit, Str_itemnameedit, Str_valueedit, Str_itemmodele, Str_picsurl, Str_discoloredit, Str_pointqe, Str_discriptionitem, IID) != 0)
            {
                rd.SaveUserAdminLogs(1, 1, UserNum, "问卷调查系统修改选项", "修改成功");
                PageRight("修改成功", "setItem.aspx");
            }
            else
            {
                PageError("意外错误:未知错误", "shortcut_list.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 + -
显示快捷键?