public void GetCompany_ReturnObject_IfFound() { var clientCode = "test Employee"; var emp = new Core.Employee { EmployeeFullName = clientCode, EmployeeId = 123, Address = "test address" }; testApplicationContext.Add(emp); var result = subject.GetData().FirstOrDefault(x => x.EmployeeId == emp.EmployeeId); result.EmployeeId.Should().Equals(emp.EmployeeId); }
public ActionResult About() { ViewBag.Message = "Your application description page."; Core.Employee emp = new Core.Employee() { EmployeeID = -1, LastName = "sheley", FirstName = "andrew", MiddleName = "scott", ParkingLogID = 3, }; return(View()); }
public IActionResult About() { ViewData["Message"] = "Your application description page."; ViewData["Environment"] = _hostingEnvironment.EnvironmentName; ViewData["ConnectionString"] = _configuration.GetConnectionString("DBConnection"); Core.Employee e = new Core.Employee() { EmployeeID = -1, LastName = "Sheley", FirstName = "Andrew", MiddleName = "Scott", ParkingLogID = 2, }; return(View()); }
public IActionResult SaveEmployee(Core.Employee employee) { //validate EMployee data if (!string.IsNullOrEmpty(employee.PhoneNumber)) { Regex.Replace(employee.PhoneNumber.Trim(), @"\+\(|\)|\-", ""); } if (ValidateEmployee(employee)) { if (_appDal.SaveEmployee(employee)) { return(Json(new { success = true, message = "Created Successfully" })); } } else { return(Json(new { success = false, message = "Fields are not correct" })); } return(Json(new { success = false, message = "Error while saving" })); }
public IActionResult EditEmployee(int id) { try { Core.Employee employee = _appDal.GetData().FirstOrDefault(e => e.EmployeeId == id); if (employee == null) { return(NotFound()); } ViewData["Title"] = "Personal Information"; ViewData["Employee"] = employee; return(PartialView("~/Views/Employee/_AddForm.cshtml")); } catch (Exception ex) { Console.WriteLine(ex.Message); return(Json(new { success = false, message = "Error while deleting." })); } }
private bool ValidateEmployee(Core.Employee employee) { bool empNameValid = true; bool empAddValid = true; bool empPhoneValid = true; if (string.IsNullOrEmpty(employee.EmployeeFullName)) { empNameValid = false; } if (string.IsNullOrEmpty(employee.Address)) { empAddValid = false; } if (string.IsNullOrEmpty(employee.PhoneNumber) && employee.PhoneNumber.Length > 10) { empPhoneValid = false; } return(empNameValid && empAddValid && empPhoneValid); }
public IActionResult AddEmployee() { try { ViewData["Title"] = "Personal Information"; ViewData["Employee"] = new Core.Employee(); List <SelectListItem> pos = new List <SelectListItem> { new SelectListItem { Text = Position.genMgr, Value = Position.genMgr }, new SelectListItem { Text = Position.hrDir, Value = Position.hrDir }, new SelectListItem { Text = Position.prdMgr, Value = Position.prdMgr }, new SelectListItem { Text = Position.prjMgr, Value = Position.prjMgr }, new SelectListItem { Text = Position.senEdr, Value = Position.senEdr }, new SelectListItem { Text = Position.edr, Value = Position.edr }, }; ViewBag.Positions = pos; return(PartialView("~/Views/Employee/_AddEmp.cshtml")); } catch (Exception ex) { _logger.Error($"error in adding data {ex}"); return(null); } }
public System.Threading.Tasks.Task AcceptAvailableShiftAsync(Core.ScheduleShift shift, Core.Employee employee) { return(base.Channel.AcceptAvailableShiftAsync(shift, employee)); }
public void AcceptAvailableShift(Core.ScheduleShift shift, Core.Employee employee) { base.Channel.AcceptAvailableShift(shift, employee); }
public Core.Employee Add(Core.Employee newEmployee) { listEmployee.Add(newEmployee); return(newEmployee); }
public System.Threading.Tasks.Task UpdateEmployeeAsync(Core.Employee employee) { return(base.Channel.UpdateEmployeeAsync(employee)); }
public void UpdateEmployee(Core.Employee employee) { base.Channel.UpdateEmployee(employee); }
public System.Threading.Tasks.Task InsertEmployeeAsync(Core.Employee employee) { return(base.Channel.InsertEmployeeAsync(employee)); }
public void InsertEmployee(Core.Employee employee) { base.Channel.InsertEmployee(employee); }
public System.Threading.Tasks.Task <Core.TemplateShift> CreateTemplateShiftAsync(DesktopClient.TemplateShiftService.DayOfWeek weekDay, double hours, System.TimeSpan startTime, int templateScheduleId, Core.Employee employee) { return(base.Channel.CreateTemplateShiftAsync(weekDay, hours, startTime, templateScheduleId, employee)); }
public Core.TemplateShift CreateTemplateShift(ServiceHosting.Tests.TemplateShiftService.DayOfWeek weekDay, double hours, System.TimeSpan startTime, int templateScheduleId, Core.Employee employee) { return(base.Channel.CreateTemplateShift(weekDay, hours, startTime, templateScheduleId, employee)); }