package com.action.admin;
import java.util.ArrayList;
import java.util.List;
import com.db.admin.AdminDAO;
import com.db.organization.DeptVO;
import com.db.user.UserVO;
public class AdminDeptSerchAction {
private List<UserVO> list = new ArrayList<UserVO>();
private List<DeptVO> dlist = new ArrayList<DeptVO>();
public void setDlist(List<DeptVO> dlist) {
this.dlist = dlist;
}
private AdminDAO adminDAO;
private int curpage;
private int totalpage;
private String page;
private String dname;
private int deptno;
public void setDeptno(int deptno) {
this.deptno = deptno;
}
public void setDname(String dname) {
this.dname = dname;
}
public String getDname() {
return dname;
}
public String getPage() {
return page;
}
public void setPage(String page) {
this.page = page;
}
public int getCurpage() {
return curpage;
}
public int getTotalpage() {
return totalpage;
}
public void setAdminDAO(AdminDAO adminDAO) {
this.adminDAO = adminDAO;
}
public List<UserVO> getList() {
return list;
}
public int getDeptno() {
return deptno;
}
public String execute() throws Exception {
//String strCurpage = servletRequest.getParameter("page");
if(page == null)
page="1";
curpage = Integer.parseInt(page);
List<UserVO> temp = adminDAO.serchDept(dname);
int j=0;
int pagecnt = (curpage*10)-10;
for(int i=0; i<temp.size(); i++) {
if(j<10 && i>=pagecnt) {
UserVO vo = temp.get(i);
list.add(vo);
j++;
}
}
int count = adminDAO.UserCount();
int total = count/10;
if(count%10 > 0)
total++;
totalpage = total;
dlist = adminDAO.DeptList();
// servletRequest.getParameter("curpage");
// servletRequest.getParameter("totalpage");
//list = adminDAO.Loginfo();
return "success";
}
public List<DeptVO> getDlist() {
return dlist;
}
}