Subversion Repositories DevTools

Rev

Rev 15 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15 Rev 19
Line 16... Line 16...
16
<!--#include file="common/_popup_window_common.asp"-->
16
<!--#include file="common/_popup_window_common.asp"-->
17
 
17
 
18
<%
18
<%
19
'------------ VARIABLE DEFINITION -------------
19
'------------ VARIABLE DEFINITION -------------
20
Dim objWSH
20
Dim objWSH
-
 
21
Dim rsQry
-
 
22
Dim generated
21
'------------ CONSTANTS DECLARATION -----------
23
'------------ CONSTANTS DECLARATION -----------
22
'------------ VARIABLE INIT -------------------
24
'------------ VARIABLE INIT -------------------
23
'------------ CONDITIONS ----------------------
25
'------------ CONDITIONS ----------------------
24
'----------------------------------------------
26
'----------------------------------------------
25
%>
27
%>
26
<%
28
<%
-
 
29
Function DateReversed ( dDate )
-
 
30
	' Ensures Reverse Date format YYYY-MM-DD
-
 
31
	If IsNull(dDate) Then Exit Function
-
 
32
	DateReversed = Year(dDate) &"-"&  Month(dDate) &"-"& Day(dDate)
-
 
33
End Function
27
'--------------------------------------------------------------------------------------------------------------------------
34
'--------------------------------------------------------------------------------------------------------------------------
28
 
35
 
29
'--------------------------------------------------------------------------------------------------------------------------
36
'--------------------------------------------------------------------------------------------------------------------------
30
%>
37
%>
31
<%
38
<%
32
'**************************** M  A  I  N ******************************
39
'**************************** M  A  I  N ******************************
33
 
40
 
34
If Request("bom_id") <> "" Then
41
If Request("bom_id") <> "" Then
35
	Set objWSH = Server.CreateObject("WScript.Shell")
-
 
36
	objWSH.Run   "cmd.exe /c cscript.exe //B //NoLogo "& APP_ROOT &"\jobs\NodesSpecRelease.wsf /bom_id:"& Request("bom_id") , 0, True 
-
 
37
	
42
	
-
 
43
	OraDatabase.Parameters.Add "BOM_ID",	Request("bom_id"),	ORAPARM_INPUT, ORATYPE_NUMBER 
-
 
44
	Set rsQry = OraDatabase.DbCreateDynaset( GetQuery("NodesSpecFileNames.sql"), cint(0))
-
 
45
	OraDatabase.Parameters.Remove "BOM_ID"
-
 
46
	
-
 
47
	If rsQry.RecordCount <> 0 Then 
-
 
48
		
-
 
49
		generated = true
-
 
50
		
-
 
51
		Set objWSH = Server.CreateObject("WScript.Shell")
-
 
52
		objWSH.Run   "cmd.exe /c cscript.exe //B //NoLogo "& APP_ROOT &"\jobs\NodesSpecRelease.wsf /bom_id:"& Request("bom_id") , 0, True 
-
 
53
		
-
 
54
		OraDatabase.Parameters.Add "BOM_ID", 	Request("bom_id"), 			ORAPARM_INPUT, ORATYPE_NUMBER
-
 
55
		OraDatabase.Parameters.Add "USER_ID", 	objAccessControl.UserId, 	ORAPARM_INPUT, ORATYPE_NUMBER 
-
 
56
	
-
 
57
		objEH.TryORA ( OraSession )
-
 
58
	
-
 
59
		OraDatabase.ExecuteSQL _
-
 
60
		"BEGIN   pk_Bom.Log_Bom_Trail ( :BOM_ID, 'NODE SPECS FILE GENERATED', :USER_ID, NULL );   END;"
-
 
61
	
-
 
62
		objEH.CatchORA ( OraSession )
-
 
63
		
-
 
64
		OraDatabase.Parameters.Remove "BOM_ID"
-
 
65
		OraDatabase.Parameters.Remove "USER_ID"	
-
 
66
 
-
 
67
		Dim objZIPObject
-
 
68
		Set rsQry = OraDatabase.DbCreateDynaset( "SELECT bn.BOM_NAME, br.BRANCH_NAME, bn.BOM_NAME ||''|| b.BOM_VERSION ||'.'|| b.BOM_LIFECYCLE AS VERSION FROM BOMS B, BRANCHES BR, BOM_NAMES BN WHERE B.BOM_ID = "& Request("bom_id") &" AND B.BRANCH_ID = BR.BRANCH_ID AND B.BOM_NAME_ID = BN.BOM_NAME_ID", cint(0))
-
 
69
	
-
 
70
		Set objZIPObject = Server.CreateObject("aspZip.EasyZIP")
-
 
71
	
-
 
72
		objZIPObject.ZipFileName = ""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\nodespecfiles\"& rsQry("branch_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &".zip"
-
 
73
		objZIPObject.ArgsClear
-
 
74
		objZIPObject.ArgsAdd(""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\nodespecfiles\"& rsQry("branch_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &"\*.*")
-
 
75
		objZIPObject.Zip
-
 
76
	
-
 
77
		Response.Write "Files Zipped=" & objZIPObject.SuccessCNT & " with Error="& objZIPObject.Error		
-
 
78
	
38
	Response.write "Node Spec Files Generated.<br>"
79
		'Response.write "Node Spec Files Generated.<br>"
39
	Response.write "Go to <a href=\\auperaweb08\wwwTRD\manager_suite\deployment_manager\nodespecfiles>\\auperaweb08\wwwTRD\manager_suite\deployment_manager\nodespecfiles</a>"
80
		'Response.write "Go to <a href=\\auperaweb08\wwwTRD\manager_suite_DEVELOPMENT\deployment_manager\nodespecfiles>\\auperaweb08\wwwTRD\manager_suite_DEVELOPMENT\deployment_manager\nodespecfiles</a>"
-
 
81
		Dim myMail, LocalPath
-
 
82
		Set myMail=Server.CreateObject("Persits.MailSender")
-
 
83
		LocalPath = ""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\nodespecfiles\"& rsQry("branch_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &".zip"
-
 
84
		
-
 
85
		myMail.Host = SMTP_HOST
-
 
86
		myMail.Subject="NODESPEC FILES Generated from Deployment Manager"
-
 
87
		myMail.From="releasem@erggroup.com"
-
 
88
		myMail.AddAddress objAccessControl.UserEmail
-
 
89
		' Attach the file
-
 
90
		myMail.AddAttachment LocalPath
-
 
91
		myMail.Body = "Your requested node spec files .." 
-
 
92
		myMail.Send
-
 
93
		
-
 
94
		set myMail = nothing
-
 
95
		set objWSH = nothing
-
 
96
	
-
 
97
		rsQry.Close
-
 
98
		Set rsQry = nothing
-
 
99
	Else	
-
 
100
	generated = false
-
 
101
		Response.write "Node spec filenames not found in the BOM!!!"
-
 
102
		
-
 
103
	End If	
40
	
104
	
41
Else
105
Else
42
	Response.write "Please specify bom_id. <br>Example:<br> "& SCRIPT_NAME &"?bom_id=1234"
106
	Response.write "Please specify bom_id. <br>Example:<br> "& SCRIPT_NAME &"?bom_id=1234"
43
End If
107
End If
44
 
108
 
45
'**********************************************************************
109
'**********************************************************************
-
 
110
If generated Then
46
%>
111
%>
-
 
112
<script language="Javascript">
-
 
113
alert("You will be emailed shortly with the NodeSpec files generated. Click OK to Redirect to Previous Page...")
-
 
114
history.back()
-
 
115
</script>
47
<%
116
<%
-
 
117
Else
-
 
118
%>
-
 
119
<script language="Javascript">
-
 
120
alert("Click OK to Redirect to Previous Page...")
-
 
121
history.back()
-
 
122
</script>
-
 
123
<%
-
 
124
End If
48
'------------ RUN AFTER CODE RUN --------------
125
'------------ RUN AFTER CODE RUN --------------
49
'----------------------------------------------
126
'----------------------------------------------
50
%><!--#include file="common/globals_destructor.asp"-->
127
%><!--#include file="common/globals_destructor.asp"-->