01.
protected
void
btnAssignsubmit_Click(
object
sender, EventArgs e)
02.
{
03.
DateTime Ts = Convert.ToDateTime(txtAssignDate.Text +
" "
+ txtAssignTime.Text);
04.
txt4.Text = txtAssignDate.Text +
" "
+ txtAssignTime.Text;
05.
06.
for
(
int
i = 0; i <= grdAssignList.Rows.Count - 1; i++)
07.
{
08.
CheckBox chkDel = (CheckBox)grdAssignList.Rows[i].FindControl(
"chkAssignList"
);
09.
Label lblID = (Label)grdAssignList.Rows[i].FindControl(
"lblALisid"
);
10.
11.
if
(chkDel.Checked)
12.
{
13.
con.Open();
14.
String sqlSelect8 =
"select Listtime3 from Listhealty where ListId = '"
+ lblID.Text +
"'"
;
15.
com.CommandText = sqlSelect8;
16.
com.Connection = con;
17.
18.
SqlDataReader dr;
19.
dr = com.ExecuteReader();
20.
dr.Read();
21.
22.
txt3.Text = dr[
"Listtime3"
].ToString();
23.
24.
int
Time = Convert.ToInt32(txt3.Text);
25.
DateTime TimeS = Convert.ToDateTime(txt4.Text);
26.
DateTime Result = TimeS.AddMinutes(Time);
27.
28.
switch
(i)
29.
{
30.
case
1:
31.
32.
break
;
33.
}
34.
con.Close();
35.
36.
String sqlInsert =
"insert into Assign(ClinicId, StaffId, ListId, PatientId, AssignDate, AssignTimestart, Timestart, Timefinish, Assigndetail) "
+
"values('"
+ Session[
"sessionAssCli"
] +
"', '"
+ Session[
"sessionAssSta"
] +
"', '"
+ lblID.Text +
"','"
37.
+ Session[
"sessionPatientId"
] +
"', '"
+ txtAssignDate.Text +
"','"
+ txtAssignTime.Text +
"', @Ts, @re, '"
+ txtAssigndetail.Text +
"')"
;
38.
39.
40.
com.CommandText = sqlInsert;
41.
com.Connection = con;
42.
43.
com.Parameters.Add(
"@Ts"
, SqlDbType.DateTime).Value = Ts;
44.
com.Parameters.Add(
"@re"
, SqlDbType.DateTime).Value = Result;
45.
46.
con.Open();
47.
com.ExecuteNonQuery();
48.
com.Parameters.Clear();
49.
con.Close();
50.
}
51.
}
52.
}
53.
}