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

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <script language ="javascript" type ="text/javascript" >
        function KeyPressFuncIsWholeNumber() {

            if (event.keyCode < 48 || event.keyCode > 57)
            { event.returnValue = false; }
        }
    </script>
    <script language="javascript" type="text/javascript">
        function validate() {
            var message = "";

//            if (document.getElementById("<%=txtBranchCode.ClientID%>").value == "") {
//                message += "You have to enter the Branch Code...\n";
//            }

            if (isNaN(document.getElementById("<%=txtBranchCode.ClientID%>").value)) {
                message += "Branch Code must contain numbers only\n";
            }

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

        function validateAccountNo() {
            var message = "";

            if (document.getElementById("<%=txtBranchCode1.ClientID%>").value == "") {
                message += "You have to enter the Branch Code...\n";
            }

            if (document.getElementById("<%=txtEnBranch.ClientID%>").value == "") {
                message += "You have to enter the Branch Name...\n";
            }


            if (isNaN(document.getElementById("<%=txtBranchCode1.ClientID%>").value)) {
                message += "Branch Code must contain numbers only\n";
            }

            if (message.length > 0) {
                message = "please notice the following requirments:\n\n" + message;
                alert(message);
                return false;
            }
            return true;
        }
        
    </script>
    <style type="text/css">
        .style1
        {
            height: 20px;
        }
    </style>
</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 Branch
                                    </td>
                                </tr>
                            </table>
                            <br/>
                            <!------------------------------------body End1 ----------------------------------------------->
                            <asp:Label ID="Label1" runat="server" Text="" class="fieldError"></asp:Label>
                            <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>
                            <asp:Panel ID="pnlSearch" runat ="server" >
                            <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                <tr>
                                    <td class="tdNormal" style="width: 15%">
                                        Branch Code</td>
                                    <td colspan="4">
                                        <asp:TextBox ID="txtBranchCode" runat="server" class="fieldNormal" Width="250" onKeypress="return KeyPressFuncIsWholeNumber()" 
                                            MaxLength="3"></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="Button1_Click"
                                            OnClientClick="return validate()" />
                                    </td>
                                </tr>
                            </table>
                            </asp:Panel>
                                        <br />
                                        <table border="0" cellpadding="0" cellspacing="0" class="grid_TitleBG_B">
                                            <tr>
                                                <td>
                                                    Branch</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="branch_cd"
                                                CssClass="gridMaster" OnRowCommand="GridView1_RowCommand"
                                                AllowPaging="True" AllowSorting="True" CellPadding="4" ForeColor="#333333" GridLines="None"
                                                OnRowCreated="GridView1_RowCreated" EmptyDataText="There are no Branches" 
                                                onpageindexchanging="GridView1_PageIndexChanging">
                                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                <Columns>
                                                    <asp:BoundField DataField="branch_cd" HeaderText="Branch_Code"/>
                                                    <asp:BoundField DataField="L_NM" HeaderText="Name(EN)" />
                                                    <asp:BoundField DataField="A_NM" HeaderText="Name(AR)" />
                                                    <asp:BoundField DataField="acct_number" HeaderText="Account No"/>
                                                   
                                                    <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="d" Text="Delete" ItemStyle-Width="30px"
                                                        ImageUrl="~/Images/delete.jpg" >
                                                        <ItemStyle Width="30px" />
                                                    </asp:ButtonField>
                                                </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  style="width: 20%">
                                       
                                        <asp:DropDownList ID="ddlPages" runat="server" class="fieldNormal" AutoPostBack="True"
                                            Width="50px" OnSelectedIndexChanged="ddlPages_SelectedIndexChanged">

                                        </asp:DropDownList>
                                         Go To Page
                                    </td>
                                                </tr>                                        
                                            <tr>
                                            
                                                <td>
                                                    <asp:Button ID="btnAdd" runat="server" Text="     Add     " class="Btn_M_Normal"
                                                        OnClick="btnAdd_Click" />
                                                        </td> 
                                            </tr>
                                            
                                        </table>
                                        <br>
                                        <!------------------------------------body End1 ----------------------------------------------->
                                        <asp:Panel ID="pnlControls" runat="server" Width="40%">
                                            <fieldset id="addItem">
                                                <legend id="addItem">Adding new Branch</legend>
                                            </fieldset>
                                            <table border="0" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                                 <tr>
                                                    <td class="tdNormal" style="width:5%">
                                                        Branch Code</td>
                                                        
                                                    <td class="tdNormal" style="width:20%">
                                                        <asp:TextBox ID="txtBranchCode1" runat="server" Width="100%" 
                                                            class="fieldNormal" MaxLength="3" onKeypress="return KeyPressFuncIsWholeNumber()"></asp:TextBox>
                                                    </td>
                                                   <%-- <td class ="tdNormal"></td>--%>
                                                  
                                                  
                                                </tr>
                                                <tr>
                                                    <td class="tdNormal" style="width:5%">
                                                        Branch Name(EN)&nbsp;
                                                    </td>
                                                    <td class="tdNormal" style="width:20%">
                                                        <asp:TextBox ID="txtEnBranch" runat="server" Width="100%" class="fieldNormal" 
                                                            MaxLength="255"></asp:TextBox>
                                                    </td>
                                                      <%--<td class ="tdLong"></td>--%>
                                                  
                                                  
                                                </tr>
                                                <tr>
                                                    <td class ="tdNormal" style="width :5%">Branch Name(AR)</td>
                                                    <td class ="tdNormal" style="width :20%">
                                                        <asp:TextBox ID="txtARBranch" runat="server" class="fieldMultiLine" Rows="4" 
                                                            Width="100%" CssClass="fieldNormal" MaxLength="255"></asp:TextBox>
                                                    </td>
                                                     <%-- <td class ="tdLong"></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" runat="server" Text="   Save   " OnClick="btnSave_Click" OnClientClick ="return validateAccountNo()" class="Btn_M_Normal" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </asp:Panel>
                                        <!------------------------------------body End2 ----------------------------------------------->
                                        <br>
                                    </td>
                                </tr>
                            </table>
                            <!------------------------------------body End2 ----------------------------------------------->
                        </td>
                    </tr>
                </table>
</asp:Content>


