Commit dca9f732 authored by caluka's avatar caluka

Adding validation for sitecode exist in user_site table


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97508 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ab0b80c2
......@@ -157,7 +157,6 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R
simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
loginSiteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
columnValue = genericUtility.getColumnValue(currentColumn, dom);
......@@ -188,6 +187,9 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R
siteCodeTo = genericUtility.getColumnValue("site_code__to", dom1);
yield = genericUtility.getColumnValue("yield", dom1);
System.out.println("yield>>>>["+yield+"]");
System.out.println("siteCodeFr>>>["+siteCodeFr+"]before siteCodeTo"+siteCodeTo+"]");
siteCodeTo=siteCodeFr;
System.out.println("after siteCodeFr>>>["+siteCodeFr+"]after siteCodeTo"+siteCodeTo+"]");
/*
* "SELECT A.TRAN_ID, A.SITE_CODE, A.ITEM_CODE, B.DESCR, A.QUANTITY, A.DUE_DATE, A.UNIT, A.YIELD_PERC "
* + "FROM MPS_ORDER A, ITEM B "+
......@@ -279,7 +281,8 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R
yield = genericUtility.getColumnValue("yield", dom1);
System.out.println("case 3 yield>>>>["+yield+"]");
System.out.println("mpsOrder["+mpsOrder+"]");
siteCodeTo=siteCodeFr;
System.out.println("after siteCodeFr>>>["+siteCodeFr+"]after siteCodeTo"+siteCodeTo+"]");
java.util.Date dt = new java.util.Date();
SimpleDateFormat sdf1= new SimpleDateFormat(genericUtility.getDBDateFormat());
newsysdate = java.sql.Timestamp.valueOf(sdf1.format(dt)+" 00:00:00.0");
......@@ -750,6 +753,7 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R
String siteCode = "";
String itemCode = "";
String quantity = "";
String profileId = "",loginId = "";
Connection conn = null;
PreparedStatement pstmt = null;
......@@ -759,6 +763,8 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R
simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
conn = getConnection();
userId = getValueFromXTRA_PARAMS(xtraParams, "userId");
profileId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "profileId");
loginId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
if (objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext);
......@@ -807,6 +813,25 @@ public class RequirementIC extends ValidatorEJB implements RequirementICLocal, R
break;
}
sql = "SELECT COUNT(*) COUNT FROM USER_SITE WHERE USER_ID = ? AND SITE_CODE= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginId);
pstmt.setString(2, siteCodeFr);
rs = pstmt.executeQuery();
if (rs.next())
{
count = rs.getInt("COUNT");
}
rs.close();
rs = null;
if (count == 0)
{
errCode = "INVUSRSITE";
errString = getErrorString(childNodeName, errCode, userId);
break;
}
}
if (siteCodeTo == null || siteCodeTo.trim().length() == 0)
{
......
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