public override ViewModelBase Initialize() { socket = new FleetServiceClient(); homeViewModel = new HomeViewModel() { ChangePasswordCommand = new RelayCommand(ExecuteChangePasswordCommand) }; return(homeViewModel); }
public Employee AddEmployee(FleetServiceClient socket) { addEmployeeWindow = new AddEmployeeWindow(); addEmployeeViewModel = new AddEmployeeViewModel() { AddCommand = new RelayCommand(ExecuteAddCommand), BusinessUnits = socket.GetAllBusinessUnits().ToList() }; addEmployeeWindow.DataContext = addEmployeeViewModel; return(addEmployeeWindow.ShowDialog() == true ? addEmployeeViewModel.Employee : null); }
public void ChangePassword(FleetServiceClient socket, User user) { this.socket = socket; this.user = user; changePasswordViewModel = new ChangePasswordViewModel() { ChangePasswordCommand = new RelayCommand(ExecutedChangePasswordCommand) }; changePasswordWindow = new ChangePasswordWindow(); changePasswordWindow.DataContext = changePasswordViewModel; changePasswordWindow.ShowDialog(); }
public User LoginUser(FleetServiceClient socket) { this.socket = socket; loginWindow = new LoginWindow(); loginViewModel = new LoginViewModel() { LoginCommand = new RelayCommand(ExecuteLoginCommand) }; loginWindow.DataContext = loginViewModel; if (loginWindow.ShowDialog() == true) { return(user); } else { return(null); } }
static void Main() { var fleetService = new FleetServiceClient(); var hostSummaryService = new HostSummaryServiceClient(); Console.WriteLine("Loading the fellt state......"); var fleetRequest = new FleetRequest(Config.FleetStateFilePath); var fleetStatusResult = fleetService.LoadFleetState(fleetRequest); if (!fleetStatusResult.Notifications.HasErrors) { Console.WriteLine("\r\r"); Console.WriteLine("Fleet state results."); DisplayFleetStatus(fleetStatusResult); Console.WriteLine("The follow is a smmary of the fleet status"); Console.WriteLine("\r\r"); var summaryRequest = new HostSummaryRequest(Config.HostStatisticsFilePath) { Hosts = fleetStatusResult.Hosts }; var result = hostSummaryService.SummarizeHostStatistics(summaryRequest); DisplaySummary(result); } else { Console.Write("The following errors occured"); foreach (var error in fleetStatusResult.Notifications) { Console.WriteLine(error); } } Console.ReadLine(); }
public void Initialize() { socket = new FleetServiceClient(); fleetManagementView = new FleetManagementView(); fleetManagementViewModel = new FleetManagementViewModel() { LogoutCommand = new RelayCommand(ExecuteLogoutCommand), NewCommand = new RelayCommand(ExecuteNewCommand), SaveCommand = new RelayCommand(ExecuteSaveCommand), DeleteCommand = new RelayCommand(ExecuteDeleteCommand), OpenHomeCommand = new RelayCommand(ExecuteOpenHomeCommand), OpenCostMonthCommand = new RelayCommand(ExecuteOpenCostMonthCommand), OpenCostBusinessAreaCommand = new RelayCommand(ExecuteOpenCostBusinessAreaCommand), OpenVehiclesCommand = new RelayCommand(ExecuteOpenVehiclesCommand), OpenEmployeesCommand = new RelayCommand(ExecuteOpenEmployeesCommand), OpenBusinessAreasCommand = new RelayCommand(ExecuteOpenBusinessAreasCommand), OpenUserCommand = new RelayCommand(ExecuteOpenUserCommand) }; fleetManagementViewModel.ActiveViewModel = new HomeViewController(null).Initialize(); fleetManagementView.DataContext = fleetManagementViewModel; LoginWindowController loginWindowController = new LoginWindowController(); user = loginWindowController.LoginUser(socket); if (user != null) { fleetManagementViewModel.ActiveViewModel = new HomeViewController(user).Initialize(); fleetManagementView.DataContext = fleetManagementViewModel; fleetManagementView.ShowDialog(); } else { fleetManagementView.Close(); } }
public VehicleToEmployeeRelation AddRelation(FleetServiceClient socket, Vehicle vehicle) { addRelationWindow = new AddRelationWindow(); //Filter wich Employees get shown List <Employee> emps = socket.GetAllEmployees().ToList(); List <VehicleToEmployeeRelation> rels = socket.GetRelationFromVehicle(vehicle).ToList(); List <Employee> selectedEmps = new List <Employee>(emps); emps.ForEach(emp => { if (rels.Find(rel => rel.EmployeeId.Id == emp.Id) != null) { selectedEmps.Remove(emp); } }); addRelationViewModel = new AddRelationViewModel() { AddCommand = new RelayCommand(ExecuteAddCommand), CancelCommand = new RelayCommand(ExecuteCancelCommand), Employees = new ObservableCollection <Employee>(selectedEmps), Vehicle = vehicle }; addRelationWindow.DataContext = addRelationViewModel; if (addRelationWindow.ShowDialog() == true) { var relation = addRelationViewModel.Relation; relation.EmployeeId = addRelationViewModel.SelectedEmployee; relation.VehicleId = vehicle; return(relation); } else { return(null); } }
public void Initialize() { socket = App.Container.Resolve <FleetServiceClient>(); fleetManagementView = App.Container.Resolve <FleetManagementView>(); fleetManagementViewModel = new FleetManagementViewModel() { LogoutCommand = new RelayCommand(ExecuteLogoutCommand), NewCommand = new RelayCommand(ExecuteNewCommand, BlockExecution), SaveCommand = new RelayCommand(ExecuteSaveCommand, BlockExecution), DeleteCommand = new RelayCommand(ExecuteDeleteCommand, BlockExecution), OpenHomeCommand = new RelayCommand(ExecuteOpenHomeCommand), OpenCostMonthCommand = new RelayCommand(ExecuteOpenCostMonthCommand), OpenCostBusinessAreaCommand = new RelayCommand(ExecuteOpenCostBusinessAreaCommand), OpenVehiclesCommand = new RelayCommand(ExecuteOpenVehiclesCommand), OpenEmployeesCommand = new RelayCommand(ExecuteOpenEmployeesCommand), OpenBusinessAreasCommand = new RelayCommand(ExecuteOpenBusinessAreasCommand), OpenUserCommand = new RelayCommand(ExecuteOpenUserCommand) }; Login(); }
public VehicleToEmployeeRelation AddRelation(FleetServiceClient socket, Vehicle vehicle) { addRelationWindow = new AddRelationWindow(); addRelationViewModel = new AddRelationViewModel() { AddCommand = new RelayCommand(ExecuteAddCommand), CancelCommand = new RelayCommand(ExecuteCancelCommand), Employees = new ObservableCollection <Employee>(socket.GetAllEmployees()), Vehicle = vehicle }; addRelationWindow.DataContext = addRelationViewModel; if (addRelationWindow.ShowDialog() == true) { var relation = addRelationViewModel.Relation; relation.EmployeeId = addRelationViewModel.SelectedEmployee; relation.VehicleId = vehicle; return(relation); } else { return(null); } }
public UserViewController(FleetServiceClient socket, User user, FleetManagementController parent) { this.socket = socket; this.user = user; this.parent = parent; }
public EmployeesViewController(FleetServiceClient socket, FleetManagementController parent) { this.socket = socket; this.parent = parent; }
public CostMonthViewController(FleetServiceClient socket) { this.socket = socket; }
public BusinessAreasViewController(FleetServiceClient socket, FleetManagementController parent) { this.socket = socket; this.parent = parent; }
public CostBusinessAreaViewController(FleetServiceClient socket) { this.socket = socket; }