示例#1
0
        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;
        }
示例#2
0
        public EditUser(ConsoleViewModel consoleViewModel)
        {
            this.DataContext = this;

            _ConsoleViewModel = consoleViewModel;

            InitializeComponent();
        }
 public MainMenuWindow()
 {
     InitializeComponent();
     _ConsoleViewModel = new ConsoleViewModel();
     _ConsoleViewModel.InitializeViewModelData();
 }
示例#4
0
        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();
        }