<%@ Page Title="会议配置" Language="C#" MaintainScrollPositionOnPostback="true"  MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Book_Room_Config.aspx.cs" Inherits="Book.Admin.Book_Room_Config" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

 
 
     <table class="layui-table">
                        <tr>
                            <th width="150px">所属区域:</th>
                            <td>
                              <asp:DropDownList ID="ddl_area" 
                                  AutoPostBack=true  
                                   lay-ignore    style="width:300px; display:inline-block"
                                   runat="server"     
                                  CssClass="form-control"
                                   
                                  >  </asp:DropDownList>
                                &nbsp;&nbsp;&nbsp;&nbsp;

                                 排序数学: <asp:TextBox   AutoComplete="off" style="display:inline-block; width:200px" CssClass=" layui-input" ID="txt_orderid" Text="0"  runat="server"></asp:TextBox>

                            </td>
                        </tr>

                         <tr id="tr_cattype">
                            <th class="req">添加类别:</th>
                            <td>
                               
    
      <input type="radio" name="cattype"  lay-filter="cattype" value="room" title="会议室"  <%=ViewState["cattype"].ToString()=="room"?"checked":"" %> >
      <input type="radio" name="cattype"  lay-filter="cattype" value="pc" title="笔记本"  <%=ViewState["cattype"].ToString()=="pc"?"checked":"" %>>
      <input type="radio" name="cattype"  lay-filter="cattype" value="projector" title="投影仪"  <%=ViewState["cattype"].ToString()=="projector"?"checked":"" %>>

                            </td>
                        </tr>

                         

                         

                        
                         <tr>
                                <th   class="req">类别名称：</th>
                                <td>
                                   
                                    <asp:TextBox  CssClass="layui-input" AutoComplete="off"
                                          ValidationGroup="Add" 
                                          ID="txt_catname"
                                         runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ValidationGroup="Add" 
                                        ID="RequiredFieldValidator1" runat="server" 
                                        ErrorMessage="必须填写类别" ControlToValidate="txt_catname" 
                                        Display="Dynamic"></asp:RequiredFieldValidator>
                                </td>
                            </tr>






<tr     id="tr_pro">
<th>
    会议室属性：
</th>
<td> 
       

    
    容纳人数  <asp:TextBox ID="txt_num" Text="10"  style="display:inline; width:100px"  class=" layui-input  " runat="server"></asp:TextBox>  &nbsp;&nbsp;&nbsp;&nbsp;
     内置支持 
     <input type="checkbox" name="builtin"  value="projector" title="内置投影仪">
      <input type="checkbox" name="builtin" value="pc" title="内置笔记本" >
      <input type="checkbox" name="builtin" value="telc" title="支持电话会议">
      <input type="checkbox" name="builtin" value="vtc" title="支持视频会议">  
 
</td>
</tr>




 


                            
<tr>
<th >预定权限:</th>
<td>
 
    <input type="checkbox" name="roles" title="All Roles" value="All Roles" lay-skin="primary"  >


    <asp:Repeater runat="server" ID="rpt_roles"  >
        <ItemTemplate>

             <input type="checkbox" name="roles" value="<%#Eval("rolename") %>" title="<%#Eval("rolename") %>" lay-skin="primary"  >
        </ItemTemplate>

    </asp:Repeater>
     

    
 </td>
</tr> 
                         

                            

                                   
                            <tr>
                                <th></th>
                                <td>
                                    <asp:Button ID="btn_add" 
                                         runat="server" Text="添加"  ValidationGroup="Add" 
                                        class="layui-btn" onclick="btn_add_Click" /> 
                                </td>
                            </tr> 
                    </table>
                 
          




    

    <script>
        layui.use(function ()
        {
           var form= layui.form;
           form.on("radio(cattype)", function (data) {
               var _cattype = data.value;
               if (_cattype == "pc" || _cattype == "projector") {
                   $("#tr_pro").hide();
               }
               else {
                   $("#tr_pro").show();
               }
           }); 

        });



      var selcat=$("input[name=cattype]:checked").val();
      if (selcat == "pc" || selcat == "projector") {
          $("#tr_pro").hide();
      }
      else {
          $("#tr_pro").show();
      }
    </script>



    <hr />


<!-- 1 -->


  <h3 style="margin-top:40px">会议室列表</h3>
    
    <asp:GridView ID="GridView1"  
        AutoGenerateColumns="false"   
        DataKeyNames="id" 
        DataSourceID="SqlDataSource1" 
        AllowPaging="false"   
        GridLines="None"
        runat="server" 
        OnRowUpdating="GridView1_RowUpdating" 
        onrowdatabound="GridView1_RowDataBound" 
        CssClass="layui-table"
      >
    <Columns>
   
    <asp:BoundField DataField="catname" HeaderText="会议室名称" HeaderStyle-Width="200px" ControlStyle-CssClass="layui-input" />
    <asp:BoundField DataField="orderid" HeaderText="顺序号" HeaderStyle-Width="90px" ControlStyle-CssClass="layui-input"/>
 
<asp:TemplateField>
    <HeaderStyle Width="130px" />
<HeaderTemplate>允许权限</HeaderTemplate>
<ItemTemplate>
      <asp:Label ID="Label1" runat="server" Text='<%# Bind("allowroles") %>'></asp:Label>
</ItemTemplate>


<EditItemTemplate>
  <asp:CheckBoxList ID="checkboxlists" runat="server"  
       DataTextField="allowroles" DataValueField="allowroles" 
       AppendDataBoundItems="true">
     <asp:ListItem Text="All Roles" Value="All Roles"></asp:ListItem>
   </asp:CheckBoxList>
</EditItemTemplate>
</asp:TemplateField>





<asp:TemplateField>
    <HeaderStyle Width="130px" />
<HeaderTemplate>

内置投影仪

</HeaderTemplate>
<ItemTemplate>
   <%#Eval("hasprojector").ToString() == "1" ? "<img src=images/ok.gif >" : ""%>
</ItemTemplate>
<EditItemTemplate>
  <asp:CheckBox runat="server" ID="gv_cb_hasprojector"  name="xxxxxx"/> 
</EditItemTemplate>

</asp:TemplateField>





<asp:TemplateField>
    <HeaderStyle Width="130px" />
<HeaderTemplate>
内置笔记本
</HeaderTemplate>
<ItemTemplate>
<%#Eval("haspc").ToString() == "1" ? "<img src=images/ok.gif >" : ""%>
</ItemTemplate>

<EditItemTemplate>
<asp:CheckBox runat="server" ID="gv_cb_haspc"   name="xxxxxx"/>

</EditItemTemplate>
</asp:TemplateField>



<asp:TemplateField>
    <HeaderStyle Width="130px" />
<HeaderTemplate>
支持电话会议

</HeaderTemplate>
<ItemTemplate>
<%#Eval("hastc").ToString() == "1" ? "<img src=images/ok.gif >" : ""%>
</ItemTemplate>

<EditItemTemplate>
   <asp:CheckBox runat="server" ID="gv_cb_hastc"    name="xxxxxx" /> 
</EditItemTemplate>
</asp:TemplateField>



<asp:TemplateField>
    <HeaderStyle Width="130px" />
<HeaderTemplate>
支持视频会议

</HeaderTemplate>
<ItemTemplate>
   <%#Eval("hasvtc").ToString() == "1" ? "<img src=images/ok.gif >" : ""%>
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox runat="server" ID="gv_cb_hasvtc"    name="xxxxxx" />

</EditItemTemplate>

</asp:TemplateField>





<asp:TemplateField>
    <HeaderStyle Width="160px" />
<HeaderTemplate>
容纳人数
</HeaderTemplate>
<ItemTemplate>
<%#Eval("num") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" ID="gv_txt_num" ControlStyle-CssClass="layui-input" 
     Text=<%#Eval("num") %>></asp:TextBox>
</EditItemTemplate>


</asp:TemplateField>
         

   <asp:CommandField
       HeaderStyle-Width="160px"
       
        HeaderText="操作" EditText="编辑" 
       DeleteText="<span onclick=&quot;JavaScript:return confirm('确定删除吗？')&quot;>删除</span> "  
       UpdateText="更新"  
       CancelText="取消"  
        ControlStyle-CssClass="layui-btn layui-btn-sm"
       ShowDeleteButton="True" 
       ShowEditButton="True" />



 </Columns>
    
   
    </asp:GridView>
  
 
   
   <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ConnectionStrings:ConnectionString %>" 
                DeleteCommand="DELETE FROM [book_categories] WHERE [id] = @id"  
                SelectCommand="SELECT * FROM [book_categories] WHERE ([cattype] = @cattype) and (areaid=@areaid) ORDER BY [orderid] asc" 
                UpdateCommand="UPDATE [book_categories] SET [catname] = @catname, [orderid] = @orderid, [allowroles] = @allowroles, hasprojector=@hasprojector, haspc=@haspc,hastc=@hastc,hasvtc=@hasvtc,num=@num WHERE [id] = @id" 
                >
                <SelectParameters>
                    <asp:Parameter Name="cattype" Type="String" DefaultValue="room" />
                    <asp:ControlParameter Name="areaid" Type="Int32" DefaultValue="0" ControlID="ddl_area" />
                </SelectParameters>
                <DeleteParameters>
                    <asp:Parameter Name="id" Type="Int32" />
                </DeleteParameters>

                <UpdateParameters>
                    <asp:Parameter Name="catname" Type="String" />
                    <asp:Parameter Name="orderid" Type="Int32" />
                   <asp:Parameter Name="allowroles" Type="String" />
                   
                <asp:Parameter Name="hasprojector" Type="String" />
                <asp:Parameter Name="haspc" Type="String" />
                <asp:Parameter Name="hastc" Type="String" />
                <asp:Parameter Name="hasvtc" Type="String" />
                <asp:Parameter Name="num" Type="String" /> 

                </UpdateParameters>
             </asp:SqlDataSource>
           

 
 

  
 
<!-- /1 -->

 

<!-- 2 -->
 
        <h3 style="margin-top:40px">笔记本列表</h3>
           
          <asp:GridView ID="GridView2"
                AutoGenerateColumns="false"   
   DataKeyNames="id" 
              DataSourceID="SqlDataSource2" 
              AllowPaging="false"  
              runat="server" 
                 OnRowUpdating="GridView2_RowUpdating"  
              GridLines="None"
                 onrowdatabound="GridView2_RowDataBound" 
                      CssClass="layui-table"
      >
    <Columns>
    
    <asp:BoundField DataField="catname" HeaderText="笔记本名称" HeaderStyle-Width="200px"  ControlStyle-CssClass="layui-input" />
    <asp:BoundField DataField="orderid" HeaderText="顺序号" HeaderStyle-Width="90px"  ControlStyle-CssClass="layui-input" />
 
<asp:TemplateField>
    <HeaderStyle Width="130px" />
<HeaderTemplate>允许权限</HeaderTemplate>
<ItemTemplate>
      <asp:Label ID="Label1" runat="server" Text='<%# Bind("allowroles") %>'></asp:Label>
</ItemTemplate>


<EditItemTemplate>
  <asp:CheckBoxList ID="checkboxlists" runat="server"   DataTextField="allowroles" DataValueField="allowroles"  AppendDataBoundItems="true">
     <asp:ListItem Text="All Roles" Value="All Roles"></asp:ListItem>
       </asp:CheckBoxList>
</EditItemTemplate>
</asp:TemplateField>





   <asp:CommandField HeaderText="操作" EditText="编辑"
         ControlStyle-CssClass="layui-btn layui-btn-sm"
        DeleteText="<span onclick=&quot;JavaScript:return confirm('确定删除吗？')&quot;>删除</span> "  
       UpdateText="更新"  CancelText="取消" ShowDeleteButton="True" ShowEditButton="True" />



 </Columns>
     
    
    </asp:GridView>
  
   
          <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                ConnectionString="<%$ConnectionStrings:ConnectionString %>" 
                DeleteCommand="DELETE FROM [book_categories] WHERE [id] = @id"  
                SelectCommand="SELECT [id], [catname], [orderid], [cattype], [allowroles] FROM [book_categories] WHERE ([cattype] = @cattype) and (areaid=@areaid)  ORDER BY [orderid] asc" 
                UpdateCommand="UPDATE [book_categories] SET [catname] = @catname, [orderid] = @orderid, [allowroles] = @allowroles WHERE [id] = @id" 
                >
                <SelectParameters>
                    <asp:Parameter Name="cattype" Type="String" DefaultValue="pc" />
                    <asp:ControlParameter Name="areaid" Type="Int32" DefaultValue="0" ControlID="ddl_area" />
                </SelectParameters>
                <DeleteParameters>
                    <asp:Parameter Name="id" Type="Int32" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:Parameter Name="catname" Type="String" />
                    <asp:Parameter Name="orderid" Type="Int32" />
                   <asp:Parameter Name="allowroles" Type="String" />
                    <asp:Parameter Name="id" Type="Int32" />
                </UpdateParameters>
             </asp:SqlDataSource>
           
 
 

  
 
<!-- /2 -->

 
 


    
<!-- 3 -->

     <h3 style="margin-top:40px">投影仪列表</h3>
 

    <asp:GridView ID="GridView3"  
        AutoGenerateColumns="false"  
   DataKeyNames="id"
         DataSourceID="SqlDataSource3" 
        AllowPaging="false"  
   runat="server" 
                 OnRowUpdating="GridView3_RowUpdating" 
                 onrowdatabound="GridView3_RowDataBound" 
        GridLines="None" 
                  CssClass="layui-table"
      >
    <Columns>
    
    <asp:BoundField DataField="catname" HeaderText="投影仪名称"  headerstyle-Width="200"  ControlStyle-CssClass="layui-input" />
    <asp:BoundField DataField="orderid" HeaderText="顺序号"  headerstyle-Width="90px"  ControlStyle-CssClass="layui-input" />
 
<asp:TemplateField>
    <HeaderStyle Width="130px" />
<HeaderTemplate>允许权限</HeaderTemplate>
<ItemTemplate>
      <asp:Label ID="Label1" runat="server" Text='<%# Bind("allowroles") %>'></asp:Label>
</ItemTemplate>


<EditItemTemplate>
  <asp:CheckBoxList ID="checkboxlists" runat="server"   DataTextField="allowroles" DataValueField="allowroles"  AppendDataBoundItems="true">
     <asp:ListItem Text="All Roles" Value="All Roles"></asp:ListItem>
       </asp:CheckBoxList>
</EditItemTemplate>
</asp:TemplateField>




   <asp:CommandField HeaderText="操作" EditText="编辑" 
         ControlStyle-CssClass="layui-btn layui-btn-sm"
       DeleteText="<span onclick=&quot;JavaScript:return confirm('确定删除吗？')&quot;>删除</span> "
         UpdateText="更新"  CancelText="取消" ShowDeleteButton="True" ShowEditButton="True" />



 </Columns>
    
        
    
    </asp:GridView>
  

 

     
            <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                ConnectionString="<%$ConnectionStrings:ConnectionString %>" 
                DeleteCommand="DELETE FROM [book_categories] WHERE [id] = @id"  
                SelectCommand="SELECT [id], [catname], [orderid], [cattype], [allowroles] FROM [book_categories] WHERE ([cattype] = @cattype)  and (areaid=@areaid)  ORDER BY [orderid] asc" 
                
                UpdateCommand="UPDATE [book_categories] SET [catname] = @catname, [orderid] = @orderid, [allowroles] = @allowroles WHERE [id] = @id" 
                >
                <SelectParameters>
                    <asp:Parameter Name="cattype" Type="String" DefaultValue="projector" />
                      <asp:ControlParameter Name="areaid" Type="Int32" DefaultValue="0" ControlID="ddl_area" />
                </SelectParameters>
                <DeleteParameters>
                    <asp:Parameter Name="id" Type="Int32" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:Parameter Name="catname" Type="String" />
                    <asp:Parameter Name="orderid" Type="Int32" />
                   <asp:Parameter Name="allowroles" Type="String" />
                    <asp:Parameter Name="id" Type="Int32" />
                </UpdateParameters>
             </asp:SqlDataSource>
           
     
  
 
<!-- /3 -->


<!--  /projector -->
 
















    <script>

        $("span[name=xxxxxx] input").each(
            function()
            { 
                $(this).attr("lay-skin", "primary");
            }
            ); 
      
    </script>













</asp:Content>
