<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="SchemeMaster.aspx.vb" Inherits="FinIQWebApp.SchemeMaster" MasterPageFile="~/FiniqAppMasterPage.Master" Title="Scheme Master" MaintainScrollPositionOnPostback="true" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server"></asp:ScriptManagerProxy>

    <style type="text/css">
        .tdbrk {
            width: 5px;
        }

        .deactivate {
            width: 200px;
            /*padding-right: 10px;*/ /*Commented by Bhagyashri B*/
            /*padding-left: 5px;*/
        }

        .ActiveN span {
            color: red !important;
        }

        .button {
            Width: 100px;
        }

        .lowerdiv {
            padding-top: 10px;
        }

        .upperdiv {
            padding-top: 6px;
            padding-left: 5px;
            border: none;
        }

        .gridCol1 {
            width: 160px;
        }

        .gridCol {
            width: 100px;
        }

        .displayNone {
            display: none;
        }

        /*Added by Bhagyashri B 07-01-2020*/
        .width_8_char {
            width: 8ch;
            max-width: 8ch;
        }

        .width_16_char {
            width: 16ch;
            max-width: 16ch;
        }

        .width_24_char {
            width: 24ch;
        }
        /*End By bhagyashri B*/

        .GridHeader {
            background-color: #ededed !important;
        }
    </style>

    <script type="text/javascript">

        function AllowCharactersOnly(e) {
            var keycode;
            if (window.event)
                keycode = window.event.keyCode;
            else if (event)
                keycode = event.keyCode;
            else if (e)
                keycode = e.which;
            else return true;
            if ((keycode > 64 && keycode < 91) || (keycode > 96 && keycode < 123) || (keycode == 95)) { return true; }
            else { return false; } return true;
        }

        function EnterEvent(e) {
            //alert(e.keyCode)
            if (e.keyCode == 13 || e.keyCode == 9) {
                document.getElementById('<%=btnEnter.ClientID%>').click();
            }
        }

    </script>

    <div class="upperdiv">
        <table id="tbMain" runat="server" style="border-spacing: 5px 10px; border-collapse: separate;">

            <tr class="tdbrk">
                <%--<asp:TextBox ID="txtSearch" runat="server" Width="100px" CssClass="txt" AutoPostBack="True"  ></asp:TextBox>--%>
                <td>
                    <asp:Button ID="btnEnter" runat="server" class="displayNone" />
                    <asp:Label ID="lblScheme" runat="server" Text="Scheme"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtSearch" runat="server" Style="width: 65ch;" CssClass="txt" onfocus="this.select();" onmouseup="return false;" onkeydown="return EnterEvent(event)" textchanged=""></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="btnLoad" runat="server" Text="Load" CssClass="btn button" />
                </td>
                <td>
                    <asp:Button ID="btnInsert" runat="server" Text="Insert" CssClass="btn button" Style="margin-right: 5px;" />
                    <asp:Button ID="btnUpdate" runat="server" Text="Update" CssClass="btn button" Style="margin-right: 5px;" />
                    <asp:Button ID="btnExport" runat="server" CssClass="btn button" Text="Export" Style="margin-right: 5px;" />
                    <%--<asp:Button ID="btnCancel" runat="server" Width="100px" Text="Cancel"  CssClass="btn button" />--%>
                    <asp:Button ID="btnDelete" runat="server" Text="Delete" CssClass="btn button" Style="margin-right: 5px;" />
                    <asp:CheckBox ID="chkDeactivate" runat="server" Text="Include Deactivated" AutoPostBack="True" class="deactivate" />
                </td>
                <td>
                    <asp:TextBox ID="txtRows" runat="server" onfocus="this.select();" onmouseup="return false;" MaxLength="3" Text="99" Style="margin-left: 10px; text-align: right;" AutoPostBack="true" Width="35px" onkeypress="return isNumberKey(event)"></asp:TextBox>
                    <asp:Label ID="lblrows" runat="server" Text="Rows Per Page"></asp:Label>
                    <asp:Label ID="lblRowCount" runat="server" CssClass="lbl" Style="padding-left: 10px;">Total Record(s): </asp:Label>
                    <asp:Label ID="lblTotRecord" runat="server" CssClass="lbl" Style="padding-right: 25px;"></asp:Label>
                    <asp:Label ID="lblErrorMsg" runat="server" CssClass="lblError"></asp:Label>
                    <asp:Label ID="lblError" runat="server" CssClass="lblError"></asp:Label>
                </td>
            </tr>
        </table>
    </div>

    <div class="lowerdiv">
        <table id="Table1" runat="server" style="margin-left: 7px;">
            <tr>
                <td>
                    <asp:GridView ID="grdSchemeCode" runat="server" ShowHeaderWhenEmpty="true" EmptyDataText="No Records Found" BorderWidth="1"
                        rules="All" ShowHeader="true" AllowPaging="True" PageSize="20" PagerStyle-Height="32px"
                        AutoGenerateColumns="false" HeaderStyle-CssClass="GridHeaderTitle" Width="100%"
                        CssClass="Grid" CellPadding="0" RowHeadersWidthSizeMode="DisableResizing;" SelectedRowStyle-Wrap="false"
                        CellSpacing="0">

                        <SelectedRowStyle CssClass="GridItemSelect" />
                        <RowStyle CssClass="GridItem" />
                        <HeaderStyle CssClass="GridHeader" />
                        <FooterStyle CssClass="GridFooter" />
                        <PagerStyle CssClass="GridPager" />

                        <PagerSettings Mode="NumericFirstLast"
                            FirstPageText="First"
                            LastPageText="Last"
                            Position="Bottom" />

                        <EmptyDataTemplate>
                            <asp:Label ID="lbldatagrid" runat="server" CssClass="lbl" Text="No data found."></asp:Label>
                        </EmptyDataTemplate>
                        <Columns>

                            <asp:TemplateField Visible="false">
                                <HeaderTemplate>
                                    <asp:CheckBox ID="chkAll" runat="server" AutoPostBack="true" OnCheckedChanged="CheckUncheckAll" />
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:CheckBox ID="chkSelect" runat="server" AutoPostBack="true" OnCheckedChanged="CountCheckedRows"></asp:CheckBox>
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:CommandField ControlStyle-Font-Underline="false" ButtonType="Link" ShowEditButton="true" CancelText="Cancel" UpdateText=""
                                EditText="Edit" ItemStyle-CssClass="width_8_char" HeaderStyle-CssClass="width_8_char" ItemStyle-HorizontalAlign="Center"
                                HeaderStyle-HorizontalAlign="Center"></asp:CommandField>

                            <asp:TemplateField HeaderText="Alias">
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="False" CssClass="width_24_char"></HeaderStyle>
                                <ItemStyle HorizontalAlign="left" Wrap="true" CssClass="width_24_char" />
                                <ItemTemplate>
                                    <asp:Label ID="lblSchemeAlias" CssClass="width_24_char" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Scheme_Alias").ToString)%>'>
                                    </asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtSchemeAlias" runat="server" onfocus="this.select();" onmouseup="return false;" CssClass="txt width_24_char" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Scheme_Alias").ToString)%>' OnKeyPress=" return AllowCharactersOnly(this);" />
                                </EditItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="Name">
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="False" CssClass="width_24_char"></HeaderStyle>
                                <ItemStyle HorizontalAlign="left" Wrap="true" CssClass="width_24_char" />
                                <ItemTemplate>
                                    <asp:Label ID="lblSchemeName" CssClass="width_24_char" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Scheme_Name").ToString)%>'>
                                    </asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtSchemeName" runat="server" onfocus="this.select();" onmouseup="return false;" CssClass="txt width_24_char" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Scheme_Name").ToString)%>' />
                                </EditItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="Strategy Prefix">
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="False" CssClass="width_24_char"></HeaderStyle>
                                <ItemStyle HorizontalAlign="left" Wrap="true" CssClass="width_24_char" />
                                <ItemTemplate>
                                    <asp:Label ID="lblStrategyPrefix" CssClass="width_24_char" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Strategy_Prefix").ToString)%>'>
                                    </asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtStrategyPrefix" runat="server" onfocus="this.select();" onmouseup="return false;" CssClass="txt width_24_char" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Strategy_Prefix").ToString)%>' />
                                </EditItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="Product">
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="False" CssClass="width_16_char"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Left" Wrap="false" CssClass="width_16_char" />
                                <ItemTemplate>
                                    <asp:Label ID="lblProduct" CssClass="width_16_char" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Product_Code").ToString)%>'>
                                    </asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:DropDownList ID="ddlProduct" runat="server" CssClass="ddl width_16_char">
                                    </asp:DropDownList>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <%--  --%>

                            <asp:TemplateField HeaderText="Flow YN" Visible="false"> <%--Visible-false added by TejaswiniB discussed with RukhsarS--%>
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="true" CssClass="width_8_char"></HeaderStyle>
                                <ItemStyle HorizontalAlign="center" Wrap="false" CssClass="width_8_char" />
                                <ItemTemplate>
                                    <asp:Label ID="lblFlowYN" CssClass="width_8_char" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Flow_YN").ToString)%>'>
                                    </asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:DropDownList ID="ddlFlowYN" runat="server" CssClass="ddl width_8_char">
                                        <asp:ListItem Value="Y">Y</asp:ListItem>
                                        <asp:ListItem Value="N">N</asp:ListItem>
                                    </asp:DropDownList>
                                </EditItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="Active YN">
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="False" CssClass="width_8_char"></HeaderStyle>
                                <ItemStyle HorizontalAlign="center" Wrap="false" CssClass="width_8_char" />
                                <ItemTemplate>
                                    <asp:Label ID="lblActiveYN" CssClass="width_8_char" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Active_YN").ToString)%>'>
                                    </asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:DropDownList ID="ddlActiveYN" runat="server" CssClass="ddl width_8_char">
                                        <asp:ListItem Value="Y">Y</asp:ListItem>
                                        <asp:ListItem Value="N">N</asp:ListItem>
                                    </asp:DropDownList>
                                </EditItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="Scheme Code">
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="False"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Center" Wrap="false" />
                                <ItemTemplate>
                                    <asp:Label ID="lblSchemeCode" CssClass="lbl" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Scheme_Code").ToString)%>'>
                                    </asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtSchemeCode" runat="server" onfocus="this.select();" onmouseup="return false;" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Scheme_Code").ToString)%>' />
                                </EditItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="Security No. Type">
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="False"></HeaderStyle>
                                <ItemStyle HorizontalAlign="left" Wrap="false" />
                                <ItemTemplate>
                                    <asp:Label ID="lblSecurityNoType" CssClass="lbl" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Security_No_type").ToString)%>'>
                                    </asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:DropDownList ID="ddlSecurityNoType" runat="server" CssClass="ddl">
                                    </asp:DropDownList>
                                </EditItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="Visibility Map">
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="False"></HeaderStyle>
                                <ItemStyle HorizontalAlign="left" Wrap="false" />
                                <ItemTemplate>
                                    <asp:Label ID="lblVisibilityMap" CssClass="lbl" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Visibility_Map").ToString)%>'>
                                    </asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtVisibilityMap" runat="server" CssClass="txt" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Visibility_Map").ToString)%>' />
                                </EditItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="Offering">
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="False"></HeaderStyle>
                                <ItemStyle HorizontalAlign="left" Wrap="false" />
                                <ItemTemplate>
                                    <asp:Label ID="lblOfferingType" CssClass="lbl" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Offering").ToString)%>'>
                                    </asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:DropDownList ID="ddlOfferingType" runat="server" CssClass="ddl">
                                    </asp:DropDownList>
                                </EditItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="WM Active Y/N">
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="False"></HeaderStyle>
                                <ItemStyle HorizontalAlign="center" Wrap="false" />
                                <ItemTemplate>
                                    <asp:Label ID="lblWMActiveYN" CssClass="lbl" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.WM_ActiveYN").ToString)%>'>
                                    </asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:DropDownList ID="ddlWMActiveYN" runat="server" CssClass="ddl">
                                    </asp:DropDownList>
                                </EditItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="WM Y/N">
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="False"></HeaderStyle>
                                <ItemStyle HorizontalAlign="center" Wrap="false" />
                                <ItemTemplate>
                                    <asp:Label ID="lblWMYN" CssClass="lbl" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.WM_YN").ToString)%>'>
                                    </asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:DropDownList ID="ddlWMYN" runat="server" CssClass="ddl">
                                    </asp:DropDownList>
                                </EditItemTemplate>
                            </asp:TemplateField>

                        </Columns>
                    </asp:GridView>
                    <asp:HiddenField ID="hdnRowIndex" runat="server" />
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
