Exemplo n.º 1
0
        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());
        }
Exemplo n.º 4
0
 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" }));
 }
Exemplo n.º 5
0
        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." }));
            }
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
 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);
     }
 }
Exemplo n.º 8
0
 public System.Threading.Tasks.Task AcceptAvailableShiftAsync(Core.ScheduleShift shift, Core.Employee employee)
 {
     return(base.Channel.AcceptAvailableShiftAsync(shift, employee));
 }
Exemplo n.º 9
0
 public void AcceptAvailableShift(Core.ScheduleShift shift, Core.Employee employee)
 {
     base.Channel.AcceptAvailableShift(shift, employee);
 }
Exemplo n.º 10
0
 public Core.Employee Add(Core.Employee newEmployee)
 {
     listEmployee.Add(newEmployee);
     return(newEmployee);
 }
Exemplo n.º 11
0
 public System.Threading.Tasks.Task UpdateEmployeeAsync(Core.Employee employee)
 {
     return(base.Channel.UpdateEmployeeAsync(employee));
 }
Exemplo n.º 12
0
 public void UpdateEmployee(Core.Employee employee)
 {
     base.Channel.UpdateEmployee(employee);
 }
Exemplo n.º 13
0
 public System.Threading.Tasks.Task InsertEmployeeAsync(Core.Employee employee)
 {
     return(base.Channel.InsertEmployeeAsync(employee));
 }
Exemplo n.º 14
0
 public void InsertEmployee(Core.Employee employee)
 {
     base.Channel.InsertEmployee(employee);
 }
Exemplo n.º 15
0
 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));
 }
Exemplo n.º 16
0
 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));
 }