private void btnShiftManagementWindow_Click(object sender, RoutedEventArgs e) { Shiftviewer shiftViewer = new Shiftviewer(); shiftViewer.Show(); this.Close(); }
private void Cancel_Click(object sender, RoutedEventArgs e) { Shiftviewer shiftviewer = new Shiftviewer(); shiftviewer.Show(); this.Close(); }
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 DiscardChange(object sender, RoutedEventArgs e) { Shiftviewer shiftviewer = new Shiftviewer(); shiftviewer.Show(); this.Close(); }
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(); }
private void DeleteShift(object sender, RoutedEventArgs e) { _ConsoleViewModel.InitializeViewModelData(); List <Shift> temp = _ConsoleViewModel.ShiftList(); int delete = temp.FindIndex(x => x.ShiftID.Equals(editShiftViewModel.Id)); if (delete != -1) { _ConsoleViewModel.DeleteFromShiftList(delete); } _ConsoleViewModel.SaveScheduleProgress(); Shiftviewer shiftviewer = new Shiftviewer(); shiftviewer.Show(); this.Close(); }