-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmachinetype.aspx.cs
executable file
·148 lines (133 loc) · 4.54 KB
/
machinetype.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
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
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;
using System.Data;
using System.Web.Configuration;
public partial class machinetype : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["admin"] == null)
Server.Transfer("admin.aspx");
DataView dvop = (DataView)(sdsoper.Select(DataSourceSelectArguments.Empty));
if (!Page.IsPostBack)
{
for (int i = 0; i < dvop.Table.Rows.Count; i++)
{
cblist.Items.Add(new ListItem("("+ dvop.Table.Rows[i][2].ToString()+") "+dvop.Table.Rows[i][1].ToString()+" ("+dvop.Table.Rows[i][3].ToString()+")", dvop.Table.Rows[i][2].ToString()));
}
}
}
protected void submittype_Click(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
List<string> li = new List<string>();
foreach (ListItem cbf in cblist.Items)
{
if (cbf.Selected)
{
li.Add(cbf.Value.ToString());
}
}
string final = string.Join(",", li);
h1.Value = final;
sdsmtype.Insert();
Response.Redirect("machinetype.aspx");
}
}
protected void selectall_CheckedChanged(object sender, EventArgs e)
{
if (selectall.Checked==true)
{
foreach (ListItem item in cblist.Items)
{
item.Selected = true;
}
}
else
{
foreach (ListItem item in cblist.Items)
{
item.Selected = false;
}
}
}
protected void cbeditop_CheckedChanged(object sender, EventArgs e)
{
if (cbeditop.Checked == true)
{
ddleditop.Enabled = true;
edittype.Enabled = true;
tbmac.Enabled = false;
submittype.Enabled = false;
}
else
{
ddleditop.Enabled = false;
edittype.Enabled = false;
tbmac.Enabled = true;
submittype.Enabled = true;
foreach (ListItem cbf in cblist.Items) cbf.Selected = false;
}
}
protected void edittype_Click(object sender, EventArgs e)
{
List<string> li = new List<string>();
foreach (ListItem cbf in cblist.Items)
{
if (cbf.Selected)
{
li.Add(cbf.Value.ToString());
}
}
string final = string.Join(",", li);
h1.Value = final;
sdsmtype.Update();
DataView dvm = (DataView)(reflectmac.Select(DataSourceSelectArguments.Empty));
for (int i = 0; i < dvm.Table.Rows.Count; i++)
{
string mac = dvm.Table.Rows[i][0].ToString();
hiddenmac.Value = mac;
DataView dvj = (DataView)(reflectjob.Select(DataSourceSelectArguments.Empty));
if(dvj.Table.Rows.Count>0)
{
hiddenjob.Value = dvj.Table.Rows[0][0].ToString();
DataView dvplan = (DataView)(reflectplan.Select(DataSourceSelectArguments.Empty));
dvplan.Sort = "phase";
foreach(ListItem cbf in cblist.Items)
{
if (cbf.Selected)
{
if(dvplan.Find(cbf.Value)<0)
{
hiddenphase.Value = cbf.Value;
string dtt = Convert.ToDateTime(dvj.Table.Rows[0]["startdate"]).ToShortDateString();
reflectplan.Insert();
}
}
}
}
}
}
protected void ddleditop_SelectedIndexChanged(object sender, EventArgs e)
{
foreach (ListItem cbf in cblist.Items) cbf.Selected = false;
DataView dv = (DataView)(sdsmtype.Select(DataSourceSelectArguments.Empty));
dv.Sort = "type";
int i = dv.Find(ddleditop.SelectedValue);
if(i>=0)
{
string ph = dv.Table.Rows[i][1].ToString();
string []pharr = ph.Split(',');
foreach (ListItem cbf in cblist.Items)
{
if (pharr.Contains<string>(cbf.Value.ToString())) cbf.Selected = true;
}
}
}
}