-
Notifications
You must be signed in to change notification settings - Fork 0
/
Default.cs
877 lines (499 loc) · 19.9 KB
/
Default.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
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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
namespace Book_Store
{
//
// Filename: Default.cs
// Generated with CodeCharge 2.0.5
// ASP.NET C#.ccp build 03/07/2002
//
//-------------------------------
//
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
/// <summary>
/// Summary description for Default.
/// </summary>
public partial class Default : System.Web.UI.Page
{
//Default CustomIncludes begin
protected CCUtility Utility;
//Search form Search variables and controls declarations
//Grid form Recommended variables and controls declarations
protected string Recommended_sSQL;
protected string Recommended_sCountSQL;
protected int Recommended_CountPage;
protected int i_Recommended_curpage=1;
//Grid form What variables and controls declarations
protected string What_sSQL;
protected string What_sCountSQL;
protected int What_CountPage;
protected int i_What_curpage=1;
//Grid form Categories variables and controls declarations
protected string Categories_sSQL;
protected string Categories_sCountSQL;
protected int Categories_CountPage;
protected int i_Categories_curpage=1;
//Grid form New variables and controls declarations
protected string New_sSQL;
protected string New_sCountSQL;
protected int New_CountPage;
protected int i_New_curpage=1;
//Grid form Weekly variables and controls declarations
protected string Weekly_sSQL;
protected string Weekly_sCountSQL;
protected int Weekly_CountPage;
protected int i_Weekly_curpage=1;
//Grid form Specials variables and controls declarations
protected string Specials_sSQL;
protected string Specials_sCountSQL;
protected int Specials_CountPage;
protected int i_Specials_curpage=1;
// For each Search form hiddens for PK's,List of Values and Actions
protected string Search_FormAction="Books.aspx?";
// For each AdvMenu form hiddens for PK's,List of Values and Actions
protected string AdvMenu_FormAction=".aspx?";
// For each Recommended form hiddens for PK's,List of Values and Actions
protected string Recommended_FormAction=".aspx?";
// For each What form hiddens for PK's,List of Values and Actions
protected string What_FormAction=".aspx?";
// For each Categories form hiddens for PK's,List of Values and Actions
protected string Categories_FormAction=".aspx?";
// For each New form hiddens for PK's,List of Values and Actions
protected string New_FormAction=".aspx?";
// For each Weekly form hiddens for PK's,List of Values and Actions
protected string Weekly_FormAction=".aspx?";
// For each Specials form hiddens for PK's,List of Values and Actions
protected string Specials_FormAction=".aspx?";
public Default()
{
this.Init += new System.EventHandler(Page_Init);
}
// Default CustomIncludes end
//-------------------------------
public void ValidateNumeric(object source, ServerValidateEventArgs args) {
try{
Decimal temp=Decimal.Parse(args.Value);
args.IsValid=true;
}catch{
args.IsValid=false; }
}
//===============================
// Default Show begin
protected void Page_Load(object sender, EventArgs e)
{
Utility=new CCUtility(this);
//===============================
// Default Open Event begin
// Default Open Event end
//===============================
//===============================
// Default OpenAnyPage Event begin
// Default OpenAnyPage Event end
//===============================
//
//===============================
// Default PageSecurity begin
// Default PageSecurity end
//===============================
if (!IsPostBack){
Page_Show(sender, e);
}
}
protected void Page_Unload(object sender, EventArgs e)
{
//
// CODEGEN: This call is required by the ASP+ Windows Form Designer.
//
if(Utility!=null) Utility.DBClose();
}
protected void Page_Init(object sender, EventArgs e)
{
//
// CODEGEN: This call is required by the ASP+ Windows Form Designer.
//
InitializeComponent();
Search_search_button.Click += new System.EventHandler (this.Search_search_Click);
Recommended_Pager.NavigateCompleted+=new NavigateCompletedHandler(this.Recommended_pager_navigate_completed);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
protected void Page_Show(object sender, EventArgs e)
{
Search_Show();
AdvMenu_Show();
Recommended_Bind();
What_Bind();
Categories_Bind();
New_Bind();
Weekly_Bind();
Specials_Bind();
}
// Default Show end
// End of Login form
void Search_Show() {
// Search Open Event begin
// Search Open Event end
// Search Show begin
Utility.buildListBox(Search_category_id.Items,"select category_id,name from categories order by 2","category_id","name","All","");
string s;
s=Utility.GetParam("category_id");
try {Search_category_id.SelectedIndex=Search_category_id.Items.IndexOf(Search_category_id.Items.FindByValue(s));
}catch{}
s=Utility.GetParam("name");
Search_name.Text = s;
// Search Show Event begin
// Search Show Event end
// Search Show end
// Search Close Event begin
// Search Close Event end
}
void Search_search_Click(Object Src, EventArgs E) {
string sURL = Search_FormAction + "category_id="+Search_category_id.SelectedItem.Value+"&"
+ "name="+Search_name.Text+"&"
;
// Transit
sURL += "";
Response.Redirect(sURL);
}
// End of Login form
protected void AdvMenu_Show(){
// AdvMenu Open Event begin
// AdvMenu Open Event end
// AdvMenu Show begin
// AdvMenu BeforeShow Event begin
// AdvMenu BeforeShow Event end
// AdvMenu Show end
}
// End of Login form
const int Recommended_PAGENUM = 5;
public void Recommended_Repeater_ItemDataBound(Object Sender, RepeaterItemEventArgs e){
// Recommended Show Event begin
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) {
((HyperLink)e.Item.FindControl("Recommended_name")).Text ="<img border=\"0\" src=\"" + ((DataRowView)e.Item.DataItem )["i_image_url"].ToString() + "\"></td><td valign=\"top\"><table width=\"100%\" style=\"width:100%\"><tr><td style=\"background-color: #FFFFFF; border-style: inset; border-width: 0\"><font style=\"font-size: 10pt; color: #CE7E00; font-weight: bold\"><b>" + ((DataRowView)e.Item.DataItem )["i_name"].ToString() + "</b>";
}
// Recommended Show Event end
}
ICollection Recommended_CreateDataSource() {
// Recommended Show begin
Recommended_sSQL = "";
Recommended_sCountSQL = "";
string sWhere = "", sOrder = "";
bool HasParam = false;
//-------------------------------
// Build ORDER BY statement
//-------------------------------
System.Collections.Specialized.StringDictionary Params =new System.Collections.Specialized.StringDictionary();
sWhere = " WHERE is_recommended=1";
//-------------------------------
// Build base SQL statement
//-------------------------------
Recommended_sSQL = "select [i].[author] as i_author, " +
"[i].[image_url] as i_image_url, " +
"[i].[item_id] as i_item_id, " +
"[i].[name] as i_name, " +
"[i].[price] as i_price " +
" from [items] i ";
//-------------------------------
//-------------------------------
//-------------------------------
//-------------------------------
// Assemble full SQL statement
//-------------------------------
Recommended_sSQL = Recommended_sSQL + sWhere + sOrder;
if (Recommended_sCountSQL.Length== 0) {
int iTmpI = Recommended_sSQL.ToLower().IndexOf("select ");
int iTmpJ = Recommended_sSQL.ToLower().LastIndexOf(" from ")-1;
Recommended_sCountSQL = Recommended_sSQL.Replace(Recommended_sSQL.Substring(iTmpI + 7, iTmpJ-6), " count(*) ");
iTmpI = Recommended_sCountSQL.ToLower().IndexOf(" order by");
if (iTmpI > 1) Recommended_sCountSQL = Recommended_sCountSQL.Substring(0, iTmpI);
}
//-------------------------------
OleDbDataAdapter command = new OleDbDataAdapter(Recommended_sSQL, Utility.Connection);
DataSet ds = new DataSet();
command.Fill(ds, (i_Recommended_curpage - 1) * Recommended_PAGENUM, Recommended_PAGENUM,"Recommended");
OleDbCommand ccommand = new OleDbCommand(Recommended_sCountSQL, Utility.Connection);
int PageTemp=(int)ccommand.ExecuteScalar();
Recommended_Pager.MaxPage=(PageTemp%Recommended_PAGENUM)>0?(int)(PageTemp/Recommended_PAGENUM)+1:(int)(PageTemp/Recommended_PAGENUM);
bool AllowScroller=Recommended_Pager.MaxPage==1?false:true;
DataView Source;
Source = new DataView(ds.Tables[0]);
if (ds.Tables[0].Rows.Count == 0){
Recommended_no_records.Visible = true;
AllowScroller=false;}
else
{Recommended_no_records.Visible = false;
AllowScroller=AllowScroller&&true;}
Recommended_Pager.Visible=AllowScroller;
return Source;
// Recommended Show end
}
protected void Recommended_pager_navigate_completed(Object Src, int CurrPage)
{
i_Recommended_curpage=CurrPage;
// Recommended CustomNavigation Event begin
// Recommended CustomNavigation Event end
Recommended_Bind();
}
void Recommended_Bind() {
Recommended_Repeater.DataSource = Recommended_CreateDataSource();
Recommended_Repeater.DataBind();
}
// End of Login form
const int What_PAGENUM = 20;
public void What_Repeater_ItemDataBound(Object Sender, RepeaterItemEventArgs e){
// What Show Event begin
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) {
((HyperLink)e.Item.FindControl("What_article_title")).Text ="<b>"+((DataRowView)e.Item.DataItem )["e_article_title"].ToString()+"<b>";
((Label)e.Item.FindControl("What_article_desc")).Text="<img align=\"left\" border=\"0\" src=\"" + Utility.Dlookup("items","image_url","item_id=" + ((DataRowView)e.Item.DataItem )["e_item_id"].ToString()) + "\">" + ((DataRowView)e.Item.DataItem )["e_article_desc"].ToString();
}
// What Show Event end
}
ICollection What_CreateDataSource() {
// What Show begin
What_sSQL = "";
What_sCountSQL = "";
string sWhere = "", sOrder = "";
bool HasParam = false;
System.Collections.Specialized.StringDictionary Params =new System.Collections.Specialized.StringDictionary();
sWhere = " WHERE editorial_cat_id=1";
//-------------------------------
// Build base SQL statement
//-------------------------------
What_sSQL = "select [e].[article_desc] as e_article_desc, " +
"[e].[article_title] as e_article_title, " +
"[e].[item_id] as e_item_id " +
" from [editorials] e ";
//-------------------------------
//-------------------------------
//-------------------------------
//-------------------------------
// Assemble full SQL statement
//-------------------------------
What_sSQL = What_sSQL + sWhere + sOrder;
//-------------------------------
OleDbDataAdapter command = new OleDbDataAdapter(What_sSQL, Utility.Connection);
DataSet ds = new DataSet();
command.Fill(ds, 0, What_PAGENUM, "What");
DataView Source;
Source = new DataView(ds.Tables[0]);
if (ds.Tables[0].Rows.Count == 0){
What_no_records.Visible = true;
}
else
{What_no_records.Visible = false;
}
return Source;
// What Show end
}
void What_Bind() {
What_Repeater.DataSource = What_CreateDataSource();
What_Repeater.DataBind();
}
// End of Login form
const int Categories_PAGENUM = 20;
public void Categories_Repeater_ItemDataBound(Object Sender, RepeaterItemEventArgs e){
// Categories Show Event begin
// Categories Show Event end
}
ICollection Categories_CreateDataSource() {
// Categories Show begin
Categories_sSQL = "";
Categories_sCountSQL = "";
string sWhere = "", sOrder = "";
bool HasParam = false;
System.Collections.Specialized.StringDictionary Params =new System.Collections.Specialized.StringDictionary();
//-------------------------------
// Build base SQL statement
//-------------------------------
Categories_sSQL = "select [c].[category_id] as c_category_id, " +
"[c].[name] as c_name " +
" from [categories] c ";
//-------------------------------
//-------------------------------
//-------------------------------
//-------------------------------
// Assemble full SQL statement
//-------------------------------
Categories_sSQL = Categories_sSQL + sWhere + sOrder;
//-------------------------------
OleDbDataAdapter command = new OleDbDataAdapter(Categories_sSQL, Utility.Connection);
DataSet ds = new DataSet();
command.Fill(ds, 0, Categories_PAGENUM, "Categories");
DataView Source;
Source = new DataView(ds.Tables[0]);
if (ds.Tables[0].Rows.Count == 0){
Categories_no_records.Visible = true;
}
else
{Categories_no_records.Visible = false;
}
return Source;
// Categories Show end
}
void Categories_Bind() {
Categories_Repeater.DataSource = Categories_CreateDataSource();
Categories_Repeater.DataBind();
}
// End of Login form
const int New_PAGENUM = 20;
public void New_Repeater_ItemDataBound(Object Sender, RepeaterItemEventArgs e){
// New Show Event begin
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) {
((HyperLink)e.Item.FindControl("New_article_title")).Text ="<b>"+((DataRowView)e.Item.DataItem )["e_article_title"].ToString()+"<b>";
((Label)e.Item.FindControl("New_article_desc")).Text="<img align=\"left\" border=\"0\" src=\"" + Utility.Dlookup("items","image_url","item_id=" + ((DataRowView)e.Item.DataItem )["e_item_id"].ToString()) + "\">" + ((DataRowView)e.Item.DataItem )["e_article_desc"].ToString();
}
// New Show Event end
}
ICollection New_CreateDataSource() {
// New Show begin
New_sSQL = "";
New_sCountSQL = "";
string sWhere = "", sOrder = "";
bool HasParam = false;
System.Collections.Specialized.StringDictionary Params =new System.Collections.Specialized.StringDictionary();
sWhere = " WHERE editorial_cat_id=2";
//-------------------------------
// Build base SQL statement
//-------------------------------
New_sSQL = "select [e].[article_desc] as e_article_desc, " +
"[e].[article_title] as e_article_title, " +
"[e].[item_id] as e_item_id " +
" from [editorials] e ";
//-------------------------------
//-------------------------------
//-------------------------------
//-------------------------------
// Assemble full SQL statement
//-------------------------------
New_sSQL = New_sSQL + sWhere + sOrder;
//-------------------------------
OleDbDataAdapter command = new OleDbDataAdapter(New_sSQL, Utility.Connection);
DataSet ds = new DataSet();
command.Fill(ds, 0, New_PAGENUM, "New");
DataView Source;
Source = new DataView(ds.Tables[0]);
if (ds.Tables[0].Rows.Count == 0){
New_no_records.Visible = true;
}
else
{New_no_records.Visible = false;
}
return Source;
// New Show end
}
void New_Bind() {
New_Repeater.DataSource = New_CreateDataSource();
New_Repeater.DataBind();
}
// End of Login form
const int Weekly_PAGENUM = 20;
public void Weekly_Repeater_ItemDataBound(Object Sender, RepeaterItemEventArgs e){
// Weekly Show Event begin
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) {
((HyperLink)e.Item.FindControl("Weekly_article_title")).Text ="<b>"+((DataRowView)e.Item.DataItem )["e_article_title"].ToString()+"<b>";
((Label)e.Item.FindControl("Weekly_article_desc")).Text="<img align=\"left\" border=\"0\" src=\"" + Utility.Dlookup("items","image_url","item_id=" + ((DataRowView)e.Item.DataItem )["e_item_id"].ToString()) + "\">" + ((DataRowView)e.Item.DataItem )["e_article_desc"].ToString();
}
// Weekly Show Event end
}
ICollection Weekly_CreateDataSource() {
// Weekly Show begin
Weekly_sSQL = "";
Weekly_sCountSQL = "";
string sWhere = "", sOrder = "";
bool HasParam = false;
System.Collections.Specialized.StringDictionary Params =new System.Collections.Specialized.StringDictionary();
sWhere = " WHERE editorial_cat_id=3";
//-------------------------------
// Build base SQL statement
//-------------------------------
Weekly_sSQL = "select [e].[article_desc] as e_article_desc, " +
"[e].[article_title] as e_article_title, " +
"[e].[item_id] as e_item_id " +
" from [editorials] e ";
//-------------------------------
//-------------------------------
//-------------------------------
//-------------------------------
// Assemble full SQL statement
//-------------------------------
Weekly_sSQL = Weekly_sSQL + sWhere + sOrder;
//-------------------------------
OleDbDataAdapter command = new OleDbDataAdapter(Weekly_sSQL, Utility.Connection);
DataSet ds = new DataSet();
command.Fill(ds, 0, Weekly_PAGENUM, "Weekly");
DataView Source;
Source = new DataView(ds.Tables[0]);
if (ds.Tables[0].Rows.Count == 0){
Weekly_no_records.Visible = true;
}
else
{Weekly_no_records.Visible = false;
}
return Source;
// Weekly Show end
}
void Weekly_Bind() {
Weekly_Repeater.DataSource = Weekly_CreateDataSource();
Weekly_Repeater.DataBind();
}
// End of Login form
const int Specials_PAGENUM = 20;
public void Specials_Repeater_ItemDataBound(Object Sender, RepeaterItemEventArgs e){
// Specials Show Event begin
// Specials Show Event end
}
ICollection Specials_CreateDataSource() {
// Specials Show begin
Specials_sSQL = "";
Specials_sCountSQL = "";
string sWhere = "", sOrder = "";
bool HasParam = false;
System.Collections.Specialized.StringDictionary Params =new System.Collections.Specialized.StringDictionary();
sWhere = " WHERE editorial_cat_id=4";
//-------------------------------
// Build base SQL statement
//-------------------------------
Specials_sSQL = "select [e].[article_desc] as e_article_desc, " +
"[e].[article_title] as e_article_title " +
" from [editorials] e ";
//-------------------------------
//-------------------------------
//-------------------------------
//-------------------------------
// Assemble full SQL statement
//-------------------------------
Specials_sSQL = Specials_sSQL + sWhere + sOrder;
//-------------------------------
OleDbDataAdapter command = new OleDbDataAdapter(Specials_sSQL, Utility.Connection);
DataSet ds = new DataSet();
command.Fill(ds, 0, Specials_PAGENUM, "Specials");
DataView Source;
Source = new DataView(ds.Tables[0]);
if (ds.Tables[0].Rows.Count == 0){
Specials_no_records.Visible = true;
}
else
{Specials_no_records.Visible = false;
}
return Source;
// Specials Show end
}
void Specials_Bind() {
Specials_Repeater.DataSource = Specials_CreateDataSource();
Specials_Repeater.DataBind();
}
}
}