<%@ page language="VB" autoeventwireup="false" inherits="Manage_DeviceLogList, App_Web_hmglkoo5" enableEventValidation="false" %>
<%@ Register TagPrefix="obout" Namespace="Obout.Grid" Assembly="obout_Grid_NET" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Untitled Page</title>
    <link href="../StyleSheet.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">	

    </script>

    <script type="text/javascript">

        var popUpObj;

        function showModalPopUp(DeviceLogId, TableName) {

            popUpObj = window.open("ViewAttendancePhoto.aspx?Id=" + DeviceLogId + "&TableName=" + TableName + "",

    "ModalPopUp",

    "toolbar=no," +

    "scrollbars=no," +

    "location=no," +

    "statusbar=no," +

    "menubar=no," +

    "resizable=0," +

    "width=300," +

    "height=300," +

    "left = 490," +

    "top=300"

    );

            popUpObj.focus();

            LoadModalDiv();

        }


        function LoadModalDiv() {

            var bcgDiv = document.getElementById("divBackground");

            bcgDiv.style.display = "block";

        }

        function HideModalDiv() {

            var bcgDiv = document.getElementById("divBackground");

            bcgDiv.style.display = "none";

        }

      

    </script>

</head>
<body>
    <form id="form1" runat="server">
    <table cellpadding="0" cellspacing="0" style="border-right: gray 1px solid; border-top: gray 1px solid;
        border-left: gray 1px solid; border-bottom: gray 1px solid;">
        <tr style="font-weight: bold; font-size: 14px; background-color: lightsteelblue;
            padding-left: 5px; padding-top: 3px; padding-bottom: 3px; color: white;">
            <td style="font-weight: bold; font-size: 14px; background-color: lightsteelblue;
                padding: 5px; color: white;">
                Device Logs List
            </td>
            <td align="right">
                <asp:Label ID="lblError" runat="server" Width="300px" ForeColor="Red"></asp:Label>
                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
            </td>
        </tr>
        <tr style="background-color: lightsteelblue;">
            <td colspan="2" style="text-align: right;">
                <hr />
                Select Device
                <asp:DropDownList ID="drp_Devices" runat="server" Width="96px">
                </asp:DropDownList>
                Month
                <asp:DropDownList ID="ddlMonth" runat="server" Width="48px" AutoPostBack="True">
                    <asp:ListItem>1</asp:ListItem>
                    <asp:ListItem>2</asp:ListItem>
                    <asp:ListItem>3</asp:ListItem>
                    <asp:ListItem>4</asp:ListItem>
                    <asp:ListItem>5</asp:ListItem>
                    <asp:ListItem>6</asp:ListItem>
                    <asp:ListItem>7</asp:ListItem>
                    <asp:ListItem>8</asp:ListItem>
                    <asp:ListItem>9</asp:ListItem>
                    <asp:ListItem>10</asp:ListItem>
                    <asp:ListItem>11</asp:ListItem>
                    <asp:ListItem>12</asp:ListItem>
                </asp:DropDownList>
                &nbsp; Year
                <asp:TextBox ID="txtYear" runat="server" Width="128px" AutoPostBack="True"></asp:TextBox>&nbsp;&nbsp;From
                Date
                <asp:DropDownList ID="ddlFromDate" runat="server" Width="48px">
                </asp:DropDownList>
                &nbsp;To Date
                <asp:DropDownList ID="ddlToDate" runat="server" Width="48px">
                </asp:DropDownList>
                <asp:Button ID="btnGo" runat="server" Text="Filter" /> &nbsp;<asp:Button 
                    ID="btnLogsWithTemp" runat="server" Text="Logs With Temp. & without mask" 
                    Width="218px" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <obout:Grid ID="Dg_DeviceLogs1" runat="server" ShowLoadingMessage="true" EnableRecordHover="true"
                    AllowFiltering="true" CallbackMode="true" Serialize="false" KeepSelectedRecords="true"
                    AutoGenerateColumns="false" AllowAddingRecords="False" FolderStyle="~/styles/grid/styles/premiere_blue"
                    Width="808px">
                    <Columns>
                        <obout:Column ID="Id" DataField="DeviceLogId" Visible="False" Width="100" ReadOnly="True"
                            HeaderText="DeviceCommandId" ConvertEmptyStringToNull="False" Index="0" />
                        <obout:Column ID="DownloadDate" SortOrder="Desc" DataField="DownloadDate" Width="150"
                            HeaderText="Download Date" DataFormatString="{0:dd MMM yyyy HH:mm:ss}" ConvertEmptyStringToNull="False"
                            DataFormatString_GroupHeader="{0:dd MMM yyyy HH:mm:ss}" Index="1" />
                        <obout:Column ID="DeviceId" DataField="DeviceId" Visible="False" Width="200" HeaderText="Device Id"
                            ConvertEmptyStringToNull="False" Index="2" />
                        <obout:Column ID="UserId" DataField="UserId" Width="220" HeaderText="User Id" ConvertEmptyStringToNull="False"
                            Index="3" />
                        <obout:Column ID="LogDate" DataField="LogDate" Width="150" HeaderText="Log Date"
                            DataFormatString="{0:dd MMM yyyy HH:mm:ss}" ConvertEmptyStringToNull="False"
                            DataFormatString_GroupHeader="{0:dd MMM yyyy HH:mm:ss}" Index="4" />
                        <obout:Column ID="DeviceSName" DataField="DeviceSName" Width="200" HeaderText="Device Name"
                            ConvertEmptyStringToNull="False" Index="5" />
                        <obout:Column ID="DeviceSNo" DataField="SerialNumber" Width="220" HeaderText="Serial No"
                            ConvertEmptyStringToNull="False" Index="6" />
                        <obout:Column ID="C4" DataField="C4" Width="130" HeaderText="Att State" ConvertEmptyStringToNull="False"
                            Index="7">
                        </obout:Column>
                        <obout:Column ID="C5" DataField="C5" Width="130" HeaderText="Verify Mode" ConvertEmptyStringToNull="False"
                            Index="8">
                        </obout:Column>
                        <obout:Column Width="80" HeaderText="Att Photo" ConvertEmptyStringToNull="False"
                            Index="17" TemplateId="tplViewPhoto">
                            <TemplateSettings TemplateId="tplViewPhoto" />
                        </obout:Column>
                        <obout:Column ConvertEmptyStringToNull="False" DataField="FileName" HeaderText="FileName"
                            Visible="False">
                        </obout:Column>
                        <obout:Column ConvertEmptyStringToNull="False" DataField="TableName" HeaderText="TableName"
                            Visible="False" Index="18">
                        </obout:Column>
                    </Columns>
                    <Templates>
                       
                        <obout:GridTemplate runat="server" ID="tplViewPhoto">
                            <Template>
                                <a href="Javascript:void(0);" onclick="showModalPopUp('<%#Container.DataItem.Item("DeviceLogId")%>','<%#Container.DataItem.Item("TableName")%>')">
                                    <%#ShowPhotoColumn(Container.DataItem.Item("FileName"))%>
                                </a>
                            </Template>
                        </obout:GridTemplate>
                    </Templates>
                </obout:Grid>
            </td>
        </tr>
    </table>
    </form>
    <script runat="server">
        
        Function ParseExecutionDate(ByVal ExecutionDate As String)
            Try
                If CDate(ExecutionDate) < CDate("1910-01-01") Then
                    Return ""
                Else
                    Return CDate(ExecutionDate).ToString("dd-MMM-yyyy HH:mm")
                End If
            Catch ex As Exception
                Return ""
            End Try
            
        End Function
        
        Function ShowPhotoColumn(ByVal FileName As String)
            Try
                If Not String.IsNullOrEmpty(FileName) Then
                    Return "View"
                Else
                    Return ""
                End If
              
            Catch ex As Exception
                Return ""
            End Try
            
        End Function
    </script>
</body>
</html>
