public ActionResult Create(NewEmployeeViewModel model) { BLLProfile _profile = new BLLProfile(); try { if (ModelState.IsValid) { if (_profile.NewEmployee(model, User.IDNO)) { return RedirectToAction("Index"); } else { ModelState.AddModelError("", "An error has been encountered. Please contact your System Administrator."); } } NewEmployeeViewModel _newEmployee = new NewEmployeeViewModel(); _newEmployee.Position = _profile.GetPositionTitles(); _newEmployee.EmploymentStatus = _profile.GetEmploymentStatus(); return View(_newEmployee); } catch { NewEmployeeViewModel _newEmployee = new NewEmployeeViewModel(); _newEmployee.Position = _profile.GetPositionTitles(); _newEmployee.EmploymentStatus = _profile.GetEmploymentStatus(); ModelState.AddModelError("", "An error has been encountered. Please contact your System Administrator."); return View(_newEmployee); } }
public ActionResult Create() { NewEmployeeViewModel _newEmployee = new NewEmployeeViewModel(); BLLProfile _profile = new BLLProfile(); _newEmployee.Password = _profile.GeneratePassword(); _newEmployee.Position = _profile.GetPositionTitles(); _newEmployee.Department = _profile.GetDepartmentNames(); _newEmployee.CivilStatus = _profile.GetCivilStatus(); _newEmployee.EmploymentStatus = _profile.GetEmploymentStatus(); return View(_newEmployee); }
public ActionResult Edit(string IDNO) { BLLProfile _profile = new BLLProfile(); EditEmployeeViewModel _employee = _profile.GetEmployeeProfile(IDNO); _employee.IDNO = IDNO; _employee.CivilStatus = _profile.GetCivilStatus(); _employee.Department = _profile.GetDepartmentNames(); _employee.EmploymentStatus = _profile.GetEmploymentStatus(); return View(_employee); }
public ActionResult Edit(EditEmployeeViewModel model) { BLLProfile _profile = new BLLProfile(); try { if(ModelState.IsValid) { if(_profile.UpdateEmployeeProfile(model, User.IDNO)) { TempData["editEmployee_result"] = "Employee profile has successfully been updated."; } else { ModelState.AddModelError("", "An error has occurred."); } } EditEmployeeViewModel _employee = _profile.GetEmployeeProfile(model.IDNO); _employee.CivilStatus = _profile.GetCivilStatus(); _employee.Position = _profile.GetPositionTitles(); _employee.Department = _profile.GetDepartmentNames(); _employee.EmploymentStatus = _profile.GetEmploymentStatus(); return View(_employee); } catch(Exception e) { EditEmployeeViewModel _employee = _profile.GetEmployeeProfile(model.IDNO); _employee.CivilStatus = _profile.GetCivilStatus(); _employee.Position = _profile.GetPositionTitles(); _employee.Department = _profile.GetDepartmentNames(); _employee.EmploymentStatus = _profile.GetEmploymentStatus(); ModelState.AddModelError("", e.StackTrace); return View(_employee); } }