<%@ page language="C#" autoeventwireup="true" masterpagefile="~/Admin/MasterPage/Default.Master" inherits="Admin_SysSetting_FontUser_FontUserList, YBBQYCMS_deploy" theme="Standard" viewStateEncryptionMode="Never" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PageBody" runat="server">
    <table style="width:100%">
        <tr>
            <td>
                <DataLayerWebControls:HeadMenuWebControls ID="HeadMenuWebControls1" runat="server"
                    HeadOPTxt="前台用户列表" HeadTitleTxt="前台用户设置" HeadHelpTxt="帮助">
                </DataLayerWebControls:HeadMenuWebControls>
                <DataLayerWebControls:TabOptionWebControls ID="TabOptionWebControls1" runat="server">
                    <DataLayerWebControls:TabOptionItem ID="TabOptionItem1" runat="server" Tab_Name="前台用户列表">
                        <asp:GridView ID="GridView1" runat="server" OnSorting="GridView1_Sorting"
                            AutoGenerateColumns="False" Width="100%">
                            <Columns>
                               <asp:TemplateField>
                                  <ItemTemplate>
                                         <input name="CheckBox" id="CheckBox" value="<%#Eval("ID") %>" type="checkbox" />
                                  </ItemTemplate>
                                  <HeaderTemplate>
                                         &nbsp;<input id="CheckboxAll" type="checkbox" value="0" onclick="SelectAll();" />
                                  </HeaderTemplate>
                              </asp:TemplateField>
                                <asp:TemplateField SortExpression="ID" HeaderText="序号▼">
                                    <ItemTemplate>
                                        <%# (this.AspNetPager1.CurrentPageIndex - 1) * this.AspNetPager1.PageSize + Container.DataItemIndex + 1%>
                                    </ItemTemplate>
                                    <ItemStyle Wrap="True" />
                                    <HeaderStyle Wrap="False" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="用户名" SortExpression="UserName">
                                    <ItemTemplate>
                                        <a href="FontUserManger.aspx?CMD=List&UserId=<%# Eval("ID") %>">
                                            <%# Eval("UserName")%>
                                        </a>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="所属角色" SortExpression="RoleId">
                                    <ItemTemplate>
                                        <%# ReturnRoleName((int)Eval("RoleId"))%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField SortExpression="LastLoginTime" HeaderText="最后登录时间">
                                    <ItemTemplate>
                                        <%# DataBinder.Eval(Container.DataItem, "LastLoginTime", "{0:yyyy年M月d日}")%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField HeaderText="最后登录IP" SortExpression="LoginIp" DataField="LoginIp" />
                                <asp:TemplateField HeaderText="是/否锁定">
                                    <ItemTemplate>
                                        <font color="#668a00">
                                            <%# Eval("LockUser").ToString() == "1" ? "√" : "×"%>
                                        </font>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText ="修改">
                                <ItemTemplate>
                                <a href ="FontUserManger.aspx?CMD=Edit&UserId=<%# Eval("ID") %>" >编辑</a>
                                </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                        <DataLayerWebControls:AspNetPager ID="AspNetPager1" runat="server" OnPageChanged="AspNetPager1_PageChanged1">
                        </DataLayerWebControls:AspNetPager>
                        <asp:Button ID="Button2" OnClick="Button2_Click" runat="server" OnClientClick="return deleteop();"
                            Text="删除" CssClass="button_bak" ></asp:Button>
                             <asp:Button ID="Button1" OnClick="Button1_Click" runat="server" OnClientClick="return changeop();"
                            Text="改变锁定状态" CssClass="button_bak" ></asp:Button>
                    </DataLayerWebControls:TabOptionItem>
                </DataLayerWebControls:TabOptionWebControls>

   <script language="javascript" type="text/javascript">
       function SelectAll() {
           var e = document.getElementsByTagName("input");
           var IsTrue;
           if (document.getElementById("CheckboxAll").value == "0") {
               IsTrue = true;
               document.getElementById("CheckboxAll").value = "1"
           }
           else {
               IsTrue = false;
               document.getElementById("CheckboxAll").value = "0"
           }
           for (var i = 0; i < e.length; i++) {
               if (e[i].type == "checkbox") {
                   e[i].checked = IsTrue;
               }
           }
       }
       function changeop() {
           var checkok = false;
           var e = document.getElementsByTagName("input");
           for (var i = 0; i < e.length; i++) {
               if (e[i].type == "checkbox") {
                   if (e[i].checked == true) {
                       checkok = true;
                       break;
                   }
               }
           }
           if (checkok)
               return confirm('确实要改变用户锁定状态吗?');
           else {

               alert("请选择记录!");
               return false;
           }
       }
       function deleteop() {
           var checkok = false;
           var e = document.getElementsByTagName("input");
           for (var i = 0; i < e.length; i++) {
               if (e[i].type == "checkbox") {
                   if (e[i].checked == true) {
                       checkok = true;
                       break;
                   }
               }
           }
           if (checkok)
               return confirm('删除后不可恢复,确认要批量删除选中记录吗？');
           else {

               alert("请选择要删除的记录!");
               return false;
           }
       }

                </script>

            </td>
        </tr>
    </table>
</asp:Content>
