Commit 3ceee0f0 authored by caluka's avatar caluka

Sending Email if we click cancel button of Travel Information in StarClub...

Sending Email if we click cancel button of Travel Information in  StarClub Employee details.[W14BSUN003]


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@95073 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c2f6230e
...@@ -19,7 +19,7 @@ import java.sql.ResultSet; ...@@ -19,7 +19,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import javax.ejb.Stateless; import javax.ejb.Stateless;
/*
import javax.mail.*; import javax.mail.*;
import javax.mail.internet.*; import javax.mail.internet.*;
import javax.activation.*; import javax.activation.*;
...@@ -29,7 +29,7 @@ import java.lang.reflect.*; ...@@ -29,7 +29,7 @@ import java.lang.reflect.*;
import javax.naming.InitialContext; import javax.naming.InitialContext;
import javax.ejb.*; import javax.ejb.*;
import javax.rmi.*; import javax.rmi.*;
*/
@Stateless @Stateless
public class EmpTravelInfoCancel extends ActionHandlerEJB implements EmpInfoSubmitRemote, EmpInfoSubmitLocal public class EmpTravelInfoCancel extends ActionHandlerEJB implements EmpInfoSubmitRemote, EmpInfoSubmitLocal
...@@ -55,14 +55,16 @@ public class EmpTravelInfoCancel extends ActionHandlerEJB implements EmpInfoSubm ...@@ -55,14 +55,16 @@ public class EmpTravelInfoCancel extends ActionHandlerEJB implements EmpInfoSubm
public String confirm( String tranId, String xtraParams, String forcedFlag, Connection conn, boolean connStatus ) throws RemoteException,ITMException public String confirm( String tranId, String xtraParams, String forcedFlag, Connection conn, boolean connStatus ) throws RemoteException,ITMException
{ {
String retString = ""; String retString = "";
String sql = ""; String sql = "",sql1="";
String userType="",sendTo="", sendCC="",formatCode="",senBCC=""; String userType="",formatCode="";
int count=0,upd=0; String travelCode="",division="";
int upd=0;
ResultSet rs = null; ResultSet rs = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
GenericUtility genericUtility = null; GenericUtility genericUtility = null;
ITMDBAccessEJB itmDBAccess = null; ITMDBAccessEJB itmDBAccess = null;
StringBuffer commInfo = new StringBuffer(); StringBuffer commInfo = new StringBuffer();
String objName="",winName="",refSer="",tranIdCol="",eventCode="",empCode="",empFirstName="",empLastName="",empMiddleName="",formatType="",nsmCode="";
try try
{ {
genericUtility = GenericUtility.getInstance(); genericUtility = GenericUtility.getInstance();
...@@ -73,38 +75,96 @@ public class EmpTravelInfoCancel extends ActionHandlerEJB implements EmpInfoSubm ...@@ -73,38 +75,96 @@ public class EmpTravelInfoCancel extends ActionHandlerEJB implements EmpInfoSubm
conn.setAutoCommit(false); conn.setAutoCommit(false);
connStatus = true; connStatus = true;
/*sendTo="chandrashekar.aluka@baseinformation.com"; sql1 = " update emp_travel_info set status = 'X' where tran_id = ? ";
sendCC="chandrashekar.aluka@baseinformation.com,cpatil@baseinformation.com"; pstmt = conn.prepareStatement(sql1);
senBCC="chandrashekar.aluka@baseinformation.com";
commInfo.append("<ROOT>");
commInfo.append("<MAIL><EMAIL_TYPE>page</EMAIL_TYPE><ENTITY_CODE>BASE</ENTITY_CODE>");
commInfo.append("<ENTITY_TYPE>"+userType+"</ENTITY_TYPE>");
commInfo.append("<TO_ADD>"+sendTo+"</TO_ADD>");
commInfo.append("<CC_ADD>"+sendCC+"</CC_ADD>");
commInfo.append("<BCC_ADD>"+senBCC+"</BCC_ADD>");
commInfo.append("<FORMAT_CODE></FORMAT_CODE>");
commInfo.append("<EMP_CODE></EMP_CODE>");
commInfo.append("<TRAVEL_CODE></TRAVL_CODE>");
commInfo.append("<NSM_CODE>empcode</NSM_CODE>");
commInfo.append("<EMPNAME></EMPNAME>");
commInfo.append("<ATTACHMENT><BODY>Transaction Cancelled </BODY><LOCATION></LOCATION></ATTACHMENT>");
commInfo.append("</MAIL>");
commInfo.append("</ROOT>");
EMail email = new EMail();
email.sendMail(commInfo.toString(), "");
email = null;*/
sql = " update emp_travel_info set status = 'X' where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
upd = pstmt.executeUpdate(); upd = pstmt.executeUpdate();
pstmt.close();pstmt = null; pstmt.close();pstmt = null;
System.out.println(" status updated:: "+upd); System.out.println(" status updated:: "+upd);
if(upd > 0) if(upd > 0)
{ {
objName = "emp_travel_info";
winName = "w_emp_travel_info";
eventCode="act_cancel";
sql="select comm_format from system_events where obj_name = '"+objName+"' "
+ " and event_code = '"+eventCode+"' ";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
formatCode = rs.getString("comm_format");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql="select ref_ser, tran_id_col from transetup where tran_window = '"+winName+"' ";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
refSer = rs.getString("ref_ser");
tranIdCol = rs.getString("tran_id_col");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(refSer == null ) refSer =" ";
if(tranIdCol == null ) tranIdCol =" ";
sql = " select emp_code,emp_fname,emp_lname,emp_mname from emp_travel_info where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
empCode = rs.getString("emp_code");
empFirstName = rs.getString("emp_fname");
empLastName = rs.getString("emp_lname");
empMiddleName = rs.getString("emp_mname");
}
rs.close();rs = null;
pstmt.close();pstmt = null;
sql = " select division from nsm_email where nsm_code=(select emp_code from emp_travel_info where tran_id=?) ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
division = rs.getString("division");
}
rs.close();rs = null;
pstmt.close();pstmt = null;
sql = " select travel_code,nsm_code from nsm_email where division = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, division);
rs = pstmt.executeQuery();
if(rs.next())
{
travelCode = rs.getString("travel_code");
nsmCode = rs.getString("nsm_code");
}
rs.close();rs = null;
pstmt.close();pstmt = null;
commInfo.append("<ROOT>");
commInfo.append("<MAIL><EMAIL_TYPE>page</EMAIL_TYPE><ENTITY_CODE>BASE</ENTITY_CODE>");
commInfo.append("<ENTITY_TYPE>"+userType+"</ENTITY_TYPE>");
commInfo.append("<TO_ADD></TO_ADD>");
commInfo.append("<CC_ADD></CC_ADD>");
commInfo.append("<BCC_ADD></BCC_ADD>");
commInfo.append("<FORMAT_CODE>"+formatCode+"</FORMAT_CODE>");
commInfo.append("<TRAVEL_CODE>"+travelCode+"</TRAVEL_CODE>");
commInfo.append("<NSM_CODE>"+nsmCode+"</NSM_CODE>");
commInfo.append("<EMPNAME>"+empFirstName+"</EMPNAME>");
commInfo.append("<ATTACHMENT><BODY>Transaction Cancelled </BODY><LOCATION></LOCATION></ATTACHMENT>");
commInfo.append("</MAIL><XML_DATA></XML_DATA>");
commInfo.append("</ROOT>");
EMail email = new EMail();
email.sendMail(commInfo.toString(), "ITM");
email = null;
retString = "submited"; retString = "submited";
System.out.println(" information submited::"); System.out.println(" information submited::");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment