示例#1
0
        public void QueryEmployeeByName(string empName)
        {
            EmployeeQueryHandlerWebServer employeeQueryHandlerWebServer = new EmployeeQueryHandlerWebServer(_connectionAgent);
            EmplyeeViewModelQuery         emplyeeViewModelQuery         = new EmplyeeViewModelQuery(employeeQueryHandlerWebServer,
                                                                                                    EmplyeeViewModelQuery.SearchFilter.ByEmployeeName);
            Task workItemsLoadingTask = Task.Run(() => emplyeeViewModelQuery.GetEmployeesAsync(empName));

            workItemsLoadingTask.Wait();
            Assert.IsTrue(emplyeeViewModelQuery.RetrievedEmployees.Count > 0);
        }
 public QueryEmployeePage(IConnectionHandler connectionHandler, SearchFilter searchFilter)
 {
     InitializeComponent();
     _searchFilter = searchFilter;
     EmployeeQueryHandlerWebServer employeeQueryHandlerWebServer = new EmployeeQueryHandlerWebServer(connectionHandler);
     _employeeViewModelQuery = new EmplyeeViewModelQuery(employeeQueryHandlerWebServer, _searchFilter);
     _employeeViewModelQuery.ShowMessageToUserEvent += _employeeViewModelQuery_ShowMessageToUserEvent;
     DataContext = _employeeViewModelQuery;
     InitializeUIElementsBasedOnFilter();
 }
示例#3
0
        private Employee GetEmployeeById(int empId)
        {
            Employee retrievedEmployee = null;
            EmployeeQueryHandlerWebServer employeeQueryHandlerWebServer = new EmployeeQueryHandlerWebServer(_connectionAgent);
            EmplyeeViewModelQuery         emplyeeViewModelQuery         = new EmplyeeViewModelQuery(employeeQueryHandlerWebServer,
                                                                                                    EmplyeeViewModelQuery.SearchFilter.ByEmployeeId);
            Task workItemsLoadingTask = Task.Run(() => emplyeeViewModelQuery.GetEmployeesAsync(empId.ToString()));

            workItemsLoadingTask.Wait();
            if (emplyeeViewModelQuery.RetrievedEmployees.Count == 1)
            {
                retrievedEmployee = emplyeeViewModelQuery.RetrievedEmployees[0];
            }
            return(retrievedEmployee);
        }
示例#4
0
        public UpdateEmployeePage(IConnectionHandler connectionHandler, EmployeeViewModelUpdate.UpdateType updateType)
        {
            InitializeComponent();
            EmployeeUpdateHandlerWebServer employeeUpdateHandlerWebServer = new EmployeeUpdateHandlerWebServer(connectionHandler);

            _employeeViewModelUpdate = new EmployeeViewModelUpdate(employeeUpdateHandlerWebServer, updateType);
            _employeeViewModelUpdate.ShowMessageToUserEvent += _employeeViewModel_ShowMessageToUserEvent;
            DataContext = _employeeViewModelUpdate;
            TextBoxEmployeeId.Clear();
            InitializeUIBasedOnUpdateType(updateType);
            if (updateType == EmployeeViewModelUpdate.UpdateType.EditEmployee || updateType == EmployeeViewModelUpdate.UpdateType.RemoveEmployee)
            {
                EmployeeQueryHandlerWebServer employeeQueryHandlerWebServer = new EmployeeQueryHandlerWebServer(connectionHandler);
                _employeeViewModelQuery = new EmplyeeViewModelQuery(employeeQueryHandlerWebServer, EmplyeeViewModelQuery.SearchFilter.ByEmployeeId);
            }
        }