EventDetails eventDetails = new EventDetails();
MarketingFacadeHome home = (MarketingFacadeHome)CVUtility.getHomeObject("com.centraview.marketing.marketingfacade.MarketingFacadeHome", "MarketingFacade");
MarketingFacade remote = home.create();
remote.setDataSource(dataSource);
int eventid = 0;
boolean duplicateEvent = false;
if(request.getParameter(MarketingConstantKeys.TYPEOFOPERATION)!= null
&& (request.getParameter(MarketingConstantKeys.TYPEOFOPERATION)).equals("DUPLICATE")){
duplicateEvent = true;
}
DynaActionForm dynaForm = (DynaActionForm)form;
String eventID = (String)dynaForm.get("eventid");
if (eventID != null && !eventID.equals(""))
{
eventid = Integer.parseInt(eventID);
}
eventID = (String)request.getParameter("eventid");
if (eventid == 0 && eventID != null && !eventID.equals(""))
{
eventid = Integer.parseInt(eventID);
} //end of if statement (eventid == 0)
eventID = (String)request.getAttribute("eventid");
if (eventid == 0 && eventID != null && !eventID.equals(""))
{
eventid = Integer.parseInt(eventID);
}
request.setAttribute("eventid",eventid+"");
eventDetails = remote.getEventDetails(individualId, eventid);
eventDetails.setEventid(eventid);
dynaForm.set("eventid", "" + eventid);
dynaForm.set("name", eventDetails.getName());
dynaForm.set("description", eventDetails.getDetail());
dynaForm.set("whoshouldattend", eventDetails.getWhoshouldattend());
dynaForm.set("maxattendees", "" + eventDetails.getMaxattendees());
dynaForm.set("moderatorid", "" + eventDetails.getModeratorid());
dynaForm.set("moderatorname", eventDetails.getModeratorname());
Calendar calendar = new GregorianCalendar();
if (eventDetails.getStartdate() != null)
{
Timestamp date = (Timestamp)eventDetails.getStartdate();
calendar.setTimeInMillis(date.getTime());
int[] hhmm = new int[2];
hhmm[0] = calendar.get(Calendar.HOUR_OF_DAY);
hhmm[1] = calendar.get(Calendar.MINUTE);
String strTime = CVUtility.convertTime24HrsFormatToStr(hhmm);
dynaForm.set("startmonth", Integer.toString(calendar.get(Calendar.MONTH) + 1));
dynaForm.set("startday", Integer.toString(calendar.get(Calendar.DATE)));
dynaForm.set("startyear", Integer.toString(calendar.get(Calendar.YEAR)));
dynaForm.set("starttime", strTime);
}
if (eventDetails.getEnddate() != null)
{
Timestamp date = (Timestamp)eventDetails.getEnddate();
calendar.setTimeInMillis(date.getTime());
int[] hhmm = new int[2];
hhmm[0] = calendar.get(Calendar.HOUR_OF_DAY);
hhmm[1] = calendar.get(Calendar.MINUTE);
String strTime = CVUtility.convertTime24HrsFormatToStr(hhmm);
dynaForm.set("endmonth", Integer.toString(calendar.get(Calendar.MONTH) + 1));
dynaForm.set("endday", Integer.toString(calendar.get(Calendar.DATE)));
dynaForm.set("endyear", Integer.toString(calendar.get(Calendar.YEAR)));
dynaForm.set("endtime", strTime);
}
if (eventDetails.getCreateddate() != null)
{
Timestamp date = (Timestamp)eventDetails.getCreateddate();
calendar.setTimeInMillis(date.getTime());
String month = getCalenderMonth(calendar.get(Calendar.MONTH) + 1);
dynaForm.set("createddate", month + " " + Integer.toString(calendar.get(Calendar.DATE)) + ", " + Integer.toString(calendar.get(Calendar.YEAR)));
}
if (eventDetails.getModifieddate() != null)
{
Timestamp date = (Timestamp)eventDetails.getModifieddate();
calendar.setTimeInMillis(date.getTime());
String month = getCalenderMonth(calendar.get(Calendar.MONTH) + 1);
dynaForm.set("modifieddate", month + " " + Integer.toString(calendar.get(Calendar.DATE)) + ", " + Integer.toString(calendar.get(Calendar.YEAR)));
}
if (!duplicateEvent)
{
try
{
boolean accepted = remote.hasUserAcceptedEvent(eventid, individualId);
request.setAttribute("showRegisterButton", new Boolean(true));
request.setAttribute("hasAccepted", new Boolean(accepted));
}
catch (IndividualNotInvitedException inie)
{