-
Notifications
You must be signed in to change notification settings - Fork 8
/
updateTutionFee.aspx.cs
88 lines (79 loc) · 2.94 KB
/
updateTutionFee.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
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class updateTutionFee : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["conn"].ToString());
SqlCommand cmd1, cmd2;
SqlDataAdapter da;
DataSet ds;
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Enabled = false;
}
protected void btnText_Click(object sender, EventArgs e)
{
da = new SqlDataAdapter("select tutionfeedue from studentdetails where rollno = '" + txtID.Text + "'", con);
ds = new DataSet();
try
{
da.Fill(ds);
// txttutionfee.Text = ds.Tables[0].Rows[0][0].ToString();
TextBox1.Text = ds.Tables[0].Rows[0][0].ToString();
}
catch (Exception er)
{
TextBox1.Text = "Fee Details Are Not Available For This Hallticket Number";
}
}
protected void btnChkAll_Click(object sender, EventArgs e)
{
int ActualFee, PaidFee, DueFee;
da = new SqlDataAdapter("SELECT tutionfee,tutionfeedue FROM studentdetails WHERE rollno='" + txtID.Text + "'", con);
ds = new DataSet();
da.Fill(ds);
ActualFee = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());
//PaidFee = Convert.ToInt32(ds.Tables[0].Rows[0][1].ToString());
DueFee = Convert.ToInt32(ds.Tables[0].Rows[0][1].ToString());
if (DueFee != 0)
{
lblErr.Text = "";
PaidFee = Convert.ToInt32(TextBox2.Text);
if (ActualFee > PaidFee)
{
DueFee = ActualFee - PaidFee;
da = new SqlDataAdapter("UPDATE studentdetails SET tutionfeedue='" + DueFee + "'", con);
ds = new DataSet();
da.Fill(ds);
da = new SqlDataAdapter("SELECT tutionfee,tutionfeedue FROM studentdetails WHERE rollno='" + txtID.Text + "'", con);
ds = new DataSet();
da.Fill(ds);
ActualFee = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());
//PaidFee = Convert.ToInt32(ds.Tables[0].Rows[0][1].ToString());
DueFee = Convert.ToInt32(ds.Tables[0].Rows[0][1].ToString());
TextBox1.Text = DueFee.ToString();
lblErr.Text = "Updated Successfully";
}
else
{
lblErr.Text = "Enter Correct Value";
}
}
//else
//{
// lblErr.Text = "Enter Correct Value";
//}
}
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Enabled = true;
}
}