frmQx.vb
上传用户:wj57717022
上传日期:2014-12-16
资源大小:4093k
文件大小:7k
源码类别:

医药行业

开发平台:

Visual Basic

  1. Public Class frmQx
  2.     Inherits System.Windows.Forms.Form
  3. #Region " Windows 窗体设计器生成的代码 "
  4.     Public Sub New()
  5.         MyBase.New()
  6.         '该调用是 Windows 窗体设计器所必需的。
  7.         InitializeComponent()
  8.         '在 InitializeComponent() 调用之后添加任何初始化
  9.     End Sub
  10.     '窗体重写 dispose 以清理组件列表。
  11.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  12.         If disposing Then
  13.             If Not (components Is Nothing) Then
  14.                 components.Dispose()
  15.             End If
  16.         End If
  17.         MyBase.Dispose(disposing)
  18.     End Sub
  19.     'Windows 窗体设计器所必需的
  20.     Private components As System.ComponentModel.IContainer
  21.     '注意: 以下过程是 Windows 窗体设计器所必需的
  22.     '可以使用 Windows 窗体设计器修改此过程。
  23.     '不要使用代码编辑器修改它。
  24.     Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
  25.     Friend WithEvents TvCustomer As System.Windows.Forms.TreeView
  26.     Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
  27.     Friend WithEvents StatusBar1 As System.Windows.Forms.StatusBar
  28.     Friend WithEvents dgmenu As System.Windows.Forms.DataGrid
  29.     Friend WithEvents ToolBar1 As System.Windows.Forms.ToolBar
  30.     Friend WithEvents tbrSave As System.Windows.Forms.ToolBarButton
  31.     Friend WithEvents tbrExit As System.Windows.Forms.ToolBarButton
  32.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  33.         Me.GroupBox1 = New System.Windows.Forms.GroupBox
  34.         Me.TvCustomer = New System.Windows.Forms.TreeView
  35.         Me.GroupBox2 = New System.Windows.Forms.GroupBox
  36.         Me.dgmenu = New System.Windows.Forms.DataGrid
  37.         Me.StatusBar1 = New System.Windows.Forms.StatusBar
  38.         Me.ToolBar1 = New System.Windows.Forms.ToolBar
  39.         Me.tbrSave = New System.Windows.Forms.ToolBarButton
  40.         Me.tbrExit = New System.Windows.Forms.ToolBarButton
  41.         Me.GroupBox1.SuspendLayout()
  42.         Me.GroupBox2.SuspendLayout()
  43.         CType(Me.dgmenu, System.ComponentModel.ISupportInitialize).BeginInit()
  44.         Me.SuspendLayout()
  45.         '
  46.         'GroupBox1
  47.         '
  48.         Me.GroupBox1.Controls.Add(Me.TvCustomer)
  49.         Me.GroupBox1.Location = New System.Drawing.Point(8, 57)
  50.         Me.GroupBox1.Name = "GroupBox1"
  51.         Me.GroupBox1.Size = New System.Drawing.Size(176, 327)
  52.         Me.GroupBox1.TabIndex = 1
  53.         Me.GroupBox1.TabStop = False
  54.         '
  55.         'TvCustomer
  56.         '
  57.         Me.TvCustomer.AllowDrop = True
  58.         Me.TvCustomer.ImageIndex = -1
  59.         Me.TvCustomer.LabelEdit = True
  60.         Me.TvCustomer.Location = New System.Drawing.Point(8, 15)
  61.         Me.TvCustomer.Name = "TvCustomer"
  62.         Me.TvCustomer.Nodes.AddRange(New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("员工列表")})
  63.         Me.TvCustomer.SelectedImageIndex = -1
  64.         Me.TvCustomer.Size = New System.Drawing.Size(160, 305)
  65.         Me.TvCustomer.Sorted = True
  66.         Me.TvCustomer.TabIndex = 0
  67.         '
  68.         'GroupBox2
  69.         '
  70.         Me.GroupBox2.Controls.Add(Me.dgmenu)
  71.         Me.GroupBox2.Location = New System.Drawing.Point(192, 57)
  72.         Me.GroupBox2.Name = "GroupBox2"
  73.         Me.GroupBox2.Size = New System.Drawing.Size(464, 327)
  74.         Me.GroupBox2.TabIndex = 2
  75.         Me.GroupBox2.TabStop = False
  76.         '
  77.         'dgmenu
  78.         '
  79.         Me.dgmenu.DataMember = ""
  80.         Me.dgmenu.HeaderForeColor = System.Drawing.SystemColors.ControlText
  81.         Me.dgmenu.Location = New System.Drawing.Point(8, 15)
  82.         Me.dgmenu.Name = "dgmenu"
  83.         Me.dgmenu.Size = New System.Drawing.Size(448, 305)
  84.         Me.dgmenu.TabIndex = 0
  85.         '
  86.         'StatusBar1
  87.         '
  88.         Me.StatusBar1.Location = New System.Drawing.Point(0, 391)
  89.         Me.StatusBar1.Name = "StatusBar1"
  90.         Me.StatusBar1.Size = New System.Drawing.Size(661, 22)
  91.         Me.StatusBar1.TabIndex = 3
  92.         '
  93.         'ToolBar1
  94.         '
  95.         Me.ToolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat
  96.         Me.ToolBar1.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {Me.tbrSave, Me.tbrExit})
  97.         Me.ToolBar1.DropDownArrows = True
  98.         Me.ToolBar1.Location = New System.Drawing.Point(0, 0)
  99.         Me.ToolBar1.Name = "ToolBar1"
  100.         Me.ToolBar1.ShowToolTips = True
  101.         Me.ToolBar1.Size = New System.Drawing.Size(661, 44)
  102.         Me.ToolBar1.TabIndex = 4
  103.         '
  104.         'tbrSave
  105.         '
  106.         Me.tbrSave.Text = "保存"
  107.         '
  108.         'tbrExit
  109.         '
  110.         Me.tbrExit.Text = "退出"
  111.         '
  112.         'frmQx
  113.         '
  114.         Me.AutoScaleBaseSize = New System.Drawing.Size(8, 18)
  115.         Me.ClientSize = New System.Drawing.Size(661, 413)
  116.         Me.ControlBox = False
  117.         Me.Controls.Add(Me.ToolBar1)
  118.         Me.Controls.Add(Me.StatusBar1)
  119.         Me.Controls.Add(Me.GroupBox2)
  120.         Me.Controls.Add(Me.GroupBox1)
  121.         Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
  122.         Me.Name = "frmQx"
  123.         Me.Text = "权限分配"
  124.         Me.GroupBox1.ResumeLayout(False)
  125.         Me.GroupBox2.ResumeLayout(False)
  126.         CType(Me.dgmenu, System.ComponentModel.ISupportInitialize).EndInit()
  127.         Me.ResumeLayout(False)
  128.     End Sub
  129. #End Region
  130.     Public lsweb As New jxcmanage
  131.     Public dslocals As New DataSet
  132.     
  133.     Private Sub frmQx_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  134.         dslocals = lsweb.returndataset("select 操作员 from wz_mm", "wz_mm")
  135.         Dim drcurrent As DataRow
  136.         Dim tnCurrent As TreeNode
  137.         Dim i As Integer
  138.         For i = 0 To dslocals.Tables(0).Rows.Count - 1
  139.             drcurrent = dslocals.Tables(0).Rows(i)
  140.             tnCurrent = TvCustomer.Nodes(0).Nodes.Add(drcurrent("操作员"))
  141.             tnCurrent.Tag = drcurrent("操作员")
  142.         Next
  143.     End Sub
  144.     Private Sub TvCustomer_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TvCustomer.AfterSelect
  145.         dslocals = lsweb.returndataset("select * from wz_menu where username='" & e.Node.Tag & "'", "wz_menu")
  146.         dgmenu.DataSource = dslocals.Tables(0).DefaultView
  147.     End Sub
  148.     
  149.     Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick
  150.         Select Case e.Button.Text
  151.             Case "保存"
  152.                 If lsweb.updatedataset("select * from wz_menu", "wz_menu", dslocals, DataRowState.Modified) = True Then
  153.                     MessageBox.Show("权限配置成功保存!", "提示", MessageBoxButtons.OK)
  154.                 Else
  155.                     MessageBox.Show("权限配置保存失败!", "提示", MessageBoxButtons.AbortRetryIgnore)
  156.                 End If
  157.             Case "退出"
  158.                 Me.Close()
  159.         End Select
  160.     End Sub
  161. End Class