-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDoctorVerification.aspx.cs
93 lines (88 loc) · 2.86 KB
/
DoctorVerification.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
public partial class DoctorVerification : System.Web.UI.Page
{
SqlConnection con;
SqlCommand cmd;
SqlDataAdapter adp;
DataTable dt;
void bindview()
{
adp = new SqlDataAdapter("select * from dtable where did=@did", con);
adp.SelectCommand.Parameters.AddWithValue("did", Request.QueryString.Get("DID"));
dt = new DataTable();
adp.Fill(dt);
DetailsView1.DataSource = dt;
DetailsView1.DataBind();
if (dt.Rows.Count != 0)
{
string status = dt.Rows[0]["status"].ToString().ToLower ();
if (status.Equals("register"))
RadioButtonList1.Enabled = true;
else if (status.Equals("rejected"))
{
RadioButtonList1.Enabled = true;
RadioButtonList1.SelectedIndex = 1;
}
else if (status.Equals("accepted"))
{
RadioButtonList1.Enabled = false;
RadioButtonList1.SelectedIndex = 0;
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
try
{
Label1.Text = "";
Menu m2 = (Menu)Master.FindControl("Menu2");
m2.Visible = true;
con = new SqlConnection(ConfigurationManager.ConnectionStrings["connection"].ConnectionString);
con.Open();
if (!IsPostBack)
{
if (Request .QueryString .Get ("DID")!=null )
bindview();
}
}
catch (Exception ex)
{
Label1.Text = ex.Message;
}
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
try
{
if (RadioButtonList1.SelectedIndex == -1)
{
Label1.Text = "Status Not Selected......";
return;
}
string status = "";
if (RadioButtonList1 .SelectedIndex ==0)
status ="Accepted";
else if (RadioButtonList1 .SelectedIndex ==1 )
status ="Rejected";
cmd = new SqlCommand("update dtable set status=@status where did=@did", con);
cmd.Parameters.AddWithValue("status", status);
cmd.Parameters.AddWithValue("did", Request.QueryString.Get("DID"));
cmd.ExecuteNonQuery();
cmd.Dispose();
Label1.Text = "Verification Process Successfully Updated.....";
bindview();
}
catch (Exception ex)
{
Label1.Text = ex.Message;
}
}
}