/// <summary> /// 分配权限页面 /// </summary> /// <returns></returns> public ActionResult Privileges() { //查询所有员工 List <EmployeeInfo> emlist = dal.GetAllEmployeer(); ViewBag.emlist = emlist; //查询岗位 PostDal pdal = new PostDal(); List <PostInfo> postlist = pdal.GetAllPost(); ViewBag.postlist = postlist; //查询部门 DeptDal ddal = new DeptDal(); List <Dept> deptlist = ddal.GetDeptInfo(); ViewBag.deptlist = deptlist; //根据员工id查询员工 int?id = Convert.ToInt32(Request["id"]); if (id != 0) { EmployeeInfo em = dal.GetEmployeerByID(id); //记录下拉列表选择的员工 ViewBag.selEmp = em; } return(View()); }
/// <summary> /// 将岗位调动给部门页面 /// </summary> /// <returns></returns> public ActionResult PostByDept() { //所有部门 List <Dept> deptlist = dal.GetAllDept(); ViewBag.deptlist = deptlist; //所有岗位 List <PostInfo> polist = dal.GetAllPost(); ViewBag.polist = polist; return(View()); }
/// <summary> /// 更新信息页面 /// </summary> /// <returns></returns> public ActionResult UpdProfile() { //获取查询员工的id int id = Convert.ToInt32(Session["emid"]); EmployeeInfo em = dal.GetEmployeerByID(id); ViewBag.info = em; PostDal pdal = new PostDal(); //所有岗位 List <PostInfo> postlist = pdal.GetAllPost(); ViewBag.postlist = postlist; 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()); }
/// <summary> /// /我的个人信息页面 /// </summary> /// <returns></returns> public ActionResult MyInfo() { //获取登陆用户id EmployeeInfo em = (EmployeeInfo)Session["Employeer"]; //根据id查询 EmployeeInfo emer = dal.GetEmployeerByID(em.ID); //将值传到前台 // ViewBag.emer = emer; Session["Employeer"] = emer; //查询所有岗位 PostDal pd = new PostDal(); List <PostInfo> pl = pd.GetAllPost(); //将值传到前台 ViewBag.post = pl; //查询所有部门 DeptDal ddd = new DeptDal(); List <Dept> delist = ddd.GetDeptInfo(); ViewBag.dept = delist; //根据员工id查询员工工资 EmployeeDal emdal = new EmployeeDal(); Payroll p = emdal.GetPayByid(em.ID); ViewBag.empay = p; // 修改员工的方法 if (Request["name"] != null) { EmployeeInfo my = new EmployeeInfo(); my.ID = em.ID; string imgurl = GetUpdImg(); if (imgurl != "") { my.EmployeeHead = imgurl; } my.LoginName = Request["name"]; my.LoginPassword = Request["pwd"]; my.Sex = Convert.ToInt32(Request["sex"]); my.IDNumber = Convert.ToInt64(Request["num"]); my.BirthDay = Request["birth"]; my.Phone = Convert.ToInt64(Request["phone"]); my.Email = Request["email"]; my.EmployeeAddress = Request["address"]; my.Degree = Request["degree"]; my.EmployeeProfile = Request["profile"]; bool isUpd = dal.UpdMy(my); if (isUpd) { return(Content("1")); } } 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()); }