<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MyProfilePage.aspx.cs" Inherits="TruxWebPortal.MyProfilePage" %>
<%@ Import Namespace="TruxWebPortal.Common" %>
<%@ Import Namespace="System.Data" %>

<%@ Register TagPrefix="ucHeader" TagName="truxHeader" Src="header.ascx" %>
<%@ Register TagPrefix="ucFooter" TagName="truxFooter" Src="footer.ascx" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
    <head id="HeadLogin" runat="server">
        <title>My Profile</title>

        <link rel="stylesheet" type="text/css" href="_style/stylesheet.css" title="TRUX7" />
        <link rel="stylesheet" type="text/css" href="_style/TRUX_nav.css" title="TRUX7" />
        <script type="text/javascript" src="js/jquery/jquery-1.11.2.min.js"></script>

        <script src="showhide.js" type="text/javascript"></script>

        <script type="text/javascript">
            window.scrollTo = function() {};

            var ccReceiptKey = '<%= PaymentCCGuid %>';

            window.addEventListener("storage", function (event) {
                if (event.key === ccReceiptKey) {
                try {
                    var receipt = localStorage.getItem(ccReceiptKey);
                    if (receipt.length > 0) {
                        document.getElementById("<%= hfCCReceipt.ClientID %>").value = receipt;
                        if ($("#<%= hfCCReceipt.ClientID %>").val().length > 0) {
                            __doPostBack("<%= btnAddCreditCard.ClientID %>", '');
                        }
                    }
                } finally {
                    localStorage.removeItem(ccReceiptKey);
                }
            }

            });

            var globalPaymentPopup = null;

            function openRequestedPopup(url, isAch) {

                if (globalPaymentPopup == null || globalPaymentPopup.closed) {
                    //document.getElementById("<%= btnAddCreditCard.ClientID %>").disabled = true;
                    globalPaymentPopup = window.open(url, "_blank", "resizable,scrollbars,status");
                }
                else {
                    globalPaymentPopup.focus();
                };
            }

            function ClientValidate(source, arguments) {
                var lastName = $("#" + source.controltovalidate.replace("FirstName", "LastName")).val();
                if ((arguments.Value && arguments.Value.trim()) || (lastName && lastName.trim())) {
                    arguments.IsValid = true;
                } else {
                    arguments.IsValid = false;
                }
            }

            function errorMessage() {
                var isValid = true;

                if (globalPaymentPopup != null && !globalPaymentPopup.closed) {
                    globalPaymentPopup.focus();
                    return false;
                }

                if (typeof Page_ClientValidate === "function") {
                    isValid = Page_ClientValidate("shared");                    
                }

                return isValid;
            }

        </script>

        <style type="text/css">
            .popup { height: 21px; }
        </style>

    </head>
    
    <body>
        <ucHeader:truxHeader ID="Hdr1" runat="server"></ucHeader:truxHeader>
        <div id="main_area">
            <div id="work_area">
                <h1>My Profile</h1>

                <form id="form1" runat="server" autocomplete="off">
                    <asp:ScriptManager ID="ScriptManager1" runat="server">
                                                                                </asp:ScriptManager>
                    <p class="description">
                        <span id="Span19">
                            <asp:Label ID="lblDesc" runat="server"></asp:Label>
                        </span>
                    </p>

                    <div id="add_company" class="full_width">

                        <div class="title_bar_blk">
                            Add Another Account
                        </div>
                        <!-- close Title Bar -->

                        <p class="intro">
                            You can add another account from the current company or another company to your list from same service provider.<a href="_help/registration.aspx#add_accounts" target="_blank">
                                                                                                                                                <img style="margin-left: 5px; vertical-align: middle; width: 18px;" src="_images/help.png" />
                                                                                                                                            </a>
                        </p>
                        <p class="frm_error_lbl">
                            <asp:Label ID="lblAddCompanyMsg" runat="server"></asp:Label>
                        </p>
                        <span id="Span3" style="color: Red;"></span>
                        <label>Invoice Number:</label>
                        <asp:TextBox ID="txtInvoiceNumb" class="textfield" runat="server"></asp:TextBox>
                        <label>Invoice Total:</label>
                        <asp:TextBox class="textfield" ID="txtInvoiceTotal" runat="server"></asp:TextBox>
                        <asp:Button ID="btnAddAccount" runat="server" Text="Submit"
                                    CssClass="default_button" OnClick="btnAddAccount_Click" />
                    </div>

                    <div id="Div1" class="full_width">

                        <div class="title_bar_blk">
                            Update My Email Address
                        </div>
                        <!-- close Title Bar -->

                        <p class="intro">
                            You can update your login email address<a href="_help/profile_management.aspx#modifyemail" target="_blank">
                                                                       <img style="margin-left: 5px; vertical-align: middle; width: 18px;" src="_images/help.png" />
                                                                   </a>
                        </p>
                        <p class="frm_error_lbl">
                            <asp:Label ID="lblUpdateEmailMsg" runat="server"></asp:Label>
                        </p>
                        <label>Current Email Address:</label>
                        <asp:TextBox ID="txtCurrentEmail" class="textfield" disabled="disabled" runat="server"></asp:TextBox>

                        <label>New Email Address:</label>
                        <asp:TextBox ID="txtNewEmail" class="textfield" runat="server"></asp:TextBox>
                        <asp:Button ID="btnEmail" runat="server" Text="Submit" CssClass="default_button" OnClick="btnEmail_Click" OnClientClick=" return confirm('Are you sure you want to replace the email address?'); " />

                    </div>

                    <div id="Div2" class="full_width">

                        <div class="title_bar_blk">
                            Change Password
                        </div>
                        <!-- close Title Bar -->

                        <p class="intro">
                            The new password must be different from the old password.<a href="_help/profile_management.aspx#changepassword" target="_blank">
                                                                                         <img style="margin-left: 5px; vertical-align: middle; width: 18px;" src="_images/help.png" />
                                                                                     </a>
                        </p>
                        <p class="frm_error_lbl">
                            <asp:Label ID="lblChangePWMsg" runat="server"></asp:Label>
                        </p>
                        <span id="Span1" style="color: Red;"></span>

                        <label>Old Password:</label>
                        <asp:TextBox ID="txtOldPW" class="textfield" runat="server" TextMode="Password"></asp:TextBox>
                        <label>New Password:</label>
                        <asp:TextBox ID="txtNewPW" class="textfield" runat="server"
                                     TextMode="Password">
                        </asp:TextBox>
                        <label>
                            Confirm Password:
                            <span class="small">Case Sensitive</span>
                        </label>
                        <asp:TextBox ID="txtNewPW2" class="textfield" runat="server"
                                     TextMode="Password">
                        </asp:TextBox>
                        <asp:Button ID="btnPW" runat="server" Text="Update Password"
                                    CssClass="default_button" OnClick="btnPW_Click" OnClientClick=" return confirm('Are you sure you want to update the password?'); " />

                    </div>

                    <div id="password_reminder" class="full_width">
                        <div class="title_bar_blk">
                            Update My Password Reminder
                        </div>
                        <!-- close Title Bar -->

                        <p class="intro">
                            Select a new Password Reminder Question and provide the appropriate answer.<a href="_help/profile_management.aspx#changereminder" target="_blank">
                                                                                                           <img style="margin-left: 5px; vertical-align: middle; width: 18px;" src="_images/help.png" />
                                                                                                       </a>
                        </p>
                        <p class="frm_error_lbl">
                            <asp:Label ID="lblReminderMsg" runat="server"></asp:Label>
                        </p>
                        <span id="Span2" style="color: Red;"></span>

                        <label>Question: </label>
                        <asp:DropDownList ID="ddlReminder" runat="server" Width="250px">
                        </asp:DropDownList>
                        <label>Answer:</label>
                        <asp:TextBox ID="txtAnswer" class="textfield" runat="server" MaxLength="30"></asp:TextBox>
                        <asp:Button ID="btnReminder" runat="server" Text="Submit"
                                    CssClass="default_button" OnClick="btnReminder_Click" OnClientClick=" return confirm('Are you sure you want to update your reminder question and answer?'); " />
                    </div>
                    
                    <div id="updateCreditCard" class="full_width">
                        <div class="title_bar_blk">
                            Add new credit card
                        </div>
                        <!-- close Title Bar -->

                        <p class="intro">
                            Add a new credit card. <!-- <a href="_help/my_invoices.aspx#newcard" target="_blank">
                                                                                                           <img style="margin-left: 5px; vertical-align: middle; width: 18px;" src="_images/help.png" />
                                                                                                       </a> -->
                        </p>
                        <p class="frm_error_lbl">
                            <asp:Label ID="lblCreditCardError" runat="server"></asp:Label>
                        </p>

                        <div id="option_one" class="payment_option">
                    <asp:Label ID="radCreditCardOnFile" runat="server"
                        Text="Credit Card on File" Checked="True" />
                            <!--
                    <a href="_help/my_invoices.aspx#existingcard" target="_blank">
                        
                        <img style="margin-left: 5px; vertical-align: middle; width: 18px;" src="_images/help.png" />
                    </a>
                            -->
                    <div id="Credit_Card_On_File">
                        Card No.:
        <asp:Label ID="lblCardNumber" runat="server" Text=""></asp:Label>
                        Expiration:
        <asp:Label ID="lblExpirationDate" runat="server" Text=""></asp:Label>
                    </div>
                    <!-- close Credit Card On File -->
                </div>

                        
                 
                        <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                        <ContentTemplate>
                        <div id="New_Credit_Card" style="margin-left: auto; margin-right:auto" class="payment_option">

                                <p class="frm_error_lbl">
                                    <asp:Label ID="lblNewCardMsg" runat="server"></asp:Label>
                                </p>
                                <asp:ValidationSummary ID="ValidationSummary3" runat="server" DisplayMode="List" ValidationGroup="ach" />
                                <asp:ValidationSummary ID="ValidationSummary4" runat="server" DisplayMode="List" ValidationGroup="shared" />
                            
                                <table id="ccInformation">
                                    
                                    <tr>
                                        <td>
                                            <asp:Label ID="lblCardType" runat="server" CssClass="lblPayNow">Card Type: </asp:Label>
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="ddlCardType" runat="server" style="width:auto; margin-right:auto"></asp:DropDownList>
                                        </td>
                                    </tr>
                                    <tr  id="rowCardNumber" runat="server" >
                                        <td>
                                            <asp:Label ID="lblCardNumber2" runat="server" CssClass="lblPayNow">Card Number: </asp:Label>
                                        </td>
                                        <td>
                                            <asp:TextBox class="textfield" ID="txtCardNumb" runat="server"></asp:TextBox>
                                        </td>
                                        <td id="divGlobalPayCVV2" runat="server">
                                            CVV2:<asp:TextBox class="textfield" ID="txtCvv2NewCard" runat="server"></asp:TextBox><a class="cvv2_helplnk" href="_help/my_account.aspx#cvv2help" target="_blank">what's this?</a>
                                        </td>
                                    </tr>
                                    <tr id="rowExpiration" runat="server" >
                                        <td>
                                            <asp:Label ID="lblExpiration" runat="server" CssClass="lblPayNow">Expiration: </asp:Label>
                                        </td>
                                        <td colspan="3">
                                            <asp:DropDownList ID="ddlExpMonth" name="ddlExpMonth" runat="server" CssClass="DropDownList" style="width:auto; margin-right:auto"></asp:DropDownList>
                                            <asp:DropDownList ID="ddlExpYear" name="ddlExpYear" runat="server" CssClass="DropDownList" style="width:auto; margin-right:auto"></asp:DropDownList>
                                        </td>
                                    </tr>
                                </table>
                            

                                
                            
                                <table id="new_card" runat="server" >
                                    <tr>
                                        <td>
                                            <asp:Label ID="lblName" runat="server" CssClass="lblPayNow">Cardholder Name: </asp:Label>
                                        </td>
                                        <td>
                                            <asp:TextBox class="textfield" ID="txtFirstName" runat="server" MaxLength="50"></asp:TextBox><asp:TextBox ID="txtLastName" runat="server" MaxLength="50"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Label ID="lblAddress" runat="server" CssClass="lblPayNow">Address: </asp:Label>
                                        </td>
                                        <td>
                                            <asp:TextBox class="textfield" ID="txtAddress" runat="server" MaxLength="40"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Label ID="lblCity" runat="server" CssClass="lblPayNow">City: </asp:Label>
                                        </td>
                                        <td>
                                            <asp:TextBox class="textfield" ID="txtCity" runat="server" MaxLength="40"></asp:TextBox>
                                        </td>
                                    </tr>
                                    
                                    <tr>
                                        <td>
                                            <asp:Label ID="lblStateProv" runat="server" Text="Province: " CssClass="lblPayNow"></asp:Label>
                                        </td>
                                        <td>
                                            
                    
                                            <asp:DropDownList ID="ddlStateProv" runat="server" CssClass="DropDownList" OnSelectedIndexChanged="ddlStateProv_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList><asp:TextBox class="textfield" ID="txtCountry" runat="server" ReadOnly="True" style="width:auto"></asp:TextBox>
                            
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <span class="lblPayNow">
                                                <asp:RegularExpressionValidator ID="rePostalCode" runat="server"
                                                    ControlToValidate="txtPostalCode" EnableClientScript="true" ErrorMessage="Invalid Postal Code" Text="*" Style="display: inline"
                                                    ValidationExpression="^[a-zA-Z]{1}[0-9]{1}[a-zA-Z]{1}(\s?|[-]?)[0-9]{1}[a-zA-Z]{1}[0-9]{1}$" ValidationGroup="shared">
                                                </asp:RegularExpressionValidator>
         
                                                <asp:Label ID="lblPostalCode" runat="server" Text="Postal Code: "></asp:Label>
                                            </span>
                                        </td>
                                        <td>
                                            <asp:TextBox class="textfield" ID="txtPostalCode" runat="server" MaxLength="10" placeholder="A1A 1A1"></asp:TextBox>
                                        </td>
                                    </tr>
                                    
                                    <tr>
                                        <td>
                                            <span class="lblPayNow">
                                                <asp:RegularExpressionValidator ID="rePhoneNumber" runat="server"
                                                    ControlToValidate="txtPhoneNumber" EnableClientScript="true"  ValidationGroup="shared" Text="*" ErrorMessage="Invalid Phone Number" Style="display: inline"
                                                    ValidationExpression="^([(](?=[0-9]{3}[)]{1}))?[0-9]{3}(([)]?\s?)|([-]?))[0-9]{3}([-]?|\s?)[0-9]{4}$">
                                                </asp:RegularExpressionValidator>
                                                <asp:Label ID="lblPhoneNumber" runat="server">Phone: </asp:Label>
                                        </span>
                                            </td>
                    <td>
                        <asp:TextBox class="textfield" ID="txtPhoneNumber" runat="server" MaxLength="15"></asp:TextBox>
                    </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <span class="lblPayNow">
                                                <asp:RegularExpressionValidator ID="reEmail" runat="server"
                                                    ControlToValidate="txtEmail"  ValidationGroup="shared" EnableClientScript="true" Text="*" ErrorMessage="Invalid Email Address" Style="display: inline"
                                                    ValidationExpression="^([\w-\.+_#$%&*~]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]+|[0-9]{1,3})(\]?)$">
                                                </asp:RegularExpressionValidator>
                                                <asp:Label ID="lblEmail2" runat="server" Style="display: inline">Email: </asp:Label>
                                            </span>
                                        </td>
                                        <td>
                                            <asp:TextBox class="textfield" ID="txtEmail" runat="server" MaxLength="80"></asp:TextBox>
                                        </td>
                                    </tr>
                                    
                                </table>
                            
                            <table>
                                <tr>
                                    <td>&nbsp;</td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td class="style1"></td>
                                    <td class="style1">
                                        <p id="setAsDefault" class="checkbox" runat="server">
                                            <asp:CheckBox ID="chkSetAsDefault" Checked="true" onclick="return false;" runat="server" />Set As Default Card
                                        </p>
                                        <p id="autoPay" class="checkbox" runat="server" style="margin-left:0px">
                                            <asp:RadioButton ID="radRecurring" runat="server" Checked="True"
                                                             GroupName="GroupPayment" Text="" />Auto Pay<br />
                                            <asp:Label ID="lblAutoPay" runat="server" Text=""></asp:Label>
                                        </p>

                                        
                                    </td>
                                </tr>
                            </table>
                            
                        </div>
                        </ContentTemplate>
                        </asp:UpdatePanel>
                        <span id="Span4" style="color: Red;"></span>
                        <asp:HiddenField ID="hfCCReceipt" runat="server" />
                                                <asp:Button ID="btnAddCreditCard" runat="server" Text="Add Credit Card"
                                    CssClass="default_button"  OnClientClick="return errorMessage(); " OnClick="btnAddCreditCard_Click"  />
                    </div>
                            

                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>

                            <div id="divContacts"  runat="server" class="full_width">
                                <div class="title_bar_blk">
                                    Add/Update Contact Information
                                </div>
                                <!-- close Title Bar -->

                                <p class="intro">
                                    Update current contacts or add new ones.<a href="_help/profile_management.aspx#changereminder" target="_blank">
                                                                                <img style="margin-left: 5px; vertical-align: middle; width: 18px;" src="_images/help.png" />
                                                                                
                                                                            </a>
                                </p>
                                <div style="padding: 0 5px 0 5px">


                                    <p class="frm_error_lbl">
                                        <asp:Label ID="lblContactInformation" runat="server"></asp:Label>
                                    </p>
                                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" Display="Static" ValidationGroup="UpdateContactGrid" DisplayMode="List" />
                                    <asp:ValidationSummary ID="ValidationSummary2" runat="server" Display="Static" ValidationGroup="AddContactGrid" DisplayMode="List" />
                                    <asp:GridView ID="gvContactInformation" runat="server" AutoGenerateColumns="False" CssClass="mGrid contactsGrid" ShowFooter="True" OnRowEditing="gvContactInformation_RowEditing" OnRowUpdating="gvContactInformation_RowUpdating" OnRowCancelingEdit="gvContactInformation_RowCancelingEdit" OnRowDeleting="gvContactInformation_RowDeleting" OnRowCommand="gvContactInformation_RowCommand">
                                        <AlternatingRowStyle CssClass="alt_row" />
                                        <Columns>
                                            <asp:TemplateField HeaderText="First Name">
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="editFirstName" MaxLength="50" runat="server" Text='<%# Bind("FirstName") %>'></asp:TextBox>
                                                    <asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="ClientValidate" ValidateEmptyText="true" ControlToValidate="editFirstName" Display="None" ErrorMessage="First or last name is required." ValidationGroup="UpdateContactGrid"></asp:CustomValidator>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("FirstName") %>'></asp:Label>
                                                </ItemTemplate>
                                                <FooterTemplate>
                                                    <asp:TextBox ID="addFirstName" MaxLength="50" runat="server"></asp:TextBox>
                                                    <asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="ClientValidate" ValidateEmptyText="true" ControlToValidate="addFirstName" Display="None" ErrorMessage="First or last name is required." ValidationGroup="AddContactGrid"></asp:CustomValidator>
                                                </FooterTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Middle Name">
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="TextBox2" MaxLength="50" runat="server" Text='<%# Bind("MiddleName") %>'></asp:TextBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("MiddleName") %>'></asp:Label>
                                                </ItemTemplate>
                                                <FooterTemplate>
                                                    <asp:TextBox ID="addMiddleName" MaxLength="50" runat="server"></asp:TextBox>
                                                </FooterTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Last Name">
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="editLastName" MaxLength="50" runat="server" Text='<%# Bind("LastName") %>'></asp:TextBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("LastName") %>'></asp:Label>
                                                </ItemTemplate>
                                                <FooterTemplate>
                                                    <asp:TextBox ID="addLastName" MaxLength="50" runat="server"></asp:TextBox>
                                                </FooterTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Position">
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="TextBox4" MaxLength="150" runat="server" Text='<%# Bind("Title") %>'></asp:TextBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("Title") %>'></asp:Label>
                                                </ItemTemplate>
                                                <FooterTemplate>
                                                    <asp:TextBox ID="addTitle" MaxLength="150" runat="server"></asp:TextBox>
                                                </FooterTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Phone">
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="txtEditPhone" MaxLength="10" placeholder="9999999999" runat="server" Text='<%# Bind("PhoneNumber") %>'></asp:TextBox>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtEditPhone" ErrorMessage="Phone number must be 10 Digits ex. 1234567890" ValidationExpression="^(\d{10})?$" Display="None" ValidationGroup="UpdateContactGrid"></asp:RegularExpressionValidator>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="Label5" runat="server" Text='<%# Bind("PhoneNumber") %>'></asp:Label>
                                                </ItemTemplate>
                                                <FooterTemplate>
                                                    <asp:TextBox ID="txtAddPhone" MaxLength="10" placeholder="9999999999" runat="server"></asp:TextBox>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtAddPhone" ErrorMessage="Phone number must be 10 Digits ex. 1234567890" ValidationExpression="^(\d{10})?$" Display="None" ValidationGroup="AddContactGrid"></asp:RegularExpressionValidator>
                                                </FooterTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Ext.">
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="txtEditExtension" MaxLength="6" runat="server" Text='<%# Bind("PhoneExtension") %>'></asp:TextBox>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ControlToValidate="txtEditExtension" ErrorMessage="Extension must be 1 or more digits." ValidationExpression="^\d*$" ValidationGroup="UpdateContactGrid" Display="None"></asp:RegularExpressionValidator>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="Label6" runat="server" Text='<%# Bind("PhoneExtension") %>'></asp:Label>
                                                </ItemTemplate>
                                                <FooterTemplate>
                                                    <asp:TextBox ID="txtAddExtension" MaxLength="6" runat="server"></asp:TextBox>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ControlToValidate="txtAddExtension" ErrorMessage="Extension must be 1 or more digits." ValidationExpression="^\d*$" ValidationGroup="AddContactGrid" Display="None"></asp:RegularExpressionValidator>
                                                </FooterTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Fax">
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="txtEditFax" runat="server" placeholder="9999999999" MaxLength="10" Text='<%# Bind("FaxNumber") %>'></asp:TextBox>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="txtEditFax" ErrorMessage="Fax number must be 10 Digits ex. 1234567890" ValidationExpression="^(\d{10})?$" ValidationGroup="UpdateContactGrid" Display="None"></asp:RegularExpressionValidator>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="Label7" runat="server" Text='<%# Bind("FaxNumber") %>'></asp:Label>
                                                </ItemTemplate>
                                                <FooterTemplate>
                                                    <asp:TextBox ID="txtAddFax" placeholder="9999999999" MaxLength="10" runat="server"></asp:TextBox>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="txtAddFax" ErrorMessage="Fax number must be 10 Digits ex. 1234567890" ValidationExpression="^(\d{10})?$" ValidationGroup="AddContactGrid" Display="None"></asp:RegularExpressionValidator>
                                                </FooterTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Mobile">
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="txtEditMobile" MaxLength="10" placeholder="9999999999" runat="server" Text='<%# Bind("MobileNumber") %>'></asp:TextBox>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" ControlToValidate="txtEditMobile" ErrorMessage="Mobile number must be 10 Digits ex. 1234567890" ValidationExpression="^(\d{10})?$" ValidationGroup="UpdateContactGrid" Display="None"></asp:RegularExpressionValidator>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="Label8" runat="server" Text='<%# Bind("MobileNumber") %>'></asp:Label>
                                                </ItemTemplate>
                                                <FooterTemplate>
                                                    <asp:TextBox ID="txtAddMobile"  MaxLength="10" placeholder="9999999999" runat="server"></asp:TextBox>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" ControlToValidate="txtAddMobile" ErrorMessage="Mobile number must be 10 Digits ex. 1234567890" ValidationExpression="^(\d{10})?$" ValidationGroup="AddContactGrid" Display="None"></asp:RegularExpressionValidator>
                                                </FooterTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Email">
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="txtEditEmail" MaxLength="80" placeholder="user@domain.com" runat="server" Text='<%# Bind("EmailAddress") %>'></asp:TextBox>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator6" runat="server" ControlToValidate="txtEditEmail" ErrorMessage="Invalid email address" ValidationExpression="^([\w-\.+_#$%&*~]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]+|[0-9]{1,3})(\]?)$" ValidationGroup="UpdateContactGrid" Display="None"></asp:RegularExpressionValidator>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="Label9" runat="server" Text='<%# Bind("EmailAddress") %>'></asp:Label>
                                                </ItemTemplate>
                                                <FooterTemplate>
                                                    <asp:TextBox ID="txtaddEmail" MaxLength="80" placeholder="user@domain.com" runat="server"></asp:TextBox>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator6" runat="server" ControlToValidate="txtaddEmail" ErrorMessage="Invalid email address" ValidationExpression="^([\w-\.+_#$%&*~]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]+|[0-9]{1,3})(\]?)$" ValidationGroup="AddContactGrid" Display="None"></asp:RegularExpressionValidator>
                                                </FooterTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField ShowHeader="False">
                                                <EditItemTemplate>
                                                    <asp:Button ID="Button1" runat="server" CausesValidation="True" CommandName="Update" Text="Update" ValidationGroup="UpdateContactGrid" />
                                                    &nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Button ID="Button1" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" />
                                                </ItemTemplate>
                                                <FooterTemplate>
                                                    <asp:Button CssClass="gridButton" ID="Button1" runat="server" CausesValidation="True" CommandName="Add" Text="Add" ValidationGroup="AddContactGrid" />
                                                </FooterTemplate>
                                                <ControlStyle CssClass="gridButton" />
                                            </asp:TemplateField>
                                            <asp:CommandField ButtonType="Button" ShowDeleteButton="True">
                                                <ControlStyle CssClass="gridButton" />
                                            </asp:CommandField>

                                        </Columns>
                                        <HeaderStyle CssClass="col_headers" />
                                        <RowStyle CssClass="wrap"></RowStyle>
                                    </asp:GridView>


                                </div>

                            </div>

                            <div id="divNotificationSettings" runat="server" class="full_width">
                                <div class="title_bar_blk">
                                    Update Notification Settings
                                </div>

                                <p class="intro">
                                    Update contact notification settings.<a href="_help/profile_management.aspx#changereminder" target="_blank">
                                                                             <img style="margin-left: 5px; vertical-align: middle; width: 18px;" src="_images/help.png" />
                                                                         </a>
                                </p>

                                <div style="padding: 0 5px 0 5px">
                                    <p class="frm_error_lbl">
                                        <asp:Label ID="lblContactNotification" runat="server"></asp:Label>
                                    </p>
                                
                                    <div id="email_invoice" runat="server">
                                        <div style="font-weight: bold;">
                                            Email Invoice To:&nbsp;&nbsp;&nbsp;<asp:TextBox ID="txtEmailInvoice"
                                                                                            runat="server" Width="612px" MaxLength="80" />&nbsp;&nbsp;&nbsp;
                                            <asp:Button ID="btnUpdate" Text="Update" OnClick="btnUpdate_Click" OnClientClick=" return confirm('Are you sure you want to update the Email?'); " runat="server" CssClass="gridButton"></asp:Button>
                                        </div>
                                   
                                    </div>
                                    <br/>
                                    <asp:GridView ID="gvContactNotification" runat="server" CssClass="mGrid contactsGrid" AutoGenerateColumns="False" OnRowEditing="gvContactNotification_RowEditing" OnRowUpdating="gvContactNotification_RowUpdating" OnRowCancelingEdit="gvContactNotification_RowCancelingEdit" OnDataBound="gvContactNotification_DataBound">
                                        <AlternatingRowStyle CssClass="alt_row" />
                                        <Columns>
                                            <asp:TemplateField HeaderText="First Name">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblFirstName" runat="server" Text='<%# Bind("firstName") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Last Name">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblLastName" runat="server" Text='<%# Bind("lastName") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Invoice">
                                                <EditItemTemplate>
                                                    <asp:CheckBox ID="TextBox1" runat="server" Checked='<%# bool.Parse(Eval("InvoiceSubscription").ToString()) %>'></asp:CheckBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:CheckBox Enabled="False" ID="Label1" runat="server" Checked='<%# bool.Parse(Eval("InvoiceSubscription").ToString()) %>'></asp:CheckBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Statement">
                                                <EditItemTemplate>
                                                    <asp:CheckBox ID="TextBox2" runat="server" Checked='<%# bool.Parse(Eval("StatementSubscription").ToString()) %>'></asp:CheckBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:CheckBox Enabled="False" ID="Label2" runat="server" Checked='<%# bool.Parse(Eval("StatementSubscription").ToString()) %>'></asp:CheckBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Overdue Letter">
                                                <EditItemTemplate>
                                                    <asp:CheckBox ID="TextBox3" runat="server" Checked='<%# bool.Parse(Eval("OverdueLetterSubscription").ToString()) %>'></asp:CheckBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:CheckBox Enabled="False" ID="Label3" runat="server" Checked='<%# bool.Parse(Eval("OverdueLetterSubscription").ToString()) %>'></asp:CheckBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField Visible="False" HeaderText="Customer Issue">
                                                <EditItemTemplate>
                                                    <asp:CheckBox ID="TextBox4" runat="server" Checked='<%# bool.Parse(Eval("CustomerIssueSubscription").ToString()) %>'></asp:CheckBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:CheckBox Enabled="False" ID="Label4" runat="server" Checked='<%# bool.Parse(Eval("CustomerIssueSubscription").ToString()) %>'></asp:CheckBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Payment Receipt">
                                                <EditItemTemplate>
                                                    <asp:CheckBox ID="TextBox5" runat="server" Checked='<%# bool.Parse(Eval("OnlinePaymentReceiptSubscription").ToString()) %>'></asp:CheckBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:CheckBox Enabled="False" ID="Label5" runat="server" Checked='<%# bool.Parse(Eval("OnlinePaymentReceiptSubscription").ToString()) %>'></asp:CheckBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Disposal Ticket">
                                                <EditItemTemplate>
                                                    <asp:CheckBox ID="TextBox6" runat="server" Checked='<%# bool.Parse(Eval("DisposalTicketTransactionInvoiceSubscription").ToString()) %>'></asp:CheckBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:CheckBox Enabled="False" ID="Label6" runat="server" Checked='<%# bool.Parse(Eval("DisposalTicketTransactionInvoiceSubscription").ToString()) %>'></asp:CheckBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Disposal Ticket">
                                                <EditItemTemplate>
                                                    <asp:CheckBox ID="TextBox7" runat="server" Checked='<%# bool.Parse(Eval("DisposalTicketSubscription").ToString()) %>'></asp:CheckBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:CheckBox Enabled="False" ID="Label7" runat="server" Checked='<%# bool.Parse(Eval("DisposalTicketSubscription").ToString()) %>'></asp:CheckBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Work Order">
                                                <EditItemTemplate>
                                                    <asp:CheckBox ID="TextBox8" runat="server" Checked='<%# bool.Parse(Eval("WorkOrderSubscription").ToString()) %>'></asp:CheckBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:CheckBox Enabled="False" ID="Label8" runat="server" Checked='<%# bool.Parse(Eval("WorkOrderSubscription").ToString()) %>'></asp:CheckBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Announcements">
                                                <EditItemTemplate>
                                                    <asp:CheckBox ID="TextBox9" runat="server" Checked='<%# bool.Parse(Eval("AnnouncementSubscription").ToString()) %>'></asp:CheckBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:CheckBox Enabled="False" ID="Label9" runat="server" Checked='<%# bool.Parse(Eval("AnnouncementSubscription").ToString()) %>'></asp:CheckBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Price Increase">
                                                <EditItemTemplate>
                                                    <asp:CheckBox ID="TextBox10" runat="server" Checked='<%# bool.Parse(Eval("PriceIncreaseSubscription").ToString()) %>'></asp:CheckBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:CheckBox Enabled="False" ID="Label10" runat="server" Checked='<%# bool.Parse(Eval("PriceIncreaseSubscription").ToString()) %>'></asp:CheckBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Route Change">
                                                <EditItemTemplate>
                                                    <asp:CheckBox ID="TextBox11" runat="server" Checked='<%# bool.Parse(Eval("RouteModelingNotificationLetterSubscription").ToString()) %>'></asp:CheckBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:CheckBox Enabled="False" ID="Label11" runat="server" Checked='<%# bool.Parse(Eval("RouteModelingNotificationLetterSubscription").ToString()) %>'></asp:CheckBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField Visible="False" HeaderText="Online Bin Order Receipt">
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Credit Card Expiration">
                                                <EditItemTemplate>
                                                    <asp:CheckBox ID="TextBox13" runat="server" Checked='<%# bool.Parse(Eval("CreditCardExpirationSubscription").ToString()) %>'></asp:CheckBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:CheckBox Enabled="False" ID="Label13" runat="server" Checked='<%# bool.Parse(Eval("CreditCardExpirationSubscription").ToString()) %>'></asp:CheckBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Bill of Lading">
                                                <EditItemTemplate>
                                                    <asp:CheckBox ID="TextBox14" runat="server" Checked='<%# bool.Parse(Eval("BillOfLadingSubscription").ToString()) %>'></asp:CheckBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:CheckBox Enabled="False" ID="Label14" runat="server" Checked='<%# bool.Parse(Eval("BillOfLadingSubscription").ToString()) %>'></asp:CheckBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Price Increase">
                                                <EditItemTemplate>
                                                    <asp:CheckBox ID="TextBox15" runat="server" Checked='<%# bool.Parse(Eval("PriceIncreaseWeighItSubscription").ToString()) %>'></asp:CheckBox>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:CheckBox Enabled="False" ID="Label15" runat="server" Checked='<%# bool.Parse(Eval("PriceIncreaseWeighItSubscription").ToString()) %>'></asp:CheckBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField ShowHeader="False">
                                                <EditItemTemplate>
                                                    <asp:Button ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update" Text="Update" ValidationGroup="UpdateNotificationGrid"></asp:Button>
                                                    &nbsp;<asp:Button ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:Button>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Button CssClass="gridButton" ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit"></asp:Button>
                                                </ItemTemplate>
                                                <ControlStyle CssClass="gridButton" />
                                            </asp:TemplateField>
                                        </Columns>
                                        <RowStyle CssClass="wrap"/>
                                        <HeaderStyle CssClass="col_headers" />
                                    </asp:GridView>
                                </div>
                            </div>
                        </ContentTemplate>
                        <Triggers>
                            <asp:PostBackTrigger ControlID="btnUpdate" />
                        </Triggers>
                    </asp:UpdatePanel>

                </form>
            </div>

        </div>

        <ucFooter:truxFooter ID="Ftr1" runat="server"></ucFooter:truxFooter>

    </body>
</html>