<%@LANGUAGE="VBSCRIPT"%> <% '===================================================== '| | '| wAddLicence | '| | '===================================================== %> <% Option explicit Response.Expires = 0 %> <% '------------ ACCESS CONTROL ------------------ %> <% '------------ VARIABLE DEFINITION ------------- Dim rsQry Dim sMessage Dim LICENCE_NAME Dim Query_String Dim dual Dim LICENCE_ID Dim Query_Stringx '------------ CONSTANTS DECLARATION ----------- '------------ VARIABLE INIT ------------------- sMessage = NULL Set objFormCollector = CreateObject("Scripting.Dictionary") '------------ CONDITIONS ---------------------- '---------------------------------------------- '------------ RUN BEFORE PAGE RENDER ---------- If CBool(Request("action")) Then If Request("LICENCE_NAME") = "" Then sMessage = "Cannot add an empty string as a licence name" Else Query_String = _ " SELECT * FROM licences WHERE UPPER(name) = UPPER('"& Request("LICENCE_NAME") &"')" Set rsQry = OraDatabase.DbCreateDynaset( Query_String, cint(0)) If rsQry.RecordCount = 0 Then Query_Stringx = _ "SELECT seq_gbe_id.NEXTVAL FROM DUAL" Set dual = OraDatabase.DbCreateDynaset(Query_Stringx,cint(0)) LICENCE_ID = dual("NEXTVAL") dual.Close() Set dual = Nothing OraDatabase.Parameters.Add "LICENCE", LICENCE_ID, ORAPARM_INPUT, ORATYPE_NUMBER OraDatabase.Parameters.Add "NAME", Request("LICENCE_NAME"), ORAPARM_INPUT, ORATYPE_VARCHAR2 objEH.ErrorRedirect = FALSE objEH.TryORA ( OraSession ) On Error Resume Next OraDatabase.ExecuteSQL ("begin INSERT INTO licences (licence, name) VALUES (:LICENCE, :NAME); end;") objEH.CatchORA ( OraSession ) OraDatabase.Parameters.Remove "LICENCE" OraDatabase.Parameters.Remove "NAME" If objEH.Finally Then Call OpenInParentWindow ("admin_licences.asp") Call CloseWindow() End If Else sMessage = "Licence already exists" End If rsQry.Close Set rsQry = nothing End If End If '---------------------------------------------- %> Release Manager <% '-- FROM START -------------------------------------------------------------------------------------------------------------- objFormComponent.FormName = "FormName" objFormComponent.FormClass = "form_tight" objFormComponent.Action = ScriptName objFormComponent.OnSubmit = "ShowProgress();" Call objFormComponent.FormStart() %> <%=objPMod.ComposeHiddenTags()%> <% Call objFormComponent.FormEnd() '-- FROM END ---------------------------------------------------------------------------------------------------------------- %>
Add a new licence.
<%Call Messenger ( sMessage , 3, "100%" )%>
Licence Name
<% '------------ RUN AFTER PAGE RENDER ----------- Set objFormCollector = Nothing '---------------------------------------------- Call Destroy_All_Objects %>