-
Notifications
You must be signed in to change notification settings - Fork 0
/
catalogue.aspx
253 lines (222 loc) · 11 KB
/
catalogue.aspx
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<%@ Page Language="VB" MasterPageFile="~/common/Manager.master" AutoEventWireup="false"
CodeFile="catalogue.aspx.vb" Inherits="catalogue" Title="Catalogue - Buildmate" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="head" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content" ContentPlaceHolderID="MainContent" runat="Server">
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlId="Panel1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="Panel1" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlId="btnApplyFilter">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="rgCatalogue" />
<telerik:AjaxUpdatedControl ControlID="pAddCatalogue" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlId="rgCatalogue">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="rgCatalogue" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManagerProxy>
<div class="breadcrumb">
<div class="breadcrumb-container">
Catalogue
</div>
</div>
<div class="sidebar">
<asp:Panel ID="Panel1" runat="server" DefaultButton="btnApplyFilter">
Search Catalogue
<div class="row">
<asp:Label ID="Label3" runat="server"
Text="Supplier"
CssClass="label"
AssociatedControlID="rcbSupplier" />
<telerik:RadComboBox ID="rcbSupplier" runat="server"
Width="180px"
DataSourceID="supplierDataSource"
DataTextField="supplierName"
DataValueField="id" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="rcbSupplier"
Display="Dynamic"
ErrorMessage="Supplier">
<span class="req"></span>
</asp:RequiredFieldValidator>
</div>
<div class="row">
<asp:Label ID="Label1" runat="server"
AssociatedControlID="rcbresourceType"
CssClass="label"
Text="Resource Type" />
<telerik:RadComboBox ID="rcbresourceType" runat="server"
AutoPostBack="true">
<Items>
<telerik:RadComboBoxItem Text="Labour" Value="1" Selected="true" />
<telerik:RadComboBoxItem Text="Material" Value="2" />
<telerik:RadComboBoxItem Text="Plant & Equipment" Value="3" />
</Items>
</telerik:RadComboBox>
</div>
<div class="row">
<asp:Label ID="Label2" runat="server"
AssociatedControlID="rcbResources"
CssClass="label"
Text="Resource Name" />
<telerik:RadComboBox ID="rcbResources" runat="server"
Width="180px"
Height="150px"
IsCaseSensitive="false"
ItemsPerRequest="20"
DropDownWidth="380px"
EmptyMessage="contains any word(s)"
EnableLoadOnDemand="true"
ShowMoreResultsBox="true"
EnableVirtualScrolling="true"
MarkFirstMatch="true"
HighlightTemplatedItems="true"
Filter="Contains">
<HeaderTemplate>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="width: 200px;">Product Name</td>
<td style="width: 100px;">Manufacturer</td>
<td style="width: 80px;">Part ID</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="width: 200px;">
<%# DataBinder.Eval(Container, "Text")%>
</td>
<td style="width: 100px;">
<%#DataBinder.Eval(Container, "Attributes['manufacturer']")%>
</td>
<td style="width: 80px;">
<%#DataBinder.Eval(Container, "Attributes['partId']")%>
</td>
</tr>
</table>
</ItemTemplate>
</telerik:RadComboBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="rcbResources"
Display="Dynamic"
ErrorMessage="Resource Name">
<span class="req"></span>
</asp:RequiredFieldValidator>
</div>
<div class="row">
<asp:Button ID="btnApplyFilter" runat="server" Text="Search" />
</div>
</asp:Panel>
<asp:Panel ID="pAddCatalogue" runat="server" Visible="false">
<asp:HyperLink ID="hlAddCatalogue" runat="server" CssClass="button fullButton"
NavigateUrl="~/add_catalogue.aspx?sid={0}&rid={1}" Text="Add a Resource" />
</asp:Panel>
</div>
<div class="maincontent">
<telerik:RadGrid ID="rgCatalogue" runat="server"
DataSourceID="allCatalogueDataSource"
AllowAutomaticDeletes="true"
GridLines="None">
<MasterTableView
AutoGenerateColumns="False"
DataSourceID="allCatalogueDataSource"
DataKeyNames="id"
NoMasterRecordsText=" No Catalogue Resources were found.">
<Columns>
<telerik:GridHyperLinkColumn
UniqueName="productCode"
HeaderText="Product Code"
HeaderStyle-Width="15%"
SortExpression="productCode"
DataNavigateUrlFields="id"
DataNavigateUrlFormatString="~/catalogue_details.aspx?id={0}"
DataTextField="productCode" />
<telerik:GridHyperLinkColumn
UniqueName="resourceName"
HeaderText="Resource Name"
HeaderStyle-Width="40%"
SortExpression="resourceName"
DataNavigateUrlFields="id"
DataNavigateUrlFormatString="~/catalogue_details.aspx?id={0}"
DataTextField="resourceName" />
<telerik:GridBoundColumn
DataField="price"
DataType="System.Decimal"
DataFormatString="{0:C2}"
HeaderStyle-Width="10%"
EmptyDataText="&nbsp;"
HeaderText="Price"
SortExpression="price"
UniqueName="price" />
<telerik:GridBoundColumn
UniqueName="useage"
HeaderText="Useage"
SortExpression="useage"
DataField="useage"
HeaderStyle-Width="10%"
ItemStyle-HorizontalAlign="Center"
HeaderStyle-HorizontalAlign="Center" />
<telerik:GridBoundColumn
UniqueName="leadTime"
HeaderText="Lead Time (days)"
SortExpression="leadTime"
DataField="leadTime"
HeaderStyle-Width="15%"
ItemStyle-HorizontalAlign="Center"
HeaderStyle-HorizontalAlign="Center" />
<telerik:GridTemplateColumn
UniqueName="discontinued"
HeaderText="Discontinued"
HeaderStyle-Width="10%"
HeaderStyle-horizontalAlign="Center"
ItemStyle-horizontalAlign="Center">
<ItemTemplate>
<asp:Image ID="Image1" runat="server"
Visible='<%# Not isDbNull(Eval("discontinued")) %>'
ImageUrl="~/icons/success.png" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridButtonColumn
ConfirmText="Delete this Catalogue Resource?"
ConfirmTitle="Delete"
ButtonType="ImageButton"
CommandName="Delete"
Text="Delete"
UniqueName="DeleteColumn" />
</Columns>
</MasterTableView>
</telerik:RadGrid>
</div>
<asp:SqlDataSource ID="allCatalogueDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:LocalSqlServer %>"
DeleteCommand="DELETE FROM tblCatalogueUseage WHERE id = @id"
SelectCommand="Catalogue_SELECT" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter Name="resourceId" ControlID="rcbResources" PropertyName="SelectedValue" DefaultValue="0" />
<asp:ControlParameter Name="supplierId" ControlID="rcbSupplier" PropertyName="SelectedValue" DefaultValue="0" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="supplierDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:LocalSqlServer %>"
SelectCommand="SELECT tblSuppliers.id, supplierName
FROM tblSuppliers
LEFT JOIN tblSupplierPriority ON tblSuppliers.id = supplierId
WHERE tblSupplierPriority.userid = @userid AND tblSuppliers.userId = @userId
ORDER BY position">
<SelectParameters>
<asp:SessionParameter Name="UserId" SessionField="userId" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource runat="server" ID="categoryDataSource"
ConnectionString="<%$ ConnectionStrings:LocalSqlServer %>"
SelectCommand="SELECT * From tblCategories" />
</asp:Content>