<%@ Page Language="C#" MasterPageFile="~/masterpage/MasterPage.master" AutoEventWireup="true"
    CodeFile="UserCommission.aspx.cs" Inherits="calogin_UserCommission" Title="eGen Services" %>

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

<script language="javascript" type="text/javascript">
        function fixedlength(textboxID, keyEvent, maxlength) {
            //validation for digits upto 'maxlength' defined by caller function
            if (textboxID.value.length > maxlength) {
                textboxID.value = textboxID.value.substr(0, maxlength);
            }
            else if (textboxID.value.length < maxlength || textboxID.value.length == maxlength) {
                textboxID.value = textboxID.value.replace(/[^\d]+/g, '');
                return true;
            }
            else
                return false;
        }

        function numericFilter(txb) {
            txb.value = txb.value.replace(/[^\0-9]/ig, "");
        }
 </script>
 <script type="text/javascript" language="javascript">
     function DisableRightClick(event) {

         //For mouse right click

         if (event.button == 2) {

             alert("Right Clicking not allowed!");

         }

     }

     function DisableCtrlKey(e) {

         var code = (document.all) ? event.keyCode : e.which;

         var message = "Ctrl key functionality is disabled!";

         // look for CTRL key press

         if (parseInt(code) == 17) {

             //alert(message);

             window.event.returnValue = false;

         }

     }

    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">


    <div id="request">
        

        <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
        
            <tr><td colspan="4" class="hdr"></td></tr>
            
            <tr>
                        <td width="25%">
                            &nbsp;
                        </td>
                        <td width="14%" style="text-align:right">
                            Select Service
                        </td>
                        <td width="4%" style="text-align:center">
                            <strong>:</strong>
                        </td>
                        <td width="54%">
                            <asp:DropDownList ID="DropDownList3" runat="server" Width="225px" 
                                AutoPostBack="true" 
                                onselectedindexchanged="DropDownList3_SelectedIndexChanged">
                                <asp:ListItem Value="0">Select Type</asp:ListItem>
                                <asp:ListItem Value="1">Recharge</asp:ListItem>
                                <asp:ListItem Value="2">Bill Payment</asp:ListItem>
                                <asp:ListItem Value="4">Money Transfer</asp:ListItem>
                                 <asp:ListItem Value="5">Flight</asp:ListItem>
                                <asp:ListItem Value="3">Other</asp:ListItem>
                            </asp:DropDownList>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please Select Service" ControlToValidate="DropDownList3"
                                 InitialValue="Select Type" ></asp:RequiredFieldValidator>
                        </td>
                    </tr>
            <tr>
                <td style="height: 30px" colspan="4">
                    
                </td>
            </tr>
            
            
            <tr>
                <td colspan="7">
                    
                    <asp:GridView ID="GVWlRechargeComm" runat="server" AutoGenerateColumns="false" 
                        GridLines="None"  Width="100%" HorizontalAlign="Center" ShowFooter="True" DataKeyNames="MobileDthOperatorID">
                        <FooterStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <PagerStyle BackColor="#dddee0" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <EditRowStyle BackColor="#2461BF" />
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                                    <asp:TemplateField>
                                        <ItemTemplate >
                                            <asp:CheckBox ID="chkbox" runat="server" />
                                            <%#Container.DataItemIndex + 1 %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Operator" ItemStyle-Width="170">
                                        <ItemTemplate>
                                            <asp:Label ID="lblOperator" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.OperatorName") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>                                    
                                    <asp:BoundField HeaderText="Service" DataField="OperatorType" ItemStyle-Width="170"/>                                    
                                    <asp:TemplateField HeaderText="My Margin" ItemStyle-Width="170">
                                        <ItemTemplate>
                                            <asp:Label ID="lblWlCommission" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.WlCommInPercentag") %>'></asp:Label>%
                                            <%--<asp:TextBox ID="txtCommission" Width="95px" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.WlCommInPercentag") %>'></asp:TextBox>%--%>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    
                                    <asp:TemplateField HeaderText="DSMargin(in%)" ItemStyle-Width="170">
                                        <ItemTemplate>
                                            <asp:TextBox ID="DsCommission" Width="95px" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.DSMargin") %>'
                                                onKeyUp="numericFilter(this);" oncopy="return false"  onpaste="return false" oncut="return false" onmousedown="DisableRightClick(event)" onkeydown="return DisableCtrlKey(event)" autocomplete="off"></asp:TextBox>%
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                      
                                    <asp:TemplateField HeaderText="Margin(in %)" ItemStyle-Width="170">
                                        <ItemTemplate>
                                            <asp:TextBox ID="UserCommission" Width="95px" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.UserCommInPercentag") %>'  onKeyUp="numericFilter(this);"></asp:TextBox>%
                                        </ItemTemplate>
                                    </asp:TemplateField>                                                                     
                                </Columns>
                        <EditRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <AlternatingRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:GridView>
                    
                    <asp:GridView ID="GVWlBillPayComm" runat="server" AutoGenerateColumns="false" 
                        GridLines="None"  Width="100%" HorizontalAlign="Center" ShowFooter="True" 
                        DataKeyNames="MobileDthOperatorID,WlCommInPercentag,WlSerCharInPercentag,WlSerChaInRS" 
                        onrowdatabound="GVWlBillPayComm_RowDataBound">
                        <FooterStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <PagerStyle BackColor="#dddee0" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <EditRowStyle BackColor="#2461BF" />
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                                    <asp:TemplateField>
                                        <ItemTemplate >
                                            <asp:CheckBox ID="chkbox" runat="server" />
                                            <%#Container.DataItemIndex+1 %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Operator" ItemStyle-Width="120">
                                        <ItemTemplate>
                                            <asp:Label ID="lblOperator" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.OperatorName") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>                                    
                                    <asp:BoundField HeaderText="Service" DataField="OperatorType" ItemStyle-Width="120"/>
                                    <asp:TemplateField HeaderText="My Margin" ItemStyle-Width="120">
                                        <ItemTemplate>
                                        <asp:Label ID="lblWlCommInPercentag" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.wlmargin") %>'></asp:Label>                                           
                                        </ItemTemplate>
                                    </asp:TemplateField>  
                                    <asp:TemplateField HeaderText="WlCommInPercentag"  Visible="false">
                                        <ItemTemplate>
                                        <asp:Label ID="WlCommInPercentag" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.WlCommInPercentag") %>'></asp:Label>                                           
                                        </ItemTemplate>
                                    </asp:TemplateField> 
                                    <asp:TemplateField HeaderText="WlSerCharInPercentag"  Visible="false">
                                        <ItemTemplate>
                                        <asp:Label ID="WlSerCharInPercentag" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.WlSerCharInPercentag") %>'></asp:Label>                                           
                                        </ItemTemplate>
                                    </asp:TemplateField>  
                                    <asp:TemplateField HeaderText="WlSerChaInRS"  Visible="false">
                                        <ItemTemplate>
                                        <asp:Label ID="WlSerChaInRS" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.WlSerChaInRS") %>'></asp:Label>                                           
                                        </ItemTemplate>
                                    </asp:TemplateField>                                 
                                    <asp:TemplateField HeaderText="Margin(in %)" ItemStyle-Width="120">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtUserCommInPercentag" Width="65px" MaxLength="3" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.UserCommInPercentag") %>' onKeyUp="numericFilter(this);"></asp:TextBox>%
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Charges (in %)" ItemStyle-Width="120">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtUserSerCharInPercentag" Width="65px" MaxLength="3" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.UserSerChaInPercentag") %>' onKeyUp="numericFilter(this);"></asp:TextBox>%
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Charges (in Rs.)" ItemStyle-Width="120">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtUserSerChaInRS" Width="65px" MaxLength="3" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.UserSerCharInRS") %>' onblur="return fixedlength(this, event, 2);" onkeypress="return fixedlength(this, event, 2);" onkeyup="return fixedlength(this, event, 2);"></asp:TextBox>Rs
                                        </ItemTemplate>
                                    </asp:TemplateField>                                                                       
                                </Columns>
                        <EditRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <AlternatingRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:GridView>
                    
                    <asp:GridView ID="GVOtherServices" runat="server" AutoGenerateColumns="false" 
                        GridLines="None"  Width="100%" HorizontalAlign="Center" ShowFooter="True" 
                        onrowdatabound="GVOtherServices_RowDataBound" DataKeyNames="WlCommInPercentag,WlSerChaInRS,MobileDthOperatorID">
                        <FooterStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <PagerStyle BackColor="#dddee0" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <EditRowStyle BackColor="#2461BF" />
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:TemplateField>
                                <ItemTemplate >
                                    <asp:CheckBox ID="chkbox" runat="server" />
                                    <%#Container.DataItemIndex+1 %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Operator" ItemStyle-Width="140">
                                <ItemTemplate>
                                    <asp:Label ID="lblOperator" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.OperatorName") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>                                    
                            <asp:BoundField HeaderText="Service" DataField="OperatorType" ItemStyle-Width="140"/>       
                            
                            <asp:BoundField HeaderText="My Margin" DataField="wlmargin" ItemStyle-Width="140"/>  
                             
                            <asp:TemplateField HeaderText="WlCommInPercentag"  Visible="false">
                                <ItemTemplate>
                                    <asp:Label ID="WlCommInPercentag" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.WlCommInPercentag") %>'></asp:Label>                                           
                                </ItemTemplate>
                             </asp:TemplateField> 
                                           
                             <asp:TemplateField HeaderText="WlSerChaInRS"  Visible="false">
                                        <ItemTemplate>
                                        <asp:Label ID="WlSerChaInRS" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.WlSerChaInRS") %>'></asp:Label>                                           
                                        </ItemTemplate>
                             </asp:TemplateField> 
                                                         
                            <asp:TemplateField HeaderText="Margin(in %)" ItemStyle-Width="140">
                                <ItemTemplate>
                                    <asp:TextBox ID="txtUserCommInPercentag" Width="85px" MaxLength="3"  runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.UserCommInPercentag") %>' onKeyUp="numericFilter(this);"></asp:TextBox>%
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Margin(in Rs.)" ItemStyle-Width="140">
                                <ItemTemplate>
                                    <asp:TextBox ID="txtUserSerCharInRs" Width="85px" MaxLength="3" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.UserSerCharInRS") %>' onblur="return fixedlength(this, event, 1);" onkeypress="return fixedlength(this, event, 1);" onkeyup="return fixedlength(this, event, 1);"></asp:TextBox>Rs.
                                </ItemTemplate>
                            </asp:TemplateField>                                                                                                          
                         </Columns>
                        <EditRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <AlternatingRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:GridView>

                    <asp:GridView ID="GVDMR" runat="server" AutoGenerateColumns="false" 
                        GridLines="None"  Width="100%" HorizontalAlign="Center" ShowFooter="True" DataKeyNames="MobileDthOperatorID">
                        <FooterStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <PagerStyle BackColor="#dddee0" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <EditRowStyle BackColor="#2461BF" />
                        <AlternatingRowStyle BackColor="White" />
                       <Columns>
                                    <asp:TemplateField>
                                        <ItemTemplate >
                                            <asp:CheckBox ID="chkbox" runat="server" />
                                            <%#Container.DataItemIndex + 1 %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Operator" ItemStyle-Width="170">
                                        <ItemTemplate>
                                            <asp:Label ID="lblOperator" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.OperatorName") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>                                    
                                    <asp:BoundField HeaderText="Service" DataField="OperatorType" ItemStyle-Width="170"/>                                    
                                    <asp:TemplateField HeaderText="My Margin" ItemStyle-Width="170">
                                        <ItemTemplate>
                                            <asp:Label ID="lblWlCommission" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.WlCommInPercentag") %>'></asp:Label>%
                                            <%--<asp:TextBox ID="txtCommission" Width="95px" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.WlCommInPercentag") %>'></asp:TextBox>%--%>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    
                                    <asp:TemplateField HeaderText="DSMargin(in%)" ItemStyle-Width="170">
                                        <ItemTemplate>
                                            <asp:TextBox ID="DsCommission" Width="95px" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.DSMargin") %>'
                                                onKeyUp="numericFilter(this);" oncopy="return false"  onpaste="return false" oncut="return false" onmousedown="DisableRightClick(event)" onkeydown="return DisableCtrlKey(event)" autocomplete="off"></asp:TextBox>%
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                      
                                    <asp:TemplateField HeaderText="Margin(in %)" ItemStyle-Width="170">
                                        <ItemTemplate>
                                            <asp:TextBox ID="UserCommission" Width="95px" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.UserCommInPercentag") %>'  onKeyUp="numericFilter(this);"></asp:TextBox>%
                                        </ItemTemplate>
                                    </asp:TemplateField>                                                                     
                                </Columns>
                        <EditRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <AlternatingRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:GridView>

                    <asp:GridView ID="GVTravel" runat="server" AutoGenerateColumns="false" 
                        GridLines="None"  Width="100%" HorizontalAlign="Center" ShowFooter="True" DataKeyNames="MobileDthOperatorID" Visible=false>
                        <FooterStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <PagerStyle BackColor="#dddee0" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <EditRowStyle BackColor="#2461BF" />
                        <AlternatingRowStyle BackColor="White" />
                       <Columns>
                                    <asp:TemplateField>
                                        <ItemTemplate >
                                            <asp:CheckBox ID="chkbox" runat="server" />
                                            <%#Container.DataItemIndex + 1 %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Operator" ItemStyle-Width="170">
                                        <ItemTemplate>
                                            <asp:Label ID="lblOperator" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.OperatorName") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>                                    
                                    <asp:BoundField HeaderText="Service" DataField="OperatorType" ItemStyle-Width="170"/>                                    
                                    <asp:TemplateField HeaderText="My Margin" ItemStyle-Width="170">
                                        <ItemTemplate>
                                            <asp:Label ID="lblWlCommission" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.WlCommInPercentag") %>'></asp:Label>%
                                            <%--<asp:TextBox ID="txtCommission" Width="95px" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.WlCommInPercentag") %>'></asp:TextBox>%--%>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    
                                    <asp:TemplateField HeaderText="DSMargin(in%)" ItemStyle-Width="170">
                                        <ItemTemplate>
                                            <asp:TextBox ID="DsCommission" Width="95px" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.DSMargin") %>'
                                                onKeyUp="numericFilter(this);" oncopy="return false"  onpaste="return false" oncut="return false" onmousedown="DisableRightClick(event)" onkeydown="return DisableCtrlKey(event)" autocomplete="off"></asp:TextBox>%
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                      
                                    <asp:TemplateField HeaderText="Margin(in %)" ItemStyle-Width="170">
                                        <ItemTemplate>
                                            <asp:TextBox ID="UserCommission" Width="95px" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.UserCommInPercentag") %>'  onKeyUp="numericFilter(this);"></asp:TextBox>%
                                        </ItemTemplate>
                                    </asp:TemplateField>                                                                     
                                </Columns>
                        <EditRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <AlternatingRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:GridView>

                </td>
            </tr>
            <tr><td colspan="4" style="height:30px"></td></tr>
                    <tr><td colspan="4" style="text-align:center"><asp:Button ID="btnSubmit" 
                            runat="server" Text="Submit" CssClass="button active" 
                            onclick="btnSubmit_Click" /></td></tr>
            <tr>
                <td colspan="4" style="height: 30px"><asp:ScriptManager ID="ScriptManager1" runat="server">
                    </asp:ScriptManager>
                </td>
            </tr>
        </table>
    </div>  
</asp:Content>
