Public Class ClassChG
Private vWeight As Integer = 0
Private vResultWord As String
'vDate格式为:1978-8-10
'vTime值为:
'子:子(23:00~1:00)
'丑:丑(1:00~3:00)
'寅:寅(3:00~5:00)
'卯:卯(5:00~7:00)
'辰:辰(7:00~9:00)
'巳:巳(9:00~11:00)
'午:午(11:00~13:00)
'未:未(13:00~15:00)
'申:申(15:00~17:00)
'酉:酉(17:00~19:00)
'戌:戌(19:00~21:00)
'亥:亥(21:00~23:00)
Public Sub New(ByVal vDate As String, ByVal vTime As String)
Dim ss() As String = Split(vDate, "-")
vWeight += Me.GetYearValue(ss(0))
vWeight += Me.GetMonthValue(ss(1))
vWeight += Me.GetDayValue(ss(2))
vWeight += Me.GetTimeValue(vTime)
vResultWord = Me.GetResultWord(vWeight)
End Sub
Public ReadOnly Property Weight() As Integer
Get
Weight = vWeight
End Get
End Property
Public ReadOnly Property ResultWord() As String
Get
ResultWord = vResultWord
End Get
End Property
Function GetYearValue(ByVal Year As Integer) As Integer
Select Case Year
Case 1900 : Return 7
Case 1901 : Return 7
Case 1902 : Return 9
Case 1903 : Return 12
Case 1904 : Return 8
Case 1905 : Return 7
Case 1906 : Return 13
Case 1907 : Return 5
Case 1908 : Return 14
Case 1909 : Return 5
Case 1910 : Return 9
Case 1911 : Return 17
Case 1912 : Return 5
Case 1913 : Return 7
Case 1914 : Return 12
Case 1915 : Return 8
Case 1916 : Return 5
Case 1917 : Return 6
Case 1918 : Return 19
Case 1919 : Return 6
Case 1920 : Return 8
Case 1921 : Return 16
Case 1922 : Return 10
Case 1923 : Return 7
Case 1924 : Return 12
Case 1925 : Return 9
Case 1926 : Return 6
Case 1927 : Return 7
Case 1928 : Return 12
Case 1929 : Return 5
Case 1930 : Return 9
Case 1931 : Return 8
Case 1932 : Return 7
Case 1933 : Return 8
Case 1934 : Return 15
Case 1935 : Return 9
Case 1936 : Return 16
Case 1937 : Return 8
Case 1938 : Return 8
Case 1939 : Return 9
Case 1940 : Return 12
Case 1941 : Return 6
Case 1942 : Return 8
Case 1943 : Return 5
Case 1944 : Return 5
Case 1945 : Return 15
Case 1946 : Return 6
Case 1947 : Return 16
Case 1948 : Return 15
Case 1949 : Return 8
Case 1950 : Return 9
Case 1951 : Return 12
Case 1952 : Return 10
Case 1953 : Return 7
Case 1954 : Return 15
Case 1955 : Return 6
Case 1956 : Return 5
Case 1957 : Return 14