-
Notifications
You must be signed in to change notification settings - Fork 0
/
ManageDoctorRegistrationRequests.aspx.cs
111 lines (99 loc) · 4.06 KB
/
ManageDoctorRegistrationRequests.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SignalRChat.Common;
namespace SignalRChat
{
public partial class ViewDoctorRegistrationRequests : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
BindData();
}
private void BindData()
{
try
{
string CS = ConfigurationManager.ConnectionStrings["ConnectToPatientPortal"].ConnectionString;
using (SqlConnection con = new SqlConnection(CS))
{
SqlDataAdapter da = new SqlDataAdapter("Select * from DoctorRegistrationRequestsTable", con);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}
}
catch (Exception ex)
{
Session["Exception"] = ex;
Response.Redirect("~/404.aspx");
}
}
protected void FireRowCommand(object sender, GridViewCommandEventArgs e)
{
string command = e.CommandName;
int requestId = Int32.Parse(e.CommandArgument.ToString());
switch (command)
{
case "Respond":
{
try
{
string CS = ConfigurationManager.ConnectionStrings["ConnectToPatientPortal"].ConnectionString;
using (SqlConnection connection = new SqlConnection(CS))
{
connection.Open();
SqlCommand com = new SqlCommand("Select * from DoctorRegistrationRequestsTable where RequestId='" + requestId + "'", connection);
using (SqlDataReader reader = com.ExecuteReader())
{
if (reader.Read())
{
string name = reader.GetString(1);
string email = reader.GetString(2);
GmailHandlerClass obj = new GmailHandlerClass();
string result = obj.SendEmail(email, "Patient Portal Verification and SinUp Completion", "DEAR" + name + "follow the link");
Response.Write(result);
ChangeRespondstatus(requestId);
BindData();
}
}
connection.Close();
}
}
catch (Exception ex)
{
Session["Exception"] = ex;
Response.Redirect("~/404.aspx");
}
break;
}
}
}
protected void ChangeRespondstatus(int RequestId)
{
try
{
string CS = ConfigurationManager.ConnectionStrings["ConnectToPatientPortal"].ConnectionString;
using (SqlConnection connection = new SqlConnection(CS))
{
connection.Open();
SqlCommand com = new SqlCommand("update DoctorRegistrationRequestsTable set Responded='Yes' where RequestId='" + RequestId + "'", connection);
com.ExecuteNonQuery();
connection.Close();
}
}
catch (Exception ex)
{
Session["Exception"] = ex;
Response.Redirect("~/404.aspx");
}
}
}
}