-
Notifications
You must be signed in to change notification settings - Fork 0
/
Concession.aspx.cs
70 lines (63 loc) · 2.08 KB
/
Concession.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
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.Configuration;
public partial class Concession : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Session["user"] == null)
Response.Redirect("StudentSap.aspx");
else
{
Response.ClearHeaders();
Response.AddHeader("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate");
Response.AddHeader("Pragma", "no-cache");
}
}
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Redirect("Menu.aspx");
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("ConcessionForm.aspx");
}
protected void LogoutBtn_Click(object sender, EventArgs e)
{
Session["user"] = null;
Server.Transfer("RoleSelect.aspx");
}
protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
{
String status=getstatus();
Label2.Text = "Status = ";
Label2.Text += status;
Label2.Visible = true;
ImageButton2.Visible = false;
HyperLink2.Visible = false;
}
protected string getstatus()
{
String constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
SqlConnection con = new SqlConnection(constr);
SqlCommand cmd = new SqlCommand("select top 1 status from railway_concession where SAP_n=@sapid order by appln_date desc ", con);
cmd.Parameters.AddWithValue("@sapid", Session["user"]);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
String status = "";
while (dr.Read())
{
status = dr["status"].ToString();
}
con.Close();
return status;
}
}