Private Sub DetailsView1_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles DetailsView1.ItemUpdating
Dim txtPersonelID As TextBox = CType(DetailsView1.FindControl("txtEditHeader"), TextBox)
Dim txtName As TextBox = CType(DetailsView1.FindControl("txtEditDetail"), TextBox)
Dim Text1 As Label = CType(DetailsView1.FindControl("txtEditHeader_number"), Label)
newcls_tqf3_header.setHeaderDetail(txtPersonelID.Text, txtName.Text, Text1.Text)
DetailsView1.DataBind()
Response.Redirect("mainproject.aspx")
DetailsView1.Visible = True
End Sub
Imports System
Imports System.Data
Imports System.Drawing
Imports System.Data.SqlClient
Imports System.Timers
Partial Public Class mainproject
Inherits System.Web.UI.Page
Dim newcls_tqf_group As New cls_tqf_group
Dim newcls_tqf2 As New cls_tqf2
Dim newcls_patern3 As New cls_patern_tqf3
Dim newcls_patern5 As New cls_patern_tqf5
Dim newcls_patern4 As New cls_patern_tqf4
Dim newcls_patern6 As New cls_patern_tqf6
Dim newcls_category As New cls_category
Dim newcls_header As New cls_header
Dim newcls_tqf3_header As New cls_tqf3_header
'Dim ww As New Category
'Dim zz As New Headers
Dim a1 As String
Dim root As New TreeNode("สาขาวิชา")
Dim cc As New userx
Dim TQF() As TreeNode
Dim TQF_Group() As TreeNode
Dim Category() As TreeNode
'Dim plus As New TreeNode("เพิ่มหมวด")
Dim x As DataSet
Dim y As DataSet
Dim z As DataSet
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not (Session("policy") = "คณะกรรมการ" Or Session("policy") = "อาจารย์ผู้สอน" Or Session("policy") = "อาจารย์สหกิจ") Then
Session("policy") = "บุคคลทั่วไป"
Session("user") = "guest"
End If
If Not IsPostBack And Session("policy") = "บุคคลทั่วไป" Then
Menu1.Visible = False
Menu5.Visible = False
Menu2.Visible = True
End If
Label9.Text = Session("user")
Label5.Text = Session("policy")
If Not Session("selectx") = "" Then
Label8.Text = Session("selectx")
ElseIf Not Session("selecty") = "" Then
Label8.Text = Session("selecty")
End If
Label8.Visible = True
If Session("policy") = "คณะกรรมการ" Then
Menu5.Visible = True
Menu1.Visible = True
Menu2.Visible = False
Label8.Visible = False
End If
If Session("policy") = "อาจารย์ผู้สอน" Then
LinkButton1.Visible = True
Menu1.Visible = False
Menu2.Visible = False
Menu5.Visible = True
End If
If Session("policy") = "อาจารย์สหกิจ" Then
Menu1.Visible = False
Menu2.Visible = False
Menu5.Visible = True
Label8.Visible = False
End If
If Session("policy") = "บุคคลทั่วไป" Then
Menu1.Visible = False
Menu2.Visible = True
Menu5.Visible = False
Label8.Visible = False
Button1.Visible = False
Button2.Visible = False
End If
End Sub
Private Sub TreeView1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles TreeView1.Load
If IsPostBack = False Then
TreeView1.Nodes.Clear()
x = newcls_tqf_group.getDivisionMajor()
If x.Tables("TQF_Group").Rows.Count > 0 Then
'If Trim(x.Tables("TQF_Group").Rows(0).Item("Division")) = "คอมพิวเตอร์" Then
TreeView1.Nodes.Add(root)
root.Value = "1"
ReDim TQF_Group(x.Tables("TQF_Group").Rows.Count)
For i = 0 To x.Tables("TQF_Group").Rows.Count - 1 'เริ่มจาก 0 ถึง จำนวนแถวทั้งหมดของ Major
TQF_Group(i) = New TreeNode(Trim(x.Tables("TQF_Group").Rows(i).Item("Major")))
root.ChildNodes.Add(TQF_Group(i)) '''''/////add ชื่อสาขาวิชา
TQF_Group(i).Value = Trim(x.Tables("TQF_Group").Rows(i).Item("Major_id"))
y = newcls_tqf2.getTQF(Trim(x.Tables("TQF_Group").Rows(i).Item("Division_id")), Trim(x.Tables("TQF_Group").Rows(i).Item("Major_id")))
ReDim TQF(y.Tables("TQF").Rows.Count)
For k = 0 To y.Tables("TQF").Rows.Count - 1 'เริ่มจาก 0 ถึง จำนวนแถวทั้งหมดของ TQF_number
'*****************ตรวจเช็คว่าเข้ามาใน สิทธิ์ของ อาจารย์ผู้สอน********************
If Session("policy") = "อาจารย์ผู้สอน" And (y.Tables("TQF").Rows(k).Item("Tqf_number") = 3 Or y.Tables("TQF").Rows(k).Item("Tqf_number") = 5) Then
If y.Tables("TQF").Rows(k).Item("Tqf_number") = 3 Then
TQF(k) = New TreeNode("มคอ." & Trim(y.Tables("TQF").Rows(k).Item("Tqf_number")) & "รายละเอียดรายวิชา")
TQF_Group(i).ChildNodes.Add(TQF(k)) '/////add มคอ1-7
TQF(k).Value = Trim(y.Tables("TQF").Rows(k).Item("Tqf_number")) ' ซ่อนค่า
Dim ds As DataSet
ds = newcls_patern3.getData()
Dim TQF3() As TreeNode
Dim n As Integer
ReDim TQF3(ds.Tables("tqf3").Rows.Count)
For n = 0 To ds.Tables("tqf3").Rows.Count - 1
TQF3(n) = New TreeNode(Trim(ds.Tables("tqf3").Rows(n).Item("category").ToString))
TQF(k).ChildNodes.Add(TQF3(n))
TQF3(n).Value = Trim(ds.Tables("tqf3").Rows(n).Item("category_id"))
If Session("selectx") = "" Then
Dim add1 As New TreeNode("+ตั้งหัวข้อใหม่")
TQF3(n).ChildNodes.Add(add1)
End If
Next
End If
If y.Tables("TQF").Rows(k).Item("Tqf_number") = 5 Then
TQF(k) = New TreeNode("มคอ." & Trim(y.Tables("TQF").Rows(k).Item("Tqf_number")) & "รายงานผลการดำเนินการรายวิชา")
TQF_Group(i).ChildNodes.Add(TQF(k)) '/////add มคอ1-7
TQF(k).Value = Trim(y.Tables("TQF").Rows(k).Item("Tqf_number")) ' ซ่อนค่า
Dim ds As DataSet
ds = newcls_patern5.getData
Dim TQF3() As TreeNode
Dim n As Integer
ReDim TQF3(ds.Tables("tqf5").Rows.Count)
For n = 0 To ds.Tables("tqf5").Rows.Count - 1
TQF3(n) = New TreeNode(Trim(ds.Tables("tqf5").Rows(n).Item("category").ToString))
TQF(k).ChildNodes.Add(TQF3(n))
TQF3(n).Value = Trim(ds.Tables("tqf5").Rows(n).Item("category_id"))
If Session("selectx") = "" Then
Dim add1 As New TreeNode("+ตั้งหัวข้อใหม่")
TQF3(n).ChildNodes.Add(add1)
End If
Next
End If
'*****************จบการตรวจเช็ค*************************
End If
'*****************ตรวจเช็คว่าเข้ามาใน สิทธิ์ของอาจารย์สหกิจ********************
If Session("policy") = "อาจารย์สหกิจ" And (Trim(y.Tables("TQF").Rows(k).Item("Tqf_number")) = 6 Or y.Tables("TQF").Rows(k).Item("Tqf_number") = 4) Then
If y.Tables("TQF").Rows(k).Item("Tqf_number") = 4 Then
TQF(k) = New TreeNode("มคอ." & Trim(y.Tables("TQF").Rows(k).Item("Tqf_number")) & "รายละเอียดของภาคสนาม")
TQF_Group(i).ChildNodes.Add(TQF(k)) '/////add มคอ1-7
TQF(k).Value = Trim(y.Tables("TQF").Rows(k).Item("Tqf_number")) ' ซ่อนค่า
Dim ds As DataSet
ds = newcls_patern4.getData
Dim TQF3() As TreeNode
Dim n As Integer
ReDim TQF3(ds.Tables("tqf4").Rows.Count)
For n = 0 To ds.Tables("tqf4").Rows.Count - 1
TQF3(n) = New TreeNode(Trim(ds.Tables("tqf4").Rows(n).Item("category").ToString))
TQF(k).ChildNodes.Add(TQF3(n))
TQF3(n).Value = Trim(ds.Tables("tqf4").Rows(n).Item("category_id"))
Dim add1 As New TreeNode("+ตั้งหัวข้อใหม่")
TQF3(n).ChildNodes.Add(add1)
Next
End If
If y.Tables("TQF").Rows(k).Item("Tqf_number") = 6 Then
TQF(k) = New TreeNode("มคอ." & Trim(y.Tables("TQF").Rows(k).Item("Tqf_number")) & "รายงานผลการดำเนินการ")
TQF_Group(i).ChildNodes.Add(TQF(k)) '/////add มคอ1-7
TQF(k).Value = Trim(y.Tables("TQF").Rows(k).Item("Tqf_number")) ' ซ่อนค่า
Dim ds As DataSet
ds = newcls_patern6.getData
Dim TQF3() As TreeNode
Dim n As Integer
ReDim TQF3(ds.Tables("tqf6").Rows.Count)
For n = 0 To ds.Tables("tqf6").Rows.Count - 1
TQF3(n) = New TreeNode(Trim(ds.Tables("tqf6").Rows(n).Item("category").ToString))
TQF(k).ChildNodes.Add(TQF3(n))
TQF3(n).Value = Trim(ds.Tables("tqf6").Rows(n).Item("category_id"))
Dim add1 As New TreeNode("+ตั้งหัวข้อใหม่")
TQF3(n).ChildNodes.Add(add1)
Next
End If
End If
'*****************จบการตรวจเช็ค*************************
'*****************ตรวจเช็คว่าเข้ามาใน สิทธิ์ของคณะกรรมการ********************
If Session("policy") = "คณะกรรมการ" And (y.Tables("TQF").Rows(k).Item("Tqf_number") = 1 Or y.Tables("TQF").Rows(k).Item("Tqf_number") = 2 Or y.Tables("TQF").Rows(k).Item("Tqf_number") = 7) Then
TQF(k) = New TreeNode("มคอ." & Trim(y.Tables("TQF").Rows(k).Item("Tqf_number")))
TQF_Group(i).ChildNodes.Add(TQF(k)) '/////add มคอ1-7
TQF(k).Value = Trim(y.Tables("TQF").Rows(k).Item("Tqf_number")) ' ซ่อนค่า
z = newcls_category.getCategory(Trim(x.Tables("TQF_Group").Rows(i).Item("Division_id")), Trim(x.Tables("TQF_Group").Rows(i).Item("Major_id")), Trim(y.Tables("TQF").Rows(k).Item("Tqf_number")))
ReDim Category(z.Tables("Category").Rows.Count)
Dim j As Integer
For j = 0 To z.Tables("Category").Rows.Count - 1
Category(j) = New TreeNode("หมวดที่ " & Trim(z.Tables("Category").Rows(j).Item("Category_title")))
TQF(k).ChildNodes.Add(Category(j)) '******แอดหมวด
Category(j).Value = Trim(z.Tables("Category").Rows(j).Item("Category"))
If y.Tables("TQF").Rows(k).Item("Tqf_number") = 7 Then 'แอดเฉพาะ มคอ 7
'Dim child1 As New TreeNode("+ดูหัวข้อทั้งหมด")
'Category(j).ChildNodes.Add(child1)
Dim child As New TreeNode("+ตั้งหัวข้อใหม่")
Category(j).ChildNodes.Add(child)
End If
If y.Tables("TQF").Rows(k).Item("Tqf_number") = 2 Then 'แอดเฉพาะ มคอ 2
'Dim child1 As New TreeNode("+ดูหัวข้อทั้งหมด")
'Category(j).ChildNodes.Add(child1)
Dim child As New TreeNode("+ตั้งหัวข้อใหม่")
Category(j).ChildNodes.Add(child)
End If
If y.Tables("TQF").Rows(k).Item("Tqf_number") = 1 Then 'แอดเฉพาะ มคอ 1
'Dim child1 As New TreeNode("+ดูหัวข้อทั้งหมด")
'Category(j).ChildNodes.Add(child1)
Dim child As New TreeNode("+ตั้งหัวข้อใหม่")
Category(j).ChildNodes.Add(child)
End If
Next
If y.Tables("TQF").Rows(k).Item("Tqf_number") = 1 Then
Dim plus As New TreeNode("+เพิ่มหมวด")
TQF(k).ChildNodes.Add(plus)
End If
If y.Tables("TQF").Rows(k).Item("Tqf_number") = 2 Then
Dim plus As New TreeNode("+เพิ่มหมวด")
TQF(k).ChildNodes.Add(plus)
Dim child11 As New TreeNode("+หลักสูตร")
TQF(k).ChildNodes.Add(child11)
Dim child12 As New TreeNode("+แผนการศึกษา")
TQF(k).ChildNodes.Add(child12)
Dim child13 As New TreeNode("+อาจารย์ผู้สอน")
TQF(k).ChildNodes.Add(child13)
Dim child14 As New TreeNode("+การพัฒนาผลการเรียนรู้")
TQF(k).ChildNodes.Add(child14)
Dim child15 As New TreeNode("+การกระจายผลการเรียนรู้")
TQF(k).ChildNodes.Add(child15)
Dim child16 As New TreeNode("+ตัวบ่งชี้ผลการดำเนินงาน(KPI)")
TQF(k).ChildNodes.Add(child16)
End If
If y.Tables("TQF").Rows(k).Item("Tqf_number") = 7 Then
Dim plus As New TreeNode("+เพิ่มหมวด")
TQF(k).ChildNodes.Add(plus)
Dim child1 As New TreeNode("+ข้อมูลสรุปรายวิชาของหลักสูตร")
TQF(k).ChildNodes.Add(child1)
Dim child2 As New TreeNode("+การเปิดรายวิชาในปีการศึกษา")
TQF(k).ChildNodes.Add(child2)
Dim child3 As New TreeNode("+การบริหารหลักสูตร")
TQF(k).ChildNodes.Add(child3)
Dim child4 As New TreeNode("+รายงานผลการดำเนินงาน(KPI)")
TQF(k).ChildNodes.Add(child4)
End If
End If
'*****************จบการตรวจเช็ค*************************
'*****************ตรวจเช็คว่าเข้ามาใน สิทธิ์ของบุคคลทั่วไป********************
If Session("policy") = "บุคคลทั่วไป" And (y.Tables("TQF").Rows(k).Item("Tqf_number") = 1 Or y.Tables("TQF").Rows(k).Item("Tqf_number") = 2) Then
TQF(k) = New TreeNode("มคอ." & Trim(y.Tables("TQF").Rows(k).Item("Tqf_number")))
TQF_Group(i).ChildNodes.Add(TQF(k)) '/////add มคอ1-7
TQF(k).Value = Trim(y.Tables("TQF").Rows(k).Item("Tqf_number")) ' ซ่อนค่า
z = newcls_category.getCategory(Trim(x.Tables("TQF_Group").Rows(i).Item("Division_id")), Trim(x.Tables("TQF_Group").Rows(i).Item("Major_id")), Trim(y.Tables("TQF").Rows(k).Item("Tqf_number")))
ReDim Category(z.Tables("Category").Rows.Count)
Dim j As Integer
For j = 0 To z.Tables("Category").Rows.Count - 1
Category(j) = New TreeNode("หมวดที่ " & Trim(z.Tables("Category").Rows(j).Item("Category_title")))
TQF(k).ChildNodes.Add(Category(j)) '******แอดหมวด
Category(j).Value = Trim(z.Tables("Category").Rows(j).Item("Category"))
Next
If y.Tables("TQF").Rows(k).Item("Tqf_number") = 2 Then
Dim child11 As New TreeNode("+หลักสูตร")
TQF(k).ChildNodes.Add(child11)
Dim child12 As New TreeNode("+แผนการศึกษา")
TQF(k).ChildNodes.Add(child12)
Dim child13 As New TreeNode("+อาจารย์ผู้สอน")
TQF(k).ChildNodes.Add(child13)
End If
End If
'*****************จบการตรวจเช็ค*************************
Next
Next
End If
End If
End Sub
Protected Sub TreeView1_SelectedNodeChanged(ByVal sender As Object, ByVal e As EventArgs) Handles TreeView1.SelectedNodeChanged
Dim cate As New Category
Session("path") = Split(TreeView1.SelectedNode.ValuePath, "/")
Dim myArr As Array = Split(TreeView1.SelectedNode.ValuePath, "/")
Dim myStr As String = ""
Dim i As Integer
For i = 0 To myArr.Length - 1
myStr &= myArr(i)
Next
If TreeView1.SelectedNode.Text = "+เพิ่มหมวด" Then
Dim input As String
input = InputBox("กรุณาระบุชื่อ หมวดที่ :")
If Not input = "" Then
newcls_category.insertData(myArr(0), myArr(1), myArr(2), input)
Response.Redirect("mainproject.aspx")
End If
End If
If TreeView1.SelectedNode.Text = "+ตั้งหัวข้อใหม่" Then
Response.Redirect("Header1.aspx")
End If
If i = 0 Then
If Not myArr(0) = Nothing Then
Session("myArr(0)") = myArr(0) 'session เพื่อส่งไป ให้กับ detailview รอรับค่าอยู่เพื่อแสดงผลให้ตรงกับ ค่าที่กด
End If
End If
If i = 3 Then
If Not myArr(0) = Nothing Then
Session("myArr(0)") = myArr(0)
End If
If Not myArr(1) = Nothing Then
Session("myArr(1)") = myArr(1)
End If
If Not myArr(2) = Nothing Then
Session("myArr(2)") = myArr(2)
End If
End If
If i = 5 Then
If Session("policy") = "อาจารย์ผู้สอน" Then
If Session("selecty") = "" Then
Session("selecty") = Session("selectx")
DetailsView1.AutoGenerateDeleteButton = False
DetailsView1.AutoGenerateEditButton = False
DetailsView1.AutoGenerateInsertButton = False
End If
If Not myArr(1) = Nothing Then
Session("myArr(1)") = myArr(1)
End If
If Not myArr(2) = Nothing Then
Session("myArr(2)") = myArr(2)
End If
If Not myArr(3) = Nothing Then
Session("myArr(3)") = myArr(3)
End If
Dim sql As String
sql = "SELECT Header_number, Header, Detail "
sql &= " FROM TQF3_Header"
sql &= " WHERE Major_id = '" & Session("myArr(1)") & "' AND Tqf_number = '" & Session("myArr(2)") & "' AND Category = '" & Session("myArr(3)") & "' and course='" & Session("selecty") & "'"
Dim ds As DataSet
Dim con As New Cls_Connect
ds = con.ExecuteQuery(sql, "detail")
DetailsView1.DataSource = ds.Tables("detail")
DetailsView1.DataBind()
ElseIf Session("policy") = "คณะกรรมการ" Or Session("policy") = "อาจารย์สหกิจ" Or Session("policy") = "บุคคลทั่วไป" Then
If Not myArr(1) = Nothing Then
Session("myArr(1)") = myArr(1)
End If
If Not myArr(2) = Nothing Then
Session("myArr(2)") = myArr(2)
End If
If Not myArr(3) = Nothing Then
Session("myArr(3)") = myArr(3)
End If
Dim sql As String
sql = "SELECT Header_number, Header, Detail "
sql &= " FROM Header"
sql &= " WHERE Major_id = '" & Session("myArr(1)") & "' AND Tqf_number = '" & Session("myArr(2)") & "' AND Category = '" & Session("myArr(3)") & "' "
Dim ds As DataSet
Dim con As New Cls_Connect
ds = con.ExecuteQuery(sql, "detail")
DetailsView1.DataSource = ds.Tables("detail")
DetailsView1.DataBind()
End If
End If
Dim Path As DataSet
If TreeView1.SelectedNode.Selected = True Then 'มีการกด ที่ treeview 1
If i = 1 Then
Panel5.Visible = False
DetailsView1.Visible = False
Button1.Visible = False
Button2.Visible = False
End If
If i = 2 Then
Panel5.Visible = False
DetailsView1.Visible = False
Button1.Visible = False
Button2.Visible = False
Path = newcls_tqf2.getCategory2(myArr(0), myArr(1))
If Path.Tables("Category").Rows.Count > 0 Then
GridView1.AutoGenerateDeleteButton = False
GridView1.DataSource = Path
'GridView1.DataBind()
End If
End If
If i = 4 Then
If TreeView1.SelectedNode.Text = "+หลักสูตร" Then
Response.Redirect("course.aspx")
End If
If TreeView1.SelectedNode.Text = "+แผนการศึกษา" Then
Response.Redirect("plan.aspx")
End If
If TreeView1.SelectedNode.Text = "+อาจารย์ผู้สอน" Then
Response.Redirect("teacher.aspx")
End If
If TreeView1.SelectedNode.Text = "+การพัฒนาผลการเรียนรู้" Then
Response.Redirect("Development.aspx")
End If
If TreeView1.SelectedNode.Text = "หมวดที่5แผนการสอน*" Then
Response.Redirect("plancourse.aspx")
End If
If TreeView1.SelectedNode.Text = "หมวดที่4การพัฒนาการเรียนรู้*" Then
Response.Redirect("learning.aspx")
End If
If TreeView1.SelectedNode.Text = "หมวดที่2การเรียนการสอน*" Then
Response.Redirect("TQF5.aspx")
End If
If TreeView1.SelectedNode.Text = "+การกระจายผลการเรียนรู้" Then
Response.Redirect("mapping.aspx")
End If
If TreeView1.SelectedNode.Text = "+ตัวบ่งชี้ผลการดำเนินงาน(KPI)" Then
Response.Redirect("KPI.aspx")
End If
If TreeView1.SelectedNode.Text = "+รายงานผลการดำเนินงาน(KPI)" Then
Response.Redirect("KPI7.aspx")
End If
If TreeView1.SelectedNode.Text = "+ข้อมูลสรุปรายวิชาของหลักสูตร" Then
Response.Redirect("summarycourse.aspx")
End If
If TreeView1.SelectedNode.Text = "+การบริหารหลักสูตร" Then
Response.Redirect("courseManage.aspx")
End If
If TreeView1.SelectedNode.Text = "+การเปิดรายวิชาในปีการศึกษา" Then
Response.Redirect("opencourse.aspx")
End If
If (Session("policy") = "คณะกรรมการ" Or Session("policy") = "อาจารย์สหกิจ" Or Session("policy") = "บุคคลทั่วไป") And Not TreeView1.SelectedNode.Text = "+เพิ่มหมวด" Then
DetailsView1.Visible = False
Path = newcls_header.getCategoryHeader(myArr(1), myArr(2), myArr(3))
If Path.Tables("category").Rows.Count > 0 Then
Panel5.Visible = True
If Not Session("policy") = "บุคคลทั่วไป" Then
Button1.Visible = True
Button2.Visible = True
End If
Else
Panel5.Visible = False
DetailsView1.Visible = False
If Not Session("policy") = "บุคคลทั่วไป" Then
Button1.Visible = True
Button2.Visible = True
End If
End If
GridView1.DataSource = Path
GridView1.DataBind()
End If
If Session("policy") = "อาจารย์ผู้สอน" And Not TreeView1.SelectedNode.Text = "+เพิ่มหมวด" Then
DetailsView1.Visible = False
Path = newcls_tqf3_header.getHeaderDetail(myArr(1), myArr(2), myArr(3), Label8.Text)
If Path.Tables("category").Rows.Count > 0 Then
Panel5.Visible = True
Else
Panel5.Visible = False
DetailsView1.Visible = False
Button1.Visible = False
End If
GridView1.DataSource = Path
GridView1.DataBind()
End If
End If
If i = 3 Then
Panel5.Visible = False
DetailsView1.Visible = False
Button1.Visible = False
Button2.Visible = False
End If
If TreeView1.SelectedNode.Text = "มคอ.2" Then
Response.Redirect("editor.aspx")
End If
End If
End Sub
Private Sub Image1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Image1.Load
Image1.ImageUrl = "nologo.jpg"
End Sub
Private Sub Image2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Image2.Load
Image2.ImageUrl = "แบบ2.jpg"
End Sub
Private Sub GridView1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.Load
End Sub
Private Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting
Dim myArr As Array = Split(TreeView1.SelectedNode.ValuePath, "/")
Dim myStr As String = ""
Dim i As Integer
For i = 0 To myArr.Length - 1
myStr &= myArr(i)
Next
newcls_category.deleteByTQFMajor(myArr(2), myArr(1), Trim(GridView1.DataKeys(e.RowIndex.ToString).Value))
newcls_header.deleteByCategoryMajor(Trim(GridView1.DataKeys(e.RowIndex.ToString).Value), myArr(1))
Response.Redirect("mainproject.aspx")
End Sub
Private Sub DetailsView1_ItemDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewDeleteEventArgs) Handles DetailsView1.ItemDeleting
If Session("policy") = "อาจารย์ผู้สอน" Then
Dim ds As New DataSet
Dim Text1 As Label = CType(DetailsView1.FindControl("lblHeader_number"), Label)
newcls_tqf3_header.deleteByHeaderNumber(Text1.Text)
Response.Redirect("mainproject.aspx")
ElseIf (Session("policy") = "คณะกรรมการ" Or Session("policy") = "อาจารย์สหกิจ") Then
Dim ds As New DataSet
Dim Text1 As Label = CType(DetailsView1.FindControl("lblHeader_number"), Label)
newcls_header.deleteByHeaderNumber(Text1.Text)
Response.Redirect("mainproject.aspx")
End If
End Sub
Private Sub DetailsView1_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertEventArgs) Handles DetailsView1.ItemInserting
If Session("policy") = "อาจารย์ผู้สอน" Then
Dim ds As New DataSet
Dim zz As New Headers
Dim txtPersonelID As TextBox = CType(DetailsView1.FindControl("txtAddHeader"), TextBox)
Dim txtName As TextBox = CType(DetailsView1.FindControl("txtAddDetail"), TextBox)
Dim con As New Cls_Connect
Dim myArr As Array = Session("path")
Dim myStr As String = ""
Dim i As Integer
For i = 0 To myArr.Length - 1
myStr = myArr(i)
Next
newcls_tqf3_header.insertData(myArr(1), myArr(2), myArr(3), txtPersonelID.Text, txtName.Text, Session("selecty"))
Response.Redirect("mainproject.aspx")
ElseIf (Session("policy") = "คณะกรรมการ" Or Session("policy") = "อาจารย์สหกิจ") Then
Dim ds As New DataSet
Dim zz As New Headers
Dim txtPersonelID As TextBox = CType(DetailsView1.FindControl("txtAddHeader"), TextBox)
Dim txtName As TextBox = CType(DetailsView1.FindControl("txtAddDetail"), TextBox)
Dim con As New Cls_Connect
Dim myArr As Array = Session("path")
Dim myStr As String = ""
Dim i As Integer
For i = 0 To myArr.Length - 1
myStr = myArr(i)
Next
newcls_header.insertData(myArr(1), myArr(2), myArr(3), txtPersonelID.Text, txtName.Text)
Response.Redirect("mainproject.aspx")
End If
End Sub
'Private Sub DetailsView2_ItemUpdating1(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles DetailsView2.ItemUpdating
'End Sub
Private Sub DetailsView1_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles DetailsView1.ItemUpdating
If Session("policy") = "อาจารย์ผู้สอน" Then
Dim txtPersonelID As TextBox = CType(DetailsView1.FindControl("txtEditHeader"), TextBox)
Dim txtName As TextBox = CType(DetailsView1.FindControl("txtEditDetail"), TextBox)
Dim Text1 As Label = CType(DetailsView1.FindControl("txtEditHeader_number"), Label)
newcls_tqf3_header.setHeaderDetail(txtPersonelID.Text, txtName.Text, Text1.Text)
DetailsView1.DataBind()
Response.Redirect("mainproject.aspx")
DetailsView1.Visible = True
ElseIf (Session("policy") = "คณะกรรมการ" Or Session("policy") = "อาจารย์สหกิจ") Then
Dim txtPersonelID As TextBox = CType(DetailsView1.FindControl("txtEditHeader"), TextBox)
Dim txtName As TextBox = CType(DetailsView1.FindControl("txtEditDetail"), TextBox)
Dim Text1 As Label = CType(DetailsView1.FindControl("txtEditHeader_number"), Label)
newcls_header.setHeaderDetail(txtPersonelID.Text, txtName.Text, Text1.Text)
DetailsView1.DataBind()
Response.Redirect("mainproject.aspx")
DetailsView1.Visible = True
End If
End Sub
Private Sub DetailsView1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView1.Load
If DetailsViewMode.Edit Then
DetailsView1.Visible = True
End If
If DetailsViewMode.Insert Then
DetailsView1.Visible = True
End If
If DetailsViewMode.ReadOnly Then
DetailsView1.Visible = False
End If
If Session("policy") = "บุคคลทั่วไป" Then
DetailsView1.AutoGenerateDeleteButton = False
DetailsView1.AutoGenerateEditButton = False
DetailsView1.AutoGenerateInsertButton = False
End If
End Sub
Private Sub DetailsView1_ModeChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewModeEventArgs) Handles DetailsView1.ModeChanging
Select Case e.NewMode
Case DetailsViewMode.Edit
DetailsView1.ChangeMode(DetailsViewMode.Edit)
DetailsView1.Visible = True
Case DetailsViewMode.Insert
DetailsView1.ChangeMode(DetailsViewMode.Insert)
DetailsView1.Visible = True
Case DetailsViewMode.ReadOnly
DetailsView1.ChangeMode(DetailsViewMode.ReadOnly)
DetailsView1.Visible = True
End Select
End Sub
'Private Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
' DetailsView1.ChangeMode(DetailsViewMode.ReadOnly)
'End Sub
'Private Sub DetailsView2_ItemDeleting1(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewDeleteEventArgs) Handles DetailsView2.ItemDeleting
'End Sub
'Private Sub DetailsView2_ItemInserting1(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertEventArgs) Handles DetailsView2.ItemInserting
'End Sub
'Private Sub DetailsView2_Load1(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView2.Load
' 'If TreeView1.Visible = True Then
' ' Dim myArr As Array = Split(TreeView1.SelectedNode.ValuePath, "/")
' ' Dim myStr As String = ""
' ' Dim i As Integer
' ' For i = 0 To myArr.Length - 1
' ' myStr &= myArr(i)
' ' Next
' ' Dim sql As String
' ' If i = 5 Then
' '
' ' End If
' 'End If
'End Sub
'Private Sub DetailsView2_ModeChanging1(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewModeEventArgs) Handles DetailsView2.ModeChanging
'End Sub
'Protected Sub DetailsView2_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewPageEventArgs) Handles DetailsView2.PageIndexChanging
'End Sub
'Private Sub DetailsView2_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView2.Unload
' DetailsView2.ChangeMode(DetailsViewMode.ReadOnly)
'End Sub
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles GridView1.SelectedIndexChanged
Dim myArr As Array = Split(TreeView1.SelectedNode.ValuePath, "/")
Dim myStr As String = ""
Dim i As Integer
For i = 0 To myArr.Length - 1
myStr &= myArr(i)
Next
Dim path1 As DataSet
Dim sql As String
Dim con As New Cls_Connect
If (Session("policy") = "คณะกรรมการ" Or Session("policy") = "อาจารย์สหกิจ" Or Session("policy") = "บุคคลทั่วไป") Then
sql = "select Header_number,header,detail from header where header_number= '" & GridView1.SelectedValue.ToString & "'"
path1 = con.ExecuteQuery(sql, "w")
If path1.Tables("w").Rows.Count > 0 Then
DetailsView1.DataSource = path1.Tables("w")
DetailsView1.DataBind()
GridView1.Visible = True
DetailsView1.Visible = True
Dim path As DataSet
path = newcls_header.getCategoryHeader(myArr(1), myArr(2), myArr(3))
If path.Tables("category").Rows.Count > 0 Then
Panel5.Visible = True
Else
Panel5.Visible = False
End If
GridView1.DataSource = path
GridView1.DataBind()
Else
Panel5.Visible = False
DetailsView1.Visible = False
End If
End If
If Session("policy") = "อาจารย์ผู้สอน" Then
sql = "select Header_number,header,detail from tqf3_header where header_number= '" & GridView1.SelectedValue.ToString & "'"
path1 = con.ExecuteQuery(sql, "w")
If path1.Tables("w").Rows.Count > 0 Then
DetailsView1.DataSource = path1.Tables("w")
DetailsView1.DataBind()
GridView1.Visible = True
DetailsView1.Visible = True
Dim path As DataSet
path = newcls_tqf3_header.getHeaderDetail(myArr(1), myArr(2), myArr(3), Label8.Text)
If path.Tables("category").Rows.Count > 0 Then
Panel5.Visible = True
Else
Panel5.Visible = False
End If
GridView1.DataSource = path
GridView1.DataBind()
Else
Panel5.Visible = False
DetailsView1.Visible = False
End If
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Dim myArr As Array = Split(TreeView1.SelectedNode.ValuePath, "/")
Dim myStr As String = ""
Dim i As Integer
For i = 0 To myArr.Length - 1
myStr &= myArr(i)
Next
If MsgBox("คุณแน่ใจหรือว่าต้องการลบ", MsgBoxStyle.Exclamation + MsgBoxStyle.YesNo, "คุณแน่ใจหรือว่าต้องการลบ!!") = MsgBoxResult.Yes Then
Dim sql As String
sql = "delete from category "
sql &= " where major_id='" & myArr(1) & "' and tqf_number ='" & myArr(2) & "' and category ='" & myArr(3) & "'"
Dim con As New Cls_Connect
con.ExecuteNonQuery(sql)
sql = "delete from Header"
sql &= " where major_id='" & myArr(1) & "' and tqf_number ='" & myArr(2) & "' and category ='" & myArr(3) & "'"
con.ExecuteNonQuery(sql)
Response.Redirect("mainproject.aspx")
Else
Response.Redirect("mainproject.aspx")
End If
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
Dim myArr As Array = Split(TreeView1.SelectedNode.ValuePath, "/")
Dim myStr As String = ""
Dim i As Integer
For i = 0 To myArr.Length - 1
myStr &= myArr(i)
Next
Dim sql As String
sql = "select category_title from Category "
sql &= " where major_id='" & myArr(1) & "' and tqf_number ='" & myArr(2) & "' and category ='" & myArr(3) & "'"
Dim con As New Cls_Connect
Dim ds As DataSet
ds = con.ExecuteQuery(sql, "update")
Dim input As String
input = InputBox("ชื่อเดิม :" & ds.Tables("update").Rows(0).Item("category_title"))
If Not input = "" Then
sql = " update category"
sql &= " set category_title='" & input & "'"
sql &= " where major_id='" & myArr(1) & "' and tqf_number ='" & myArr(2) & "' and category ='" & myArr(3) & "'"
con.ExecuteNonQuery(sql)
End If
Response.Redirect("mainproject.aspx")
End Sub
End Class