-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApproveClaimsPage.aspx.cs
86 lines (72 loc) · 2.49 KB
/
ApproveClaimsPage.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
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace McaWebApp
{
public partial class ApproveClaimsPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["em_no"] == null)
{
Response.Redirect("LoginPage.aspx");
}
if (Session["em_no"].Equals("1001"))
{
view_claims.Visible = true;
apply_claims.Visible = false;
}
else
{
view_claims.Visible = false;
apply_claims.Visible = true;
}
sp_name.InnerHtml = Session["em_name"].ToString();
displaygrid();
}
private void displaygrid()
{
SqlConnection cn = new SqlConnection(@"Data Source=DESKTOP-4P5P3F5\SQLEXPRESS;Initial Catalog=WCPS_Database;Integrated Security=True");
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
string s1 = " and ec_approve_date is null";
string s2 = " ";
string s3;
s3 = "SELECT ref_no AS [Ref. No.],em_name AS [Emp. Name],em_lname AS [Last Name],em_no AS [Emp.No],type AS [Type],amount AS [Amount],des AS [Description],apply_date AS [Apply Date], action AS [Approve/Raject] from dbo.claims WHERE action IS NULL";
SqlDataAdapter da = new SqlDataAdapter(s3, cn);
DataTable dt = new DataTable();
da.Fill(dt);
sp_count.InnerHtml = "<strong>" + dt.Rows.Count.ToString() + " Application pending for approve/reject.</strong> ";
ViewState["dt"] = dt;
GridView1.DataSource = ViewState["dt"];
GridView1.DataBind();
}
protected void BtnSubmit_Click(object sender, EventArgs e)
{
displaygrid();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex >= 0)
{
string s1, s2;
s2 = "";
s1 = "<a href='ApproveReject.aspx?id=" + e.Row.Cells[0].Text + "'>Edit</a>";
e.Row.Cells[8].Text = s1;
}
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataSource = ViewState["dt"];
GridView1.DataBind();
}
}
}