Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
13 rsolanki 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'|                                                   |
5
'|			          XML BOM Gen				 	 |
6
'|                                                   |
7
'=====================================================
8
%>
9
<%
10
Option explicit
11
Response.Expires = 0	' always load the page, dont store
12
%>
13
<!--#include file="common/globals.asp"-->
14
<!--#include file="common/config.asp"-->
15
<!--#include file="common/common_subs.asp"-->
16
<!--#include file="common/_popup_window_common.asp"-->
17
 
18
<%
19
'------------ VARIABLE DEFINITION -------------
20
Dim objWSH
21
'------------ CONSTANTS DECLARATION -----------
22
'------------ VARIABLE INIT -------------------
23
'------------ CONDITIONS ----------------------
24
'----------------------------------------------
25
%>
26
<%
27
'--------------------------------------------------------------------------------------------------------------------------
28
 
29
'--------------------------------------------------------------------------------------------------------------------------
30
%>
31
<%
15 rsolanki 32
Function DateReversed ( dDate )
33
	' Ensures Reverse Date format YYYY-MM-DD
34
	If IsNull(dDate) Then Exit Function
35
	DateReversed = Year(dDate) &"-"&  Month(dDate) &"-"& Day(dDate)
36
End Function
13 rsolanki 37
'**************************** M  A  I  N ******************************
38
 
39
If Request("bom_id") <> "" Then
40
	Set objWSH = Server.CreateObject("WScript.Shell")
41
	objWSH.Run   "cmd.exe /c cscript.exe //B //NoLogo "& APP_ROOT &"\jobs\PostBOMRelease.wsf /bom_id:"& Request("bom_id") , 0, True 
42
 
15 rsolanki 43
	OraDatabase.Parameters.Add "BOM_ID", 	Request("bom_id"), 			ORAPARM_INPUT, ORATYPE_NUMBER
44
	OraDatabase.Parameters.Add "USER_ID", 	objAccessControl.UserId, 	ORAPARM_INPUT, ORATYPE_NUMBER 
13 rsolanki 45
 
15 rsolanki 46
	objEH.TryORA ( OraSession )
47
 
48
	OraDatabase.ExecuteSQL _
49
	"BEGIN   pk_Bom.Log_Bom_Trail ( :BOM_ID, 'XML BOM GENERATED', :USER_ID, NULL );   END;"
50
 
51
	objEH.CatchORA ( OraSession )
52
 
53
	OraDatabase.Parameters.Remove "BOM_ID"
54
	OraDatabase.Parameters.Remove "USER_ID"	
55
 
56
	Dim rsQry, objZIPObject
57
	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))
58
 
59
	Set objZIPObject = Server.CreateObject("aspZip.EasyZIP")
60
 
61
	objZIPObject.ZipFileName = ""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\downloads\"& rsQry("branch_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &".zip"
62
	objZIPObject.ArgsClear
63
	objZIPObject.ArgsAdd(""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\downloads\"& rsQry("branch_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &"\*.*")
64
	objZIPObject.Zip
65
 
66
	Response.Write "Files Zipped=" & objZIPObject.SuccessCNT & " with Error="& objZIPObject.Error
67
	'Response.Write(""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\downloads\"& rsQry("bom_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &".zip")
68
 
69
 
70
 
71
	Dim myMail, LocalPath
72
	Set myMail=Server.CreateObject("Persits.MailSender")
73
	LocalPath = ""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\downloads\"& rsQry("branch_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &".zip"
74
 
75
	myMail.Host = SMTP_HOST
76
	myMail.Subject="XML BOM Generated from Deployment Manager"
77
	myMail.From="releasem@erggroup.com"
78
	myMail.AddAddress objAccessControl.UserEmail
79
	' Attach the file
80
	myMail.AddAttachment LocalPath
81
	myMail.Body = "Your requested xml files .." 
82
	myMail.Send
83
 
19 rsolanki 84
	set myMail = nothing
85
	set objWSH = nothing
15 rsolanki 86
 
87
	rsQry.Close
88
	Set rsQry = nothing
89
 
90
	'Response.write "<br>You will be emailed shortly with the XML files generated.<br>"
91
	'Response.write "Go to <a href='\\auperaweb08\wwwTRD\manager_suite_DEVELOPMENT\deployment_manager\downloads'>\\auperaweb08\wwwTRD\manager_suite_DEVELOPMENT\deployment_manager\downloads</a>"
92
 
13 rsolanki 93
Else
94
	Response.write "Please specify bom_id. <br>Example:<br> "& SCRIPT_NAME &"?bom_id=1234"
95
End If
96
 
97
'**********************************************************************
98
%>
15 rsolanki 99
<script language="Javascript">
100
alert("You will be emailed shortly with the XML files generated. Click OK to Redirect to Previous Page...")
101
history.back()
102
</script>
13 rsolanki 103
<%
104
'------------ RUN AFTER CODE RUN --------------
105
'----------------------------------------------
106
%><!--#include file="common/globals_destructor.asp"-->