<%@ page language="C#" masterpagefile="~/MasterPage.master" autoeventwireup="true" CodeFile="JobNo.aspx.cs" inherits="Maintenance_TEC_JobNo" title="<%$ Resources: SiteMapLocalizations, Maintenance_JobNoEdit %>" theme="white" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <script language="javascript" type="text/javascript" src="../../Script/OpenSubPage.js"></script>
    <script language="javascript" type="text/javascript" src="../../Script/HScript.js"></script>
    <script language="javascript" type="text/javascript">
        function txtFAB_onclick(FABID, ToolID){
            //var sSelected = $(ID).value.replace(/\n/, ",");
            $(ToolID).value = "";
            
			// 開新視窗
			newWin = window.open("../../SubPages/SelectionPage.aspx?SelectValue=FABs&EnableManualInput=False&AssignObjName=" + FABID, "SelectionPage", config="top=50,left=50,width=670,height=310,resizable=no,scrollbars=no")
			newWin.focus();
        }
        function txtTool_onclick(ToolID, FABID){
            var sSelected = $(FABID).value.replace(/\r/g, "").replace(/\n/g, ",");
            var sCondi = "FABID|" + sSelected;
            
			// 開新視窗
			newWin = window.open("../../SubPages/SelectionPage.aspx?SelectValue=Tools&EnableManualInput=False&AssignObjName=" + ToolID + "&Condition=" + sCondi, "SelectionPage", config="top=50,left=50,width=670,height=310,resizable=no,scrollbars=no")
			newWin.focus();
        }
 		// 供子視窗呼叫以改變父視窗的Select物件的函數
		function changeSelectValue( objName, values){	
			oSel = $(objName);
			var sValues = "";
			for (var i=0; i< values.length; i++)
				sValues += "," + values[i];
			oSel.value = sValues.substring(1).replace(/,/g, "\n");			
		}
   </script>
<center>
<p class="masterpageContentTop" >
    <table id="TABLE1" class="SelectCondition">
        <tr>
            <td class="SelectionCondition">
                <asp:Label ID="Label5" runat="server" Text="<%$Resources:Universal, WorksList_JobNo %>"></asp:Label>
                :
            </td>
            <td class="SelectionCondition">
                <asp:TextBox ID="txtSelConditionJobNo" runat="Server" Width="90px"></asp:TextBox></td>
            <td class="SelectionCondition">
                <asp:Label ID="Label6" runat="server" Text="<%$Resources:Universal, Comm_FABID %>"></asp:Label>
                :
            </td>
            <td class="SelectionCondition">
                <asp:TextBox ID="txtSelConditionFABID" runat="Server" Width="90px"></asp:TextBox></td>
            <td class="SelectionCondition">
                <asp:Label ID="Label1" runat="server" Text="<%$Resources:Universal, Comm_StartDate %>"></asp:Label>
                :
            </td>
            <td class="SelectionCondition">
                <asp:TextBox ID="txtSelConditionStartDate" runat="Server" Width="90px"></asp:TextBox>
            </td>
            <td class="SelectionCondition">
                <asp:Label ID="Label2" runat="server" Text="<%$Resources:Universal, Comm_EndDate %>"></asp:Label>
                :
            </td>
            <td class="SelectionCondition">
                <asp:TextBox ID="txtSelConditionEndDate" runat="Server" Width="90px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="SelectionCondition">
                <asp:Label ID="Label7" runat="server" Text="<%$Resources:Universal, Comm_Status %>"></asp:Label>
                :
            </td>
            <td colspan="7" align="left" class="SelectionCondition">
                <asp:DropDownList ID="ddlStatus" runat="server" Width="90px">
                    <asp:ListItem Text="" Value="" Selected="true"></asp:ListItem>
                    <asp:ListItem Text="<%$ Resources: Universal, Comm_Processing %>" Value="Processing"></asp:ListItem>
                    <asp:ListItem Text="<%$ Resources: Universal, Comm_IsClosed %>" Value="Closed"></asp:ListItem>
                </asp:DropDownList></td>
        </tr>
        <tr>
            <td align="right" colspan="8" class="bottomRow">
                <asp:Button ID="btnSearch" runat="server" Width="60px" Text="<%$ resources:Universal,Data_Search %>" OnClick="btnSearch_Click" />
                <asp:Button ID="btnAddNew" runat="Server" Width="100px" Text="<%$ resources:Universal,Data_AddNew %>" OnClick="btnAddNew_Click" />

<%--                <asp:Label ID="Label8" runat="server" Text="<%$Resources:Universal, Comm_Zoom %>"></asp:Label>
                :
                <input id="btnZoomIn" onclick="ZoomIn()" style="width: 20px" type="button" value="+" />
                <input id="btnZoomOut" onclick="ZoomOut()" style="width: 20px" type="button" value="-" />
--%>            </td>
        </tr>
    </table>

<%--<asp:CheckBox ID="chkIncludeIsClosed" Text="<%$ resources:Universal,Msg_IncludeIsClosed %>" AutoPostBack="False" runat="Server" 
Checked='<%# Bind("IncludeClosed") %>'  OnCheckedChanged="chkIncludeIsClosed_CheckedChanged" />
    &nbsp; &nbsp;
&nbsp; &nbsp;&nbsp; &nbsp;
--%>
    <asp:HiddenField ID="hidCondition" runat="server" />
    &nbsp; &nbsp;
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" PageSize="40" CellSpacing="1"
        AutoGenerateColumns="False" CellPadding="4" DataKeyNames="JobNo" DataSourceID="ObjectDataSource1" EmptyDataText="null"
        ForeColor="#333333" GridLines="None" OnRowCreated="GridView1_RowCreated" OnRowCommand="GridView1_RowCommand" OnRowDataBound="GridView1_RowDataBound" >
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" HorizontalAlign="center" VerticalAlign="middle" />

        <Columns>
            <asp:CommandField UpdateText="<%$ resources:Universal,Data_Update %>" CancelText="<%$ resources:Universal,Data_Cancel %>" 
                EditText="<%$ resources:Universal,Data_Edit %>" DeleteText="<%$ resources:Universal,Data_Delete %>" />

            <asp:TemplateField HeaderText="<%$ resources:Universal,JobNo_ID %>" SortExpression="JobNo">
                <ItemTemplate>
                    <asp:Label ID="lblItemJobNo" runat="server" Text='<%# Eval("JobNo") %>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txtEditJobNo" runat="server" Text='<%# Bind("JobNo") %>' Width="80px" />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ControlToValidate="txtEditJobNo"
                        ErrorMessage="<%$ resources:Universal, Msg_Remind_JobNo %>" ValidationGroup="AddValidationControls">*</asp:RequiredFieldValidator>
                    </EditItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="txtAddJobNo" runat="server" Text='<%# Bind("JobNo") %>' Width="60px" Wrap="false" />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ControlToValidate="txtAddJobNo"
                        ErrorMessage="<%$ resources:Universal, Msg_Remind_JobNo %>" ValidationGroup="AddValidationControls">*</asp:RequiredFieldValidator>
               </FooterTemplate>
            </asp:TemplateField>
            <%--FABID--%>            
            <asp:TemplateField HeaderText="<%$ resources:Universal,Comm_FABID %>" SortExpression="FABID">
                <ItemTemplate>
                    <asp:Label ID="lblItemFABID" runat="server" Text='<%# Eval("FABID").ToString().Replace("\r\n","<br>") %>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txtFABID" runat="server" Text='<%# Bind("FABID") %>' TextMode="MultiLine" Rows="3" Width="100px" OnLoad="txtEditFABID_onLoad" />
                </EditItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="txtFABID" runat="server" Text='<%# Bind("FABID") %>' TextMode="MultiLine" Rows="3" Width="100px" OnLoad="txtEditFABID_onLoad" />
               </FooterTemplate>
            </asp:TemplateField>
             <%--Tool--%>            
           <asp:TemplateField ItemStyle-Width="130px" ItemStyle-Wrap="false" HeaderText="<%$ resources:Universal,JobNo_Tools %>">
                <ItemTemplate>
                    <asp:Label ID="lblItemTools" runat="server" Text='<%# Eval("Tools").ToString().Replace("\r\n","<br>") %>' Width="100px" />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txtTools" runat="server" Text='<%# Bind("Tools") %>' TextMode="MultiLine" Rows="3" Width="100px"  />
<%--                    <asp:HyperLink ImageUrl="~\imanges\more.gif" ID="hlTools" Target="_blank" runat="Server"></asp:HyperLink>
--%>                </EditItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="txtTools" runat="server" Text='<%# Bind("Tools") %>' TextMode="MultiLine"  Rows="3" Width="100px" />
<%--                    <asp:HyperLink ImageUrl="~\imanges\more.gif" ID="hlTools" Target="_blank" runat="Server"></asp:HyperLink>
--%>               </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="90px" HeaderText="<%$ resources:Universal,Comm_CreateDate %>">
                <ItemTemplate>
                    <asp:Label ID="lblCreateDate" runat="server" Text='<%# Eval("CreateDate") %>' Width="70px" />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txtEditCreateDate" runat="server" Text='<%# Bind("CreateDate") %>' Width="70px"  />
                    <asp:HyperLink ImageUrl="~\imanges\more.gif" ID="hlCreateDate" Target="_blank" runat="Server"></asp:HyperLink>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator41" runat="server" ControlToValidate="txtEditCreateDate"
                        ErrorMessage="<%$ resources:Universal, Msg_Remind_CreateDate %>" ValidationGroup="AddValidationControls">*</asp:RequiredFieldValidator>
                </EditItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="txtAddCreateDate" runat="server" Text='<%# Bind("Tools") %>' Width="70px" />
                    <asp:HyperLink ImageUrl="~\imanges\more.gif" ID="hlCreateDate" Target="_blank" runat="Server"></asp:HyperLink>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator42" runat="server" ControlToValidate="txtAddCreateDate"
                        ErrorMessage="<%$ resources:Universal, Msg_Remind_CreateDate %>" ValidationGroup="AddValidationControls">*</asp:RequiredFieldValidator>
               </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="40px" HeaderText="<%$ resources:Universal,JobNo_Charge %>" SortExpression="Charge">
                <ItemTemplate>
                    <asp:Label ID="lblItemCharge" runat="server" Text='<%# Eval("Charge") %>' Width="40px" />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txtEditCharge" runat="server" Text='<%# Bind("Charge") %>' Width="40px" />
                </EditItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="txtAddCharge" runat="server" Text='<%# Bind("Charge") %>' Width="40px" />
               </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<%$ resources:Universal, JobNo_Description %>">
                <ItemTemplate>
                    <asp:Label ID="lblItemDescription" runat="server" Text='<%# Eval("Description") %>' Width="200px" />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txtEditDescription" runat="server" Text='<%# Bind("Description") %>' TextMode="MultiLine"  Rows="3" Width="200px"  />
                </EditItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="txtAddDescription" runat="server" Text='<%# Bind("Description") %>' TextMode="MultiLine"  Rows="3" Width="200px"  />
               </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<%$ resources:Universal, Comm_IsClosed %>">
                <ItemTemplate>
                    <asp:Label ID="lblItemIsClosed" runat="server" Text='<%# (bool)Eval("IsClosed") ? "V" : String.Empty %>' />
                </ItemTemplate>
                <EditItemTemplate>
<%--                    <asp:TextBox ID="txtEditCompleted" runat="server" Text='<%# Bind("IsClosed") %>' />
--%>                    <asp:CheckBox ID="chkEditIsClosed" runat="Server" Checked='<%# Bind("IsClosed") %>' />
                </EditItemTemplate>
                <FooterTemplate>
                    <asp:CheckBox ID="ChkAddIsClosed" runat="server" Checked='<%# Bind("IsClosed") %>' />
               </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButtonEdit" runat="server" CausesValidation="False" CommandName="Edit"
                        Text="<%$ resources:Universal,Data_Edit %>" />
                    <asp:LinkButton ID="LinkButtonDelete" runat="server" CausesValidation="False" CommandName="Delete"
                        Text="<%$ resources:Universal,Data_Delete %>" OnClientClick="<%$ Resources: Universal, Msg_DelConfirm %>" />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:LinkButton ID="LinkButtonUpdate" runat="server" ValidationGroup="AddValidationControls" CausesValidation="true"
                        Text="<%$ resources:Universal,Data_Update %>" CommandName="Update" />
                    <asp:LinkButton ID="LinkButtonCancel" runat="server" CausesValidation="False" CommandName="Cancel"
                        Text="<%$ resources:Universal,Data_Cancel %>" />
                </EditItemTemplate>
                <FooterTemplate>
                    <asp:Button ID="btnSave" runat="server" ValidationGroup="AddValidationControls" CausesValidation="true" 
                        Text="<%$ resources:Universal,Data_Save %>"  CommandName="Save" OnClick="btnSave_Click" />
                    <asp:Button ID="btnInsertCancel" runat="server" Text="<%$ resources:Universal,Data_Cancel %>" 
                        OnClick="btnInsertCancel_Click" />
                </FooterTemplate>
            </asp:TemplateField>
        </Columns>
     
        <RowStyle BackColor="#8FFFFF" ForeColor="#333333" />
        <EditRowStyle BackColor="#999999" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    </asp:GridView>


    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" TypeName="TEC_JobNoData"
        SelectMethod="Select" InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" 
        UpdateMethod="Update" DeleteMethod="Delete" ><%--FilterExpression="IsClosed='{0}'">--%>
        <InsertParameters>
            <asp:Parameter Name="JobNo" Type="String" />
            <asp:Parameter Name="Charge" Type="String" />
            <asp:Parameter Name="FABID" Type="String" />
            <asp:Parameter Name="IsClosed" Type="Boolean" />
            <asp:Parameter Name="Description" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="JobNo" Type="String" />        
            <asp:Parameter Name="Charge" Type="String" />
            <asp:Parameter Name="FABID" Type="String" />
            <asp:Parameter Name="IsClosed" Type="Boolean" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="original_JobNo" Type="String" />
        </UpdateParameters>
        <DeleteParameters>
            <asp:Parameter Name="original_JobNo" Type="String" />
        </DeleteParameters>
        <SelectParameters>
            <asp:QueryStringParameter Name="IncludeClosed" QueryStringField="IncludeClosed" Type="Boolean" DefaultValue="False" />
        </SelectParameters>
<%--        <FilterParameters>
            <asp:QueryStringParameter Name="IncludeClosed" QueryStringField="IsClosed" DefaultValue="True" Type="Boolean" />
        </FilterParameters>
--%>    </asp:ObjectDataSource>



    <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
         ShowSummary="False" ValidationGroup="EditValidationControls" />
    <asp:ValidationSummary ID="ValidationSummary2" runat="server" ShowMessageBox="True"
         ShowSummary="False" ValidationGroup="AddValidationControls" />
    </p>
</center>
</asp:Content>

