82 lines
3.1 KiB
VB.net
82 lines
3.1 KiB
VB.net
|
|
Public Class form_SupplierManage
|
|||
|
|
Dim m_Table As New System.Data.DataTable
|
|||
|
|
Dim m_Supplier As New CSupplier
|
|||
|
|
|
|||
|
|
Private Sub GetDataSet()
|
|||
|
|
'SQL_Query("SELECT * FROM `AccountManageTable`", m_Table)
|
|||
|
|
If Not m_Table Is Nothing Then
|
|||
|
|
m_Table.Dispose()
|
|||
|
|
End If
|
|||
|
|
m_Table = New DataTable
|
|||
|
|
SQL_Query(COL_RIGHTS.供应商管理, "SELECT * FROM `" & CSupplier.cst_TABLE_NAME & "`", m_Table)
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub SetDataBinding()
|
|||
|
|
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)
|
|||
|
|
|
|||
|
|
Grid1.Locked = True
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Function DeleteItem(ByVal strID As String) As Boolean
|
|||
|
|
Dim result As ERROR_CODE = m_Supplier.DeleteItem(strID)
|
|||
|
|
If result = ERROR_CODE.SUCCESS Then
|
|||
|
|
SetDataBinding()
|
|||
|
|
Return True
|
|||
|
|
ElseIf result = ERROR_CODE.NORIGHT Then
|
|||
|
|
MsgBox("删除失败: ""无访问权限!""")
|
|||
|
|
Else
|
|||
|
|
MsgBox("删除失败: 请检查网络连接或联系管理员!")
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
Return False
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
Private Sub Grid1_BeforeUserDeleteRow(ByVal Sender As System.Object, ByVal e As FlexCell.Grid.BeforeUserDeleteRowEventArgs) Handles Grid1.BeforeUserDeleteRow
|
|||
|
|
e.Cancel = True
|
|||
|
|
'If MsgBox("确定要删除该行数据?", MsgBoxStyle.OkCancel Or MsgBoxStyle.DefaultButton2, "删除确认") <> MsgBoxResult.Ok Then
|
|||
|
|
' e.Cancel = True
|
|||
|
|
'Else
|
|||
|
|
' Dim strSupplierID As String = Grid1.Cell(e.FirstRow, CSupplier.COLS.供应商ID + 1).Text
|
|||
|
|
' DeleteItem(strSupplierID)
|
|||
|
|
' SetDataBinding()
|
|||
|
|
'End If
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub form_SupplierManage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
|||
|
|
If CBool(Current_Rights(COL_RIGHTS.供应商管理) And RIGHTS.WRITE) = False Then
|
|||
|
|
bt_Add.Enabled = False
|
|||
|
|
bt_Del.Enabled = False
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
SetDataBinding()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub bt_Refresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_Refresh.Click
|
|||
|
|
SetDataBinding()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub bt_Add_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_Add.Click
|
|||
|
|
Dim pAddDlg As New dlg_AddSupplier
|
|||
|
|
pAddDlg.ShowDialog()
|
|||
|
|
SetDataBinding()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub bt_Del_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_Del.Click
|
|||
|
|
If Grid1.Selection.FirstRow >= 1 Then
|
|||
|
|
Dim strSupplierID As String = Grid1.Cell(Grid1.Selection.FirstRow, CSupplier.COLS.供应商ID + 1).Text
|
|||
|
|
DeleteItem(strSupplierID)
|
|||
|
|
SetDataBinding()
|
|||
|
|
End If
|
|||
|
|
End Sub
|
|||
|
|
End Class
|