Esempio n. 1
0
        public ActionResult OnPositionSave(OnPosition onPosition, string returnUrl = "HREmployeeIndex")
        {
            ViewBag.Path1 = "员工管理";
            var clientList = db.User.Where(a => a.Id == WebSecurity.CurrentUserId).Single().HRClients.Select(a => a.Id).ToList();
            Employee employee = db.Employee.Where(a => a.Id == onPosition.EmployeeId && clientList.Contains(a.ClientId)).SingleOrDefault();
            if (employee == null)
            {
                return HttpNotFound();
            }
            if (ModelState.IsValid)
            {
                try
                {
                    employee.Timestamp = onPosition.Timestamp;
                    employee.EmployeeStatus = EmployeeStatus.在职;

                    db.PPSave();

                    return Redirect(Url.Content(returnUrl));
                }
                catch (Exception e)
                {
                    Common.RMOk(this, "记录" + employee + "入职失败!" + e.ToString());
                }
            }

            ViewBag.ReturnUrl = returnUrl;

            return View(onPosition);
        }
Esempio n. 2
0
        public ActionResult OnPosition(int id, string returnUrl = "HREmployeeIndex")
        {
            ViewBag.Path1 = "员工管理";
            var clientList = db.User.Where(a => a.Id == WebSecurity.CurrentUserId).Single().HRClients.Select(a => a.Id).ToList();
            Employee employee = db.Employee.Where(a => a.Id == id && clientList.Contains(a.ClientId)).SingleOrDefault();
            if (employee == null)
            {
                return HttpNotFound();
            }
            OnPosition onPosition = new OnPosition { EmployeeId = employee.Id, Timestamp = employee.Timestamp };

            ViewBag.ReturnUrl = returnUrl;

            return View(onPosition);
        }