初始化
This commit is contained in:
158
WT-DMS/CAccountManage.vb
Normal file
158
WT-DMS/CAccountManage.vb
Normal file
@@ -0,0 +1,158 @@
|
||||
Public Class CAccountManage
|
||||
Dim m_SQL As New CSQLInterface
|
||||
|
||||
Const cst_TABLE_NAME As String = "帐号表"
|
||||
Public m_COLS_NAME() As String = {
|
||||
"序号",
|
||||
"帐号",
|
||||
"密码",
|
||||
"员工ID",
|
||||
"登录",
|
||||
"系统记录",
|
||||
"用户管理",
|
||||
"料号管理",
|
||||
"原料库存管理",
|
||||
"成品库存管理",
|
||||
"BOM管理",
|
||||
"供应商管理",
|
||||
"ECN管理",
|
||||
"公司管理",
|
||||
"部门管理",
|
||||
"仓库管理",
|
||||
"库位管理",
|
||||
"财务管理"
|
||||
}
|
||||
|
||||
Public Enum COLS
|
||||
序号
|
||||
帐号
|
||||
密码
|
||||
员工ID
|
||||
登录
|
||||
系统记录
|
||||
用户管理
|
||||
料号管理
|
||||
原料库存管理
|
||||
成品库存管理
|
||||
BOM管理
|
||||
供应商管理
|
||||
ECN管理
|
||||
公司管理
|
||||
部门管理
|
||||
仓库管理
|
||||
库位管理
|
||||
财务管理
|
||||
max
|
||||
End Enum
|
||||
|
||||
'权限
|
||||
Public Shared AccessRight As Integer = RIGHTS.NONE
|
||||
|
||||
|
||||
Public Sub New()
|
||||
End Sub
|
||||
|
||||
'Public Function AddItem(ByVal AccountName As String, ByVal Password As String, ByVal right As Integer, ByVal EmployeeID As Integer) As ERROR_CODE
|
||||
' If CBool(m_AccessRight And RIGHTS.WRITE) = False Then
|
||||
' Return ERROR_CODE.NORIGHT
|
||||
' End If
|
||||
' '"INSERT INTO [dbo].[TABLE1] ([11],[22],[33],[44],[55]) VALUES ('11','2','3','4','5')"
|
||||
' Dim strSql As String = "INSERT INTO " & cst_TABLE_NAME & "("
|
||||
' '加入列名
|
||||
' For i As Integer = 0 To m_COLS_NAME.Length - 1
|
||||
' If i > 0 Then
|
||||
' strSql &= ","
|
||||
' End If
|
||||
' strSql &= "[" & m_COLS_NAME(i) & "]"
|
||||
' Next
|
||||
' strSql &= ") VALUES ("
|
||||
' strSql &= "'" & Password & "'"
|
||||
' strSql &= "," & right
|
||||
' strSql &= "," & EmployeeID
|
||||
' strSql &= ")"
|
||||
|
||||
' If SQL_ExeCommand(strSql) = True Then
|
||||
' Return ERROR_CODE.SUCCESS
|
||||
' End If
|
||||
|
||||
' Return ERROR_CODE.ACCESS
|
||||
'End Function
|
||||
|
||||
'Public Function UpdateItem(ByVal AccountName As String, ByVal Password As String, ByVal right As Integer, ByVal EmployeeID As Integer) As ERROR_CODE
|
||||
' If CBool(m_AccessRight And RIGHTS.WRITE) = False Then
|
||||
' Return ERROR_CODE.NORIGHT
|
||||
' End If
|
||||
|
||||
' Dim strSql As String = "UPDATE " & cst_TABLE_NAME & " SET"
|
||||
' strSql &= " " & m_COLS_NAME(COLS.密码) & "=" & Password
|
||||
' strSql &= ", " & m_COLS_NAME(COLS.权限) & "=" & right
|
||||
' strSql &= ", " & m_COLS_NAME(COLS.员工ID) & "=" & EmployeeID
|
||||
' strSql &= " WHERE "
|
||||
' strSql &= m_COLS_NAME(COLS.帐号) & "=" & AccountName
|
||||
|
||||
' If SQL_ExeCommand(strSql) = True Then
|
||||
' Return ERROR_CODE.SUCCESS
|
||||
' End If
|
||||
|
||||
' Return ERROR_CODE.ACCESS
|
||||
'End Function
|
||||
|
||||
'Public Function DeleteItem(ByVal AccountName As String) As ERROR_CODE
|
||||
' If CBool(m_AccessRight And RIGHTS.WRITE) = False Then
|
||||
' Return ERROR_CODE.NORIGHT
|
||||
' End If
|
||||
|
||||
' Dim strSql As String = "DELETE FROM " & cst_TABLE_NAME & " WHERE "
|
||||
' strSql &= m_COLS_NAME(0) & "=" & AccountName
|
||||
|
||||
' If SQL_ExeCommand(strSql) = True Then
|
||||
' Return ERROR_CODE.SUCCESS
|
||||
' End If
|
||||
|
||||
' Return ERROR_CODE.ACCESS
|
||||
'End Function
|
||||
|
||||
Public Function QueryItem(ByVal AccountName As String, ByRef Password As String, ByRef EmployeeID As Integer, ByRef right() As String) As ERROR_CODE
|
||||
If CBool(AccessRight And RIGHTS.READ) = False Then
|
||||
Return ERROR_CODE.NORIGHT
|
||||
End If
|
||||
|
||||
'SELECT * FROM `帐号表` WHERE `帐号`='tony'
|
||||
Dim strSql As String = "SELECT * FROM `" & cst_TABLE_NAME & "` WHERE "
|
||||
'strSql &= "`" & m_COLS_NAME(COLS.帐号) & "` COLLATE utf8_general_ci ='" & AccountName & "'"
|
||||
strSql &= "`" & m_COLS_NAME(COLS.帐号) & "` ='" & AccountName & "'"
|
||||
'Dim strSql As String = "SELECT * FROM `帐号表`"
|
||||
|
||||
Dim rTable As New System.Data.DataTable
|
||||
If SQL_Query(COL_RIGHTS.用户管理, strSql, rTable) = True Then
|
||||
Try
|
||||
If rTable.Rows.Count > 0 Then
|
||||
Password = rTable.Rows(0).Item(COLS.密码)
|
||||
EmployeeID = rTable.Rows(0).Item(COLS.员工ID)
|
||||
right(COL_RIGHTS.登录) = rTable.Rows(0).Item(COLS.登录)
|
||||
right(COL_RIGHTS.系统记录) = rTable.Rows(0).Item(COLS.系统记录)
|
||||
right(COL_RIGHTS.用户管理) = rTable.Rows(0).Item(COLS.用户管理)
|
||||
right(COL_RIGHTS.料号管理) = rTable.Rows(0).Item(COLS.料号管理)
|
||||
right(COL_RIGHTS.原料库存管理) = rTable.Rows(0).Item(COLS.原料库存管理)
|
||||
right(COL_RIGHTS.成品库存管理) = rTable.Rows(0).Item(COLS.成品库存管理)
|
||||
right(COL_RIGHTS.BOM管理) = rTable.Rows(0).Item(COLS.BOM管理)
|
||||
right(COL_RIGHTS.供应商管理) = rTable.Rows(0).Item(COLS.供应商管理)
|
||||
right(COL_RIGHTS.ECN管理) = rTable.Rows(0).Item(COLS.ECN管理)
|
||||
right(COL_RIGHTS.公司管理) = rTable.Rows(0).Item(COLS.公司管理)
|
||||
right(COL_RIGHTS.部门管理) = rTable.Rows(0).Item(COLS.部门管理)
|
||||
right(COL_RIGHTS.仓库管理) = rTable.Rows(0).Item(COLS.仓库管理)
|
||||
right(COL_RIGHTS.库位管理) = rTable.Rows(0).Item(COLS.库位管理)
|
||||
right(COL_RIGHTS.财务管理) = rTable.Rows(0).Item(COLS.财务管理)
|
||||
Return ERROR_CODE.SUCCESS
|
||||
End If
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
End If
|
||||
|
||||
Return ERROR_CODE.ACCESS
|
||||
End Function
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user