001.
Imports
System.Data
002.
Imports
System.Data.SqlClient
003.
Imports
System.Data.SqlClient.SqlDataReader
004.
005.
Partial
Class
o_Admin_Manage_o_AdminServeiceIsos
006.
Inherits
System.Web.UI.Page
007.
Dim
objConn
As
New
SqlConnection
008.
Dim
objCmd
As
New
SqlCommand
009.
Dim
strConnString, strSQL
As
String
010.
Dim
strGalleryID
As
String
011.
Dim
strCusID
As
String
012.
013.
014.
Protected
Sub
Page_Load(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.Load
015.
016.
strConnString =
"Data Source=.\SQLEXPRESS;AttachDbFilename=D:\ISOS-Web-Service\App_Data\IsosDB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
017.
objConn =
New
SqlConnection(strConnString)
018.
objConn.Open()
019.
020.
If
Not
Page.IsPostBack()
Then
021.
DataListBindData()
022.
End
If
023.
024.
025.
Sub
DataListBindData()
026.
027.
strSQL =
"SELECT * FROM Car_Accident order by C_SendAcDate desc"
028.
Dim
dtReader
As
SqlDataReader
029.
objCmd =
New
SqlCommand(strSQL, objConn)
030.
dtReader = objCmd.ExecuteReader()
031.
032.
033.
myDataList.DataSource = dtReader
034.
myDataList.DataBind()
035.
036.
dtReader.Close()
037.
dtReader =
Nothing
038.
039.
End
Sub
040.
041.
Sub
FormViewBindData()
042.
043.
strSQL =
"SELECT * FROM Car_Accident WHERE C_AccidentID = "
& strGalleryID
044.
045.
Dim
dtReader
As
SqlDataReader
046.
objCmd =
New
SqlCommand(strSQL, objConn)
047.
dtReader = objCmd.ExecuteReader()
048.
049.
050.
myFormView.DataSource = dtReader
051.
myFormView.DataBind()
052.
053.
dtReader.Close()
054.
dtReader =
Nothing
055.
056.
End
Sub
057.
058.
Sub
DetailsViewBindData()
059.
strSQL =
"SELECT * FROM Car_Accident WHERE C_AccidentID = '"
& strCusID &
"' "
060.
061.
Dim
dtReader
As
SqlDataReader
062.
objCmd =
New
SqlCommand(strSQL, objConn)
063.
dtReader = objCmd.ExecuteReader()
064.
065.
066.
myDetailsView.DataSource = dtReader
067.
myDetailsView.DataBind()
068.
069.
dtReader.Close()
070.
dtReader =
Nothing
071.
072.
End
Sub
073.
074.
Sub
Page_UnLoad()
075.
076.
objConn.Close()
077.
objConn =
Nothing
078.
079.
End
Sub
080.
081.
Sub
myDataList_ItemCommand(
ByVal
source
As
Object
,
ByVal
e
As
DataListCommandEventArgs)
Handles
myDataList.ItemCommand
082.
083.
If
e.CommandName =
"View"
Then
084.
085.
strGalleryID =
Me
.myDataList.DataKeys(e.Item.ItemIndex)
086.
087.
FormViewBindData()
088.
myFormView.Visible =
True
089.
090.
091.
strCusID =
Me
.myDataList.DataKeys(e.Item.ItemIndex)
092.
093.
DetailsViewBindData()
094.
myDetailsView.Visible =
True
095.
096.
End
If
097.
End
Sub
098.
099.
Sub
myDataList_ItemDataBound(
ByVal
sender
As
Object
,
ByVal
e
As
DataListItemEventArgs)
100.
101.
102.
Dim
Image1
As
ImageButton =
CType
(e.Item.FindControl(
"Image1"
), ImageButton)
103.
If
Not
IsNothing(Image1)
Then
104.
105.
Image1.ImageUrl =
"../images/"
& e.Item.DataItem(
"C_PhotoName"
)
106.
Image1.Width = 100
107.
Image1.Height = 100
108.
109.
Image1.Attributes.Add(
"OnClick"
,
"JavaScript:showImage(oImg);"
)
110.
Image1.Style.Add(
"cursor"
,
"hand"
)
111.
112.
End
If
113.
114.
115.
Dim
lblC_AccidentID
As
Label =
CType
(e.Item.FindControl(
"lblC_AccidentID"
), Label)
116.
If
Not
IsNothing(lblC_AccidentID)
Then
117.
lblC_AccidentID.Text = e.Item.DataItem(
"C_AccidentID"
)
118.
End
If
119.
120.
121.
Dim
lblC_PolicyID
As
Label =
CType
(e.Item.FindControl(
"lblC_PolicyID"
), Label)
122.
If
Not
IsNothing(lblC_PolicyID)
Then
123.
lblC_PolicyID.Text = e.Item.DataItem(
"C_PolicyID"
)
124.
End
If
125.
126.
127.
Dim
lblC_SendAcDate
As
Label =
CType
(e.Item.FindControl(
"lblC_SendAcDate"
), Label)
128.
If
Not
IsNothing(lblC_SendAcDate)
Then
129.
lblC_SendAcDate.Text = e.Item.DataItem(
"C_SendAcDate"
)
130.
End
If
131.
132.
End
Sub
133.
End
Class