Пример #1
0
        public void DepartmentDAOGetAllShouldReturnList()
        {
            DepartmentDAO     dao  = new DepartmentDAO();
            List <Department> deps = dao.GetAll();

            Assert.IsTrue(deps.Count > 0);
        }
Пример #2
0
        public List <DepartmentViewModel> GetAll()
        {
            List <DepartmentViewModel> depsViewModelList = new List <DepartmentViewModel>();

            try
            {
                List <Department> departments = _dao.GetAll();

                foreach (var department in departments)
                {
                    DepartmentViewModel dVM = new DepartmentViewModel();
                    dVM.Id      = department.GetIdAsString();
                    dVM.Name    = department.DepartmentName;
                    dVM.Version = department.Version;

                    depsViewModelList.Add(dVM);
                }
            }
            catch (Exception ex)
            {
                ViewModelUtils.ErrorRoutine(ex, "DepartmentViewModel", "GetAll");
            }

            return(depsViewModelList);
        }
Пример #3
0
 public void TestGetAllDepartment()
 {
     try
     {
         DepartmentDAO     dep         = new DepartmentDAO();
         List <Department> departments = dep.GetAll();
         Assert.Contains(departments, d => d.ID != 0);
     }
     catch (Exception ex)
     {
         Assert.False(true, ex.Message);
     }
 }
Пример #4
0
        public EmployeeProjectsDto GetEmployeeProjectsDto(int EmployeeId)
        {
            EmployeeProjectsDto dto = new EmployeeProjectsDto();

            EmployeeDAO empDao = new EmployeeDAO();

            dto.Employee = empDao.GetFiltered("id", EmployeeId.ToString());

            DepartmentDAO depDao = new DepartmentDAO();

            dto.Departments = depDao.GetAll();

            return(dto);
        }
Пример #5
0
        public ProjectDepartmentsDTO GetProjectDepartmentsDTO(int ProjectId)
        {
            ProjectDepartmentsDTO output = new ProjectDepartmentsDTO();

            ProjectDAO projectDao = new ProjectDAO();

            output.Project = projectDao.GetFiltered("id", ProjectId.ToString());

            DepartmentDAO departmentDAO = new DepartmentDAO();

            output.Departments = departmentDAO.GetAll();

            return(output);
        }
Пример #6
0
    public void TestGetAllJustCrossFingersAndHopeItWorks()
    {
        DepartmentDAO              dao      = new DepartmentDAO();
        DepartmentViewModel        vm       = new DepartmentViewModel();
        List <Department>          emp_list = dao.GetAll();
        List <DepartmentViewModel> vm_list  = vm.GetAll();

        Assert.IsTrue(emp_list.Count == vm_list.Count);

        for (int i = 0; i < emp_list.Count; i++)
        {
            Assert.IsTrue(emp_list[i].GetIdAsString() == vm_list[i].Id);
            Assert.IsTrue(emp_list[i].DepartmentName == vm_list[i].DepartmentName);
            Assert.IsTrue(emp_list[i].Version == vm_list[i].Version);
        }
    }    // TestGetAllJustCrossFingersAndHopeItWorks
Пример #7
0
        public List <DepartmentViewModel> GetAll()
        {
            List <DepartmentViewModel> viewModels = new List <DepartmentViewModel>();

            try
            {
                List <Department> departments = _dao.GetAll();

                foreach (Department e in departments)
                {
                    //return only fields for display, subsequent get wil other fields
                    DepartmentViewModel viewModel = new DepartmentViewModel();
                    viewModel.Id             = e._id.ToString();
                    viewModel.DepartmentName = e.DepartmentName;
                    viewModels.Add(viewModel); //add to list
                }
            }
            catch (Exception ex)
            {
                ErrorRoutine(ex, "DepartmentViewModel", "GetAll");
            }
            return(viewModels);
        }
        public List <DepartmentViewModel> GetAll()
        {
            List <DepartmentViewModel> viewModels = new List <DepartmentViewModel>();

            try
            {
                List <Department> department = _dao.GetAll();
                foreach (Department dept in department)
                {
                    DepartmentViewModel viewModel = new DepartmentViewModel();
                    viewModel.Id             = dept.GetIdAsString();
                    viewModel.DepartmentName = dept.DepartmentName;
                    viewModel.Version        = dept.Version;
                    viewModel.ManagerId      = dept.GetManagerIdAsString();
                    viewModels.Add(viewModel);
                }
            }
            catch (Exception ex)
            {
                DALUtils.ErrorRoutine(ex, "DepartmentViewModel", "GetAll");
            }
            return(viewModels);
        }
Пример #9
0
        public List <DepartmentViewModel> GetAll()
        {
            List <DepartmentViewModel> vmList = new List <DepartmentViewModel>();

            try
            {
                List <Department> deptList = _dao.GetAll();

                foreach (Department e in deptList)
                {
                    //return only fields for display, subsequent get will fill other fields
                    DepartmentViewModel viewModel = new DepartmentViewModel();
                    viewModel.Id             = e.GetIdAsString();
                    viewModel.DepartmentName = e.DepartmentName;
                    vmList.Add(viewModel);//add to list
                }
            }

            catch (Exception ex)
            {
                ViewModelUtils.ErrorRoutine(ex, "DepartmentViewModel", "GetAll");
            }
            return(vmList);
        }
        public IActionResult Index()
        {
            DepartmentDAO dao = new DepartmentDAO();

            return(View(dao.GetAll()));
        }