Subversion Repositories DevTools

Rev

Rev 5590 | Rev 7286 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'|                                                   |
'|                   wAddMachClass                   |
'|                                                   |
'=====================================================
%>
<%
Option explicit
Response.Expires = 0
%>
<!--#include file="common/conf.asp"-->
<!--#include file="common/globals.asp"-->
<!--#include file="common/formating.asp"-->
<!--#include file="common/qstr.asp"-->
<!--#include file="common/common_subs.asp"-->
<!--#include file="common/_form_window_common.asp"-->
<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_general.asp"-->
<!--#include file="_access_control_login.asp"-->
<%
'------------ VARIABLE DEFINITION -------------
Dim rsQry
Dim sMessage
Dim GBE_MACHCLASS
Dim Query_String
'------------ CONSTANTS DECLARATION -----------
'------------ VARIABLE INIT -------------------
sMessage = NULL
Set objFormCollector = CreateObject("Scripting.Dictionary")
'------------ CONDITIONS ----------------------
'----------------------------------------------
%>
<%

%>
<%
'------------ RUN BEFORE PAGE RENDER ----------

If Request("type") = "delete" Then
        On Error Resume Next
        OraDatabase.Parameters.Add "BM_ID",     Request("BM_ID"),       ORAPARM_INPUT, ORATYPE_NUMBER
        objEH.TryORA ( OraSession )
        OraDatabase.ExecuteSQL _
        "BEGIN   PK_BUILDAPI.REMOVE_BUILDMACHINE ( :BM_ID );   END;"
        objEH.CatchORA ( OraSession )   
        OraDatabase.Parameters.Remove "BM_ID"

    Call OpenInWindow ("admin_gbe_machclass.asp")
    
ElseIf CBool(Request("action")) Then
 ' Update an existing entry
   If Request("bm_id") <> "" Then
      Query_String = _
      "   SELECT * FROM BUILD_MACHINES WHERE BM_ID <> " & Request("bm_id") & " AND UPPER(BM_NAME) = UPPER('"& Request("BM_NAME") &"')"

      Set rsQry = OraDatabase.DbCreateDynaset( Query_String, cint(0))

      If rsQry.RecordCount = 0 Then

         OraDatabase.Parameters.Add "BM_ID",   Request("BM_ID"),   ORAPARM_INPUT, ORATYPE_NUMBER
         OraDatabase.Parameters.Add "BM_NAME", Request("BM_NAME"), ORAPARM_INPUT, ORATYPE_VARCHAR2

         objEH.ErrorRedirect = FALSE
         objEH.TryORA ( OraSession )
         On Error Resume Next

         OraDatabase.ExecuteSQL _
         "BEGIN  PK_BUILDAPI.UPDATE_BUILDMACHINE(:BM_ID, :BM_NAME);  END;"

         objEH.CatchORA ( OraSession )

         OraDatabase.Parameters.Remove "BM_NAME"
         OraDatabase.Parameters.Remove "BM_ID"

         If objEH.Finally Then
            Call OpenInParentWindow ("admin_gbe_machclass.asp")
            Call CloseWindow()
         End If

      Else
         sMessage = "A Machine Type of that name already exists"
      End If

      rsQry.Close
      Set rsQry = nothing
   Else

      ' Create a new entry
      '
      Query_String = _
      "   SELECT * FROM BUILD_MACHINES WHERE UPPER(BM_NAME) = UPPER('"& Request("BM_NAME") &"')"

      Set rsQry = OraDatabase.DbCreateDynaset( Query_String, cint(0))

      If rsQry.RecordCount = 0 Then

         OraDatabase.Parameters.Add "BM_NAME",   Request("BM_NAME"),    ORAPARM_INPUT, ORATYPE_VARCHAR2

         objEH.ErrorRedirect = FALSE
         objEH.TryORA ( OraSession )
         On Error Resume Next

         OraDatabase.ExecuteSQL _
         "BEGIN  PK_BUILDAPI.ADD_BUILDMACHINE(:BM_NAME);  END;"

         objEH.CatchORA ( OraSession )

         OraDatabase.Parameters.Remove "BM_NAME"

         If objEH.Finally Then
            Call OpenInParentWindow ("admin_gbe_machclass.asp")
            Call CloseWindow()
         End If

      Else
         sMessage = "A Machine Type of that name already exists"
      End If

      rsQry.Close
      Set rsQry = nothing

   End If

End If


'----------------------------------------------
%>
<html>
<head>
<title>Release Manager</title>
<link rel="shortcut icon" href="<%=FavIcon%>"/>
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="images/release_manager_style.css?ver=<%=VixVerNum%>" rel="stylesheet" type="text/css">
<script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
</head>

<body leftmargin="0" topmargin="0" onLoad="self.focus();FormName.BM_NAME.focus();">
<table width="100%"  border="0" cellspacing="0" cellpadding="10">
   <tr>
      <td class="body_txt">
         Add a new Machine Type or edit an existing Machine Type.
      </td>
   </tr>
   <%
   '-- FROM START --------------------------------------------------------------------------------------------------------------
   objFormComponent.FormName = "FormName"
   objFormComponent.FormClass = "form_tight"
   objFormComponent.Action = ScriptName
   objFormComponent.OnSubmit = "MM_validateForm(""BM_NAME"",""Machine Type"",""RisCleanStrinLength4:"");return document.MM_returnValue"
   Call objFormComponent.FormStart()
   %>
   <tr>
      <td class="form_field_bg" >
         <!-- NEW PRODUCT +++++++++++++++++++++++++++++++++++++++++++++++ -->
         <%Call Messenger ( sMessage , 1, "100%" )%>
         <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
         <!--#include file="messages/_msg_inline.asp"-->

         <table width="50%" border="0">
            <%
            GBE_MACHCLASS = Request("BM_NAME")
            
            If Request("bm_id") <> "" AND GBE_MACHCLASS = "" Then
               %>
               <input type="hidden" name="bm_id" value="<%=Request("bm_id")%>">
               <%

               Dim rsTemp

               Query_String = "SELECT * FROM BUILD_MACHINES BM WHERE BM_ID = "& Request("bm_id")

               Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))

               GBE_MACHCLASS = rsTemp("BM_NAME")

               rsTemp.Close()
               Set rsTemp = Nothing
            End   If
            %>
            <tr>
               <td><span class="body_txt nowrap">Machine Type</span></td>
               <td><input name="BM_NAME" type="text" class="body_txt" value="<%=GBE_MACHCLASS%>"></td>
            </tr>
         </table>
      </td>
   </tr>
   <tr>
      <td>
         <table class="full_table">
            <tr>
               <td><%=ProgressBar()%></td>
               <td align="right">
                  <input name="btn" type="submit" class="form_btn" value="Add/Update">
                  <input name="btn" type="reset" class="form_btn" value="Cancel" onclick="parent.closeIFrame();">
               </td>
            </tr>
         </table>
      </td>
   </tr>
   <%=objPMod.ComposeHiddenTags()%>
   <input type="hidden" name="action" value="true">
   <%
   Call objFormComponent.FormEnd()
   '-- FROM END ----------------------------------------------------------------------------------------------------------------
   %>
</table>
</body>
</html>
<%
'------------ RUN AFTER PAGE RENDER -----------
Set objFormCollector = Nothing
'----------------------------------------------
Call Destroy_All_Objects
%>