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