forked from HassanAfnan/DayCareWebsite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FeePage.aspx.cs
47 lines (45 loc) · 1.41 KB
/
FeePage.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
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;
namespace DayCareWebsite
{
public partial class FeePage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
GetName();
}
}
Classes.Fee fe = new Classes.Fee();
private void GetName()
{
DropDownList1.Items.Clear();
foreach (var item in fe.GetIds())
{
DropDownList1.Items.Add(Convert.ToString(item.name));
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Classes.Connection con = new Classes.Connection();
con.getConnection();
SqlCommand com = new SqlCommand("select Uid from UserReg where CName ='"+DropDownList1.Text+"'",con.getConnection());
SqlDataReader rd = com.ExecuteReader();
while (rd.Read())
{
fe.Uid = Convert.ToInt32(rd["Uid"]);
}
fe.Amount = TextBox1.Text;
fe.DateTimeNow = DateTime.Now;
fe.Add(fe);
Response.Write("<script>alert('Sucessfully Inserted')</script>");
TextBox1.Text = "";
}
}
}