-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dowry.aspx.cs
79 lines (75 loc) · 2.54 KB
/
Dowry.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Serving_Hands
{
public partial class Dowry : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetCategoriesId();
GetOrganizationName();
}
}
Models.ClearTextBox tx = new Models.ClearTextBox();
Models.Dowery dr = new Models.Dowery();
protected void Button1_Click(object sender, EventArgs e)
{
dr.furniture = TextBox1.Text;
dr.appliances = TextBox2.Text;
dr.crokries = TextBox3.Text;
dr.organization = DropDownList2.Text;
dr.date = TextBox4.Text;
dr.Add(dr);
tx.ClearTextbox(TextBox1,TextBox2,TextBox3,TextBox4);
}
private void GetOrganizationName()
{
DropDownList2.Items.Clear();
foreach (var item in dr.GetOrganization())
{
DropDownList2.Items.Add(Convert.ToString(item.organization));
}
}
private void GetCategoriesId()
{
DropDownList1.Items.Clear();
foreach (var item in dr.GetIds())
{
DropDownList1.Items.Add(Convert.ToString(item.did));
}
}
protected void Button2_Click(object sender, EventArgs e)
{
dr.did = Convert.ToInt32(DropDownList1.Text);
dr.Delete(dr);
tx.ClearTextbox(TextBox1, TextBox2,TextBox3,TextBox4);
}
protected void Button3_Click(object sender, EventArgs e)
{
dr.did = Convert.ToInt32(DropDownList1.Text);
dr.furniture = TextBox1.Text;
dr.appliances = TextBox2.Text;
dr.crokries = TextBox3.Text;
dr.organization = DropDownList2.Text;
dr.date = TextBox4.Text;
dr.Update(dr);
tx.ClearTextbox(TextBox1,TextBox2,TextBox3,TextBox4);
}
protected void Button4_Click(object sender, EventArgs e)
{
dr.did = Convert.ToInt32(DropDownList1.Text);
dr.Search(dr);
TextBox1.Text = dr.furniture;
TextBox2.Text = dr.appliances;
TextBox3.Text = dr.crokries;
DropDownList2.Text = dr.organization;
TextBox4.Text = dr.date;
}
}
}