<%@ Page Language="C#" MasterPageFile="~/Master/MasterPage.master" AutoEventWireup="true" Inherits="PirTickets.TicketForm" Title="Ticket" Codebehind="TicketForm.aspx.cs"  ViewStateEncryptionMode="Never"  %>

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

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

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h2>Book in New Repair</h2>
    <table cellpadding="2" border="0">
        <tr>
            <td>Date Received:</td>
            <td>           </td>
            <td colspan="3">
                <asp:TextBox ID="txtDateReceived" runat="server" ReadOnly="True"></asp:TextBox>
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td valign="top">Received By:</td>
            <td valign="top">           &nbsp;</td>
            <td valign="top">
                <asp:Label ID="lblReceiver" runat="server" Text="Label"></asp:Label>
            </td>
            <td valign="top">
                Location:</td>
            <td>
                <asp:DropDownList ID="ddSites" runat="server" DataSourceID="SqlDataSites" 
                    DataTextField="sitename" DataValueField="id" 
                    onselectedindexchanged="ddSites_SelectedIndexChanged">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataSites" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:PirTickets %>" 
                    SelectCommand="SELECT [id], [sitename] FROM [sites]"></asp:SqlDataSource>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td valign="top">Customer ID:</td>
            <td valign="top"> 
            <asp:UpdatePanel ID="UpdatePanel9" runat="server">
                <ContentTemplate>         
                <asp:TextBox ID="txtretval" runat="server" Width="30px" AutoPostBack="True" 
                    ontextchanged="txtretval_TextChanged" MaxLength="5"></asp:TextBox>
                    </ContentTemplate>
                    </asp:UpdatePanel>
            </td>
            <td colspan="3">
                <asp:UpdatePanel ID="UpdatePanel7" runat="server">
                <ContentTemplate>
                <asp:DropDownList ID="DDCustomerID" runat="server" 
                    onselectedindexchanged="DDCustomerID_SelectedIndexChanged" AutoPostBack="True">
                </asp:DropDownList>
                
                <script type="text/javascript">
                        //<![CDATA[
                        function openRadWin() {
                            radopen("CustomerSearch.aspx", "Select Customer");
                        }
                        /* Called when a window is being closed. */
                        function OnClientClose(radWindow) {
                            //Another option for passing a callback value  
                            //Set the radWindow.Argument property in the dialog  
                            if (radWindow.argument) {
                                var oArea = document.getElementById("ctl00_ContentPlaceHolder1_txtretval");
                                oArea.value = radWindow.argument;
                                __doPostBack('ctl00$ContentPlaceHolder1$txtretval','');
                            }
                            else {
                                alert("No customer was selected");
                                oArea.value = "";
                            }
                            //Do cleanup if necessary  
                        }     
   
                        //]]>                                                                        
                 </script>

                    <input ID="Button1" type="button" value="Search" onclick="openRadWin();" />&nbsp;<asp:Button 
                        ID="btCustNew" runat="server" onclick="btCustNew_Click" Text="New" />
                    <br />
                    <asp:Label ID="lblcustfound" runat="server" ForeColor="Blue" Text="Label" 
                        Visible="False"></asp:Label>
                <br />
                    Search:&nbsp; Name / ID: <asp:TextBox ID="txtUserID" runat="server" MaxLength="20" 
                        Width="91px"></asp:TextBox>
                    &nbsp;Phone No: <asp:TextBox ID="txtPhoneSearch" runat="server" MaxLength="20" 
                        Width="105px"></asp:TextBox>
                    <asp:Button ID="btSearch" runat="server" onclick="btSearch_Click" Text="Find" />
                    <asp:UpdateProgress ID="UpdateProgress1" runat="server" 
                        AssociatedUpdatePanelID="UpdatePanel7" DisplayAfter="0">
                    </asp:UpdateProgress>
                </ContentTemplate>
                </asp:UpdatePanel>
            </td>
            <td></td>
        </tr>
        <tr>
            <td valign="top" colspan="5"><hr /></td>
            <td>&nbsp;</td>
        </tr>
 
 
         <tr>
            <td valign="top">Manufacturer Name:</td>
            <td></td>
            <td colspan="3">
              <asp:UpdatePanel ID="UpdatePanel1" runat="server">
               <ContentTemplate>
                <asp:DropDownList ID="ddManufacturer" runat="server" 
                    DataSourceID="SqlDataManufacturer" DataTextField="manufacturer" 
                    DataValueField="id" 
                    onselectedindexchanged="ddManufacturer_SelectedIndexChanged" 
                       AutoPostBack="True">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataManufacturer" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:PirTickets %>" 
                    SelectCommand="SELECT [id], [manufacturer] FROM [Manufacturers] order by [manufacturer]">
                </asp:SqlDataSource>
                </ContentTemplate>
                </asp:UpdatePanel>
             </td>
            <td></td>
        </tr>
         <tr>
            <td valign="top">New Manufacturer:</td>
            <td>&nbsp;</td>
            <td colspan="3">
                <asp:TextBox ID="txtOtherMan" runat="server" MaxLength="50"></asp:TextBox>
             &nbsp;<asp:Button ID="btOtherMan" runat="server" onclick="btOtherMan_Click" 
                    style="width: 154px" Text="Add Manufacturer" />
             </td>
            <td>&nbsp;</td>
        </tr>
         <tr>
            <td valign="top" colspan="5"><hr /></td>
            <td>&nbsp;</td>
        </tr>
         <tr>
            <td valign="top">Model:<br />
             </td>
            <td></td>
            <td colspan="3">                
            <asp:UpdatePanel ID="UpdatePanel6" runat="server">
               <ContentTemplate>
                <asp:DropDownList ID="DDLModel" runat="server" DataSourceID="SqlDataModel" 
                    DataTextField="ModelName" DataValueField="modelid" 
                       onselectedindexchanged="DDLModel_SelectedIndexChanged">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataModel" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:PirTickets %>" 
                    SelectCommand="SELECT [modelid], [ModelName] FROM [Models] WHERE ([manufacturerID] = @manufacturerID) ORDER BY ModelName">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="ddManufacturer" Name="manufacturerID" 
                            PropertyName="SelectedValue" Type="Int32" />
                    </SelectParameters>
                </asp:SqlDataSource>
                </ContentTemplate>
                </asp:UpdatePanel></td>
            <td></td>
        </tr> 
         <tr>
            <td valign="top">Unknown model:</td>
            <td>&nbsp;</td>
            <td colspan="3"><asp:TextBox ID="TxtModelNew" MaxLength="50" runat="server" 
                    Width="230px" />&nbsp;<asp:Button ID="btModel" runat="server" 
                    onclick="btModel_Click" Text="Add Model" />
             </td>
            <td>&nbsp;</td>
        </tr> 
         <tr>
            <td valign="top" colspan="5"><hr /></td>
            <td>&nbsp;</td>
        </tr> 
        <tr>
            <td valign="top">Serial Number:</td>
            <td>&nbsp;</td>
            <td colspan="3">  <asp:UpdatePanel ID="UpdatePanel2" runat="server">
               <ContentTemplate>
                <asp:TextBox ID="txtSerial" runat="server" MaxLength="50" 
                    ontextchanged="txtSerial_TextChanged" Width="146px" AutoPostBack="True"></asp:TextBox>
                    <asp:HyperLink ID="hlPrevious" runat="server" Visible="False" Target="_blank">Previous Repair History</asp:HyperLink>
                    </ContentTemplate>
                    </asp:UpdatePanel>
            </td>  <td>&nbsp;</td></tr> 
        <tr>
            <td>External Reference No.</td>
                  <td>  &nbsp;</td>
                    <td colspan="3">
                        <asp:TextBox ID="txtref" runat="server" MaxLength="150" Width="431px"></asp:TextBox>
                    </td>
                    <td>
                        &nbsp;</td>
        </tr>
                  
        <tr>
            <td valign="top">Equipment Description:</td>
            <td></td>
            <td colspan="3">
                <telerik:RadTextBox ID="TxtEquipmentDescription" Runat="server" 
                    Rows="10" TextMode="MultiLine" Width="517px" MaxLength="200">
                </telerik:RadTextBox>
            </td>
            <td></td>
        </tr>
        <tr>
            <td valign="top">Problem Description:</td>
            <td></td>
            <td colspan="3">
                <telerik:RadTextBox ID="TxtProblemDescription" Runat="server" Width="517px"  
                    Rows="10" TextMode="MultiLine" MaxLength="500">
                </telerik:RadTextBox>
            </td>
            <td></td>
        </tr>
         <tr>
            <td>&nbsp;</td>
            <td></td>
            <td colspan="3">&nbsp;</td>
            <td></td>
        </tr>
        <tr>
            <td>Preffered Shippping:</td>
            <td></td>
            <td colspan="3"><asp:DropDownList ID="TxtShipVia" MaxLength="50" runat="server" /></td>
            <td></td>
        </tr>
        <tr>
            <td>Assigned Technician:</td>
            <td></td>
            <td colspan="3">
                <asp:UpdatePanel ID="UpdatePanel8" runat="server">
                <ContentTemplate>
            <asp:DropDownList ID="TxtAssignedTechnician"  runat="server" 
                    Width="142px" Enabled="False" />&nbsp;<asp:CheckBox ID="cbAssign" runat="server" 
                    Text="Assign" oncheckedchanged="CheckBox1_CheckedChanged" 
                        AutoPostBack="True" />
                    </ContentTemplate>
                    </asp:UpdatePanel>
            </td>
            <td></td>
        </tr>
      
        <tr>
            <td>Date Promised:</td>
            <td></td>
            <td colspan="3">
                <telerik:RadDatePicker ID="DPDatePromised" Runat="server">
                </telerik:RadDatePicker>
            </td>
            <td></td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lblBag" runat="server" Text="With Laptop Bag:"></asp:Label>
            </td>
            <td></td>
            <td colspan="3"><asp:CheckBox ID="CbxWithBezel"  runat="server" /></td>
            <td></td>
        </tr>

        <tr>
            <td>
                <asp:Label ID="lblCharger" runat="server" Text="With Charger:"></asp:Label>
            </td>
            <td></td>
            <td colspan="3"><asp:CheckBox ID="CbxWithPowerCord"  runat="server" /></td>
            <td></td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lblBatt" runat="server" Text="With Battery:"></asp:Label>
            </td>
            <td></td>
            <td colspan="3"><asp:CheckBox ID="CbxWithSignalCable"  runat="server" /></td>
            <td></td>
        </tr>
        <tr>
            <td>Warranty Work:</td>
            <td></td>
            <td colspan="3">
                <asp:UpdatePanel ID="UpdatePanel3" runat="server">
                <ContentTemplate>
            <asp:CheckBox ID="CbxWarrantyWork"  runat="server" 
                    oncheckedchanged="CbxWarrantyWork_CheckedChanged" AutoPostBack="True" />
                    </ContentTemplate>
                </asp:UpdatePanel>
                    </td>
            <td></td>
        </tr>
        <tr>
            <td>
            <asp:UpdatePanel ID="UpdatePanel4" runat="server">
                <ContentTemplate>
                <asp:Label ID="lblWarranty" runat="server" Text="Warranty Expires:"></asp:Label>
                 </ContentTemplate>
                </asp:UpdatePanel>
            </td>
            <td></td>
            <td colspan="3"><asp:UpdatePanel ID="UpdatePanel5" runat="server">
                <ContentTemplate>
                <telerik:RadDatePicker ID="dpWarranty" Runat="server" Culture="en-GB">
                </telerik:RadDatePicker>
                </ContentTemplate>
                </asp:UpdatePanel>
            </td>
            <td></td>
        </tr>
        <tr>
            <td>Diagnostic Fee:</td>
            <td></td>
            <td colspan="3">
                <asp:DropDownList ID="DDBenchFee" runat="server" DataSourceID="SqlDataCosts" 
                    DataTextField="CostVal" DataValueField="CostVal">
                </asp:DropDownList>
            </td>
            <td></td>
        </tr>
        <tr>
            <td>Estimated Cost:</td>
            <td></td>
            <td colspan="3">
                <asp:DropDownList ID="DDEstimatedCost" runat="server" 
                    DataSourceID="SqlDataCosts" DataTextField="CostVal" DataValueField="CostVal">
                </asp:DropDownList>
            </td>
            <td></td>
        </tr>
        <tr>
            <td>Deposit Paid:</td>
            <td></td>
            <td colspan="3"><asp:DropDownList ID="DDDepositDue" runat="server" DataSourceID="SqlDataCosts" 
                    DataTextField="CostVal" DataValueField="CostVal" />
                <asp:SqlDataSource ID="SqlDataCosts" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:PirTickets %>" 
                    SelectCommand="SELECT [CostVal] FROM [Costs]"></asp:SqlDataSource>
            </td>
            <td></td>
        </tr>
       <tr>
            <td colspan="2"></td>
            <td colspan="4">
                <asp:Button ID="BtnUpdate"  runat="server" Text="Submit" onclick="BtnUpdate_Click" />&nbsp;&nbsp;
                <asp:Button ID="BtnCancel" CausesValidation="false" runat="server" Text="Cancel" onclick="BtnCancel_Click" />&nbsp;&nbsp;
                <telerik:RadWindowManager ID="RadWindowManager1" runat="server" 
                    Behavior="Default" InitialBehavior="none" Left="375px" Top="200px" Height="550px" Width="775px" Title="Select Customer"
                    OnClientClose="OnClientClose">
                </telerik:RadWindowManager>
                </td>
        </tr>
    </table>
<br />


<br />
</asp:Content>
