<%@ LANGUAGE = "VBScript" %> <% '----------------------------------------------------------- ' ASPilot.com - Gateway ' ------------------------------ ' Copyright © 2004 Spliethof Inc ' ' This file lists all the customer account interface for the ' shopping cart. PilotInitialize GetCurrentCustomer MarkCurrentCustomerActive mode = EStr(Request.QueryString("mode")) '----------------------------------------------------------- ' GetCurrentManufOrdersRS ' ----------------------- ' Gets the current manufacturer's order history info. '----------------------------------------------------------- Function GetCurrentManufOrdersRS() Dim strSQL strSQL = "SELECT tord.* FROM tblOrders tord INNER JOIN tblOrdersItems toi ON tord.OrderID = toi.OrderID WHERE toi.ItemID IN (SELECT ItemID FROM tblInventory WHERE Actual_Manuf "& CSQLEq(s_lngManufID) &") ORDER BY tord.TheDate DESC" Set GetCurrentManufOrdersRS = OpenFastRS(strSQL) End Function '----------------------------------------------------------- ' IsManufLoggedIn ' --------------- ' Tests to see if current manufacturer is logged in. '----------------------------------------------------------- Function IsManufLoggedIn() Dim rs IsManufLoggedIn = False If Not IsEmpty(s_lngManufID) Then Set rs = GetCurrentManufLoginRS() If HasRecords(rs) Then If Not IsNull(rs("LoggedIn")) Then If s_lngSecurityLevel >= 1 Then If DateDiff("n", rs("LastActive"), Now()) <= s_lngActivityTimeOut Then If s_lngSecurityLevel >= 2 Then If IsDate(s_dtmManufIn) Then If DateDiff("s", rs("LoggedIn"), s_dtmManufIn) = 0 Then If s_lngSecurityLevel >= 3 Then If Not IsNull(rs("SessionID")) Then If rs("SessionID") = Session.SessionID Then IsManufLoggedIn = True End If Else IsManufLoggedIn = True End If End If End If Else IsManufLoggedIn = True End If End If Else IsManufLoggedIn = True End If End If End If rs.Close Set rs = Nothing End If End Function '----------------------------------------------------------- ' ExPageManufDownload ' ------------------- ' Displays the Gateway manufacturer downloads. '----------------------------------------------------------- Sub ExPageManufDownload() Dim rs If Not PilotPageBegin("manuf_gateway", Empty) Then Response.Redirect g.HomePageURL & "pilot.asp" Set rs = GetCurrentManufDownloadRS() Response.Write "Here you can find all the downloadable inventory items available on this site produced by your company:

Go back to your Gateway.

" End Sub '----------------------------------------------------------- ' ExPageManufLogin ' ---------------- ' Displays the Gateway manufacturer login. '----------------------------------------------------------- Sub ExPageManufLogin(page) If Not PilotPageBegin("manuf_gateway", Empty) Then Response.Redirect g.HomePageURL & "pilot.asp" Response.Write "

" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "
 " & IIf(IsEmpty(s_lngManufID), "Login", "Welcome") & " 
" Response.Write "
" Response.Write "" Response.Write "" Response.Write "" Response.Write "" If s_strCookieUse = "will" Then Response.Write "" Response.Write "
Manufacturer Gateway
Please Login:
Forgot your password? Email it to me!
" Response.Write "
" Response.Write "Enter your Email:
" Response.Write "Enter your Password: " Response.Write "" Response.Write "


" End Sub '----------------------------------------------------------- ' ManufLogout ' ----------- ' Logs current manufacturer all the way out. '----------------------------------------------------------- Sub ManufLogout() Dim rs Set rs = OpenUpdateableRS("SELECT LastActive, LoggedIn, SessionID FROM tblManufacturers WHERE ManufID " & CSQLEq(s_lngManufID)) If HasRecords(rs) Then rs("LastActive") = Now() rs("LoggedIn") = Null rs("SessionID") = Null rs.Update End If rs.Close: Set rs = Nothing s_lngManufID = Empty s_dtmManufIn = Empty Session.Contents("manuf_id") = Empty Session.Contents("manuf_in") = Empty Response.Cookies("manuf_id") = Empty Response.Cookies("manuf_id").Expires = BEGINNING_OF_TIME Response.Cookies("manuf_in") = Empty Response.Cookies("manuf_in").Expires = BEGINNING_OF_TIME End Sub '----------------------------------------------------------- ' ExPageManufLogout ' ----------------- ' Displays the Gateway manufacturer logout. '----------------------------------------------------------- Sub ExPageManufLogout() If Not PilotPageBegin("manuf_gateway", Empty) Then Response.Redirect g.HomePageURL & "pilot.asp" Response.Write "




You have been successfully logged out.

To login again, please click here,
or click here to return home..



" End Sub '----------------------------------------------------------- ' ExPageManufMenu ' --------------- ' Displays the Gateway manufacturer menu. '----------------------------------------------------------- Sub ExPageManufMenu() If Not PilotPageBegin("manuf_gateway", Empty) Then Response.Redirect g.HomePageURL & "pilot.asp" Response.Write "Welcome to the " & g.HomeDomain & " Manufacturer's Gateway. We hope to provide you with simple access to all of your info.. if you would like to see something added here, feel free to contact us direct. Please select your destination from the menu below:" Response.Write "" Response.Write "
Click here to Logout

" End Sub '----------------------------------------------------------- ' ExPageManufOrdersReport ' ----------------------- ' Displays the Gateway manufacturer's past orders report. '----------------------------------------------------------- Sub ExPageManufOrdersReport() Dim rs, rsOrders, rsOrdersItems If Not PilotPageBegin("manuf_gateway", Empty) Then Response.Redirect g.HomePageURL & "pilot.asp" Set rs = GetCurrentManufRS() Set rsOrders = GetCurrentManufOrdersRS() Response.Write "
" Response.Write "" Response.Write "" Response.Write "
" Response.Write "Order History for " & rs("Name") & " Products
" If HasRecords(rsOrders) Then Do Until rsOrders.EOF Set rsOrderItems = GetOrderItemsRS(rsOrders("OrderID")) Response.Write "" Response.Write "" Response.Write "" Do Until rsOrderItems.EOF Response.Write"" rsOrderItems.MoveNext Loop rsOrderItems.Close: Set rsOrderItems = Nothing rsOrders.MoveNext If Not rsOrders.EOF Then Response.Write"" Loop Else Response.Write"" End If Response.Write"
Order ID "&rsOrders("ORDERID")&"
Date "&rsOrders("THEDATE")&"
Item NameQtyStatus
"&rsOrderItems("ITEMNAME")&""&rsOrderItems("QUANTITY")&""&rsOrderItems("STATUS")&"

There are no orders containing items from this manufacturer.
« Click here to return home.
" rsOrders.Close: Set rsOrders = Nothing rs.Close: Set rs = Nothing End Sub '----------------------------------------------------------- ' ExPageManufProfile ' ------------------ ' Displays the Gateway manufacturer's profile. '----------------------------------------------------------- Sub ExPageManufProfile() Dim rs If Not PilotPageBegin("manuf_gateway", Empty) Then Response.Redirect g.HomePageURL & "pilot.asp" Response.Write "" Response.Write "" Set rs = GetCurrentManufRS() CreateTextField "*Name", rs("Name"), "Name", "", True, "Manufacturer name", False, "" CreateTextArea "Description", rs("Descrip"), "Descrip", "", False, "Gateway manuf" CreateHRBreak CreateTextField "Email", rs("EMail"), "EMail", "", False, "Email Address", False, "" CreateTextField "Password", rs("PWord"), "Password", "", False, "Password for Gateway access", False, "" Response.Write "" Response.Write "" Response.Write "
Edit your eProfile
Click to submit changes
« Click here to CANCEL and return home.
" End Sub '----------------------------------------------------------- ' UpdateManufProfile ' ------------------ ' Updates the current manufacturer's eProfile. '----------------------------------------------------------- Function UpdateManufProfile(ByVal strName, strDesc, strEMail, strPassword) Dim rs UpdateManufProfile = False If IsEmpty(s_lngManufID) Then Exit Function strName = EStr(strName) If IsEmpty(strName) Then Exit Function Set rs = OpenFastRS("SELECT ManufID From tblManufacturers WHERE ManufID <> " & s_lngManufID & " AND Name " & CSQLEq(strName)) If HasRecords(rs) Then rs.Close: Set rs = Nothing Exit Function End If rs.Close: Set rs = Nothing Set rs = OpenUpdateableRS("SELECT Name, Descrip, EMail, PWord FROM tblManufacturers WHERE ManufID " & CSQLEq(s_lngManufID)) If HasRecords(rs) Then rs("Name") = strName rs("Descrip") = EStr(strDesc) rs("EMail") = EStr(strEMail) rs("PWord") = EStr(strPassword) rs.Update UpdateManufProfile = True End If rs.Close: Set rs = Nothing End Function '----------------------------------------------------------- ' Main portion of the page '----------------------------------------------------------- If GetCurrentManuf Then MarkCurrentManufActive If Not PilotPageBegin("manuf_gateway", Empty) Then Response.Redirect g.HomePageURL & "pilot.asp" TemplateBeforePC Select Case mode Case "login" If Request.Form("savecookie") = "on" Then s_blnSaveCookie = True If ManufLogin(Request.Form("email"), Request.Form("password")) Then Response.Redirect g.SecureURL & "manufgateway.asp" ExPageManufLogin(g.SecureURL & "manufgateway.asp?mode=login") Case "logout" If IsManufLoggedIn() Then ManufLogout ExPageManufLogout Else Response.Redirect g.SecureURL & "manufgateway.asp?mode=login" End If Case "profile" If Not IsManufLoggedIn() Then Response.Redirect g.SecureURL & "manufgateway.asp?mode=login" If Request.Form("submit.x") <> "" Then If Not PilotPageBegin("manuf_gateway", Empty) Then Response.Redirect g.HomePageURL & "pilot.asp" If UpdateManufProfile(Request.Form("Name"), Request.Form("Descrip"), Request.Form("EMail"), Request.Form("Password")) Then Response.Write "


" Response.Write "
Your eProfile has been successfully updated.
Click here to return
Click here to logout
Click here to return to the main site..
" Else Response.Write "


" Response.Write "
Errors occurred saving new info. Your eProfile has not been updated!
Click here to return
Click here to logout
Click here to return to the main site..
" End If Else ExPageManufProfile End If Case "rpt_orders" If Not IsManufLoggedIn() Then Response.Redirect g.SecureURL & "manufgateway.asp?mode=login" ExPageManufOrdersReport Case "download" If Not IsManufLoggedIn() Then Response.Redirect g.SecureURL & "manufgateway.asp?mode=login" ExPageManufDownload Case Else If Not IsManufLoggedIn() Then Response.Redirect g.SecureURL & "manufgateway.asp?mode=login" ExPageManufMenu End Select TemplateAfterPC PilotPageEnd %>