% Response.Buffer = EW_RESPONSE_BUFFER %> <% Session.Timeout = 20 %> <% Response.Expires = 0 Response.ExpiresAbsolute = Now() - 1 Response.AddHeader "pragma", "no-cache" Response.AddHeader "cache-control", "private, no-cache, no-store, must-revalidate" %> <% ' Define page object Dim dimonds_list Set dimonds_list = New cdimonds_list Set Page = dimonds_list ' Page init processing Call dimonds_list.Page_Init() ' Page main processing Call dimonds_list.Page_Main() %> <% If dimonds.Export = "" Then %> <% End If %> <% If dimonds.Export = "" Then %> <% End If %> <% ' Load recordset Set Rs = dimonds_list.LoadRecordset() dimonds_list.lTotalRecs = Rs.RecordCount dimonds_list.lStartRec = 1 If dimonds_list.lDisplayRecs <= 0 Then ' Display all records dimonds_list.lDisplayRecs = dimonds_list.lTotalRecs End If If Not (dimonds.ExportAll And dimonds.Export <> "") Then dimonds_list.SetUpStartRec() ' Set up start record position End If %>
<% If dimonds.Export = "" And dimonds.CurrentAction = "" Then %> <% End If %>
<% If dimonds.Export = "" And dimonds.CurrentAction = "" Then %>|
<%
' Close recordset and connection
Rs.Close
Set Rs = Nothing
%>
<% If dimonds.Export = "" Then %>
<% If dimonds.CurrentAction <> "gridadd" And dimonds.CurrentAction <> "gridedit" Then %>
<% End If %> <% 'If dimonds_list.lTotalRecs > 0 Then %> <% 'End If %> <% End If %> |
" & Message & "
" Session(EW_SESSION_MESSAGE) = "" ' Clear message in Session End If End Sub ' ----------------------- ' Validate Page request ' Public Function IsPageRequest() If dimonds.UseTokenInUrl Then IsPageRequest = False If Not (ObjForm Is Nothing) Then IsPageRequest = (dimonds.TableVar = ObjForm.GetValue("t")) End If If Request.QueryString("t").Count > 0 Then IsPageRequest = (dimonds.TableVar = Request.QueryString("t")) End If Else IsPageRequest = True End If End Function ' ----------------------------------------------------------------- ' Class initialize ' - init objects ' - open ADO connection ' Private Sub Class_Initialize() ' Initialize table object Set dimonds = New cdimonds ' Initialize form object Set ObjForm = Nothing ' Intialize page id (for backward compatibility) EW_PAGE_ID = "list" ' Initialize table name (for backward compatibility) EW_TABLE_NAME = "dimonds" ' Open connection to the database Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open EW_DB_CONNECTION_STRING ' Initialize list options Set ListOptions = New cListOptions End Sub ' ----------------------------------------------------------------- ' Subroutine Page_Init ' - called before page main ' - check Security ' - set up response header ' - call page load events ' Sub Page_Init() dimonds.Export = Request.QueryString("export") ' Get export parameter gsExport = dimonds.Export ' Get export parameter, used in header gsExportFile = dimonds.TableVar ' Get export file, used in header If dimonds.Export = "print" Or dimonds.Export = "html" Then ' Printer friendly / Export to html, no action required End If If dimonds.Export = "word" Then Response.ContentType = "application/vnd.ms-word" Response.AddHeader "Content-Disposition:", "attachment; filename=" & gsExportFile & ".doc" End If ' Global page loading event (in userfn7.asp) Call Page_Loading() ' Page load event, used in current page Call Page_Load() End Sub ' ----------------------------------------------------------------- ' Class terminate ' - clean up page object ' Private Sub Class_Terminate() Call Page_Terminate("") End Sub ' ----------------------------------------------------------------- ' Subroutine Page_Terminate ' - called when exit page ' - clean up ADO connection and objects ' - if url specified, redirect to url ' Sub Page_Terminate(url) ' Page unload event, used in current page Call Page_Unload() ' Global page unloaded event (in userfn60.asp) Call Page_Unloaded() If Not (Conn Is Nothing) Then Conn.Close ' Close Connection Set Conn = Nothing Set dimonds = Nothing Set ListOptions = Nothing ' Go to url if specified If url <> "" Then Response.Clear Response.Redirect url End If End Sub ' ' Subroutine Page_Terminate (End) ' ---------------------------------------- Dim lDisplayRecs ' Number of display records Dim lStartRec, lStopRec, lTotalRecs, lRecRange Dim sSrchWhere Dim lRecCnt Dim lEditRowCnt Dim lRowCnt, lRowIndex Dim lOptionCnt Dim lRecPerRow, lColCnt Dim sDeleteConfirmMsg ' Delete confirm message Dim sDbMasterFilter, sDbDetailFilter Dim bMasterRecordExists Dim ListOptions Dim sMultiSelectKey ' ----------------------------------------------------------------- ' Page main processing ' Sub Page_Main() lDisplayRecs = 20 lRecRange = 10 lRecCnt = 0 ' Record count ' Search filters Dim sSrchAdvanced, sSrchBasic, sFilter sSrchAdvanced = "" ' Advanced search filter sSrchBasic = "" ' Basic search filter sSrchWhere = "" ' Search where clause sFilter = "" ' Master/Detail sDbMasterFilter = "" ' Master filter sDbDetailFilter = "" ' Detail filter If IsPageRequest Then ' Validate request ' Set up records per page dynamically SetUpDisplayRecs() ' Handle reset command ResetCmd() ' Get search criteria for advanced search Call LoadSearchValues() ' Get search values If ValidateSearch() Then sSrchAdvanced = AdvancedSearchWhere() Else Message = gsSearchError End If ' Get basic search criteria If gsSearchError = "" Then sSrchBasic = BasicSearchWhere() End If ' Set Up Sorting Order SetUpSortOrder() End If ' End Validate Request ' Restore display records If dimonds.RecordsPerPage <> "" Then lDisplayRecs = dimonds.RecordsPerPage ' Restore from Session Else lDisplayRecs = 20 ' Load default End If ' Load Sorting Order LoadSortOrder() ' Build search criteria If sSrchAdvanced <> "" Then If sSrchWhere <> "" Then sSrchWhere = "(" & sSrchWhere & ") AND (" & sSrchAdvanced & ")" Else sSrchWhere = sSrchAdvanced End If End If If sSrchBasic <> "" Then If sSrchWhere <> "" Then sSrchWhere = "(" & sSrchWhere & ") AND (" & sSrchBasic & ")" Else sSrchWhere = sSrchBasic End If End If ' Call Recordset Searching event Call dimonds.Recordset_Searching(sSrchWhere) ' Save search criteria If sSrchWhere <> "" Then If sSrchBasic = "" Then Call ResetBasicSearchParms() If sSrchAdvanced = "" Then Call ResetAdvancedSearchParms() dimonds.SearchWhere = sSrchWhere ' Save to Session lStartRec = 1 ' Reset start record counter dimonds.StartRecordNumber = lStartRec Else Call RestoreSearchParms() End If ' Build filter sFilter = "" If sDbDetailFilter <> "" Then If sFilter <> "" Then sFilter = "(" & sFilter & ") AND (" & sDbDetailFilter & ")" Else sFilter = sDbDetailFilter End If End If If sSrchWhere <> "" Then If sFilter <> "" Then sFilter = "(" & sFilter & ") AND (" & sSrchWhere & ")" Else sFilter = sSrchWhere End If End If ' Set up filter in Session dimonds.SessionWhere = sFilter dimonds.CurrentFilter = "" ' Export Data only If dimonds.Export = "html" Or dimonds.Export = "csv" Or dimonds.Export = "word" Or dimonds.Export = "excel" Or dimonds.Export = "xml" Then Call ExportData() Call Page_Terminate("") ' Clean up Response.End ' Terminate response End If End Sub ' ----------------------------------------------------------------- ' Set up number of records displayed per page ' Sub SetUpDisplayRecs() Dim sWrk sWrk = Request.QueryString(EW_TABLE_REC_PER_PAGE) If sWrk <> "" Then If IsNumeric(sWrk) Then lDisplayRecs = CInt(sWrk) Else If LCase(sWrk) = "all" Then ' Display all records lDisplayRecs = -1 Else lDisplayRecs = 10 ' Non-numeric, load default End If End If dimonds.RecordsPerPage = lDisplayRecs ' Save to Session ' Reset start position lStartRec = 1 dimonds.StartRecordNumber = lStartRec End If End Sub ' ----------------------------------------------------------------- ' Return Advanced Search Where based on QueryString parameters ' Function AdvancedSearchWhere() Dim sWhere sWhere = "" ' Field Item No Call BuildSearchSql(sWhere, dimonds.Item_No, False) ' Field Date Added Call BuildSearchSql(sWhere, dimonds.Date_Added, False) ' Field Shape Call BuildSearchSql(sWhere, dimonds.Shape, False) ' Field Carat Weight Call BuildSearchSql(sWhere, dimonds.Carat_Weight, False) ' Field Cut Call BuildSearchSql(sWhere, dimonds.Cut, True) ' Field Color Call BuildSearchSql(sWhere, dimonds.Color, True) ' Field Clarity Call BuildSearchSql(sWhere, dimonds.Clarity, True) ' Field Certificate Call BuildSearchSql(sWhere, dimonds.Certificate, False) ' Field Price Call BuildSearchSql(sWhere, dimonds.Price, False) ' Field Depth Call BuildSearchSql(sWhere, dimonds.Depth, False) ' Field Table Call BuildSearchSql(sWhere, dimonds.Table, False) ' Field Polish Call BuildSearchSql(sWhere, dimonds.Polish, True) ' Field Symmetry Call BuildSearchSql(sWhere, dimonds.Symmetry, True) ' Field Girdle Call BuildSearchSql(sWhere, dimonds.Girdle, False) ' Field Culet Call BuildSearchSql(sWhere, dimonds.Culet, False) ' Field Fluorescence Call BuildSearchSql(sWhere, dimonds.Fluorescence, False) ' Field Measurements Call BuildSearchSql(sWhere, dimonds.Measurements, False) ' Field Crown Angle Call BuildSearchSql(sWhere, dimonds.Crown_Angle, False) ' Field Crown % Call BuildSearchSql(sWhere, dimonds.Crown_25, False) ' Field Pavilion Angle Call BuildSearchSql(sWhere, dimonds.Pavilion_Angle, False) ' Field Pavilion % Call BuildSearchSql(sWhere, dimonds.Pavilion_25, False) ' Field Slideshow Call BuildSearchSql(sWhere, dimonds.Slideshow, False) ' Field Ratio Call BuildSearchSql(sWhere, dimonds.Ratio, False) ' Field Description Call BuildSearchSql(sWhere, dimonds.Description, False) AdvancedSearchWhere = sWhere ' Set up search parm If AdvancedSearchWhere <> "" Then ' Field Item No Call SetSearchParm(dimonds.Item_No) ' Field Date Added Call SetSearchParm(dimonds.Date_Added) ' Field Shape Call SetSearchParm(dimonds.Shape) ' Field Carat Weight Call SetSearchParm(dimonds.Carat_Weight) ' Field Cut Call SetSearchParm(dimonds.Cut) ' Field Color Call SetSearchParm(dimonds.Color) ' Field Clarity Call SetSearchParm(dimonds.Clarity) ' Field Certificate Call SetSearchParm(dimonds.Certificate) ' Field Price Call SetSearchParm(dimonds.Price) ' Field Depth Call SetSearchParm(dimonds.Depth) ' Field Table Call SetSearchParm(dimonds.Table) ' Field Polish Call SetSearchParm(dimonds.Polish) ' Field Symmetry Call SetSearchParm(dimonds.Symmetry) ' Field Girdle Call SetSearchParm(dimonds.Girdle) ' Field Culet Call SetSearchParm(dimonds.Culet) ' Field Fluorescence Call SetSearchParm(dimonds.Fluorescence) ' Field Measurements Call SetSearchParm(dimonds.Measurements) ' Field Crown Angle Call SetSearchParm(dimonds.Crown_Angle) ' Field Crown % Call SetSearchParm(dimonds.Crown_25) ' Field Pavilion Angle Call SetSearchParm(dimonds.Pavilion_Angle) ' Field Pavilion % Call SetSearchParm(dimonds.Pavilion_25) ' Field Slideshow Call SetSearchParm(dimonds.Slideshow) ' Field Ratio Call SetSearchParm(dimonds.Ratio) ' Field Description Call SetSearchParm(dimonds.Description) End If End Function ' ----------------------------------------------------------------- ' Build search sql ' ' ----------------------------------------------------------------- ' Build search sql ' Sub BuildSearchSql(Where, Fld, MultiValue) Dim FldParm, FldVal, FldOpr, FldCond, FldVal2, FldOpr2 FldParm = Mid(Fld.FldVar, 3) FldVal = Request.QueryString("x_" & FldParm) FldOpr = Request.QueryString("z_" & FldParm) FldCond = Request.QueryString("v_" & FldParm) FldVal2 = Request.QueryString("y_" & FldParm) FldOpr2 = Request.QueryString("w_" & FldParm) Dim sWrk sWrk = "" FldOpr = UCase(Trim(FldOpr)) If (FldOpr = "") Then FldOpr = "=" FldOpr2 = UCase(Trim(FldOpr2)) If FldOpr2 = "" Then FldOpr2 = "=" If EW_SEARCH_MULTI_VALUE_OPTION = 1 Then MultiValue = False If FldOpr <> "LIKE" Then MultiValue = False If FldOpr2 <> "LIKE" And FldVal2 <> "" Then MultiValue = False If MultiValue Then Dim sWrk1, sWrk2 ' Field value 1 If FldVal <> "" Then sWrk1 = ew_GetMultiSearchSql(Fld, FldVal) Else sWrk1 = "" End If ' Field value 2 If FldVal2 <> "" And FldCond <> "" Then sWrk2 = ew_GetMultiSearchSql(Fld, FldVal2) Else sWrk2 = "" End If ' Build final SQL sWrk = sWrk1 If sWrk2 <> "" Then If sWrk <> "" Then sWrk = "(" & sWrk & ") " & FldCond & " (" & sWrk2 & ")" Else sWrk = sWrk2 End If End If Else FldVal = ConvertSearchValue(Fld, FldVal) FldVal2 = ConvertSearchValue(Fld, FldVal2) sWrk = ew_GetSearchSql(Fld, FldVal, FldOpr, FldCond, FldVal2, FldOpr2) End If If sWrk <> "" Then If Where <> "" Then Where = Where & " AND " Where = Where & "(" & sWrk & ")" End If End Sub ' ----------------------------------------------------------------- ' Set search parm ' Sub SetSearchParm(Fld) Dim FldParm FldParm = Mid(Fld.FldVar, 3) Call dimonds.SetAdvancedSearch("x_" & FldParm, Request.QueryString("x_" & FldParm)) Call dimonds.SetAdvancedSearch("z_" & FldParm, Request.QueryString("z_" & FldParm)) Call dimonds.SetAdvancedSearch("v_" & FldParm, Request.QueryString("v_" & FldParm)) Call dimonds.SetAdvancedSearch("y_" & FldParm, Request.QueryString("y_" & FldParm)) Call dimonds.SetAdvancedSearch("w_" & FldParm, Request.QueryString("w_" & FldParm)) End Sub ' ----------------------------------------------------------------- ' Convert search value ' Function ConvertSearchValue(Fld, FldVal) ConvertSearchValue = FldVal If Fld.FldDataType = EW_DATATYPE_BOOLEAN Then If FldVal <> "" Then ConvertSearchValue = ew_IIf(FldVal="1", "True", "False") ElseIf Fld.FldDataType = EW_DATATYPE_DATE Then If FldVal <> "" Then ConvertSearchValue = ew_UnFormatDateTime(FldVal, Fld.FldDateTimeFormat) End If End Function ' ----------------------------------------------------------------- ' Return Basic Search sql ' Function BasicSearchSQL(Keyword) Dim sKeyword sKeyword = ew_AdjustSql(Keyword) BasicSearchSQL = "" If IsNumeric(sKeyword) Then BasicSearchSQL = BasicSearchSQL & "[Item No] = " & sKeyword & " OR " BasicSearchSQL = BasicSearchSQL & "[Shape] LIKE '%" & sKeyword & "%' OR " If IsNumeric(sKeyword) Then BasicSearchSQL = BasicSearchSQL & "[Carat Weight] = " & sKeyword & " OR " BasicSearchSQL = BasicSearchSQL & "[Cut] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Color] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Clarity] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Certificate] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Certificate pic] LIKE '%" & sKeyword & "%' OR " If IsNumeric(sKeyword) Then BasicSearchSQL = BasicSearchSQL & "[Price] = " & sKeyword & " OR " BasicSearchSQL = BasicSearchSQL & "[Picture] LIKE '%" & sKeyword & "%' OR " If IsNumeric(sKeyword) Then BasicSearchSQL = BasicSearchSQL & "[Depth] = " & sKeyword & " OR " If IsNumeric(sKeyword) Then BasicSearchSQL = BasicSearchSQL & "[Table] = " & sKeyword & " OR " BasicSearchSQL = BasicSearchSQL & "[Polish] LIKE '%" & sKeyword & "%' OR " BasicSearchSQL = BasicSearchSQL & "[Symmetry] LIKE '%" & sKeyword & "%' OR " If Right(BasicSearchSQL, 4) = " OR " Then BasicSearchSQL = Left(BasicSearchSQL, Len(BasicSearchSQL)-4) End Function ' ----------------------------------------------------------------- ' Return Basic Search Where based on search keyword and type ' Function BasicSearchWhere() Dim sSearchStr, sSearchKeyword, sSearchType Dim sSearch, arKeyword, sKeyword sSearchStr = "" sSearchKeyword = Request.QueryString(EW_TABLE_BASIC_SEARCH) sSearchType = Request.QueryString(EW_TABLE_BASIC_SEARCH_TYPE) If sSearchKeyword <> "" Then sSearch = Trim(sSearchKeyword) If sSearchType <> "" Then While InStr(sSearch, " ") > 0 sSearch = Replace(sSearch, " ", " ") Wend arKeyword = Split(Trim(sSearch), " ") For Each sKeyword In arKeyword If sSearchStr <> "" Then sSearchStr = sSearchStr & " " & sSearchType & " " sSearchStr = sSearchStr & "(" & BasicSearchSQL(sKeyword) & ")" Next Else sSearchStr = BasicSearchSQL(sSearch) End If End If If sSearchKeyword <> "" then dimonds.BasicSearchKeyword = sSearchKeyword dimonds.BasicSearchType = sSearchType End If BasicSearchWhere = sSearchStr End Function ' ----------------------------------------------------------------- ' Clear all search parameters ' Sub ResetSearchParms() ' Clear search where sSrchWhere = "" dimonds.SearchWhere = sSrchWhere ' Clear basic search parameters Call ResetBasicSearchParms() ' Clear advanced search parameters Call ResetAdvancedSearchParms() End Sub ' ----------------------------------------------------------------- ' Clear all basic search parameters ' Sub ResetBasicSearchParms() ' Clear basic search parameters dimonds.BasicSearchKeyword = "" dimonds.BasicSearchType = "" End Sub ' ----------------------------------------------------------------- ' Clear all advanced search parameters ' Sub ResetAdvancedSearchParms() ' Clear advanced search parameters Call dimonds.SetAdvancedSearch("x_Item_No", "") Call dimonds.SetAdvancedSearch("x_Date_Added", "") Call dimonds.SetAdvancedSearch("x_Shape", "") Call dimonds.SetAdvancedSearch("x_Carat_Weight", "") Call dimonds.SetAdvancedSearch("y_Carat_Weight", "") Call dimonds.SetAdvancedSearch("x_Cut", "") Call dimonds.SetAdvancedSearch("x_Color", "") Call dimonds.SetAdvancedSearch("x_Clarity", "") Call dimonds.SetAdvancedSearch("x_Certificate", "") Call dimonds.SetAdvancedSearch("x_Price", "") Call dimonds.SetAdvancedSearch("y_Price", "") Call dimonds.SetAdvancedSearch("x_Depth", "") Call dimonds.SetAdvancedSearch("y_Depth", "") Call dimonds.SetAdvancedSearch("x_Table", "") Call dimonds.SetAdvancedSearch("y_Table", "") Call dimonds.SetAdvancedSearch("x_Polish", "") Call dimonds.SetAdvancedSearch("x_Symmetry", "") Call dimonds.SetAdvancedSearch("x_Girdle", "") Call dimonds.SetAdvancedSearch("x_Culet", "") Call dimonds.SetAdvancedSearch("x_Fluorescence", "") Call dimonds.SetAdvancedSearch("x_Measurements", "") Call dimonds.SetAdvancedSearch("x_Crown_Angle", "") Call dimonds.SetAdvancedSearch("x_Crown_25", "") Call dimonds.SetAdvancedSearch("x_Pavilion_Angle", "") Call dimonds.SetAdvancedSearch("x_Pavilion_25", "") Call dimonds.SetAdvancedSearch("x_Slideshow", "") Call dimonds.SetAdvancedSearch("x_Ratio", "") Call dimonds.SetAdvancedSearch("x_Description", "") End Sub ' ----------------------------------------------------------------- ' Restore all search parameters ' Sub RestoreSearchParms() sSrchWhere = dimonds.SearchWhere ' Restore advanced search settings If gsSearchError = "" Then Call RestoreAdvancedSearchParms() End If End Sub ' ----------------------------------------------------------------- ' Restore all advanced search parameters ' Sub RestoreAdvancedSearchParms() ' Restore advanced search parms dimonds.Item_No.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Item_No") dimonds.Date_Added.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Date_Added") dimonds.Shape.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Shape") dimonds.Carat_Weight.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Carat_Weight") dimonds.Carat_Weight.AdvancedSearch.SearchValue2 = dimonds.GetAdvancedSearch("y_Carat_Weight") dimonds.Cut.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Cut") dimonds.Color.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Color") dimonds.Clarity.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Clarity") dimonds.Certificate.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Certificate") dimonds.Price.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Price") dimonds.Price.AdvancedSearch.SearchValue2 = dimonds.GetAdvancedSearch("y_Price") dimonds.Depth.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Depth") dimonds.Depth.AdvancedSearch.SearchValue2 = dimonds.GetAdvancedSearch("y_Depth") dimonds.Table.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Table") dimonds.Table.AdvancedSearch.SearchValue2 = dimonds.GetAdvancedSearch("y_Table") dimonds.Polish.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Polish") dimonds.Symmetry.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Symmetry") dimonds.Girdle.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Girdle") dimonds.Culet.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Culet") dimonds.Fluorescence.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Fluorescence") dimonds.Measurements.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Measurements") dimonds.Crown_Angle.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Crown_Angle") dimonds.Crown_25.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Crown_25") dimonds.Pavilion_Angle.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Pavilion_Angle") dimonds.Pavilion_25.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Pavilion_25") dimonds.Slideshow.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Slideshow") dimonds.Ratio.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Ratio") dimonds.Description.AdvancedSearch.SearchValue = dimonds.GetAdvancedSearch("x_Description") End Sub ' ----------------------------------------------------------------- ' Set up Sort parameters based on Sort Links clicked ' Sub SetUpSortOrder() Dim sOrderBy Dim sSortField, sLastSort, sThisSort Dim bCtrl ' Check for an Order parameter If Request.QueryString("order").Count > 0 Then dimonds.CurrentOrder = Request.QueryString("order") dimonds.CurrentOrderType = Request.QueryString("ordertype") ' Field Shape Call dimonds.UpdateSort(dimonds.Item_No) ' Field Carat Weight Call dimonds.UpdateSort(dimonds.Carat_Weight) ' Field Cut Call dimonds.UpdateSort(dimonds.Cut) ' Field Color Call dimonds.UpdateSort(dimonds.Color) ' Field Clarity Call dimonds.UpdateSort(dimonds.Clarity) ' Field Certificate Call dimonds.UpdateSort(dimonds.Certificate) ' Field Price Call dimonds.UpdateSort(dimonds.Price) ' Field Depth Call dimonds.UpdateSort(dimonds.Depth) ' Field Table Call dimonds.UpdateSort(dimonds.Table) ' Field Polish Call dimonds.UpdateSort(dimonds.Polish) ' Field Symmetry Call dimonds.UpdateSort(dimonds.Symmetry) dimonds.StartRecordNumber = 1 ' Reset start position End If End Sub ' ----------------------------------------------------------------- ' Load Sort Order parameters ' Sub LoadSortOrder() Dim sOrderBy sOrderBy = dimonds.SessionOrderBy ' Get order by from Session If sOrderBy = "" Then If dimonds.SqlOrderBy <> "" Then sOrderBy = dimonds.SqlOrderBy dimonds.SessionOrderBy = sOrderBy End If End If End Sub ' ----------------------------------------------------------------- ' Reset command based on querystring parameter cmd= ' - RESET: reset search parameters ' - RESETALL: reset search & master/detail parameters ' - RESETSORT: reset sort parameters ' Sub ResetCmd() Dim sCmd ' Get reset cmd If Request.QueryString("cmd").Count > 0 Then sCmd = Request.QueryString("cmd") ' Reset search criteria If LCase(sCmd) = "reset" Or LCase(sCmd) = "resetall" Then Call ResetSearchParms() End If ' Reset Sort Criteria If LCase(sCmd) = "resetsort" Then Dim sOrderBy sOrderBy = "" dimonds.SessionOrderBy = sOrderBy dimonds.Item_No.Sort = "" dimonds.Carat_Weight.Sort = "" dimonds.Cut.Sort = "" dimonds.Color.Sort = "" dimonds.Clarity.Sort = "" dimonds.Certificate.Sort = "" dimonds.Price.Sort = "" dimonds.Depth.Sort = "" dimonds.Table.Sort = "" dimonds.Polish.Sort = "" dimonds.Symmetry.Sort = "" End If ' Reset start position lStartRec = 1 dimonds.StartRecordNumber = lStartRec End If End Sub Dim Pager ' ----------------------------------------------------------------- ' Set up Starting Record parameters based on Pager Navigation ' Sub SetUpStartRec() Dim nPageNo ' Exit if lDisplayRecs = 0 If lDisplayRecs = 0 Then Exit Sub If IsPageRequest Then ' Validate request ' Check for a START parameter If Request.QueryString(EW_TABLE_START_REC).Count > 0 Then lStartRec = Request.QueryString(EW_TABLE_START_REC) dimonds.StartRecordNumber = lStartRec ElseIf Request.QueryString(EW_TABLE_PAGE_NO).Count > 0 Then nPageNo = Request.QueryString(EW_TABLE_PAGE_NO) If IsNumeric(nPageNo) Then lStartRec = (nPageNo-1)*lDisplayRecs+1 If lStartRec <= 0 Then lStartRec = 1 ElseIf lStartRec >= ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1 Then lStartRec = ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1 End If dimonds.StartRecordNumber = lStartRec End If End If End If lStartRec = dimonds.StartRecordNumber ' Check if correct start record counter If Not IsNumeric(lStartRec) Or lStartRec = "" Then ' Avoid invalid start record counter lStartRec = 1 ' Reset start record counter dimonds.StartRecordNumber = lStartRec ElseIf CLng(lStartRec) > CLng(lTotalRecs) Then ' Avoid starting record > total records lStartRec = ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1 ' Point to last page first record dimonds.StartRecordNumber = lStartRec ElseIf (lStartRec-1) Mod lDisplayRecs <> 0 Then lStartRec = ((lStartRec-1)\lDisplayRecs)*lDisplayRecs+1 ' Point to page boundary dimonds.StartRecordNumber = lStartRec End If End Sub ' ----------------------------------------------------------------- ' Load search values for validation ' Function LoadSearchValues() ' Load search values dimonds.Shape.AdvancedSearch.SearchValue = Request.QueryString("x_Shape") dimonds.Carat_Weight.AdvancedSearch.SearchValue = Request.QueryString("x_Carat_Weight") dimonds.Carat_Weight.AdvancedSearch.SearchValue2 = Request.QueryString("y_Carat_Weight") dimonds.Cut.AdvancedSearch.SearchValue = Request.QueryString("x_Cut") dimonds.Color.AdvancedSearch.SearchValue = Request.QueryString("x_Color") dimonds.Clarity.AdvancedSearch.SearchValue = Request.QueryString("x_Clarity") dimonds.Price.AdvancedSearch.SearchValue = Request.QueryString("x_Price") dimonds.Price.AdvancedSearch.SearchValue2 = Request.QueryString("y_Price") dimonds.Depth.AdvancedSearch.SearchValue = Request.QueryString("x_Depth") dimonds.Depth.AdvancedSearch.SearchValue2 = Request.QueryString("y_Depth") dimonds.Table.AdvancedSearch.SearchValue = Request.QueryString("x_Table") dimonds.Table.AdvancedSearch.SearchValue2 = Request.QueryString("y_Table") dimonds.Polish.AdvancedSearch.SearchValue = Request.QueryString("x_Polish") dimonds.Symmetry.AdvancedSearch.SearchValue = Request.QueryString("x_Symmetry") End Function ' ----------------------------------------------------------------- ' Load recordset ' Function LoadRecordset() ' Call Recordset Selecting event Call dimonds.Recordset_Selecting(dimonds.CurrentFilter) ' Load list page sql Dim sSql sSql = dimonds.ListSQL If EW_DEBUG_ENABLED Then Response.Write sSql ' Show SQL for debugging ' Load recordset Dim RsRecordset Set RsRecordset = Server.CreateObject("ADODB.Recordset") RsRecordset.CursorLocation = EW_CURSORLOCATION RsRecordset.Open sSql, Conn, 1, 2 ' Call Recordset Selected event Call dimonds.Recordset_Selected(RsRecordset) Set LoadRecordset = RsRecordset End Function ' ----------------------------------------------------------------- ' Load row based on key values ' Function LoadRow() Dim RsRow, sSql, sFilter sFilter = dimonds.KeyFilter ' Call Row Selecting event Call dimonds.Row_Selecting(sFilter) ' Load sql based on filter dimonds.CurrentFilter = sFilter sSql = dimonds.SQL If EW_DEBUG_ENABLED Then Response.Write sSql ' Show SQL for debugging Set RsRow = Server.CreateObject("ADODB.Recordset") RsRow.Open sSql, Conn If RsRow.Eof Then LoadRow = False Else LoadRow = True RsRow.MoveFirst Call LoadRowValues(RsRow) ' Load row values ' Call Row Selected event Call dimonds.Row_Selected(RsRow) End If RsRow.Close Set RsRow = Nothing End Function ' ----------------------------------------------------------------- ' Load row values from recordset ' Sub LoadRowValues(RsRow) dimonds.Item_No.DbValue = RsRow("Item No") dimonds.Date_Added.DbValue = RsRow("Date Added") dimonds.Shape.DbValue = RsRow("Shape") dimonds.Carat_Weight.DbValue = RsRow("Carat Weight") dimonds.Cut.DbValue = RsRow("Cut") dimonds.Color.DbValue = RsRow("Color") dimonds.Clarity.DbValue = RsRow("Clarity") dimonds.Certificate.DbValue = RsRow("Certificate") dimonds.Certificate_pic.Upload.DbValue = RsRow("Certificate pic") dimonds.Price.DbValue = RsRow("Price") dimonds.Picture.Upload.DbValue = RsRow("Picture") dimonds.Depth.DbValue = RsRow("Depth") dimonds.Table.DbValue = RsRow("Table") dimonds.Polish.DbValue = RsRow("Polish") dimonds.Symmetry.DbValue = RsRow("Symmetry") dimonds.Girdle.DbValue = RsRow("Girdle") dimonds.Culet.DbValue = RsRow("Culet") dimonds.Fluorescence.DbValue = RsRow("Fluorescence") dimonds.Measurements.DbValue = RsRow("Measurements") dimonds.Crown_Angle.DbValue = RsRow("Crown Angle") dimonds.Crown_25.DbValue = RsRow("Crown %") dimonds.Pavilion_Angle.DbValue = RsRow("Pavilion Angle") dimonds.Pavilion_25.DbValue = RsRow("Pavilion %") dimonds.Slideshow.DbValue = ew_IIf(RsRow("Slideshow"), "1", "0") dimonds.Ratio.DbValue = RsRow("Ratio") dimonds.Description.DbValue = RsRow("Description") End Sub ' ----------------------------------------------------------------- ' Render row values based on field settings ' Sub RenderRow() ' Call Row Rendering event Call dimonds.Row_Rendering() ' --------------------------------------- ' Common render codes for all row types ' --------------------------------------- ' Shape dimonds.Shape.CellCssStyle = "" dimonds.Shape.CellCssClass = "" ' Carat Weight dimonds.Carat_Weight.CellCssStyle = "" dimonds.Carat_Weight.CellCssClass = "" ' Cut dimonds.Cut.CellCssStyle = "" dimonds.Cut.CellCssClass = "" ' Color dimonds.Color.CellCssStyle = "" dimonds.Color.CellCssClass = "" ' Clarity dimonds.Clarity.CellCssStyle = "" dimonds.Clarity.CellCssClass = "" ' Certificate dimonds.Certificate.CellCssStyle = "" dimonds.Certificate.CellCssClass = "" ' Price dimonds.Price.CellCssStyle = "" dimonds.Price.CellCssClass = "" ' Depth dimonds.Depth.CellCssStyle = "" dimonds.Depth.CellCssClass = "" ' Table dimonds.Table.CellCssStyle = "" dimonds.Table.CellCssClass = "" ' Polish dimonds.Polish.CellCssStyle = "" dimonds.Polish.CellCssClass = "" ' Symmetry dimonds.Symmetry.CellCssStyle = "" dimonds.Symmetry.CellCssClass = "" ' ----------- ' View Row ' ----------- If dimonds.RowType = EW_ROWTYPE_VIEW Then ' View row ' Item No dimonds.Item_No.ViewValue = dimonds.Item_No.CurrentValue dimonds.Item_No.ViewValue = ew_FormatNumber(dimonds.Item_No.ViewValue, 0, -2, -2, -2) dimonds.Item_No.CssStyle = "font-weight:bold;" dimonds.Item_No.CssClass = "" dimonds.Item_No.ViewCustomAttributes = "" ' Shape If dimonds.Shape.CurrentValue & "" <> "" Then sSqlWrk = "SELECT [shape], [Pic] FROM [shape] WHERE [shape] = '" & ew_AdjustSql(dimonds.Shape.CurrentValue) & "'" Set RsWrk = Conn.Execute(sSqlWrk) If Not RsWrk.Eof Then dimonds.Shape.ViewValue = RsWrk("shape") dimonds.Shape.ViewValue = dimonds.Shape.ViewValue & ew_ValueSeparator(0) & RsWrk("Pic") Else dimonds.Shape.ViewValue = dimonds.Shape.CurrentValue End If RsWrk.Close Set RsWrk = Nothing Else dimonds.Shape.ViewValue = Null End If dimonds.Shape.CssStyle = "font-weight:bold;" dimonds.Shape.CssClass = "" dimonds.Shape.ViewCustomAttributes = "" ' Carat Weight dimonds.Carat_Weight.ViewValue = dimonds.Carat_Weight.CurrentValue dimonds.Carat_Weight.ViewValue = ew_FormatNumber(dimonds.Carat_Weight.ViewValue, 2, -2, 0, 0) dimonds.Carat_Weight.CssStyle = "font-weight:bold;" dimonds.Carat_Weight.CssClass = "" dimonds.Carat_Weight.ViewCustomAttributes = "" ' Cut If dimonds.Cut.CurrentValue & "" <> "" Then arwrk = Split(dimonds.Cut.CurrentValue&"",",") sSqlWrk = "SELECT [Cut] FROM [cut] WHERE " sWhereWrk = "" For ari = 0 to UBound(arwrk) If sWhereWrk <> "" Then sWhereWrk = sWhereWrk & " OR " sWhereWrk = sWhereWrk & "[Cut] = '" & ew_AdjustSql(Trim(arwrk(ari))) & "'" Next If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & "(" & sWhereWrk & ")" Set RsWrk = Conn.Execute(sSqlWrk) dimonds.Cut.ViewValue = "" ari = 0 Do While Not RsWrk.Eof dimonds.Cut.ViewValue = dimonds.Cut.ViewValue & RsWrk("Cut") RsWrk.MoveNext If Not RsWrk.Eof Then dimonds.Cut.ViewValue = dimonds.Cut.ViewValue & ew_ViewOptionSeparator(ari) ' Separate Options End If ari = ari + 1 Loop RsWrk.Close Set RsWrk = Nothing Else dimonds.Cut.ViewValue = Null End If dimonds.Cut.CssStyle = "font-weight:bold;" dimonds.Cut.CssClass = "" dimonds.Cut.ViewCustomAttributes = "" ' Color If dimonds.Color.CurrentValue & "" <> "" Then arwrk = Split(dimonds.Color.CurrentValue&"",",") sSqlWrk = "SELECT [Color] FROM [color] WHERE " sWhereWrk = "" For ari = 0 to UBound(arwrk) If sWhereWrk <> "" Then sWhereWrk = sWhereWrk & " OR " sWhereWrk = sWhereWrk & "[Color] = '" & ew_AdjustSql(Trim(arwrk(ari))) & "'" Next If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & "(" & sWhereWrk & ")" Set RsWrk = Conn.Execute(sSqlWrk) dimonds.Color.ViewValue = "" ari = 0 Do While Not RsWrk.Eof dimonds.Color.ViewValue = dimonds.Color.ViewValue & RsWrk("Color") RsWrk.MoveNext If Not RsWrk.Eof Then dimonds.Color.ViewValue = dimonds.Color.ViewValue & ew_ViewOptionSeparator(ari) ' Separate Options End If ari = ari + 1 Loop RsWrk.Close Set RsWrk = Nothing Else dimonds.Color.ViewValue = Null End If dimonds.Color.CssStyle = "font-weight:bold;" dimonds.Color.CssClass = "" dimonds.Color.ViewCustomAttributes = "" ' Clarity If dimonds.Clarity.CurrentValue & "" <> "" Then arwrk = Split(dimonds.Clarity.CurrentValue&"",",") sSqlWrk = "SELECT [Clarity] FROM [clarity] WHERE " sWhereWrk = "" For ari = 0 to UBound(arwrk) If sWhereWrk <> "" Then sWhereWrk = sWhereWrk & " OR " sWhereWrk = sWhereWrk & "[Clarity] = '" & ew_AdjustSql(Trim(arwrk(ari))) & "'" Next If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & "(" & sWhereWrk & ")" Set RsWrk = Conn.Execute(sSqlWrk) dimonds.Clarity.ViewValue = "" ari = 0 Do While Not RsWrk.Eof dimonds.Clarity.ViewValue = dimonds.Clarity.ViewValue & RsWrk("Clarity") RsWrk.MoveNext If Not RsWrk.Eof Then dimonds.Clarity.ViewValue = dimonds.Clarity.ViewValue & ew_ViewOptionSeparator(ari) ' Separate Options End If ari = ari + 1 Loop RsWrk.Close Set RsWrk = Nothing Else dimonds.Clarity.ViewValue = Null End If dimonds.Clarity.CssStyle = "font-weight:bold;" dimonds.Clarity.CssClass = "" dimonds.Clarity.ViewCustomAttributes = "" ' Certificate dimonds.Certificate.ViewValue = dimonds.Certificate.CurrentValue dimonds.Certificate.CssStyle = "" dimonds.Certificate.CssClass = "" dimonds.Certificate.ViewCustomAttributes = "" ' Certificate pic If Not IsNull(dimonds.Certificate_pic.Upload.DbValue) Then dimonds.Certificate_pic.ViewValue = dimonds.Certificate_pic.Upload.DbValue Else dimonds.Certificate_pic.ViewValue = "" End If dimonds.Certificate_pic.CssStyle = "" dimonds.Certificate_pic.CssClass = "" dimonds.Certificate_pic.ViewCustomAttributes = "" ' Price dimonds.Price.ViewValue = dimonds.Price.CurrentValue dimonds.Price.ViewValue = ew_FormatCurrency(dimonds.Price.ViewValue, 0, -2, -2, -2) dimonds.Price.CssStyle = "font-weight:bold;" dimonds.Price.CssClass = "" dimonds.Price.ViewCustomAttributes = "" ' Picture If Not IsNull(dimonds.Picture.Upload.DbValue) Then dimonds.Picture.ViewValue = dimonds.Picture.Upload.DbValue dimonds.Picture.ImageAlt = "" Else dimonds.Picture.ViewValue = "" End If dimonds.Picture.CssStyle = "" dimonds.Picture.CssClass = "" dimonds.Picture.ViewCustomAttributes = "" ' Depth dimonds.Depth.ViewValue = dimonds.Depth.CurrentValue dimonds.Depth.ViewValue = ew_FormatPercent(dimonds.Depth.ViewValue, 1, -2, 0, 0) dimonds.Depth.CssStyle = "font-weight:bold;" dimonds.Depth.CssClass = "" dimonds.Depth.ViewCustomAttributes = "%" ' Table dimonds.Table.ViewValue = dimonds.Table.CurrentValue dimonds.Table.ViewValue = ew_FormatPercent(dimonds.Table.ViewValue, 1, -2, 0, 0) dimonds.Table.CssStyle = "font-weight:bold;" dimonds.Table.CssClass = "" dimonds.Table.ViewCustomAttributes = "" ' Polish If dimonds.Polish.CurrentValue & "" <> "" Then arwrk = Split(dimonds.Polish.CurrentValue&"",",") sSqlWrk = "SELECT [Polish] FROM [polish] WHERE " sWhereWrk = "" For ari = 0 to UBound(arwrk) If sWhereWrk <> "" Then sWhereWrk = sWhereWrk & " OR " sWhereWrk = sWhereWrk & "[Polish] = '" & ew_AdjustSql(Trim(arwrk(ari))) & "'" Next If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & "(" & sWhereWrk & ")" Set RsWrk = Conn.Execute(sSqlWrk) dimonds.Polish.ViewValue = "" ari = 0 Do While Not RsWrk.Eof dimonds.Polish.ViewValue = dimonds.Polish.ViewValue & RsWrk("Polish") RsWrk.MoveNext If Not RsWrk.Eof Then dimonds.Polish.ViewValue = dimonds.Polish.ViewValue & ew_ViewOptionSeparator(ari) ' Separate Options End If ari = ari + 1 Loop RsWrk.Close Set RsWrk = Nothing Else dimonds.Polish.ViewValue = Null End If dimonds.Polish.CssStyle = "font-weight:bold;" dimonds.Polish.CssClass = "" dimonds.Polish.ViewCustomAttributes = "" ' Symmetry If dimonds.Symmetry.CurrentValue & "" <> "" Then arwrk = Split(dimonds.Symmetry.CurrentValue&"",",") sSqlWrk = "SELECT [Symmetry] FROM [symmetry] WHERE " sWhereWrk = "" For ari = 0 to UBound(arwrk) If sWhereWrk <> "" Then sWhereWrk = sWhereWrk & " OR " sWhereWrk = sWhereWrk & "[Symmetry] = '" & ew_AdjustSql(Trim(arwrk(ari))) & "'" Next If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & "(" & sWhereWrk & ")" Set RsWrk = Conn.Execute(sSqlWrk) dimonds.Symmetry.ViewValue = "" ari = 0 Do While Not RsWrk.Eof dimonds.Symmetry.ViewValue = dimonds.Symmetry.ViewValue & RsWrk("Symmetry") RsWrk.MoveNext If Not RsWrk.Eof Then dimonds.Symmetry.ViewValue = dimonds.Symmetry.ViewValue & ew_ViewOptionSeparator(ari) ' Separate Options End If ari = ari + 1 Loop RsWrk.Close Set RsWrk = Nothing Else dimonds.Symmetry.ViewValue = Null End If dimonds.Symmetry.CssStyle = "font-weight:bold;" dimonds.Symmetry.CssClass = "" dimonds.Symmetry.ViewCustomAttributes = "" ' Girdle dimonds.Girdle.ViewValue = dimonds.Girdle.CurrentValue dimonds.Girdle.CssStyle = "" dimonds.Girdle.CssClass = "" dimonds.Girdle.ViewCustomAttributes = "" ' Culet dimonds.Culet.ViewValue = dimonds.Culet.CurrentValue dimonds.Culet.CssStyle = "" dimonds.Culet.CssClass = "" dimonds.Culet.ViewCustomAttributes = "" ' Fluorescence dimonds.Fluorescence.ViewValue = dimonds.Fluorescence.CurrentValue dimonds.Fluorescence.CssStyle = "" dimonds.Fluorescence.CssClass = "" dimonds.Fluorescence.ViewCustomAttributes = "" ' Measurements dimonds.Measurements.ViewValue = dimonds.Measurements.CurrentValue dimonds.Measurements.CssStyle = "" dimonds.Measurements.CssClass = "" dimonds.Measurements.ViewCustomAttributes = "" ' Crown Angle dimonds.Crown_Angle.ViewValue = dimonds.Crown_Angle.CurrentValue dimonds.Crown_Angle.ViewValue = ew_FormatNumber(dimonds.Crown_Angle.ViewValue, 2, -2, 0, 0) dimonds.Crown_Angle.CssStyle = "" dimonds.Crown_Angle.CssClass = "" dimonds.Crown_Angle.ViewCustomAttributes = "" ' Crown % dimonds.Crown_25.ViewValue = dimonds.Crown_25.CurrentValue dimonds.Crown_25.ViewValue = ew_FormatPercent(dimonds.Crown_25.ViewValue, 2, -1, 0, 0) dimonds.Crown_25.CssStyle = "" dimonds.Crown_25.CssClass = "" dimonds.Crown_25.ViewCustomAttributes = "" ' Pavilion Angle dimonds.Pavilion_Angle.ViewValue = dimonds.Pavilion_Angle.CurrentValue dimonds.Pavilion_Angle.ViewValue = ew_FormatNumber(dimonds.Pavilion_Angle.ViewValue, 2, -2, 0, 0) dimonds.Pavilion_Angle.CssStyle = "" dimonds.Pavilion_Angle.CssClass = "" dimonds.Pavilion_Angle.ViewCustomAttributes = "" ' Pavilion % dimonds.Pavilion_25.ViewValue = dimonds.Pavilion_25.CurrentValue dimonds.Pavilion_25.ViewValue = ew_FormatPercent(dimonds.Pavilion_25.ViewValue, 2, -2, -1, 0) dimonds.Pavilion_25.CssStyle = "" dimonds.Pavilion_25.CssClass = "" dimonds.Pavilion_25.ViewCustomAttributes = "" ' Ratio dimonds.Ratio.ViewValue = dimonds.Ratio.CurrentValue dimonds.Ratio.ViewValue = ew_FormatNumber(dimonds.Ratio.ViewValue, 2, -2, 0, 0) dimonds.Ratio.CssStyle = "" dimonds.Ratio.CssClass = "" dimonds.Ratio.ViewCustomAttributes = "" ' Description dimonds.Description.ViewValue = dimonds.Description.CurrentValue dimonds.Description.CssStyle = "" dimonds.Description.CssClass = "" dimonds.Description.ViewCustomAttributes = "" ' View refer script ' Shape dimonds.Shape.HrefValue = "" ' Carat Weight dimonds.Carat_Weight.HrefValue = "" ' Cut dimonds.Cut.HrefValue = "" ' Color dimonds.Color.HrefValue = "" ' Clarity dimonds.Clarity.HrefValue = "" ' Certificate dimonds.Certificate.HrefValue = "" ' Price dimonds.Price.HrefValue = "" ' Depth dimonds.Depth.HrefValue = "" ' Table dimonds.Table.HrefValue = "" ' Polish dimonds.Polish.HrefValue = "" ' Symmetry dimonds.Symmetry.HrefValue = "" ' ------------ ' Search Row ' ------------ ElseIf dimonds.RowType = EW_ROWTYPE_SEARCH Then ' Search row ' Shape dimonds.Shape.EditCustomAttributes = "" sSqlWrk = "SELECT [shape], [shape], [Pic], '' AS SelectFilterFld FROM [shape]" sWhereWrk = "" If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk Set RsWrk = Server.CreateObject("ADODB.Recordset") RsWrk.Open sSqlWrk, Conn If Not RsWrk.Eof Then arwrk = RsWrk.GetRows Else arwrk = "" End If RsWrk.Close Set RsWrk = Nothing dimonds.Shape.EditValue = arwrk ' Carat Weight dimonds.Carat_Weight.EditCustomAttributes = "" dimonds.Carat_Weight.EditValue = ew_HtmlEncode(dimonds.Carat_Weight.AdvancedSearch.SearchValue) dimonds.Carat_Weight.EditCustomAttributes = "" dimonds.Carat_Weight.EditValue2 = ew_HtmlEncode(dimonds.Carat_Weight.AdvancedSearch.SearchValue2) ' Cut dimonds.Cut.EditCustomAttributes = "" sSqlWrk = "SELECT [Cut], [Cut], '' AS Disp2Fld, '' AS SelectFilterFld FROM [cut]" sWhereWrk = "" If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk Set RsWrk = Server.CreateObject("ADODB.Recordset") RsWrk.Open sSqlWrk, Conn If Not RsWrk.Eof Then arwrk = RsWrk.GetRows Else arwrk = "" End If RsWrk.Close Set RsWrk = Nothing dimonds.Cut.EditValue = arwrk ' Color dimonds.Color.EditCustomAttributes = "" sSqlWrk = "SELECT [Color], [Color], '' AS Disp2Fld, '' AS SelectFilterFld FROM [color]" sWhereWrk = "" If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk Set RsWrk = Server.CreateObject("ADODB.Recordset") RsWrk.Open sSqlWrk, Conn If Not RsWrk.Eof Then arwrk = RsWrk.GetRows Else arwrk = "" End If RsWrk.Close Set RsWrk = Nothing dimonds.Color.EditValue = arwrk ' Clarity dimonds.Clarity.EditCustomAttributes = "" sSqlWrk = "SELECT [Clarity], [Clarity], '' AS Disp2Fld, '' AS SelectFilterFld FROM [clarity]" sWhereWrk = "" If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk Set RsWrk = Server.CreateObject("ADODB.Recordset") RsWrk.Open sSqlWrk, Conn If Not RsWrk.Eof Then arwrk = RsWrk.GetRows Else arwrk = "" End If RsWrk.Close Set RsWrk = Nothing dimonds.Clarity.EditValue = arwrk ' Certificate dimonds.Certificate.EditCustomAttributes = "" dimonds.Certificate.EditValue = ew_HtmlEncode(dimonds.Certificate.AdvancedSearch.SearchValue) ' Price dimonds.Price.EditCustomAttributes = "" dimonds.Price.EditValue = ew_HtmlEncode(dimonds.Price.AdvancedSearch.SearchValue) dimonds.Price.EditCustomAttributes = "" dimonds.Price.EditValue2 = ew_HtmlEncode(dimonds.Price.AdvancedSearch.SearchValue2) ' Depth dimonds.Depth.EditCustomAttributes = "" dimonds.Depth.EditValue = ew_HtmlEncode(dimonds.Depth.AdvancedSearch.SearchValue) dimonds.Depth.EditCustomAttributes = "" dimonds.Depth.EditValue2 = ew_HtmlEncode(dimonds.Depth.AdvancedSearch.SearchValue2) ' Table dimonds.Table.EditCustomAttributes = "" dimonds.Table.EditValue = ew_HtmlEncode(dimonds.Table.AdvancedSearch.SearchValue) dimonds.Table.EditCustomAttributes = "" dimonds.Table.EditValue2 = ew_HtmlEncode(dimonds.Table.AdvancedSearch.SearchValue2) ' Polish dimonds.Polish.EditCustomAttributes = "" sSqlWrk = "SELECT [Polish], [Polish], '' AS Disp2Fld, '' AS SelectFilterFld FROM [polish]" sWhereWrk = "" If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk Set RsWrk = Server.CreateObject("ADODB.Recordset") RsWrk.Open sSqlWrk, Conn If Not RsWrk.Eof Then arwrk = RsWrk.GetRows Else arwrk = "" End If RsWrk.Close Set RsWrk = Nothing dimonds.Polish.EditValue = arwrk ' Symmetry dimonds.Symmetry.EditCustomAttributes = "" sSqlWrk = "SELECT [Symmetry], [Symmetry], '' AS Disp2Fld, '' AS SelectFilterFld FROM [symmetry]" sWhereWrk = "" If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk Set RsWrk = Server.CreateObject("ADODB.Recordset") RsWrk.Open sSqlWrk, Conn If Not RsWrk.Eof Then arwrk = RsWrk.GetRows Else arwrk = "" End If RsWrk.Close Set RsWrk = Nothing dimonds.Symmetry.EditValue = arwrk End If ' Call Row Rendered event Call dimonds.Row_Rendered() End Sub ' ----------------------------------------------------------------- ' Validate search ' Function ValidateSearch() ' Initialize gsSearchError = "" ' Check if validation required If Not EW_SERVER_VALIDATE Then ValidateSearch = True Exit Function End If If Not ew_CheckNumber(dimonds.Carat_Weight.AdvancedSearch.SearchValue) Then If gsSearchError <> "" Then gsSearchError = gsSearchError & "