Wednesday, 23 May 2018

Birthday Portlet

<%
SimpleDateFormat formatter = new SimpleDateFormat("MMM dd");
List<EmployeeDetails> list = EmployeeDetailsLocalServiceUtil.getEmployeeDetailses(-1, -1);
List<EmployeeDetails> blist = new ArrayList<>();
Date date = new Date();
for(EmployeeDetails e : list){
Date dob = e.getDob();
if( dob.getDate() == date.getDate() && dob.getMonth() == date.getMonth()){
blist.add(e);
}
}
%>
<%if(blist.isEmpty()){%>
<b>There is no B day</b>
<%}else if(!list.isEmpty()){
for(EmployeeDetails emp : blist){%>
<%

FileEntry dlfileentry = DLAppServiceUtil.getFileEntry(emp.getFileEntryId());
String imageURL ="/documents/" + dlfileentry.getGroupId() + "/"
+ dlfileentry.getFolderId() + "/" + dlfileentry.getTitle()
+ "/" + dlfileentry.getUuid();
%>
<a href="<%=imageURL%>"><img src="<%=imageURL%>" alt="image" class="mmm"/></a>

<p class="bday nomargin"><%=emp.getEmployeename() %></p>
<b class="wish">Wish you happy B day</b>

<%String dates=formatter.format(emp.getDob()); %>

<p class="bday"><%=dates%></p>
<%} }%>


No comments:

Post a Comment