<%@ Page Language="C#" MasterPageFile="~/MasterPages/Main.master" AutoEventWireup="true" CodeFile="Users.aspx.cs" Inherits="Security_Users"  %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

    <script language="javascript" type="text/javascript">
function validate()
{
    var message = "";
    if (document.getElementById("<%=txtUserID.ClientID%>").value=="")
        message += "User ID Feild can not be blank\n";
    if (document.getElementById("<%=txtUserName.ClientID%>").value=="")
        message += "User Name Feild can not be blank\n";

    
    if(message.length >0)
    {
        message = "please notice the following requirments:\n\n" + message;
        alert(message);
        return false;
    }
      return true;
}

function validate1()
{
    var message = "";
//    if (document.getElementById("<%=TextBox1.ClientID%>").value=="")
//        message += "New Password Feild can not be blank\n";
//        
//    if (document.getElementById("<%=TextBox2.ClientID%>").value=="")
//        message += "New Password confirmation Feild can not be blank\n";
//        
//    if (document.getElementById("<%=TextBox1.ClientID%>").value.length < 8 )
//        message += "Password Field should be longer than 8 characters\n";
//        
//    if (document.getElementById("<%=TextBox1.ClientID%>").value != document.getElementById("<%=TextBox2.ClientID%>").value )
//        message += "Passwords does not match\n";
        
    if(message.length >0)
    {
        message = "please notice the following requirments:\n\n" + message;
        alert(message);
        return false;
    }
      return true;
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table class="body_MainTB" border="0" cellpadding="0" cellspacing="0">
                    <tr align="center">
                        <td valign="top">
                            <!------------------------------------body St  ---------------------------------------------->
                            <table border="0" cellpadding="0" cellspacing="0" class="body_formTitle">
                                <tr>
                                    <td>
                                        Manage Users
                                    </td>
                                </tr>
                            </table>
                            <br>
                            <!------------------------------------body End1 ----------------------------------------------->
                            <table border="0" cellpadding="0" cellspacing="0" class="contTB">
                                <tr>
                                    <td align="center">
                                        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="Frow">
                                            <tr>
                                                <td>
                                                </td>
                                            </tr>
                                        </table>
                                        <br />
                                        <asp:Panel ID="pnl_filters" runat="server" Width="100%">
                                        <table border="0" width=100% cellpadding="0" cellspacing="0" class="add_ItemTB">
                                                <tr>
                                                    <td class="tdNormal">
                                                        User ID</td>
                                                    <td colspan=4>
                                                        <asp:TextBox ID="txtSearchUserID" runat="server" class="fieldNormalUserId" 
                                                            MaxLength="20" Width="250"></asp:TextBox>
                                                 </td>
                                                </tr>
                                                <tr>
                                                    <td class="tdNormal">
                                                        User Name</td>
                                                    <td colspan=4>
                                                        <asp:TextBox ID="txtSearchUserName" runat="server" class="fieldNormal" Width=250 
                                                            MaxLength="100"></asp:TextBox>
                                                 </td>
                                                </tr>
                                               
                                                <tr>
                                                    <td colspan="5" style="text-align:center">
                                                        <asp:Button ID="btnSearch" runat="server" Text="Search" CssClass="Btn_L_Normal" 
                                                            onclick="btnSearch_Click" />
                                                    </td>
                                                </tr>
                                            </table>
                                            <br />
                                    </asp:Panel>
                                        <table border="0" cellpadding="0" cellspacing="0" class="grid_TitleBG_B">
                                            <tr>
                                                <td>
                                                    Users
                                                </td>
                                            </tr>
                                        </table>
                                        <asp:Panel ID="pnlGrid" runat="server" Width="100%">
                                            <asp:Label ID="lblError" runat="server" Text="" class="fieldError"></asp:Label>
                                            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="U_ID"
                                                CssClass="gridMaster" OnRowCommand="GridView1_RowCommand"
                                                AllowPaging="True" AllowSorting="True" CellPadding="4" ForeColor="#333333" GridLines="None"
                                                OnRowCreated="GridView1_RowCreated" EmptyDataText="There are no users" 
                                                onpageindexchanging="GridView1_PageIndexChanging">
                                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                <Columns>
                                                    <asp:BoundField DataField="U_ID" HeaderText="U_ID"/>
                                                    <asp:BoundField DataField="USER_ID" HeaderText="User ID" />
                                                    <asp:BoundField DataField="USER_NAME" HeaderText="User name" />
                                                    <asp:BoundField DataField="PASSWORD" HeaderText="PASSWORD" />
                                                    <asp:BoundField DataField="USER_TEL_NO" HeaderText="USER_TEL_NO" />
                                                    <asp:BoundField DataField="TEL_EXTEN" HeaderText="TEL_EXTEN" />
                                                    <asp:BoundField DataField="GID" HeaderText="Group" />
                                                    <asp:BoundField DataField="super_flag" HeaderText="Super User" />
                                                    <asp:BoundField DataField="g_name" HeaderText="Group" />
                                                    <asp:ButtonField ButtonType="Image" CommandName="d" Text="Delete" ItemStyle-Width="30px"
                                                        ImageUrl="~/Images/delete.jpg" >
                                                        <ItemStyle Width="30px" />
                                                    </asp:ButtonField>
                                                    <asp:ButtonField ButtonType="Image" CommandName="u" Text="Update" ItemStyle-Width="30px"
                                                        ImageUrl="~/Images/edit.jpg" >
                                                        <ItemStyle Width="30px" />
                                                    </asp:ButtonField>
                                                    <asp:ButtonField ButtonType="Image" CommandName="r" Text="Reset" ItemStyle-Width="30px"
                                                        ImageUrl="~/Images/EN/update.jpg" >
                                                        <ItemStyle Width="30px" />
                                                    </asp:ButtonField>
                                                    <asp:BoundField DataField="super_user" HeaderText="" />
                                                    <asp:BoundField DataField="STATUS"     HeaderText="" />
                                                </Columns>
                                                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                                <EditRowStyle BackColor="#999999" />
                                                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                            </asp:GridView>
                                        </asp:Panel>
                                        <table border="0" cellpadding="0" cellspacing="0" class="action_TB_BgForm">
                                            <tr>
                                                <td>
                                                    <asp:Button ID="btnAdd" runat="server" Text="     Add     " class="Btn_M_Normal"
                                                        OnClick="btnAdd_Click" />
                                            </tr>
                                        </table>
                                        <br>
                                        <!------------------------------------body End1 ----------------------------------------------->
                                        <asp:Panel ID="pnlControls" runat="server" Width="100%">
                                            <fieldset id="addItem">
                                                <legend id="addItem">Adding new user</legend>
                                            </fieldset>
                                            <table border="0" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                                <tr>
                                                    <td class="tdNormal" style="width:15%">
                                                        User ID
                                                    </td>
                                                    <td class="tdNormal" style="width:30%">
                                                        <asp:TextBox ID="txtUserID" runat="server" Width="100%" class="fieldNormalUserId" 
                                                            MaxLength="20"></asp:TextBox>
                                                    </td>
                                                    <td class="tdNormal" style="width:10%">
                                                        &nbsp;
                                                    </td>
                                                    <td class="tdNormal" style="width:15%">
                                                        User Name
                                                    </td>
                                                    <td class="tdNormal" style="width:30%">
                                                        <asp:TextBox ID="txtUserName" runat="server" Width="100%" class="fieldNormal" 
                                                            MaxLength="100"></asp:TextBox>
                                                    </td>
                                                </tr>
                                               <%-- <tr>
                                                    <td>
                                                        Password
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="txtPass1" runat="server" Width="100%"  class="fieldNormal" TextMode="Password"></asp:TextBox>                                                        
                                                    </td>
                                                    <td>
                                                        &nbsp;
                                                    </td>
                                                    <td>
                                                        Verify Password
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="txtPass2" runat="server" Width="100%" class="fieldNormal" TextMode="Password"></asp:TextBox>
                                                    </td>
                                                </tr>--%>
                                                <tr>
                                                    <td>
                                                        USER_TEL_NO
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="USER_TEL_NO" runat="server" Width="100%"  class="fieldNormal" ></asp:TextBox>                                                        
                                                    </td>
                                                    <td>
                                                        &nbsp;
                                                    </td>
                                                    <td>
                                                        TEL_EXTEN
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="TEL_EXTEN" runat="server" Width="100%" class="fieldNormal" 
                                                            MaxLength="15" ></asp:TextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        Group
                                                    </td>
                                                    <td colspan="4">
                                                     <asp:CheckBoxList ID="chkBoxGroups" runat="server" 
                                                     DataTextField="GROUP_NAME" DataValueField="GID"
                                                            class="fieldNormal" RepeatColumns="2">
                                                           </asp:CheckBoxList>
                                                        <%--<asp:RadioButtonList ID="RadioButtonList1" runat="server" 
                                                        DataTextField="GROUP_NAME" DataValueField="GID"
                                                            class="fieldNormal" RepeatColumns="2">
                                                        </asp:RadioButtonList>--%>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        Status
                                                    </td>
                                                    <td>
                                                        <asp:RadioButton ID="rdActive" runat="server" Checked="True" GroupName="group" Text="Active"
                                                            class="fieldNormal" />
                                                        <asp:RadioButton ID="rdInActive" runat="server" GroupName="group" Text="InActive"
                                                            class="fieldNormal" />
                                                    </td>
                                                    <td>
                                                        &nbsp;
                                                    </td>
                                                    <td>
                                                        
                                                    </td>
                                                    <td>
                                                        
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        Super User
                                                    </td>
                                                    <td>
                                                        <asp:CheckBox ID="chkSuper" runat="server" />
                                                    </td>
                                                    <td>
                                                        &nbsp;
                                                    </td>
                                                    <td>
                                                        &nbsp;
                                                    </td>
                                                    <td>
                                                        &nbsp;
                                                    </td>
                                                </tr>
                                            </table>
                                            <table border="0" cellpadding="0" cellspacing="0" class="action_TB_BgaddItem">
                                                <tr>
                                                    <td>
                                                        <asp:Button ID="Button2" runat="server" Text="   Cancel   " 
                                                            OnClick="btnCancel_Click" class="Btn_M_Normal" CausesValidation="False" />
                                                        <asp:Button ID="Button1" OnClientClick="return validate()" runat="server" Text="   Save   " OnClick="btnSave_Click" class="Btn_M_Normal" />
                                                    </td>
                                                </tr>
                                            </table>
                                            <table>
                                                <tr>
                                                    <td align="left">
                                                    </td>
                                                </tr>
                                            </table>
                                        </asp:Panel>
                                        <asp:Panel ID="pnlPassword" runat="server" Width="100%">
                                            <fieldset id="addItem">
                                                <legend id="addItem">Reset user password</legend>
                                            </fieldset>
                                            <table border="0" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                            <tr>
                                                    <td class="tdNormal" style="width:15%">
                                                        New Password
                                                    </td>
                                                    <td class="tdNormal" style="width:30%">
                                                        <asp:TextBox ID="TextBox1" runat="server" Width="100%"  class="fieldNormal" TextMode="Password"></asp:TextBox>                                                        
                                                    </td>
                                                    <td>
                                                    </td>
                                                    <td>
                                                    </td>
                                                    <td>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        Verify New Password
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="TextBox2" runat="server" Width="100%"  class="fieldNormal" TextMode="Password"></asp:TextBox>                                                        
                                                    </td>
                                                <td></td>
                                                    <td>
                                                    </td>
                                                    <td>
                                                    </td>
                                                </tr>
                                            </table>
                                            <table border="0" cellpadding="0" cellspacing="0" class="action_TB_BgaddItem">
                                                <tr>
                                                    <td>
                                                        <asp:Button ID="Button3" runat="server" Text="   Cancel   " 
                                                            OnClick="Button3_Click" class="Btn_M_Normal" CausesValidation="False" />
                                                        <asp:Button ID="Button4" OnClientClick="return validate1()" runat="server" 
                                                        Text="   Save   " OnClick="Button4_Click" class="Btn_M_Normal" />
                                                    </td>
                                                </tr>
                                            </table>
                                            <table>
                                                <tr>
                                                    <td align="left">
                                                    </td>
                                                </tr>
                                            </table>
                                        </asp:Panel>
                                        <!------------------------------------body End2 ----------------------------------------------->
                                        <br>
                                    </td>
                                </tr>
                            </table>
                            <!------------------------------------body End2 ----------------------------------------------->
                        </td>
                    </tr>
                </table>
</asp:Content>

