Public Class Form_SysLog
    Dim m_LogManage As New CLogManage
    Dim m_Table As New System.Data.DataTable
    Dim m_InitOver As Boolean = False

    Private Sub GetDataSet()
        If Not m_Table Is Nothing Then
            m_Table.Dispose()
        End If
        m_Table = New DataTable

        SQL_Query(COL_RIGHTS.系统记录, "SELECT * FROM `" & CLogManage.cst_TABLE_NAME & "` GROUP BY `" & CLogManage.m_COLS_NAME(CLogManage.COLS.序号) & "`", m_Table)
    End Sub

    'Private Sub bt_Add_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    '    If m_LogManage.AddItem("系统记录表", "添加一条", "tony") = ERROR_CODE.SUCCESS Then
    '        MsgBox("OK")
    '    Else
    '        MsgBox("error")
    '    End If
    'End Sub

    'Private Sub btDel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    '    m_LogManage.DeleteItem(1)
    'End Sub

    'Private Sub btQuery_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    '    Dim rDate As Date = Now
    '    Dim rData(6) As String

    '    m_LogManage.QueryItem(2, rDate, rData(1), rData(2), rData(3), rData(4), rData(5))
    'End Sub

    'Private Sub btGetCount_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    '    Dim count As Integer
    '    m_LogManage.GetLogCounts(count)
    '    MsgBox(count)
    'End Sub

    Private Sub btRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btRefresh.Click
        RefreshList()
    End Sub

    Private Function RefreshList() As Boolean
        GetDataSet()

        Grid1.AllowUserSort = True
        Grid1.DisplayFocusRect = False
        Grid1.ExtendLastCol = True
        Grid1.DisplayRowArrow = True
        Grid1.BoldFixedCell = False
        Grid1.SortIndicatorStyle = FlexCell.SortIndicatorStyleEnum.Light3D

        '绑定到数据源时可以指定固定行数，但绑定后不能改变Grid.FixedRows属性的值
        'Grid1.SetDataBinding(m_Table, "products", True, 2)
        Grid1.SetDataBinding(m_Table, "", True, 1)

        CGirdInfo.LoadGridInfo("系统记录", Grid1)

        Grid1.Locked = True

        Return True
    End Function

    Private Sub Form_SysLog_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        RefreshList()
        CGirdInfo.LoadGridInfo("系统记录", Grid1)

        Me.Left = My.Settings.FORM_SYSLOG_X
        Me.Top = My.Settings.FORM_SYSLOG_Y
        Me.Width = My.Settings.FORM_SYSLOG_WIDTH
        Me.Height = My.Settings.FORM_SYSLOG_HEIGHT

        m_InitOver = True
    End Sub

    Private Sub Form_SysLog_LocationChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LocationChanged
        If m_InitOver = True Then
            My.Settings.FORM_SYSLOG_X = Me.Left
            My.Settings.FORM_SYSLOG_Y = Me.Top
            My.Settings.Save()
        End If
    End Sub

    Private Sub Form_SysLog_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize
        If m_InitOver = True Then
            My.Settings.FORM_SYSLOG_HEIGHT = Me.Height
            My.Settings.FORM_SYSLOG_WIDTH = Me.Width
            My.Settings.Save()
        End If
    End Sub

    Private Sub Grid1_ColWidthChange(ByVal Sender As System.Object, ByVal e As FlexCell.Grid.ColWidthChangeEventArgs) Handles Grid1.ColWidthChange
        CGirdInfo.SaveGirdInfo("系统记录", Grid1)
    End Sub
End Class