private void SaveChange(object sender, RoutedEventArgs e) { _ConsoleViewModel.InitializeViewModelData(); List <Shift> temp = _ConsoleViewModel.ShiftList(); Shift found = temp.Find(x => x.ShiftID.Equals(editShiftViewModel.Id)); if (found != null) { found.DateOfShift = editShiftViewModel.Date; int year = editShiftViewModel.Date.Year; int month = editShiftViewModel.Date.Month; int day = editShiftViewModel.Date.Day; found.Coverage = editShiftViewModel.Coverage; found.EndTime = new DateTime(year, month, day, editShiftViewModel.EHour, editShiftViewModel.EMinute, 0); found.StartTime = new DateTime(year, month, day, editShiftViewModel.SHour, editShiftViewModel.SMinute, 0); found.WorkingEmployees = editShiftViewModel.WorkingEmployees; found.AvailableEmployees = editShiftViewModel.AvailableEmployee; found.NumberOfCashiers = editShiftViewModel.NumberOfCashiers; found.NumberOfCooks = editShiftViewModel.NumberOfCooks; found.NumberOfDiswashers = editShiftViewModel.NumberOfDiswashers; found.NumberOfManagers = editShiftViewModel.NumberOfManagers; found.NumberOfWaiters = editShiftViewModel.NumberOfWaiters; } int delete = temp.FindIndex(x => x.ShiftID.Equals(editShiftViewModel.Id)); _ConsoleViewModel.DeleteFromShiftList(delete); _ConsoleViewModel.AddShift(found); _ConsoleViewModel.SaveScheduleProgress(); Shiftviewer shiftviewer = new Shiftviewer(); shiftviewer.Show(); this.Close(); }
public UserManagementWindow() { InitializeComponent(); _ConsoleViewModel.InitializeViewModelData(); _UserManagerViewModel = new UserManagerViewModel(_ConsoleViewModel.HolderData.RegisteredEmployees); this.DataContext = _UserManagerViewModel; }
public Shiftviewer() { InitializeComponent(); List <Shift> initialShiftList; _ConsoleViewModel.InitializeViewModelData(); initialShiftList = _ConsoleViewModel.ShiftList(); _ShiftManagermentViewModel = new ShiftManagementViewModel(initialShiftList); this.DataContext = _ShiftManagermentViewModel; }
private void rdAvailable_Checked(object sender, RoutedEventArgs e) { // put on available list if (SelectedSchedule.AvailableEmployees.Exists(x => x.ID == _CurrentUser.ID) == false) { SelectedSchedule.AvailableEmployees.Add(_CurrentUser); } List <Shift> ShiftList = _ConsoleViewModel.ShiftList(); int index = ShiftList.FindIndex(x => x.ShiftID.Equals(SelectedSchedule.ShiftID)); _ConsoleViewModel.DeleteFromShiftList(index); _ConsoleViewModel.AddShift(SelectedSchedule); _ConsoleViewModel.SaveScheduleProgress(); _ConsoleViewModel.InitializeViewModelData(); }
public ManageShifts(Employee CurrentUser) { InitializeComponent(); _ConsoleViewModel = new ConsoleViewModel(); _ConsoleViewModel.InitializeViewModelData(); AvailableShifts = new ObservableCollection <Shift>(_ConsoleViewModel.HolderData.CreatedShifts.OrderBy(x => x.StartTime)); _CurrentUser = CurrentUser; NameOfCurrentUser = CurrentUser.UserName; SelectedSchedule = _AvailableShifts.FirstOrDefault <Shift>(); DateOfShift = SelectedSchedule.DateOfShift.ToShortDateString(); StartTimeShift = SelectedSchedule.StartTimeFormatted; EndTimeShift = SelectedSchedule.EndTimeFormatted; ListOfAvailableEmployees = SelectedSchedule.AvailableEmployees.Where <Employee>(employee => employee.ID == _CurrentUser.ID).ToList <Employee>(); if (ListOfAvailableEmployees.Count == 0) { IsAvailable = false; IsNotAvailable = !IsAvailable; } else { IsAvailable = true; IsNotAvailable = !IsAvailable; } this.DataContext = this; }
private void Save_Click(object sender, RoutedEventArgs e) { newShift = new Shift(); newShift.NumberOfCashiers = addShiftViewModel.NumberOfCashiers; newShift.NumberOfCooks = addShiftViewModel.NumberOfCooks; newShift.NumberOfDiswashers = addShiftViewModel.NumberOfDiswashers; newShift.NumberOfWaiters = addShiftViewModel.NumberOfWaiters; newShift.NumberOfManagers = addShiftViewModel.NumberOfManagers; newShift.DateOfShift = addShiftViewModel.ShiftDate; int year = newShift.DateOfShift.Year; int month = newShift.DateOfShift.Month; int day = newShift.DateOfShift.Day; int hour = Convert.ToInt32(addShiftViewModel.StartHour); int min = Convert.ToInt32(addShiftViewModel.StartMinute); newShift.StartTime = new DateTime(year, month, day, hour, min, 0); hour = Convert.ToInt32(addShiftViewModel.EndHour); min = Convert.ToInt32(addShiftViewModel.EndMinute); newShift.EndTime = new DateTime(year, month, day, hour, min, 0); _ConsoleViewModel.InitializeViewModelData(); newShift.ShiftID = newShift.GetHashCode(); _ConsoleViewModel.AddShift(newShift); _ConsoleViewModel.SaveScheduleProgress(); Shiftviewer shiftviewer = new Shiftviewer(); shiftviewer.Show(); this.Close(); }
private void btnSignIn_Click(object sender, RoutedEventArgs e) { consoleViewModel.InitializeViewModelData(); List <Employee> Employees = new List <Employee>(); Employees = consoleViewModel.EmployeeList(); if (!_MainWindowViewModel.ManagerEnabled && _MainWindowViewModel.UserName == "admin" && _MainWindowViewModel.Password == "x123xadmin") { MainMenuWindow mainMenuWindow = new MainMenuWindow(); mainMenuWindow.Show(); this.Close(); return; } if (!_MainWindowViewModel.EmployeeEnabled && Employees.Exists(x => x.UserName == _MainWindowViewModel.UserName)) { Employee found = Employees.Find(x => x.UserName == _MainWindowViewModel.UserName); if (found.PIN == _MainWindowViewModel.Password && found.IsManager == false) { //Window needs to be changed to employee UI EmployeeView employeeView = new EmployeeView(found); employeeView.Show(); this.Close(); return; } else { MessageBox.Show("Wrong Password"); return; } } if (!_MainWindowViewModel.ManagerEnabled && Employees.Exists(x => x.UserName == _MainWindowViewModel.UserName)) { Employee ManagerFound = Employees.Find(x => x.UserName == _MainWindowViewModel.UserName); if (ManagerFound.PIN == _MainWindowViewModel.Password && ManagerFound.IsManager == true) { MainMenuWindow mainMenuWindow = new MainMenuWindow(); mainMenuWindow.Show(); this.Close(); return; } else { MessageBox.Show("Wrong Password"); return; } } MessageBox.Show("\r\nWrong Login Username/ Password (Case Sensitivity)\r\n" + "\nCheck User Preference"); return; }
private void btnPrintScheduleButton_Click(object sender, RoutedEventArgs e) { string filePath; _ConsoleViewModel.InitializeViewModelData(); _ConsoleViewModel.GenerateSchedule(); _ConsoleViewModel.SaveScheduleProgress(); filePath = _ConsoleViewModel.PrintSchedule(); MessageBox.Show("\r\nSchedule Printed!\r\nYou can find the file at: " + filePath + "\r\n"); }
public MainMenuWindow() { InitializeComponent(); _ConsoleViewModel = new ConsoleViewModel(); _ConsoleViewModel.InitializeViewModelData(); }
static void Main(string[] args) { ConsoleViewModel _ConsoleViewModel = new ConsoleViewModel(); char choice = '0'; _ConsoleViewModel.InitializeViewModelData(); Console.WriteLine("Welcome to the Scheduleator! By: DropTables, LLC\n"); while (choice != 'Q' || choice != 'q') { Console.WriteLine("S) Add a Shift\r"); Console.WriteLine("L) List of Shifts\r"); Console.WriteLine("A) Add an Employee\r"); Console.WriteLine("E) Set Employee Availablity\r"); Console.WriteLine("D) Display all Employee\r"); Console.WriteLine("C) Save Progress\r"); Console.WriteLine("G) Generate Schedule\r"); Console.WriteLine("P) Print Schedule\r"); Console.WriteLine("Q) Exit Scheduleator\r"); Console.Write("\nPlease Enter Choice: "); choice = Console.ReadKey().KeyChar; switch (choice) { case 'C': case 'c': _ConsoleViewModel.SaveScheduleProgress(); break; case 'G': case 'g': _ConsoleViewModel.GenerateSchedule(); break; case 'E': case 'e': _ConsoleViewModel.SetEmployeeAvailability(); break; case 'A': case 'a': _ConsoleViewModel.RegisterNewEmployee(); break; case 'D': case 'd': _ConsoleViewModel.DisplayAllRegisteredUsers(); break; case 'S': case 's': //_ConsoleViewModel.CreateNewShift(); break; case 'L': case 'l': _ConsoleViewModel.PrintAllShifts(); break; case 'P': case 'p': _ConsoleViewModel.PrintSchedule(); break; case 'Q': case 'q': Console.WriteLine("\nQuitting the Scheduleator"); _ConsoleViewModel.SaveScheduleProgress(); Console.ReadLine(); return; default: Console.WriteLine("\nYou didn't pick an option. Please try again.\n"); break; } } Console.ReadLine(); }