Form_Log.frm
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:9k
源码类别:

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Begin VB.Form Frm_Log 
  4.    Caption         =   "上机日志"
  5.    ClientHeight    =   5385
  6.    ClientLeft      =   1785
  7.    ClientTop       =   1830
  8.    ClientWidth     =   8550
  9.    HelpContextID   =   1020
  10.    Icon            =   "Form_Log.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   5385
  13.    ScaleWidth      =   8550
  14.    StartUpPosition =   2  '屏幕中心
  15.    WindowState     =   2  'Maximized
  16.    Begin MSComctlLib.ImageList ImageList2 
  17.       Left            =   5940
  18.       Top             =   2310
  19.       _ExtentX        =   1005
  20.       _ExtentY        =   1005
  21.       BackColor       =   -2147483643
  22.       ImageWidth      =   16
  23.       ImageHeight     =   16
  24.       MaskColor       =   12632256
  25.       _Version        =   393216
  26.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  27.          NumListImages   =   5
  28.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  29.             Picture         =   "Form_Log.frx":038A
  30.             Key             =   "L"
  31.          EndProperty
  32.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  33.             Picture         =   "Form_Log.frx":0726
  34.             Key             =   "gl"
  35.          EndProperty
  36.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  37.             Picture         =   "Form_Log.frx":0AC2
  38.             Key             =   "sc"
  39.          EndProperty
  40.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  41.             Picture         =   "Form_Log.frx":0E5E
  42.             Key             =   "sx"
  43.          EndProperty
  44.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  45.             Picture         =   "Form_Log.frx":11FA
  46.             Key             =   "tc"
  47.          EndProperty
  48.       EndProperty
  49.    End
  50.    Begin MSComctlLib.Toolbar Toolbar1 
  51.       Align           =   1  'Align Top
  52.       Height          =   555
  53.       Left            =   0
  54.       TabIndex        =   1
  55.       Top             =   0
  56.       Width           =   8550
  57.       _ExtentX        =   15081
  58.       _ExtentY        =   979
  59.       ButtonWidth     =   820
  60.       ButtonHeight    =   926
  61.       Appearance      =   1
  62.       Style           =   1
  63.       ImageList       =   "ImageList2"
  64.       _Version        =   393216
  65.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  66.          NumButtons      =   6
  67.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  68.             Caption         =   "过滤"
  69.             Key             =   "Filtrate"
  70.             ImageKey        =   "gl"
  71.          EndProperty
  72.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  73.             Style           =   4
  74.             Object.Width           =   200
  75.          EndProperty
  76.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  77.             Caption         =   "删除"
  78.             Key             =   "Del"
  79.             ImageKey        =   "sc"
  80.          EndProperty
  81.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  82.             Caption         =   "刷新"
  83.             Key             =   "R"
  84.             ImageKey        =   "sx"
  85.          EndProperty
  86.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  87.             Style           =   4
  88.             Object.Width           =   200
  89.          EndProperty
  90.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  91.             Caption         =   "退出"
  92.             Key             =   "Exit"
  93.             ImageKey        =   "tc"
  94.          EndProperty
  95.       EndProperty
  96.    End
  97.    Begin MSComctlLib.ListView ListView1 
  98.       Height          =   6495
  99.       Left            =   0
  100.       TabIndex        =   0
  101.       Top             =   600
  102.       Width           =   8535
  103.       _ExtentX        =   15055
  104.       _ExtentY        =   11456
  105.       View            =   3
  106.       LabelEdit       =   1
  107.       LabelWrap       =   -1  'True
  108.       HideSelection   =   -1  'True
  109.       FullRowSelect   =   -1  'True
  110.       _Version        =   393217
  111.       Icons           =   "ImageList2"
  112.       SmallIcons      =   "ImageList2"
  113.       ForeColor       =   -2147483640
  114.       BackColor       =   -2147483643
  115.       BorderStyle     =   1
  116.       Appearance      =   1
  117.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  118.          Name            =   "宋体"
  119.          Size            =   9
  120.          Charset         =   134
  121.          Weight          =   400
  122.          Underline       =   0   'False
  123.          Italic          =   0   'False
  124.          Strikethrough   =   0   'False
  125.       EndProperty
  126.       NumItems        =   7
  127.       BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  128.          Text            =   "开始时间"
  129.          Object.Width           =   3617
  130.       EndProperty
  131.       BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  132.          SubItemIndex    =   1
  133.          Text            =   "用户"
  134.          Object.Width           =   2540
  135.       EndProperty
  136.       BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  137.          SubItemIndex    =   2
  138.          Text            =   "工作站"
  139.          Object.Width           =   2540
  140.       EndProperty
  141.       BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  142.          SubItemIndex    =   3
  143.          Text            =   "网络用户名"
  144.          Object.Width           =   2646
  145.       EndProperty
  146.       BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  147.          SubItemIndex    =   4
  148.          Text            =   "操作内容"
  149.          Object.Width           =   4410
  150.       EndProperty
  151.       BeginProperty ColumnHeader(6) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  152.          SubItemIndex    =   5
  153.          Text            =   "子系统"
  154.          Object.Width           =   3528
  155.       EndProperty
  156.       BeginProperty ColumnHeader(7) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  157.          SubItemIndex    =   6
  158.          Text            =   "状态"
  159.          Object.Width           =   1411
  160.       EndProperty
  161.    End
  162. End
  163. Attribute VB_Name = "Frm_Log"
  164. Attribute VB_GlobalNameSpace = False
  165. Attribute VB_Creatable = False
  166. Attribute VB_PredeclaredId = True
  167. Attribute VB_Exposed = False
  168. Private Sub Form_Resize()
  169.     On Error Resume Next
  170.     ListView1.Width = Me.Width - 100
  171.     ListView1.Height = Me.Height - Toolbar1.Height - 400
  172. End Sub
  173. Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
  174.     On Error GoTo error_exit
  175.     Select Case Button.Key
  176.            Case "Exit"
  177.                  Unload Me
  178.                  
  179.            Case "Del"
  180.                 If Trim(ListView1.Tag) <> "" Then
  181.                    Dim Ssql As String
  182.                    If vbNo = MsgBox("你是否要删除这些日志?", vbYesNo + 32) Then Exit Sub
  183.                    Dim I As Integer
  184.                    For I = 1 To ListView1.ListItems.Count
  185.                         Ssql = "delete " & Me.Tag & ".dbo.System_Log where id=" & Mid(ListView1.ListItems.Item(I).Key, 2, Len(ListView1.ListItems.Item(I).Key))
  186.                         Conn_System.Execute Ssql
  187.                    Next
  188.                 End If
  189.                 Log_Where ListView1.Tag
  190.            Case "R"
  191.                  Log_Where ListView1.Tag
  192.            Case "Filtrate"
  193.                  Frm_logSelect.Tag = Me.Tag
  194.                  Frm_logSelect.Show 1
  195.                  '------------------
  196.                 Log_Where ListView1.Tag
  197.                  '------------------
  198.     End Select
  199.     
  200.     Exit Sub
  201. error_exit:
  202.     MsgBox Err.Description, 16
  203. End Sub
  204. Sub Log_Where(sql As String)
  205.     On Error GoTo error_exit
  206.       Dim aDo_DataBase As New Recordset
  207.       Dim Ssql As String
  208.       If Trim(sql) = "" Then Exit Sub
  209.         Ssql = "select a.*,b.czymc from " & Me.Tag & ".dbo.System_Log a," & Me.Tag & ".dbo.Gy_Czygl B where a.userid=b.czybm and " & sql
  210.         Set aDo_DataBase = Conn_System.Execute(Ssql)
  211.          ListView1.ListItems.Clear
  212.         With aDo_DataBase
  213.         Do While Not .EOF
  214.             Set mitem = ListView1.ListItems.Add()
  215.             mitem.Text = !GeginDate
  216.             mitem.SmallIcon = "L"
  217.            ' mitem.Icon = ""
  218.             mitem.SubItems(1) = "" & !czymc
  219.             mitem.SubItems(2) = "" & !WorkstationName
  220.             mitem.SubItems(3) = Trim("" & !netusername)
  221.             mitem.SubItems(4) = "" & !WorkList
  222.             mitem.SubItems(5) = "" & !SystemName
  223.             mitem.SubItems(6) = Trim("" & !State)
  224.             mitem.Key = "T" & !Id
  225.            
  226.             .MoveNext
  227.         Loop
  228.         .Close
  229.         Set aDo_DataBase = Nothing
  230.         End With
  231.         
  232.     Exit Sub
  233. error_exit:
  234.     MsgBox Err.Description, 16
  235. End Sub