多选项、多个选择项【c#】

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="AddDataInfoCertificate.ascx.cs" Inherits="DotNetNuke.Modules.Project.AddDataInfoCertificate" %>
<script type="text/javascript" src="http://www.beijingzc.com/js/My97DatePicker/WdatePicker.js"></script>
<style type="text/css">
    table.BordTable {
        border-collapse: collapse;
    }

        table.BordTable td {
            border: 2px solid #808080;
        }
          
    }
    
</style>
<asp:Panel ID="panMain" runat="server">
   
      <asp:Button ID="btnCancel" runat="server" Text="←" OnClick="btnCancel_Click" Font-Bold="true" Font-Size="25px"  />
    <table>
        <tr>
            <td>
                <asp:Label ID="lblBUseCertificateID" runat="server" Visible="false"></asp:Label>
            </td>
        </tr>
    </table>
    <table class="BordTable">
        <tr>
            <td>
                <asp:Label ID="Label13" runat="server" Text="报备人:"></asp:Label>
            </td>
            <td>
                <asp:Label ID="lblBidUserName" runat="server"></asp:Label>
            </td>
            <td>
                <asp:Label ID="Label19" runat="server" Text="报备日期:"></asp:Label>
            </td>
            <td>
                <asp:Label ID="lblBidDate" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td colspan="4" style="text-align: center">
                <asp:Label ID="Label14" runat="server" Text="title" Font-Bold="true"></asp:Label>
            </td>
        </tr>
       
        <tr>
            <td>
                <asp:Label ID="Label17" runat="server" Text="证书类型:"></asp:Label>
            </td>
           <td colspan="3">
                <asp:CheckBox ID="CheckBox1" runat="server" Text="注册造价师" />
                <asp:CheckBox ID="CheckBox2" runat="server" Text="一级建造师" />
                <asp:CheckBox ID="CheckBox3" runat="server" Text="招标师" />
                <asp:CheckBox ID="CheckBox4" runat="server" Text="咨询师" />
                <asp:CheckBox ID="CheckBox5" runat="server" Text="监理师" />
                <asp:CheckBox ID="CheckBox6" runat="server" Text="公路造价师" />
                <asp:CheckBox ID="CheckBox7" runat="server" Text="造价员" />
               <asp:DropDownList ID="ddlCName" runat="server" Width="220px">
                    <asp:ListItem Text="请选择:" Value="请选择:" Selected="True"></asp:ListItem>
                    <asp:ListItem Text="注册造价师" Value="注册造价师"></asp:ListItem>
                    <asp:ListItem Text="一级建造师" Value="一级建造师"></asp:ListItem>
                    <asp:ListItem Text="招标师" Value="招标师"></asp:ListItem>
                    <asp:ListItem Text="咨询师" Value="咨询师"></asp:ListItem>
                    <asp:ListItem Text="监理师" Value="监理师"></asp:ListItem>
                    <asp:ListItem Text="公路造价师" Value="公路造价师"></asp:ListItem>
                    <asp:ListItem Text="造价员" Value="造价员"></asp:ListItem>
                </asp:DropDownList>
                </td>
        </tr>
     
        
        <tr>
            <td>
                <asp:Label ID="Label1" runat="server" Text="备注:"></asp:Label>
            </td>
            <td colspan="3">
                <asp:TextBox ID="tbxRemarks" runat="server" Width="320px" Height="50px" TextMode="MultiLine"></asp:TextBox>
                </td>
        </tr>
        <tr>
            <td colspan="4">
                <asp:Label ID="lblMessage" runat="server" ForeColor="Red" ToolTip="Day1"></asp:Label>
            </td>
        </tr>
        <tr>
            <td colspan="4" align="center">
                <asp:Button ID="btnSubmit" runat="server" Text="提交" OnClick="btnSubmit_Click" />
              
            </td>
        </tr>
       
    </table>
   
</asp:Panel>
-------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using DotNetNuke;
using DotNetNuke.Security.Roles;
using DotNetNuke.Services.Localization;
using DotNetNuke.Security;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Modules.HRAddUser;

namespace DotNetNuke.Modules.Project
{
    public partial class AddDataInfoCertificate : DotNetNuke.Entities.Modules.PortalModuleBase, DotNetNuke.Entities.Modules.IActionable
    {

        private DotNetNuke.Modules.HRAddUser.HRAddUserController hrc = new HRAddUserController();
        private DotNetNuke.Modules.Project.ProjectController pc = new ProjectController();
      
        protected void Page_Load(object sender, EventArgs e)
        {
           
            if (!IsPostBack)
            {
                FillUI();
            }
        }
        private void FillUI()
        {
				ddlCName.Visible = false;
           
            if (Convert.ToInt32(lblBUseCertificateID.Text) > 0)
            {
                CheckBox1.Visible = false;
                CheckBox2.Visible = false;
                CheckBox3.Visible = false;
                CheckBox4.Visible = false;
                CheckBox5.Visible = false;
                CheckBox6.Visible = false;
                CheckBox7.Visible = false;
                string sWhere = " where BUseCertificateID=" + Convert.ToInt32(lblBUseCertificateID.Text) + " ";
                DataTable dtBidProject = pc.GetDataInfoCertificate(sWhere);
                lblBidUserName.Text = Convert.ToString(dtBidProject.Rows[0]["SubmitUserName"]);
                lblBidDate.Text = Convert.ToDateTime(dtBidProject.Rows[0]["CreateDate"]).ToString("yyyy-MM-dd");
                tbBeUsedName.Text = Convert.ToString(dtBidProject.Rows[0]["BeUsedName"]);
                 ddlCName.Visible = true;
                ddlCName.SelectedValue = Convert.ToString(dtBidProject.Rows[0]["CName"]);
            }
            else
            {
                lblBidUserName.Text = UserInfo.DisplayName;
                lblBidDate.Text = DateTime.Today.ToString("yyyy-MM-dd");
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (CheckInput())
            {
               
                if (Convert.ToInt32(lblBUseCertificateID.Text) > 0)
                {
                    pc.UpdateDataInfoCertificateInfo(Convert.ToInt32(lblBUseCertificateID.Text), baid, beuserdid, tbBeUsedName.Text,
         ddlTitle.SelectedValue, ddlCName.SelectedValue, tbxRemarks.Text, UserId);
                }
                else
                {
                    if (CheckBox1.Checked == true)
                    {
                        pc.AddDataInfoCertificateInfo(baid, beuserdid, tbBeUsedName.Text,
          ddlTitle.SelectedValue, "注册造价师", tbxRemarks.Text, UserId);
                    }
                    if (CheckBox2.Checked == true)
                    {
                        pc.AddDataInfoCertificateInfo(baid, beuserdid, tbBeUsedName.Text,
          ddlTitle.SelectedValue, "一级建造师", tbxRemarks.Text, UserId);
                    }
                    if (CheckBox3.Checked == true)
                    {
                        pc.AddDataInfoCertificateInfo(baid, beuserdid, tbBeUsedName.Text,
          ddlTitle.SelectedValue, "招标师", tbxRemarks.Text, UserId);
                    }
                    if (CheckBox4.Checked == true)
                    {
                        pc.AddDataInfoCertificateInfo(baid, beuserdid, tbBeUsedName.Text,
          ddlTitle.SelectedValue, "咨询师", tbxRemarks.Text, UserId);
                    }
                    if (CheckBox5.Checked == true)
                    {
                        pc.AddDataInfoCertificateInfo(baid, beuserdid, tbBeUsedName.Text,
          ddlTitle.SelectedValue, "监理师", tbxRemarks.Text, UserId);
                    }
                    if (CheckBox6.Checked == true)
                    {
                        pc.AddDataInfoCertificateInfo(baid, beuserdid, tbBeUsedName.Text,
          ddlTitle.SelectedValue, "公路造价师", tbxRemarks.Text, UserId);
                    }
                    if (CheckBox7.Checked == true)
                    {
                        pc.AddDataInfoCertificateInfo(baid, beuserdid, tbBeUsedName.Text,
          ddlTitle.SelectedValue, "造价员", tbxRemarks.Text, UserId);
                    }
                  
                }
                Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(), true);
            }
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {
            Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(), true);
        }

        private bool CheckInput()
        {
            bool Result = true;

            if (ddlBidProjectName.Text == "请选择")
            {
                lblMessage.Text = "请选择投标项目名称。";
                Result = false;
            }
           
          
            return Result;
        }
       
        #region IActionable 成员

        DotNetNuke.Entities.Modules.Actions.ModuleActionCollection DotNetNuke.Entities.Modules.IActionable.ModuleActions
        {
            get
            {
                Entities.Modules.Actions.ModuleActionCollection Actions = new
                Entities.Modules.Actions.ModuleActionCollection();
                Actions.Add(GetNextActionID(),
                Localization.GetString(Entities.Modules.Actions.ModuleActionType.AddContent,
                LocalResourceFile), Entities.Modules.Actions.ModuleActionType.AddContent, "", "",
                EditUrl(), false, SecurityAccessLevel.Edit, true, false);
                return Actions;
            }
        }

        #endregion

    }
}

  

posted @ 2021-09-06 13:32  刘贵庆  阅读(198)  评论(0编辑  收藏  举报