- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
Sub WriteCategories(number, choice)
strSql = ""
strSql2 = ""
If number = 1 Then
strSql = "SELECT name, category_type_id" '... the rest is skipped
Elseif number = 2 Or number = 3 Then
strSql = "SELECT goco.category_order, goco.category_type_id," '... the rest is skipped
End If
If number = 1 And choice = 1 Then
strSql2 = "SELECT gosct.category_type_id, goct.operator_id," '... the rest is skipped
Set RS2 = db.Execute(strSql2)
' --- No sub categories are displayed if choice = 3
Elseif choice <> 3 Then
strSql2 = "SELECT goco.category_type_id, goco.sub_category_order, ..." 'the rest is skipped
Set RS2 = db.Execute(strSql2)
End If
Set RS = db.Execute(strSql)
' --- CategoryListCurrent should not display selected category in categoryListMoveTo and vice versa.
If number = 2 And choice = 1 Then
'... the real code is skipped
Do Until RS.EOF
'... the real code is skipped
Loop
End If
If number = 2 And choice = 2 Then
'... the real code is skipped
Do Until RS.EOF
'... the real code is skipped
Loop
End If
' --- Loop through the recordset and print categories and sub categories.
Do Until RS.EOF
'... the real code is skipped
If number = 2 And choice = 1 Then
'... the real code is skipped
End If
If number = 2 And choice = 2 Then
'... the real code is skipped
End If
If number = 3 And choice = 3 And subConfigCatId <> -1 Then
'... the real code is skipped
End If
' --- Print main categories
Response.Write ("<option style=""color:"& color &""" value=""" & RS("category_type_id") & "_0"" " & tempSel & " " & disabled & ">" & RS("name") & "</option>" &vbCrLf)
If choice <> 3 Then
' --- Print sub categories
RS2.MoveFirst
If Not RS2.EOF Then
Do Until RS2.EOF
'... the real code is skipped
If catId1 <> -1 And number = 2 And choice = 1 And subCatId1 > 0 Then
'... the real code is skipped
End If
If catId2 <> -1 And number = 2 And choice = 2 And subCatId2 > 0 Then
'... the real code is skipped
End If
' --- Only print sub categories under a matching category
If CLng(RS2("category_type_id")) = CLng(RS("category_type_id")) Then
Response.Write ("<option value=""" & RS2("category_type_id") & "_" & RS2("sub_category_type_id") & """ " & tempSelSub & "> - " & RS2("name") & "</option>" &vbCrLf)
End If
RS2.MoveNext
Loop
End If
End If
'... the real code is skipped
Loop
End Sub
Один параметр числовой. Назовём его number (C) Captain Obvious.
Второй параметр тоже числовой. Но так как имя number занято, назовём его choice.
Именованные константы?.. Анти-паттерн «Spaghetti Code»? Не, не слышал…