initial commit
This commit is contained in:
commit
252dac3143
1516 changed files with 694271 additions and 0 deletions
98
App_Code/Ps.vb
Normal file
98
App_Code/Ps.vb
Normal file
|
@ -0,0 +1,98 @@
|
|||
Imports Microsoft.VisualBasic
|
||||
|
||||
Public Class Ps
|
||||
Public Shared Function GetRankLevel(Optional ByVal Pid As String = "") As Integer
|
||||
Dim userId As String = ""
|
||||
If Pid = "" Then
|
||||
userId = BaseClasses.Utils.SecurityControls.GetCurrentUserID()
|
||||
Else
|
||||
userId = Pid
|
||||
End If
|
||||
If userId = "" Then
|
||||
Return 0
|
||||
End If
|
||||
Dim rec As PersonalIdRecord = PersonalIdTable.GetRecord("PersonalId='" & userId & "'")
|
||||
Dim rec1 As RankRecord = RankTable.GetRecord("RankId=" & rec.RankId)
|
||||
Return rec1.RankLevel
|
||||
End Function
|
||||
|
||||
Public Shared Function GetRank(ByVal RankId As Integer, Optional ByVal ShortRank As Boolean = False) As String
|
||||
Dim Rank As String = ""
|
||||
Dim rec As RankRecord = RankTable.GetRecord("RankId=" & RankId)
|
||||
If Not rec Is Nothing Then
|
||||
Rank = rec.ShortRankNormal
|
||||
End If
|
||||
Return Rank
|
||||
End Function
|
||||
Public Shared Function GetDept(ByVal DeptId As Integer) As String
|
||||
GetDept = ""
|
||||
Dim rec As DeptRecord = DeptTable.GetRecord("DeptId=" & DeptId)
|
||||
If Not rec Is Nothing Then
|
||||
GetDept = rec.DeptAbbvr
|
||||
Else
|
||||
End If
|
||||
End Function
|
||||
Public Shared Function GetSectionAbbvrNameByDeptId(ByVal DeptId As Integer) As String
|
||||
GetSectionAbbvrNameByDeptId = ""
|
||||
Dim rec As DeptRecord = DeptTable.GetRecord("DeptId=" & DeptId)
|
||||
Dim rec1 As SectionRecord = SectionTable.GetRecord("SectionId=" & rec.SectionId)
|
||||
GetSectionAbbvrNameByDeptId = rec1.SectionAbbvrName
|
||||
End Function
|
||||
Public Shared Function GetName(ByVal pid As String) As String
|
||||
GetName = ""
|
||||
Dim recId As PersonalIdRecord = PersonalIdTable.GetRecord("PersonalId='" & pid & "'")
|
||||
Dim recRank As RankRecord = RankTable.GetRecord("RankId=" & recId.RankId)
|
||||
|
||||
'25/11/54
|
||||
' If Not recId Is Nothing AndAlso Not recRank Is Nothing Then
|
||||
' GetName = recRank.ShortRankNormal & recId.PersonalName & " " & recId.PersonalLastName
|
||||
' End If
|
||||
|
||||
If recId.Sex = 2 And (recId.RankId < 34 Or recId.RankId > 36 And recId.RankId <= 57) Then
|
||||
GetName = Trim(recRank.ShortRankNormal & "หญิง " & recId.PersonalName & " " & recId.PersonalLastName & " " & recRank.suffix)
|
||||
Else
|
||||
GetName = Trim(recRank.ShortRankNormal & recId.PersonalName & " " & recId.PersonalLastName & " " & recRank.suffix)
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
Public Shared Function ChingePID(ByVal pid As String, ByVal npid As String) As Integer
|
||||
Dim myConnection As System.Data.SqlClient.SqlConnection
|
||||
Dim myCommand As New System.Data.SqlClient.SqlCommand
|
||||
Dim result As Integer
|
||||
myConnection = CType(BaseClasses.Data.SqlProvider.SqlTransaction.GetExistingTransaction().GetADOConnectionByName("DatabasePersons1"), System.Data.SqlClient.SqlConnection)
|
||||
|
||||
'Specify the name of the Stored Procedure which is to be run
|
||||
|
||||
myCommand.Connection = myConnection
|
||||
myCommand.CommandType = System.Data.CommandType.StoredProcedure
|
||||
myCommand.CommandTimeout = 15
|
||||
|
||||
'myCommand.ExecuteScalar()
|
||||
myCommand.Parameters.AddWithValue("@pid", pid)
|
||||
myCommand.Parameters.AddWithValue("@NewPid", npid)
|
||||
myCommand.CommandText = "ChangePid"
|
||||
result = myCommand.ExecuteNonQuery
|
||||
|
||||
Return result
|
||||
|
||||
End Function
|
||||
|
||||
Public Shared Function IsPid(ByVal id As String) As Boolean
|
||||
If Len(id) = 13 Then
|
||||
Dim i As Integer
|
||||
Dim sum As Integer
|
||||
For i = 1 To 12
|
||||
sum = sum + CInt(Mid(id, i, 1)) * (14 - i)
|
||||
Next
|
||||
If (11 - (sum Mod 11)) Mod 10 = CInt(Mid(id, i, 13)) Then
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
'Return True
|
||||
End If
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
End Class
|
Loading…
Add table
Add a link
Reference in a new issue