-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPaymentdetails.aspx.cs
More file actions
186 lines (173 loc) · 6.78 KB
/
Paymentdetails.aspx.cs
File metadata and controls
186 lines (173 loc) · 6.78 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Paymentdetails : System.Web.UI.Page
{
SqlConnection con = new SqlConnection("Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=studentform;Integrated Security=True;Encrypt=False");
protected void Page_Load(object sender, EventArgs e)
{
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
try
{
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";
TextBox6.Text = "";
TextBox7.Text = "";
TextBox8.Text = "";
TextBox9.Text = "";
Label11.Visible = false;
Label12.Visible = false;
Label13.Visible = false;
con.Open();
SqlCommand cmd = new SqlCommand("select * from courseallotment where sid=" + TextBox1.Text + "", con);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
TextBox2.Text = dr["sname"].ToString();
TextBox3.Text = dr["scourse"].ToString();
TextBox4.Text = dr["feetype"].ToString();
TextBox8.Text = dr["cfee"].ToString();
if (TextBox4.Text == "Single")
{
label6.Visible = false;
label7.Visible = false;
label8.Visible = false;
TextBox5.Visible = false;
TextBox6.Visible = false;
TextBox7.Visible = false;
}
else
{
label6.Visible = true;
label7.Visible = true;
label8.Visible = true;
TextBox5.Visible = true;
TextBox6.Visible = true;
TextBox7.Visible = true;
}
}
else
{
Response.Write("No data");
}
}
catch(Exception ex)
{
Response.Write(ex);
}
}
protected void Button1_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("paymentdetails_insert2", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@sid", SqlDbType.Int).Value = TextBox1.Text;
cmd.Parameters.AddWithValue("@sname", SqlDbType.VarChar).Value = TextBox2.Text;
cmd.Parameters.AddWithValue("@scourse", SqlDbType.VarChar).Value = TextBox3.Text;
cmd.Parameters.AddWithValue("@fullpayorinstall", SqlDbType.VarChar).Value = TextBox4.Text;
cmd.Parameters.AddWithValue("@installment1", SqlDbType.Int).Value = TextBox5.Text;
cmd.Parameters.AddWithValue("@pstatus", SqlDbType.VarChar).Value = TextBox9.Text;
cmd.Parameters.AddWithValue("@totalamt", SqlDbType.Int).Value = TextBox8.Text;
cmd.Parameters.AddWithValue("@doinstallment1", SqlDbType.Int).Value = DateTime.Now.ToString("MM-dd-yyyy");
cmd.ExecuteNonQuery();
con.Close();
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";
TextBox6.Text = "";
TextBox7.Text = "";
TextBox8.Text = "";
TextBox9.Text = "";
}
protected void Button2_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from paymentdetails where sid = " + TextBox1.Text + "", con);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
TextBox5.Text = dr["installment1"].ToString();
TextBox6.Text = dr["installment2"].ToString();
TextBox7.Text = dr["installment3"].ToString();
TextBox9.Text = dr["pstatus"].ToString();
Button3.Visible = true;
Button1.Visible = false;
if((TextBox5.Text!="") && (TextBox6.Text== ""))
{
Button5.Visible = true;
}
else if((TextBox6.Text != "") && (TextBox7.Text == ""))
{
Button6.Visible = true;
Button5.Visible = false;
}
}
else
{
Response.Write("No payments recorded");
}
}
protected void Button3_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("paymentdetails_update2", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@sid", SqlDbType.Int).Value = TextBox1.Text;
cmd.Parameters.AddWithValue("@sname", SqlDbType.VarChar).Value = TextBox2.Text;
cmd.Parameters.AddWithValue("@scourse", SqlDbType.VarChar).Value = TextBox3.Text;
cmd.Parameters.AddWithValue("@fullpayorinstall", SqlDbType.VarChar).Value = TextBox4.Text;
cmd.Parameters.AddWithValue("@pstatus", SqlDbType.VarChar).Value = TextBox9.Text;
cmd.Parameters.AddWithValue("@totalamt", SqlDbType.Int).Value = TextBox8.Text;
cmd.ExecuteNonQuery();
con.Close();
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";
TextBox6.Text = "";
TextBox7.Text = "";
TextBox8.Text = "";
TextBox9.Text = "";
Label11.Visible = false;
Label12.Visible = false;
Label13.Visible = false;
Button6.Visible = false;
Button5.Visible = false;
}
protected void Button5_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("install2", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@sid", SqlDbType.Int).Value = TextBox1.Text;
cmd.Parameters.AddWithValue("@installment2", SqlDbType.Int).Value = TextBox6.Text;
cmd.Parameters.AddWithValue("@doinstallment2", SqlDbType.Date).Value = DateTime.Now.ToString("MM-dd-yyyy");
cmd.ExecuteNonQuery();
con.Close();
Response.Write("Payment Recorded");
}
protected void Button6_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("install3", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@sid", SqlDbType.Int).Value = TextBox1.Text;
cmd.Parameters.AddWithValue("@installment3", SqlDbType.Int).Value = TextBox7.Text;
cmd.Parameters.AddWithValue("@doinstallment3", SqlDbType.Date).Value = DateTime.Now.ToString("MM-dd-yyyy");
cmd.ExecuteNonQuery();
con.Close();
Response.Write("Payment Recorded");
}
}