<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DeviceInfoDebug.aspx.cs" Inherits="GigaTech.CMS.Web.Apps.DeviceSystem.DeviceInfoDebug" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
                    <script src="/Scripts/jquery-1.6.4.min.js"></script>
</head>

        <script language="javascript">
            var grid;

            Ext.onReady(function () {
                Ext.QuickTips.init();

                var gridStore = Ext.create('Ext.data.Store', {
                    pageSize: 50,
                    remoteSort: true,
                    autoLoad: true,
                    fields: ['MAC', 'ID', 'SubID', 'ModelID', 'ModelSubID', 'IP', 'LogTime'],
                    proxy: {
                        type: 'ajax',
                        url: 'Handler.ashx?action=GetDeviceInfoDebug',
                        reader: {
                            type: 'json',
                            root: 'items',
                            totalProperty: 'totalCount'
                        },
                        simpleSortMode: true
                    },
                    sorters: [{
                        property: "LogTime",
                        direction: "DESC"
                    }]
                });

                grid = Ext.create('Ext.grid.Panel', {
                    tbar: [
                                                                            {
                                                                                text: 'Export',
                                                                                cls: 'x-btn-default-small',
                                                                                border: 1,
                                                                                style: {
                                                                                    borderColor: 'gray',
                                                                                    borderStyle: 'solid'
                                                                                },
                                                                                handler: function () {
                                                                                    try {
                                                                                        parent.CMSClientDownload("/Apps/DeviceSystem/ImportExport.ashx?action=Export&type=DeviceDebug");
                                                                                    } catch (e) {
                                                                                        window.open("ImportExport.ashx?action=Export&type=DeviceDebug", "CMSDownloadIFrame");
                                                                                    }
                                                                                    //window.open("ImportExport.ashx?action=Export&type=DeviceDebug", "CMSDownloadIFrame");
                                                                                }
                                                                            },'->',
                                                                            {
                                                                                text: 'Clear All',
                                                                                cls: 'x-btn-default-small',
                                                                                border: 1,
                                                                                style: {
                                                                                    borderColor: 'gray',
                                                                                    borderStyle: 'solid'
                                                                                },
                                                                                handler: function () {
                                                                                    Ext.Ajax.request({
                                                                                        url: 'Handler.ashx?action=ClearAllDeviceInfo',
                                                                                        success: function (response) {
                                                                                            var result = Ext.decode(response.responseText);
                                                                                            if (result.success) {
                                                                                                gridStore.load();
                                                                                            }
                                                                                            else {

                                                                                            }
                                                                                        },
                                                                                        failure: function (result, request) {

                                                                                        }
                                                                                    });
                                                                                }
                                                                            }
                    ],
                region: 'center',
                store: gridStore,
                columns: [
                    { text: 'MAC', dataIndex: 'MAC', flex: 1 },
                    { text: 'ID', dataIndex: 'ID', flex: 1 },
                    { text: 'SubID', dataIndex: 'SubID', flex: 1 },
                    { text: 'ModelID', dataIndex: 'ModelID', flex: 1 },
                    { text: 'ModelSubID', dataIndex: 'ModelSubID', flex: 1 },
                    { text: 'IP', dataIndex: 'IP', flex: 1 },
                    { text: 'LogTime', dataIndex: 'LogTime', flex: 1 }
                ],
                dockedItems: [{
                    xtype: 'pagingtoolbar',
                    store: gridStore,
                    dock: 'bottom',
                    displayInfo: true
                }]
            });

            Ext.create('Ext.container.Viewport', {
                layout: {
                    type: 'border'
                },
                items: [grid]
            });

            });


    </script>

<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
        <iframe id="CMSDownloadIFrame" name="CMSDownloadIFrame" style="width:0px;height:0px"></iframe>
    </form>
</body>
</html>

