<%@ Page Title="Edit Employee" Language="C#" MasterPageFile="~/Master/MasterPage.master" AutoEventWireup="true" CodeBehind="Employee_Edit.aspx.cs" Inherits="PirTickets.Employee_Edit" %>

<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="server">
    <style type="text/css">
        .style3
        {
            width: 460px;
        }
        .style4
        {
            width: 494px;
        }
        .style6
        {
            width: 145px;
        }
        .style7
        {
            width: 169px;
        }
        .style8
        {
            width: 137px;
        }
        .style9
        {
        }
        .style10
        {
            width: 174px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">


    <table cellpadding="2" border="0">
    <tr><td colspan="4">
        <asp:Label ID="lblheader" runat="server"></asp:Label></td></tr>
    <tr>
        <td class="style8">Employee ID:</td>
        <td><span style="color:red;"></span></td>
        <td class="style9">
            <asp:Label ID="lblEmpId" runat="server" Font-Bold="True"></asp:Label>
        </td>
        <td class="style1">
        </td>
    </tr>
    <tr>
        <td class="style8">Username:</td>
        <td>&nbsp;</td>
        <td class="style9" colspan="2">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:TextBox ID="txtUsername" runat="server" MaxLength="50" 
                ontextchanged="txtUsername_TextChanged" Width="230px" AutoPostBack="True"></asp:TextBox>
            <asp:Label ID="lblExists" runat="server"></asp:Label>
            <asp:UpdateProgress ID="UpdateProgress1" runat="server" 
                AssociatedUpdatePanelID="UpdatePanel1" DisplayAfter="100">
            </asp:UpdateProgress>
            </ContentTemplate>
            </asp:UpdatePanel>
        </td>
    </tr>
    </table>
    
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" 
        MultiPageID="RadMultiPage1" SelectedIndex="0">
       <Tabs>
    <telerik:RadTab runat="server" PageViewID="RadPageView1" 
                Text="Details" />
    <telerik:RadTab runat="server" PageViewID="RadPageView2" 
                Text="Contact Details" />
 <telerik:RadTab runat="server" PageViewID="RadPageView3" 
                Text="Repairs in Progress" Selected="True" />                
 <telerik:RadTab runat="server" PageViewID="RadPageView4" 
                Text="Repairs Completed" Selected="True" />  
    </Tabs>
    </telerik:RadTabStrip>
    <telerik:RadMultiPage ID="RadMultiPage1" runat="server"  SelectedIndex="0" >
        <telerik:RadPageView ID="RadPageView1" runat="server">
    
            <table>
                <tr>
                    <td class="style7">
                        Title:</td>
                    <td>
                    </td>
                    <td class="style6">
                        <asp:TextBox ID="TxtTitle" runat="server" MaxLength="20" Width="82px" /></td><td 
                        class="style1"></td></tr><tr><td class="style7">First Name:</td><td><span 
                        style="color:red;">*</span></td><td class="style6"><asp:TextBox 
                            ID="TxtFirstName" runat="server" MaxLength="50" /></td><td 
                        class="style1"><asp:RequiredFieldValidator ID="RequiredFieldValidator1" 
                            runat="server" ControlToValidate="TxtFirstName" 
                            ErrorMessage="First Name is Required" ValidationGroup="a"></asp:RequiredFieldValidator></td></tr><tr><td 
                        class="style7">Middle Name:</td><td></td><td class="style6"><asp:TextBox 
                        ID="TxtMiddleName" runat="server" MaxLength="30" Width="145px" /></td><td 
                        class="style1"></td></tr><tr><td class="style7">Last Name:</td><td><span 
                        style="color:red;">*</span></td><td class="style6"><asp:TextBox 
                            ID="TxtLastName" runat="server" MaxLength="50" Width="254px" /></td><td 
                        class="style1"><asp:RequiredFieldValidator ID="RequiredFieldValidator2" 
                            runat="server" ControlToValidate="TxtLastName" 
                            ErrorMessage="Last Name is Required" ValidationGroup="a"></asp:RequiredFieldValidator></td></tr><tr><td 
                        class="style7">Security Level:</td><td><span style="color:red;">*</span></td><td 
                        class="style6"><asp:DropDownList ID="DDsecurity" runat="server" 
                        DataSourceID="SqlDataSourceSecurity" DataTextField="security_level_description" 
                        DataValueField="id"></asp:DropDownList><asp:SqlDataSource 
                        ID="SqlDataSourceSecurity" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:PirTickets %>" 
                        SelectCommand="SELECT [id], [security_level_description] FROM [security_levels]"></asp:SqlDataSource></td><td 
                        class="style1"></td></tr><tr><td class="style7" valign="top">Location:</td><td>&nbsp;</td><td 
                        class="style6"><asp:DropDownList ID="ddSites" runat="server" 
                        DataSourceID="SqlDataSites" DataTextField="sitename" DataValueField="id"></asp:DropDownList><asp:SqlDataSource 
                        ID="SqlDataSites" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:PirTickets %>" 
                        SelectCommand="SELECT [id], [sitename] FROM [sites]"></asp:SqlDataSource></td><td 
                        class="style1">&nbsp;</td></tr><tr><td class="style7">Email:</td><td></td><td 
                        class="style6"><asp:TextBox ID="TxtEmailName" runat="server" MaxLength="50" 
                        Width="341px" /></td><td class="style1"><asp:RegularExpressionValidator 
                            ID="RegularExpressionValidator1" runat="server" 
                            ControlToValidate="TxtEmailName" ErrorMessage="Incorrect Format" 
                            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" 
                            ValidationGroup="a"></asp:RegularExpressionValidator></td></tr><tr><td 
                        class="style7">Password:</td><td><span style="color:red;">*</span></td><td 
                        class="style6"><asp:TextBox ID="txtPassword" runat="server"></asp:TextBox><asp:RequiredFieldValidator 
                        ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtPassword" 
                        ErrorMessage="Password Required" ValidationGroup="a"></asp:RequiredFieldValidator></td><td 
                        class="style1">&nbsp;</td></tr><tr><td class="style7">Confirm Password:</td><td>&nbsp;</td><td 
                        class="style6"><asp:TextBox ID="TxtPassConfirm" runat="server"></asp:TextBox><asp:CompareValidator 
                        ID="CompareValidator1" runat="server" ControlToCompare="txtPassword" 
                        ControlToValidate="TxtPassConfirm" ErrorMessage="Passwords don't match"></asp:CompareValidator></td><td 
                        class="style1">&nbsp;</td></tr></table></telerik:RadPageView><telerik:RadPageView ID="RadPageView2" runat="server">
    <table><tr><td class="style10">Address:</td><td class="style4"><asp:TextBox ID="TxtAddress" 
                    runat="server" MaxLength="255" Width="231px" /></td><td class="style1"></td></tr><tr><td 
                class="style10">City:</td><td class="style4"><asp:TextBox ID="TxtCity" 
                    runat="server" MaxLength="50" Width="225px" /></td><td class="style1"></td></tr><tr><td 
                class="style10">State:</td><td class="style4"><asp:TextBox ID="TxtState" 
                    runat="server" MaxLength="50" Width="165px" /></td><td class="style1"></td></tr><tr><td 
                class="style10">Region:</td><td class="style4"><asp:TextBox ID="TxtRegion" 
                    runat="server" MaxLength="50" /></td><td class="style1"></td></tr><tr><td 
                class="style10">Postal Code:</td><td class="style4"><asp:TextBox 
                    ID="TxtPostalCode" runat="server" MaxLength="20" Width="92px" /></td><td 
                class="style1"></td></tr><tr><td class="style10">Country:</td><td 
                    class="style4"><asp:TextBox ID="TxtCountry" runat="server" MaxLength="50" /></td><td 
                    class="style1"></td></tr><tr><td class="style10">Home Phone:</td><td 
                    class="style4"><asp:TextBox ID="TxtHomePhone" runat="server" 
                    MaxLength="30" /></td><td class="style1"></td></tr><tr><td 
                class="style10">Work Phone:</td><td class="style4"><asp:TextBox 
                    ID="TxtWorkPhone" runat="server" MaxLength="30" />&nbsp;Extension: <asp:TextBox 
                    ID="TxtExtension" runat="server" MaxLength="30" Width="73px" /></td><td></td></tr><tr><td 
                class="style10">Department Name:</td><td class="style4"><asp:TextBox 
                    ID="TxtDepartmentName" runat="server" MaxLength="50" Width="306px" /></td><td 
                class="style1"></td></tr><tr><td class="style10">Birthdate:</td><td 
                    class="style4"><asp:TextBox ID="TxtBirthdate" runat="server" 
                    MaxLength="23" /></td><td class="style1"></td></tr><tr><td 
                class="style10">Emergency Contact Name:</td><td class="style4"><asp:TextBox 
                    ID="TxtEmrgcyContactName" runat="server" MaxLength="50" Width="291px" /></td><td 
                class="style1" rowspan="4"><asp:ValidationSummary ID="ValidationSummary1" 
                    runat="server" ShowMessageBox="True" ValidationGroup="a" /></td></tr><tr><td 
                    class="style10">Emergency Contact Phone:</td><td class="style4"><asp:TextBox 
                        ID="TxtEmrgcyContactPhone" runat="server" MaxLength="30" /></td></tr></table>
   </telerik:RadPageView>
   <telerik:RadPageView ID="RadPageView3" runat="server">
  <asp:GridView 
                ID="GridView1" runat="server" AutoGenerateSelectButton="True" CellPadding="4" 
                EmptyDataText="No Repairs for this Employee" ForeColor="#333333" onselectedindexchanged="GridView1_SelectedIndexChanged" 
                Width="750px" AutoGenerateColumns="False" DataKeyNames="OrderID" 
           DataSourceID="SqlDatacompleterepairs" AllowPaging="True" 
           AllowSorting="True" ShowFooter="True"><RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
      <Columns>
          <asp:BoundField DataField="OrderID" HeaderText="ID" ReadOnly="True" 
              SortExpression="OrderID" />
          <asp:BoundField DataField="manufacturer" HeaderText="Manufacturer" 
              SortExpression="manufacturer" />
          <asp:BoundField DataField="ModelName" HeaderText="Model" 
              SortExpression="ModelName" />
          <asp:BoundField DataField="Received" HeaderText="Received" ReadOnly="True" 
              SortExpression="Received" />
          <asp:BoundField DataField="priority_name" HeaderText="Priority" 
              SortExpression="priority_name" />
          <asp:BoundField DataField="status_name" HeaderText="Status" 
              SortExpression="status_name" />
          <asp:BoundField DataField="SerialNumber" HeaderText="Serial" 
              SortExpression="SerialNumber" />
          <asp:CheckBoxField DataField="UneconomicalToRepair" HeaderText="BER" 
              SortExpression="UneconomicalToRepair" />
          <asp:BoundField DataField="externalref" HeaderText="Ref" 
              SortExpression="externalref" />
      </Columns>
      <FooterStyle 
                BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><PagerStyle 
                BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /><SelectedRowStyle 
                BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /><HeaderStyle 
                BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><EditRowStyle 
                BackColor="#999999" /><AlternatingRowStyle BackColor="White" 
                ForeColor="#284775" /></asp:GridView>
                <asp:SqlDataSource ID="SqlDatacompleterepairs" runat="server" 
           ConnectionString="<%$ ConnectionStrings:PirTickets %>" 
           SelectCommand="SELECT [OrderID], [manufacturer], [ModelName], [priority_name], [Received], [SerialNumber], [status_name],[UneconomicalToRepair],[externalref] FROM [vwRepairsbyEmployees] WHERE (([AssignedTechnician] = @AssignedTechnician) AND ([RepairCompleted] is null or [RepairCompleted] = 0 ))">
                    <SelectParameters>
                        <asp:QueryStringParameter Name="AssignedTechnician" QueryStringField="empid" 
                            Type="Int32" />
                      
                    </SelectParameters>
       </asp:SqlDataSource>
                </telerik:RadPageView>
                 <telerik:RadPageView ID="RadPageView4" runat="server">
           <asp:GridView 
                ID="GridView2" runat="server" AutoGenerateSelectButton="True" CellPadding="4" 
                EmptyDataText="No Repairs for this Employee" ForeColor="#333333" onselectedindexchanged="GridView2_SelectedIndexChanged" 
                Width="750px" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" 
                         DataKeyNames="OrderID" DataSourceID="SqlDataRepairsinProgress" 
                         ShowFooter="True"><RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
               <Columns>
                   <asp:BoundField DataField="OrderID" HeaderText="ID" ReadOnly="True" 
                       SortExpression="OrderID" />
                   <asp:BoundField DataField="manufacturer" HeaderText="Manufacturer" 
                       SortExpression="manufacturer" />
                   <asp:BoundField DataField="ModelName" HeaderText="Model" 
                       SortExpression="ModelName" />
                   <asp:BoundField DataField="Received" HeaderText="Received" ReadOnly="True" 
                       SortExpression="Received" />
                   <asp:BoundField DataField="priority_name" HeaderText="Priority" 
                       SortExpression="priority_name" />
                   <asp:BoundField DataField="status_name" HeaderText="Status" 
                       SortExpression="status_name" />
                   <asp:BoundField DataField="SerialNumber" HeaderText="Serial" 
                       SortExpression="SerialNumber" />
                   <asp:CheckBoxField DataField="UneconomicalToRepair" HeaderText="BER" 
                       SortExpression="UneconomicalToRepair" />
                   <asp:BoundField DataField="externalref" HeaderText="Ref" 
                       SortExpression="externalref" />
               </Columns>
               <FooterStyle 
                BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><PagerStyle 
                BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /><SelectedRowStyle 
                BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /><HeaderStyle 
                BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><EditRowStyle 
                BackColor="#999999" /><AlternatingRowStyle BackColor="White" 
                ForeColor="#284775" /></asp:GridView>
                     <asp:SqlDataSource ID="SqlDataRepairsinProgress" runat="server" 
                         ConnectionString="<%$ ConnectionStrings:PirTickets %>" 
                         SelectCommand="SELECT [OrderID], [manufacturer], [ModelName], [Received], [priority_name], [status_name], [SerialNumber],[UneconomicalToRepair],[externalref] FROM [vwRepairsbyEmployees] WHERE (([AssignedTechnician] = @AssignedTechnician) AND ([RepairCompleted] = @RepairCompleted)) ORDER BY [OrderID]">
                         <SelectParameters>
                             <asp:QueryStringParameter Name="AssignedTechnician" QueryStringField="empid" 
                                 Type="Int32" />
                             <asp:Parameter DefaultValue="true" Name="RepairCompleted" Type="Boolean" />
                         </SelectParameters>
                     </asp:SqlDataSource>
          </telerik:RadPageView>
     </telerik:RadMultiPage>
         
    <table>
        <tr>
            <td class="style3">&nbsp;</td><td></td>
            <td class="style6">
            <asp:UpdatePanel ID="UpdatePanel2" runat="server">
            <ContentTemplate>
                <asp:Button ID="BtnUpdate" runat="server" Text="Save" 
                    onclick="BtnUpdate_Click" />   &nbsp;&nbsp; <asp:Button ID="BtnCancel" CausesValidation="false" runat="server" 
                    Text="Cancel" onclick="BtnCancel_Click" />
                                       
                </ContentTemplate>
                </asp:UpdatePanel>
                                       
            </td>
        </tr>
        <tr>
            <td class="style3">&nbsp;</td><td>&nbsp;</td><td class="style6">
                &nbsp;</td></tr></table></asp:Content>