Punyawee Pos Internship 2015 (Software Engineering JAVA DEV at parliament-dev)elop
1. สำนักงำนเลขำธิกำรสภำผู้แทนรำษฎร
The Secretariat of The House of Representatives
ระบบวิเครำะห์โครงกำรพัฒนำบุคคลำกรด้ำนเทคโนโลยีสำรสนเทศและกำรสื่อสำร
System Of Analysis Human Resource Development Project Of Information
Technology
ระบบวิเครำะห์โครงกำรพัฒนำบุคลำกรด้ำนเทคโนโลยีสำรสนเทศและกำรสื่อสำร
กลุ่มงำนวิทยำกำรคอมพิวเตอร์ สำนักสำรสนเทศ
สำนักงำนเลขำธิกำรสภำผู้แทนรำษฎร
โดย
นักศึกษำฝึกงำน ระดับปริญญำตรี ชั้นปีที่สอง
คณะวิศวกรรมศำสตร์ สำขำวิศวกรรมซอฟต์แวร์ หลักสูตรนำนำชำติ สถำบันเทคโนโลยีพระจอมเกล้ำเจ้ำคุณทหำรลำดกระบัง
นำยปุณยวีร์ โพธิ์ศรี
นำยจำรุกิตต์ พัฒนพรกุล
รำยงำนฉบับสมบูรณ์
47. 45
addProject_Panel
Imports MySql.Data.MySqlClient
Public Class addProject_Panel
Public dbconn = Login_Form.dbconn
Public sql = Login_Form.sql
Public dbcomm = Login_Form.dbcomm
Public dbread = Login_Form.dbread
Public notadd As Boolean = False
Dim positionlist As New List(Of String)
Public x, mon As New ArrayList
Public a, months As String
Public calendarFlag As Integer = 0
Public Sub back_tile_item_Click(sender As Object, e As EventArgs) Handles
back_tile_item.Click
If Me.IsOpen Then
Me.IsOpen = False
End If
clearAll()
End Sub
Private Sub trainee_list_ColumnWidthChanging(sender As Object, e As
ColumnWidthChangingEventArgs) Handles trainee_list.ColumnWidthChanging
e.Cancel = True
e.NewWidth = trainee_list.Columns(e.ColumnIndex).Width
End Sub
Private Sub team_list_ColumnWidthChanging(sender As Object, e As
ColumnWidthChangingEventArgs) Handles team_list.ColumnWidthChanging
e.Cancel = True
e.NewWidth = team_list.Columns(e.ColumnIndex).Width
End Sub
Private Sub helper_list_ColumnWidthChanging(sender As Object, e As
ColumnWidthChangingEventArgs) Handles helper_list.ColumnWidthChanging
e.Cancel = True
e.NewWidth = helper_list.Columns(e.ColumnIndex).Width
End Sub
Private Sub add_position_button_Click(sender As Object, e As EventArgs) Handles
add_position_button.Click
Dim combotext As String = position_combobox.SelectedItem.ToString
Dim item1 As ListViewItem = trainee_list.FindItemWithText(combotext)
If (item1 IsNot Nothing) Then
Else
trainee_list.Items.Add(CreateTraineetRow(combotext))
End If
End Sub
Private Sub trainee_list_MouseClick(sender As Object, e As MouseEventArgs) Handles
trainee_list.MouseClick
' show panel list and load all information
Dim index As Integer = trainee_list.SelectedIndices(0)
Dim myValue As String = InputBox("ใส่จำนวนที่คำดหวัง", "กรุณำใส่ข้อมูล",
trainee_list.Items(index).SubItems(1).Text)
Dim myValue2 As String = InputBox("ใส่จำนวนที่มำอบรมจริง", "กรุณำใส่ข้อมูล",
trainee_list.Items(index).SubItems(2).Text)
trainee_list.Items(index).SubItems(1).Text = myValue
trainee_list.Items(index).SubItems(2).Text = myValue2
End Sub
48. 46
Private Function CreateTraineetRow(ByVal name As String) As
System.Windows.Forms.ListViewItem
'create row in this function and return row and add to project_list
Dim row As System.Windows.Forms.ListViewItem = New
System.Windows.Forms.ListViewItem(New String() {name, "0", "0"})
Return row
End Function
Private Sub checkTextbox(sender As Object, e As KeyPressEventArgs) Handles
fund_textbox.KeyPress
If Asc(e.KeyChar) <> 8 Then
If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then
e.Handled = True
End If
End If
End Sub
Private Sub checkTextbox2(sender As Object, e As KeyPressEventArgs) Handles
used_textbox.KeyPress
If Asc(e.KeyChar) <> 8 Then
If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then
e.Handled = True
End If
End If
End Sub
Private Sub addProject_Panel_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
addData()
End Sub
Public Sub addData()
calendarFlag = 0
CalendarView1.Hide()
mon.Clear()
mon.Add("มกรำคม")
mon.Add("กุมภำพันธ์")
mon.Add("มีนำคม")
mon.Add("เมษำยน")
mon.Add("พฤษภำคม")
mon.Add("มิถุนำยน")
mon.Add("กรกฎำคม")
mon.Add("สิงหำคม")
mon.Add("กันยำยน")
mon.Add("ตุลำคม")
mon.Add("พฤษจิกำยน")
mon.Add("ธันวำคม")
'add data to position combobox
sql = "SELECT * FROM `position`"
dbcomm = New MySqlCommand(sql, dbconn)
dbread = dbcomm.ExecuteReader()
While dbread.Read()
If Not (position_combobox.Items.Contains(dbread("uname"))) Then
position_combobox.Items.Add(dbread("uname"))
End If
End While
dbread.Close()
' end add data
49. 47
'add data to main_lecturer and helper combobox
sql = "SELECT * FROM `lecturerinfo`"
dbcomm = New MySqlCommand(sql, dbconn)
dbread = dbcomm.ExecuteReader()
While dbread.Read()
If Not (main_lecturer_combobox.Items.Contains(dbread("lname"))) Then
main_lecturer_combobox.Items.Add(dbread("lname"))
End If
If Not (helper_lecturer_combobox.Items.Contains(dbread("lname"))) Then
helper_lecturer_combobox.Items.Add(dbread("lname"))
End If
End While
dbread.Close()
' end add data
'add data to leader and team combobox
sql = "SELECT * FROM `leaderinfo`"
dbcomm = New MySqlCommand(sql, dbconn)
dbread = dbcomm.ExecuteReader()
While dbread.Read()
If Not (leader_combobox.Items.Contains(dbread("leadname"))) Then
leader_combobox.Items.Add(dbread("leadname"))
End If
If Not (team_combobox.Items.Contains(dbread("leadname"))) Then
team_combobox.Items.Add(dbread("leadname"))
End If
End While
dbread.Close()
' end add data
End Sub
Private Sub add_helper_button_Click(sender As Object, e As EventArgs) Handles
add_helper_button.Click
If helper_lecturer_combobox.SelectedIndex = -1 Then
Else
Dim combotext As String = helper_lecturer_combobox.SelectedItem.ToString
Dim item1 As ListViewItem = helper_list.FindItemWithText(combotext)
If (item1 IsNot Nothing) Then
Else
If main_lecturer_combobox.SelectedIndex = -1 Then
helper_list.Items.Add(CreateTraineetRow(combotext))
ElseIf combotext <> main_lecturer_combobox.SelectedItem.ToString Then
helper_list.Items.Add(CreateTraineetRow(combotext))
End If
End If
End If
End Sub
Private Sub selected_index_changed(sender As Object, e As EventArgs) Handles
main_lecturer_combobox.SelectedIndexChanged
Dim combotext As String = main_lecturer_combobox.SelectedItem.ToString
Dim item1 As ListViewItem = helper_list.FindItemWithText(combotext)
If (item1 IsNot Nothing) Then
helper_list.Items.Remove(item1)
End If
End Sub
Private Sub add_team_button_Click(sender As Object, e As EventArgs) Handles
add_team_button.Click
If team_combobox.SelectedIndex = -1 Then
50. 48
Else
Dim combotext As String = team_combobox.SelectedItem.ToString
Dim item1 As ListViewItem = team_list.FindItemWithText(combotext)
If (item1 IsNot Nothing) Then
Else
If leader_combobox.SelectedIndex = -1 Then
team_list.Items.Add(CreateTraineetRow(combotext))
ElseIf combotext <> leader_combobox.SelectedItem.ToString Then
team_list.Items.Add(CreateTraineetRow(combotext))
End If
End If
End If
End Sub
Private Sub select_index_change(sender As Object, e As EventArgs) Handles
leader_combobox.SelectedIndexChanged
Dim combotext As String = leader_combobox.SelectedItem.ToString
Dim item1 As ListViewItem = team_list.FindItemWithText(combotext)
If (item1 IsNot Nothing) Then
team_list.Items.Remove(item1)
End If
End Sub
Private Sub checkTextBoxi1(sender As Object, e As KeyPressEventArgs) Handles
TextBoxX1.KeyPress
Dim FullStop As Char
FullStop = "."
If e.KeyChar = FullStop And TextBoxX1.Text.IndexOf(FullStop) <> -1 Then
e.Handled = True
Return
End If
If Not Char.IsDigit(e.KeyChar) Then
If (e.KeyChar <> FullStop) And
(e.KeyChar <> Convert.ToChar(Keys.Back)) Then
e.Handled = True
Return
End If
End If
End Sub
Private Sub checkTextBoxi2(sender As Object, e As KeyPressEventArgs) Handles
TextBoxX2.KeyPress
Dim FullStop As Char
FullStop = "."
If e.KeyChar = FullStop And TextBoxX2.Text.IndexOf(FullStop) <> -1 Then
e.Handled = True
Return
End If
If Not Char.IsDigit(e.KeyChar) Then
If (e.KeyChar <> FullStop) And
(e.KeyChar <> Convert.ToChar(Keys.Back)) Then
e.Handled = True
Return
End If
End If
End Sub
Private Sub checkTextBoxi3(sender As Object, e As KeyPressEventArgs) Handles
TextBoxX3.KeyPress
Dim FullStop As Char
FullStop = "."
If e.KeyChar = FullStop And TextBoxX3.Text.IndexOf(FullStop) <> -1 Then