public int currentPage; //当前页 /// <summary> /// 岗位列表页面 /// </summary> /// <returns></returns> public ActionResult PostList() { int page = 1; currentPage = page; if (Request["page"] != null) { page = Convert.ToInt32(Request["page"]); currentPage = page; } //获取总条数 int totalCount = 0; if (Request["name"] != null && Request["name"] != "") { list = dal.GetPagePostInfo(page, 5, Request["name"]); totalCount = dal.GetCountBy(Request["name"]); ViewBag.pname = Request["name"]; } else { list = dal.GetPagePostInfo(page, 5, ""); totalCount = dal.GetCount(); } //获取页数 if (totalCount % 5 != 0) { totalPage = totalCount / 5 + 1; } else { totalPage = totalCount / 5; } //所有部门 List <Dept> deptlist = dal.GetAllDept(); ViewBag.deptlist = deptlist; //赋值传递 ViewBag.totalPage = totalPage; ViewBag.currentPage = currentPage; ViewBag.plist = list; return(View()); }
/// <summary> ///个人信息页面(根据员工id查询员工) /// </summary> /// <returns></returns> public ActionResult SelProfile() { int id = Convert.ToInt32(Request["id"]); Session["emid"] = id; EmployeeInfo em = dal.GetEmployeerByID(id); ViewBag.info = em; //所有部门 PostDal pdal = new PostDal(); List <Dept> deptlist = pdal.GetAllDept(); ViewBag.deptlist = deptlist; //所有岗位 List <PostInfo> postlist = pdal.GetAllPost(); ViewBag.postlist = postlist; return(View()); }
/// <summary> /// 新增员工页面 /// </summary> /// <returns></returns> public ActionResult AddEmployeer() { //验证邮箱 if (Request["email"] != null) { string _emial = Request["email"]; Regex RegCHZN = new Regex(@"^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$"); Match m = RegCHZN.Match(_emial); bool istrue = m.Success; if (istrue == false) { return(Content("1")); } } //验证用户昵称(唯一) if (Request["xuname"] != null) { //根据昵称查询员工 EmployeeInfo em = dal.GetEmployeerByLoginName(Request["xuname"]); if (em != null) { return(Content("2")); } } //所有部门 PostDal pdal = new PostDal(); List <Dept> deptlist = pdal.GetAllDept(); ViewBag.deptlist = deptlist; //所有岗位 List <PostInfo> postlist = pdal.GetAllPost(); ViewBag.postlist = postlist; return(View()); }
public int currentPage; //当前页 /// <summary> /// 员工列表页面 /// </summary> /// <returns></returns> public ActionResult EmployeerList() { int page = 1; int hang = 5; currentPage = page; if (Request["page"] != null) { page = Convert.ToInt32(Request["page"]); currentPage = page; } if (Request["hang"] != null) { hang = Convert.ToInt32(Request["hang"]); } int totalCount = 0; if (Request["searchContent"] != null) { //获取查询结果的条数 totalCount = dal.GetCountByName(Request["searchContent"]); ViewBag.totalCount = totalCount; if (Convert.ToInt32(Request["hang"]) == -1) { hang = totalCount; } ViewData["hang"] = hang; //调用分页模糊查询的方法 list = dal.GetEmployeerInfo(page, hang, Request["searchContent"]); ViewBag.content = Request["searchContent"]; } else { //获取所有员工条数 totalCount = dal.GetCount(); ViewBag.totalCount = totalCount; if (Convert.ToInt32(Request["hang"]) == -1) { hang = totalCount; } ViewData["hang"] = hang; //调用分页模糊查询的方法 list = dal.GetEmployeerInfo(page, hang, ""); } //获取页数 if (totalCount % hang != 0) { totalPage = totalCount / hang + 1; } else { totalPage = totalCount / hang; } //赋值传递 ViewBag.totalPage = totalPage; ViewBag.currentPage = currentPage; ViewBag.EmployeerInfo = list; //所有部门 PostDal pdal = new PostDal(); List <Dept> deptlist = pdal.GetAllDept(); ViewBag.deptlist = deptlist; //所有岗位 List <PostInfo> postlist = pdal.GetAllPost(); ViewBag.postlist = postlist; return(View()); }