<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Editroom.aspx.cs" Inherits="Book.Admin.Editroom" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
 

<div id=sm>
   会议室、笔记本和投影仪的配置
</div>





 
 
  <div class="ManagerForm" style=" width:700px">
 
<fieldset>

    <legend>添加类别</legend>
 
<table class="Form">
<tr>
<td colSpan="2">&nbsp;</td>
<tr>
<td>会议室名称:</td>
<td>
<asp:TextBox id="txt_catname" Runat="Server"  Columns="40" ValidationGroup="Add"></asp:TextBox>
<asp:RequiredFieldValidator ValidationGroup="Add" id="RequiredFieldValidator1" Runat="server" Text="*" ControlToValidate="txt_catname"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>顺序（按数字升序排列）:</td>
<td>
<asp:TextBox id="txt_orderid" Text="0" Runat="Server" ValidationGroup="Add" Width="150px"></asp:TextBox>
 </td>
</tr>


<tr>
<td>添加的类别:</td>
<td>
<asp:DropDownList ID="ddl_cattype" runat="server" Width="150px" AutoPostBack="True" 
        onselectedindexchanged="ddl_cattype_SelectedIndexChanged">
 <asp:ListItem Text="会议室" Value="room"></asp:ListItem>
 <asp:ListItem Text="笔记本" Value="pc"></asp:ListItem>
 <asp:ListItem Text="投影仪" Value="projector"></asp:ListItem>
    </asp:DropDownList>
    
 </td>
</tr>


<tr runat="server" id="tr_pro">
<td>
会议室属性：</td>
<td>
  
  <asp:CheckBox runat="server" ID="cb_hasprojector" />
   <asp:CheckBox runat="server" ID="cb_haspc" />  
    <asp:CheckBox runat="server" ID="cb_hastc" />
      <asp:CheckBox runat="server" ID="cb_hasvtc" />
      
       <asp:CheckBox runat="server" ID="cb_prev1" />
        <asp:CheckBox runat="server" ID="cb_prev2" /> <br />
<asp:Label ID="lbl_num" runat="server" ></asp:Label><asp:TextBox ID="txt_num"   Width="70" runat="server"></asp:TextBox>
</td>
</tr>

<tr>
<td>预定权限:</td>
<td>
<br /> 
如果选择了All Roles，其他角色自动失效<br />
<asp:CheckBoxList  ID="cbl_role" runat="server" RepeatColumns="5" RepeatDirection="Horizontal"  AppendDataBoundItems="true"> 
    <asp:ListItem Text="All Roles" Value="All Roles"></asp:ListItem>
 </asp:CheckBoxList>
    
 </td>
</tr>



 



<TR>
<TD>用户名:</TD>
<TD>
    <asp:TextBox ID="txt_username" runat="server"></asp:TextBox>
    
 </TD>
</TR>





<TR>
<TD>密码:</TD>
<TD>
    <asp:TextBox ID="txt_passworrd" runat="server"></asp:TextBox>
    
 </TD>
</TR>

 





<TR>
<TD>域:</TD>
<TD>
    <asp:TextBox ID="txt_domain" runat="server"></asp:TextBox>
    
 </TD>
</TR>






<TR>
<TD>日历URL:</TD>
<TD>
    <asp:TextBox ID="txt_url" runat="server"></asp:TextBox>
    
 </TD>
</TR>










<tr>
<td colSpan="2">
<asp:Button id="btnAdd" ValidationGroup="Add" OnClick="Add_Click" Runat="Server" class="btn" Text="添加"></asp:Button>
</td>
</tr>
</table>

 </fieldset>
 
 </div>





<!-- 已有内容 -->
<br /><br /> 
<!-- room -->



<!-- 1 -->


  <div class="ManagerForm" style=" width:800px">
 
<fieldset>
		    <legend style="background:url(style/room.gif) no-repeat; height:48px; padding-left:50px">会议室管理</legend>
 
 
    
    
    <asp:GridView ID="GridView1"  AutoGenerateColumns="false"  Width="800"
   DataKeyNames="id" DataSourceID="SqlDataSource1" AllowPaging="false"  runat="server" 
                 OnRowUpdating="GridView1_RowUpdating" 
                 onrowdatabound="GridView1_RowDataBound" 
      >
    <Columns>
    <asp:CommandField ShowEditButton=true ShowDeleteButton=true />
    <asp:BoundField DataField="catname" HeaderText="会议室名称" />
    <asp:BoundField DataField="orderid" HeaderText="顺序号" />
 
<asp:TemplateField>
<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>
<HeaderTemplate>
<%=projectorhead%>

</HeaderTemplate>
<ItemTemplate>

<%#Eval("hasprojector").ToString() == "1" ? "是" : "否"%>
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox runat="server" ID="gv_cb_hasprojector"  />

</EditItemTemplate>

</asp:TemplateField>





<asp:TemplateField>
<HeaderTemplate>
<%=pchead%>

</HeaderTemplate>
<ItemTemplate>
<%#Eval("haspc").ToString()=="1"?"是":"否" %>
</ItemTemplate>

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

</EditItemTemplate>
</asp:TemplateField>



<asp:TemplateField>
<HeaderTemplate>
<%=tchead%>

</HeaderTemplate>
<ItemTemplate>
<%#Eval("hastc").ToString()=="1"?"是":"否" %>
</ItemTemplate>

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

</EditItemTemplate>
</asp:TemplateField>



<asp:TemplateField>
<HeaderTemplate>
<%=vtchead%>

</HeaderTemplate>
<ItemTemplate>
<%#Eval("hasvtc").ToString()=="1"?"是":"否" %>
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox runat="server" ID="gv_cb_hasvtc"  />

</EditItemTemplate>

</asp:TemplateField>





<asp:TemplateField>
<HeaderTemplate>
<%=numhead%>
</HeaderTemplate>
<ItemTemplate>
<%#Eval("num") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" ID="gv_txt_num" Text=<%#Eval("num") %>></asp:TextBox>
</EditItemTemplate>


</asp:TemplateField>








<asp:TemplateField>
<HeaderTemplate>
<%=prev1%>

</HeaderTemplate>
<ItemTemplate>
<%#Eval("prev1").ToString()=="1"?"是":"否" %>
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox runat="server" ID="gv_cb_prev1"  />

</EditItemTemplate>

</asp:TemplateField>




<asp:TemplateField>
<HeaderTemplate>
<%=prev2%>

</HeaderTemplate>
<ItemTemplate>
<%#Eval("prev2").ToString()=="1"?"是":"否" %>
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox runat="server" ID="gv_cb_prev2"  />

</EditItemTemplate>

</asp:TemplateField>


  <asp:BoundField DataField="username" HeaderText="用户名" />
    <asp:BoundField DataField="password" HeaderText="密码" />
      <asp:BoundField DataField="domain" HeaderText="域" />
        <asp:BoundField DataField="url" HeaderText="日历URL" />

 </Columns>
    
    
    <HeaderStyle BackColor="#E0E0E0" Font-Bold="True" HorizontalAlign="Center" />
    <AlternatingRowStyle BackColor="#F2F2F2" />
      <RowStyle BackColor="#ffffff"  Height="28"/>
    <PagerSettings Mode="NumericFirstLast" />    
    
    </asp:GridView>
  

 

        <br />
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ConnectionStrings:ConnectionString %>" 
                DeleteCommand="DELETE FROM [book_categories] WHERE [id] = @id" 
               
                ProviderName="System.Data.SqlClient" 
                SelectCommand="SELECT * FROM [book_categories] WHERE ([cattype] = @cattype) 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,numtext=@numtext, prev1=@prev1, prev2=@prev2 , username=@username, password=@password, domain=@domain, url=@url WHERE [id] = @id" 
                >
                <SelectParameters>
                    <asp:Parameter Name="cattype" Type="String" DefaultValue="room" />
                </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" />
                <asp:Parameter Name="numtext" Type="String" />
                    <asp:Parameter Name="id" Type="Int32" />
                      <asp:Parameter Name="prev1" Type="String" />
                      <asp:Parameter Name="prev2" Type="String" />


                <asp:Parameter Name="username" Type="String" />
                <asp:Parameter Name="password" Type="String" />
                <asp:Parameter Name="domain" Type="String" />
                <asp:Parameter Name="url" Type="String" />
               
                </UpdateParameters>
             </asp:SqlDataSource>
           

</fieldset>
</div>


  
 
<!-- /1 -->


<!--  /room -->
 

<br /><br /> 

<!-- pc -->



<!-- 2 -->


  <div class="ManagerForm" style=" width:800px">
 
<fieldset>
		    <legend style="background:url(style/pc.gif) no-repeat;  height:48px; padding-left:50px">笔记本管理</legend>
 
 
    
    
    <asp:GridView ID="GridView2"  AutoGenerateColumns="false"  Width="500"
   DataKeyNames="id" DataSourceID="SqlDataSource2" AllowPaging="false"  runat="server" 
                 OnRowUpdating="GridView2_RowUpdating" 
                 onrowdatabound="GridView2_RowDataBound" 
      >
    <Columns>
    <asp:CommandField ShowEditButton=true ShowDeleteButton=true />
    <asp:BoundField DataField="catname" HeaderText="笔记本名称" />
    <asp:BoundField DataField="orderid" HeaderText="笔记本号" />
 
<asp:TemplateField>
<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:BoundField DataField="username" HeaderText="用户名" />
    <asp:BoundField DataField="password" HeaderText="密码" />
      <asp:BoundField DataField="domain" HeaderText="域" />
        <asp:BoundField DataField="url" HeaderText="日历URL" />


 </Columns>
    
    
    <HeaderStyle BackColor="#E0E0E0" Font-Bold="True" HorizontalAlign="Center" />
    <AlternatingRowStyle BackColor="#F2F2F2" />
      <RowStyle BackColor="#ffffff"  Height="28"/>
    <PagerSettings Mode="NumericFirstLast" />    
    
    </asp:GridView>
  

 

        <br />
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                ConnectionString="<%$ConnectionStrings:ConnectionString %>" 
                DeleteCommand="DELETE FROM [book_categories] WHERE [id] = @id" 
                InsertCommand="INSERT INTO [book_categories] ([catname], [orderid], [cattype], [allowroles]) VALUES (@catname, @orderid, @cattype, @allowroles)" 
                ProviderName="System.Data.SqlClient" 
                SelectCommand="SELECT  *  FROM [book_categories] WHERE ([cattype] = @cattype) ORDER BY [orderid] asc" 
                
                UpdateCommand="UPDATE [book_categories] SET [catname] = @catname, [orderid] = @orderid, [allowroles] = @allowroles  , username=@username, password=@password, domain=@domain, url=@url WHERE [id] = @id" 
                >
                <SelectParameters>
                    <asp:Parameter Name="cattype" Type="String" DefaultValue="pc" />
                </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" />

                    
                <asp:Parameter Name="username" Type="String" />
                <asp:Parameter Name="password" Type="String" />
                <asp:Parameter Name="domain" Type="String" />
                <asp:Parameter Name="url" Type="String" />

                </UpdateParameters>
             </asp:SqlDataSource>
           

</fieldset>
</div>


  
 
<!-- /2 -->


<!--  /pc -->
 
 
<br /><br /> 
 <!-- projector -->



<!-- 3 -->


  <div class="ManagerForm" style=" width:800px">
 
<fieldset>
		    <legend style="background:url(style/projector.gif) no-repeat; height:48px; padding-left:50px">投影仪管理</legend>
  
    <asp:GridView ID="GridView3"  AutoGenerateColumns="false"  Width="500"
   DataKeyNames="id" DataSourceID="SqlDataSource3" AllowPaging="false"  runat="server" 
                 OnRowUpdating="GridView3_RowUpdating" 
                 onrowdatabound="GridView3_RowDataBound" 
      >
    <Columns>
    <asp:CommandField ShowEditButton=true ShowDeleteButton=true />
    <asp:BoundField DataField="catname" HeaderText="投影仪名称" />
    <asp:BoundField DataField="orderid" HeaderText="投影仪号" />
 
<asp:TemplateField>
<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:BoundField DataField="username" HeaderText="用户名" />
    <asp:BoundField DataField="password" HeaderText="密码" />
      <asp:BoundField DataField="domain" HeaderText="域" />
        <asp:BoundField DataField="url" HeaderText="日历URL" />

 </Columns>
    
    
    <HeaderStyle BackColor="#E0E0E0" Font-Bold="True" HorizontalAlign="Center" />
    <AlternatingRowStyle BackColor="#F2F2F2" />
      <RowStyle BackColor="#ffffff"  Height="28"/>
    <PagerSettings Mode="NumericFirstLast" />    
    
    </asp:GridView>
  

 

        <br />
            <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                ConnectionString="<%$ConnectionStrings:ConnectionString %>" 
                DeleteCommand="DELETE FROM [book_categories] WHERE [id] = @id" 
                InsertCommand="INSERT INTO [book_categories] ([catname], [orderid], [cattype], [allowroles]) VALUES (@catname, @orderid, @cattype, @allowroles)" 
                ProviderName="System.Data.SqlClient" 
                SelectCommand="SELECT * FROM [book_categories] WHERE ([cattype] = @cattype) ORDER BY [orderid] asc" 
                
                UpdateCommand="UPDATE [book_categories] SET [catname] = @catname, [orderid] = @orderid, [allowroles] = @allowroles  , username=@username, password=@password, domain=@domain, url=@url  WHERE [id] = @id" 
                >
                <SelectParameters>
                    <asp:Parameter Name="cattype" Type="String" DefaultValue="projector" />
                </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" />


                          
                <asp:Parameter Name="username" Type="String" />
                <asp:Parameter Name="password" Type="String" />
                <asp:Parameter Name="domain" Type="String" />
                <asp:Parameter Name="url" Type="String" />

                </UpdateParameters>
             </asp:SqlDataSource>
           

</fieldset>
</div>


  
 
<!-- /3 -->


<!--  /projector -->
 


</asp:Content>
