Commit 0b322cbe authored by dpawar's avatar dpawar

update date format of confirm date


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@92400 ce508802-f39f-4f6c-b175-0d175dae99d5
parent df565333
...@@ -13,6 +13,7 @@ import javax.ejb.Stateless; ...@@ -13,6 +13,7 @@ import javax.ejb.Stateless;
public class EmpBondDefConfirm extends ActionHandlerEJB implements EmpBondDefConfirmLocal,EmpBondDefConfirmRemote public class EmpBondDefConfirm extends ActionHandlerEJB implements EmpBondDefConfirmLocal,EmpBondDefConfirmRemote
{ {
String loginEmpCode=""; String loginEmpCode="";
int updcnt1=0;
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{ {
...@@ -111,14 +112,13 @@ public class EmpBondDefConfirm extends ActionHandlerEJB implements EmpBondDefCon ...@@ -111,14 +112,13 @@ public class EmpBondDefConfirm extends ActionHandlerEJB implements EmpBondDefCon
rs.close(); rs.close();
rs = null; rs = null;
} }
updcnt1 =updateConfirm(conn,tranId);
System.out.println("UPDATE COUNT ---->>"+updCnt); System.out.println("UPDATE COUNT --updCnt-->>"+updCnt+" updcnt1 -->>"+updcnt1);
if (updCnt > 0) if (updCnt > 0 && updcnt1 >0 )
{ {
retString=new ITMDBAccessEJB().getErrorString("", "VCONFSUC", "", "", conn); retString=new ITMDBAccessEJB().getErrorString("", "VCONFSUC", "", "", conn);
updateConfirm(conn,tranId);
conn.commit(); conn.commit();
System.out.println("Bond amount and bond period updated successfully.......row(s) updated :"+updCnt); System.out.println("Bond amount and bond period updated successfully.......");
}else }else
{ {
...@@ -170,26 +170,22 @@ public class EmpBondDefConfirm extends ActionHandlerEJB implements EmpBondDefCon ...@@ -170,26 +170,22 @@ public class EmpBondDefConfirm extends ActionHandlerEJB implements EmpBondDefCon
} }
public void updateConfirm(Connection conn,String tranId) public int updateConfirm(Connection conn,String tranId)
{ {
PreparedStatement pstmt1=null; PreparedStatement pstmt1=null;
String sql = "UPDATE EMPLOYEE_BOND_DEF SET CONFIRMED = 'Y',CONF_DATE = ?,EMP_CODE__APRV=? WHERE TRAN_ID = ?"; int count=0;
String sql = "UPDATE EMPLOYEE_BOND_DEF SET CONFIRMED = ? ,CONF_DATE = ?,EMP_CODE__APRV=? WHERE TRAN_ID = ?";
try try
{ {
GenericUtility genericUtility = GenericUtility.getInstance(); pstmt1 = conn.prepareStatement( sql );
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat()); pstmt1.setString(1, "Y");
Timestamp timestamp = new Timestamp(System.currentTimeMillis()); pstmt1.setTimestamp(2, this.getCurrdateAppFormat());
String ConfDate = simpleDateFormat.format(timestamp).toString(); pstmt1.setString(3, loginEmpCode);
pstmt1.setString(4, tranId);
count = pstmt1.executeUpdate();
pstmt1 = conn.prepareStatement( sql ); System.out.println("confirm updated -------->>>>>>>>>updCount :"+count);
pstmt1.setString(1, ConfDate);
pstmt1.setString(2, loginEmpCode);
pstmt1.setString(3, tranId);
int updCnt = pstmt1.executeUpdate();
System.out.println("in updateConfirm method ------CONF_DATE -->>>"+ConfDate);
System.out.println("confirm updated -------->>>>>>>>>updCount :"+updCnt);
} }
catch(Exception e) catch(Exception e)
...@@ -219,7 +215,26 @@ public class EmpBondDefConfirm extends ActionHandlerEJB implements EmpBondDefCon ...@@ -219,7 +215,26 @@ public class EmpBondDefConfirm extends ActionHandlerEJB implements EmpBondDefCon
e.printStackTrace(); e.printStackTrace();
} }
return count;
} }
private java.sql.Timestamp getCurrdateAppFormat()
{
GenericUtility genericUtility = GenericUtility.getInstance();
Timestamp timestamp = null;
try
{
java.util.Date date = null;
timestamp = new Timestamp(System.currentTimeMillis());
SimpleDateFormat simpledateformat = new SimpleDateFormat(genericUtility.getDBDateFormat());
date = simpledateformat.parse(timestamp.toString());
timestamp = Timestamp.valueOf(simpledateformat.format(date).toString() + " 00:00:00.0");
}
catch(Exception exception)
{
System.out.println("Exception in [EmpBondDefConfirm] getCurrdateAppFormat " + exception.getMessage());
}
return timestamp;
}
} }
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