<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" EnableEventValidation="false" MaintainScrollPositionOnPostback="true" CodeBehind="OpenForContractor.aspx.cs" Inherits="VMT.OpenForContractor" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphJavaScriptContentPlaceHolder" runat="server">
  <script type="text/javascript">
     window.onload = function () {
               var h = document.getElementById("<%=hfScrollPosition.ClientID%>");
               document.getElementById("<%=scrollArea.ClientID%>").scrollTop = h.value;
              }
       function SetDivPosition() {
               var intY = document.getElementById("<%=scrollArea.ClientID%>").scrollTop;
               var h = document.getElementById("<%=hfScrollPosition.ClientID%>");
               h.value = intY;
         }

      function afterpostback() {

                var h = document.getElementById("<%=hfScrollPosition.ClientID%>");
                document.getElementById("<%=scrollArea.ClientID%>").scrollTop = h.value;

     }
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphPageTitleContentPlaceHolder" runat="server">
    <div id="CssPageTitle">
        <h1>
           Open Work for Contractor
        </h1>
    </div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="cphMainContentPlaceHolder" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
      <asp:UpdatePanel ID="UpdatePanel2" runat="server">
          <ContentTemplate>
              <div style="text-align:right;"><a href="default.aspx">Home</a> <strong>&#8249;&#8249;</strong> <a href="CurrentYTD.aspx">Current</a> <strong>&#8249;&#8249;</strong> Open Work for Contractor</div>
                        <div >
             <fieldset class="masterform">
                <legend>Open for Contractor</legend> 
                <div style=" width: 100%; height:300px; ">
                    <table style=" width: 100%; ">
                        <tr>
                            <td> Business Unit:</td>
                             <td> Work Year:<td/>
                                 <td> Project/Event :</td>
                                     <td> Company :</td>

                             <%--<td> <asp:Button ID="btnGo" runat="server" Text="Go" OnClick="btnGo_Click"  CssClass="FormButton"/></td> --%>
                    

                                                            <%--<td> <asp:Button ID="btnGo" runat="server" Text="Go" OnClick="btnGo_Click"  CssClass="FormButton"/></td> --%>
                        </tr>
                        <tr>
                            <td>
                                <asp:DropDownList ID="ddlBUnit" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlBUnit_SelectedIndexChanged">
                                </asp:DropDownList>
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlYear" runat="server" AutoPostBack="true" OnDataBound="ddlYear_DataBound" OnSelectedIndexChanged="ddlYear_SelectedIndexChanged">
                                </asp:DropDownList>
                                <td/>
                                <td>
                                <asp:DropDownList ID="ddlEventCode" runat="server" AutoPostBack="true" OnDataBound="ddlEventCode_DataBound" OnSelectedIndexChanged="ddlEventCode_SelectedIndexChanged">
                                </asp:DropDownList>
                                    </td>
                                <td>
                                    <asp:DropDownList ID="ddlCompany" runat="server" AutoPostBack="true" OnDataBound="ddlCompany_DataBound" OnSelectedIndexChanged="ddlCompany_SelectedIndexChanged">
                                    </asp:DropDownList>
                                </td>
                            </td>
                        </tr>
                    </table>
                    <br />
                    <asp:HiddenField ID="hfScrollPosition" runat="server" Value="0" />
               <div id="scrollArea" style=" width: 100%; height: 240px; overflow-y: scroll;" onscroll="SetDivPosition()" runat="server"> <br />
                <asp:GridView ID="gdvOpenContractor" runat="server"  BorderColor="#014567" CellPadding="3"  HeaderStyle-CssClass="FixedHeader" 
                     AutoGenerateColumns="false"  emptydatatext="No data in the data source." 
                     OnSorting="gdvOpenContractor_Sorting" AllowSorting="True" OnRowCommand="gdvOpenContractor_RowCommand">
                    <AlternatingRowStyle BackColor="#E9EFF2" />
                    <Columns>
                        <asp:TemplateField SortExpression="EVENT_CODE"   HeaderStyle-Width="251px" ItemStyle-Width="250px"  >
                            <HeaderTemplate>                                      
                                <asp:LinkButton  ID="LinkButton12" runat="server" Text="PROJECT/EVENT"  CommandName="Sort" CommandArgument="EVENT_CODE" ForeColor="Black"/>                       
                            </HeaderTemplate >
                            <ItemTemplate>
                                <%--<a href='MapView_PS.aspx?EVENT_CODE_ID=<%# Eval("EVENT_CODE_ID") %>&nm=<%# Eval("EVENT_CODE") %>' target="_blank">--%>  
                                <a href='<%=System.Configuration.ConfigurationManager.AppSettings["VMSWorkLink"]%>?bu=0&ec=<%# Eval("EVENT_CODE_ID") %>&wa=0&yr=0' target="_blank"> <asp:Label ID="Label2" runat="server" Text='<%# Bind("EVENT_CODE") %>'></asp:Label> </a>
                                
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField  SortExpression="WORK_AREA"   HeaderStyle-Width="101px" ItemStyle-Width="100px">
                            <HeaderTemplate>
                                <asp:LinkButton  ID="LinkButton1" runat="server" Text="SECTION/WA"  CommandName="Sort" CommandArgument="WORK_AREA" ForeColor="Black"/>
                            </HeaderTemplate>
                            <ItemTemplate>
                                 <asp:Label ID="lbl_WORK_AREA_ID" runat="server" Text='<%# Eval("WORK_AREA_ID") %>' Visible="false"></asp:Label>
                                <%--<a href='MapView_PS.aspx?EVENT_CODE_ID=<%# Eval("EVENT_CODE_ID") %>&WORK_AREA_ID=<%# Eval("WORK_AREA_ID") %>'  target="_blank">--%> 
                                <a href='<%=System.Configuration.ConfigurationManager.AppSettings["VMSWorkLink"]%>?bu=0&ec=<%# Eval("EVENT_CODE_ID") %>&wa=<%# Eval("WORK_AREA_ID") %>&yr=0' target="_blank">  <asp:Label ID="Label1" runat="server" Text='<%# Bind("WORK_AREA") %>'></asp:Label></a>
                            </ItemTemplate>
                        </asp:TemplateField>
                        
                        <asp:TemplateField SortExpression="COMPANY"   HeaderStyle-Width="141px" ItemStyle-Width="140px" >
                            <HeaderTemplate>                                      
                                <asp:LinkButton  ID="LinkButton2" runat="server" Text="COMPANY"  CommandName="Sort" CommandArgument="COMPANY" ForeColor="Black"/>                       
                            </HeaderTemplate >
                            <ItemTemplate>
                                <asp:Label ID="lbl_COMPANY_ID" runat="server" Text='<%# Eval("COMPANY_ID") %>' Visible="false"></asp:Label>
                                <%# Eval("COMPANY") %>
                            </ItemTemplate>
                        </asp:TemplateField>


                         <%--<asp:TemplateField SortExpression="work_status_id"  >
                            <HeaderTemplate>                                      
                                <asp:LinkButton  ID="LinkButton22" runat="server" Text="work_status_id"  CommandName="Sort" CommandArgument="work_status_id" ForeColor="Black"/>                       
                            </HeaderTemplate >
                            <ItemTemplate>
                                <%# Eval("work_status_id") %>
                            </ItemTemplate>
                        </asp:TemplateField>--%>

                        <asp:templatefield HeaderText="OPEN/CLOSE"   HeaderStyle-Width="161px" ItemStyle-Width="160px" >                           
                            <HeaderTemplate>
                                 <asp:checkbox ID="cbSelectAll"  runat="server" AutoPostBack="true"  ForeColor="Black" 
                                     OnCheckedChanged="cbSelectAll_CheckedChanged" TextAlign="Left"></asp:checkbox>   OPEN/CLOSE
                                </div>                              
                            </HeaderTemplate>
                           <%--  <HeaderStyle  HorizontalAlign="Right" VerticalAlign="Middle" Wrap="False" Width="40px" />--%>
                            <itemtemplate>
                                <asp:checkbox ID="cbSelect"  runat="server" AutoPostBack="true"  
                                   Enabled='<%# Convert.ToBoolean(Eval("open")) %>' 
                                    Checked='<%#Convert.ToBoolean(Eval("work_status_id").ToString()=="4" ) %>'
                                     OnCheckedChanged ="cbSelect_CheckedChanged" />                              
                            </itemtemplate>
                           
                            <ItemStyle  HorizontalAlign="Left" VerticalAlign="Middle" />
                        </asp:templatefield>
                        <asp:TemplateField SortExpression="STATUS"   HeaderStyle-Width="140px" ItemStyle-Width="140px" >
                            <HeaderTemplate>                                      
                                <asp:LinkButton  ID="LinkButton3" runat="server" Text="STATUS"  CommandName="Sort" CommandArgument="STATUS" ForeColor="Black"/>                       
                            </HeaderTemplate >
                            <ItemTemplate>
                                <%# Eval("STATUS") %>
                            </ItemTemplate>
                        </asp:TemplateField>


                         <asp:templatefield HeaderText="ACTIVE"   HeaderStyle-Width="161px" ItemStyle-Width="160px" >                           
                            <HeaderTemplate>
                                 <asp:checkbox ID="cbSelectAll_A"  runat="server" AutoPostBack="true"  ForeColor="Black" 
                                      TextAlign="Left"></asp:checkbox>   ACTIVATE
                                </div>                              
                            </HeaderTemplate>
                           
                            <itemtemplate>

                              <asp:Button ID="btnActive" runat="server" CssClass="GridButton" Text='<%# Eval("wcstatus") %>' CommandName="Select" CommandArgument="<%# Container.DataItemIndex %>" />
<%-- <asp:checkbox  name="onoffswitch"  id="myonoffswitch" runat="server" AutoPostBack="true"  
                                   Enabled='<%# Convert.ToBoolean(Eval("open")) %>' 
                                    Checked='<%#Convert.ToBoolean(Eval("wcstatus").ToString()=="A" ) %>'
                                    /> --%> 
   <asp:HiddenField ID="hdn_open" runat="server" Value='<%# Eval("open") %>' />
   <asp:HiddenField ID="hdn_status" runat="server" Value='<%# Eval("WCSTSDESC") %>' />                                                       
                            </itemtemplate>
                           
                            <ItemStyle  HorizontalAlign="Left" VerticalAlign="Middle" />
                        </asp:templatefield>
                    </Columns>
                    <HeaderStyle BackColor="#98C8DE" Font-Bold="True"/>
                    <SelectedRowStyle BackColor="#FFE98F" />
                </asp:GridView>
                    <td> </td> 
                </div>

               
            </div>
       </fieldset>
        </div>

        <div style="text-align:left; width: 100%;">
                    <fieldset class="masterform">
                        
                              
                        <div style=" width: 100%; height:40px; overflow-y: scroll;">
                            <table>
                <tr>
                            
                        <td> <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" Visible="false"  CssClass="FormButton"/>
                            <asp:Button ID="btnExportExcel" runat="server" CssClass="FormButton" Visible="false" OnClick="btnExportExcel_Click" Text="Export To Excel" />
                            <asp:HiddenField ID="hdn_role" runat="server" />
                    </td> 
                </tr>
            </table>


        </div>
                            </fieldset></div>    
                    </ContentTemplate>
     </asp:UpdatePanel>
</asp:Content>
