internal static void Main()
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

            Kitchen kitchen = new Kitchen();

            // Testing ServingArea.cs
            ServingArea.Tables[2].TableStatus = TableStatus.Occupied;
            ServingArea.Tables[5].TableStatus = TableStatus.Reserved;

            foreach (var item in ServingArea.Tables)
            {
                Console.WriteLine(item.TableStatus);
            }

            Console.WriteLine();

            // Testing Hostess
            Hostess hostess = new Hostess("Penka", "12345", "password");

            hostess.ReserveTable(ServingArea.Tables[2], ClientType.Regular);
            hostess.ReserveTable(ServingArea.Tables[1], ClientType.Special);
            hostess.CancelReservation(ServingArea.Tables[5]);

            Console.WriteLine();
            Console.WriteLine(ServingArea.Tables[2].TableStatus);
            Console.WriteLine(ServingArea.Tables[1].TableStatus);
            Console.WriteLine(ServingArea.Tables[5].TableStatus);
            Console.WriteLine();

            // Testing Waiters
            MenuItem         menu     = new MenuItem();
            IList <MenuItem> menuList = menu.InitializeMenu();

            Waiter waiter = new Waiter("Todor", "56789", "password");

            waiter.AddMenuItemToOrder(ServingArea.Tables[1], menuList[2]);
            waiter.AddMenuItemToOrder(ServingArea.Tables[1], menuList[1]);
            waiter.AddMenuItemToOrder(ServingArea.Tables[1], menuList[0]);
            waiter.RemoveItemFromOrder(ServingArea.Tables[1], menuList[0]);
            waiter.CalculateCheck(ServingArea.Tables[1]);
            waiter.PrintCheck(ServingArea.Tables[1]);

            waiter.CloseTable(ServingArea.Tables[1], CheckPaymentMethod.Cash);

            waiter.AddMenuItemToOrder(ServingArea.Tables[3], menuList[5]);
            waiter.CalculateCheck(ServingArea.Tables[3]);
            waiter.CloseTable(ServingArea.Tables[3], CheckPaymentMethod.Card);
            waiter.AddMenuItemToOrder(ServingArea.Tables[2], menuList[11]);
            waiter.CalculateCheck(ServingArea.Tables[2]);
            waiter.CloseTable(ServingArea.Tables[2], CheckPaymentMethod.Card);

            Waiter waiter2 = new Waiter("Alex", "88888", "password8");

            waiter2.AddMenuItemToOrder(ServingArea.Tables[7], menuList[8]);
            waiter2.CalculateCheck(ServingArea.Tables[7]);
            waiter2.PrintCheck(ServingArea.Tables[7]);
            waiter2.CloseTable(ServingArea.Tables[7], CheckPaymentMethod.Cash);
            Console.WriteLine();

            // Testing Manager
            Manager manager = new Manager("Ivan", "67456745", "pass");

            manager.CreateReport("03/04/15", "09/04/15");
            Console.WriteLine();
            manager.CreateEmployeeReport(waiter, "03/04/15", "09/04/15");

            // Testing Kitchen
            Console.WriteLine("Orders received by Kitchen:");
            foreach (var item in DishesToCook)
            {
                Console.WriteLine(item.ToString());
            }
        }
Exemple #2
0
        /// <summary>
        /// Initialization
        /// Functions
        /// Constructor for the mission main window
        /// </summary>
        public MainWindowShift(Handlers _Global_Handler, Database.Database _Database_Handler, Mission _Mission)
        {
            try
            {
                //Initialize the components
                InitializeComponent();
                this.Closing += new CancelEventHandler(Window_Closing);

                //Initialize variables
                m_Global_Handler   = _Global_Handler;
                m_Database_Handler = _Database_Handler;
                m_Mission          = _Mission;

                //Load shifts
                List <String> listShiftsId = new List <string>();
                if (m_Mission.id_list_shifts != null)
                {
                    listShiftsId = new List <string>(m_Mission.id_list_shifts.Split(';'));
                }
                m_ListOfShifts = m_Database_Handler.Get_ShiftsFromListOfId(listShiftsId);
                m_ListOfShifts.Sort((x, y) => DateTime.Compare(Convert.ToDateTime(x.date + " " + x.start_time), Convert.ToDateTime(y.date + " " + y.start_time)));

                //Fill infos mission
                Txt_Shifts_Mission.Text           = m_Mission.description;
                Txt_Shifts_Mission_City.Text      = m_Mission.city;
                Txt_Shifts_Mission_Client.Text    = m_Mission.client_name;
                Txt_Shifts_Mission_EndDate.Text   = m_Mission.end_date;
                Txt_Shifts_Mission_StartDate.Text = m_Mission.start_date;
                if (m_Mission.start_date != "")
                {
                    Cld_Shifts_Shift_Date.SelectedDate = Convert.ToDateTime(m_Mission.start_date);
                    Cld_Shifts_Shift_Date.DisplayDate  = Convert.ToDateTime(m_Mission.start_date);
                }
                Txt_Shifts_Shift_HourlyRate.Text = SoftwareObjects.GlobalSettings.hourly_rate;
                Txt_Shifts_Shift_Pause.Text      = SoftwareObjects.GlobalSettings.pause_duration;

                //Fill combo boxes
                for (int iHour = 0; iHour <= 24; ++iHour)
                {
                    Cmb_Shifts_Shift_EndHour_Hour.Items.Add(iHour.ToString("00"));;
                    Cmb_Shifts_Shift_StartHour_Hour.Items.Add(iHour.ToString("00"));;
                }
                Cmb_Shifts_Shift_EndHour_Hour.SelectedIndex   = 12;
                Cmb_Shifts_Shift_StartHour_Hour.SelectedIndex = 8;
                for (int iMin = 0; iMin < 4; ++iMin)
                {
                    int min = iMin * 15;
                    Cmb_Shifts_Shift_EndHour_Min.Items.Add(min.ToString("00"));;
                    Cmb_Shifts_Shift_StartHour_Min.Items.Add(min.ToString("00"));;
                }
                Cmb_Shifts_Shift_EndHour_Min.SelectedIndex   = 0;
                Cmb_Shifts_Shift_StartHour_Min.SelectedIndex = 0;

                for (int iHostess = 0; iHostess < SoftwareObjects.HostsAndHotessesCollection.Count; ++iHostess)
                {
                    Hostess hostess = SoftwareObjects.HostsAndHotessesCollection[iHostess];
                    if (hostess.archived == 0)
                    {
                        string name = hostess.zipcode + " \t " + hostess.firstname + " " + hostess.lastname;
                        m_List_HostsAndHostesses.Add(name);
                        m_List_IdHostsAndHostesses.Add(hostess.id);
                        Cmb_Shifts_Shift_HostOrHostess.Items.Add(name);
                    }
                }
                //Fill shifts datagrid
                m_Datagrid_Missions_ShiftsCollection.Clear();
                for (int iShift = 0; iShift < m_ListOfShifts.Count; ++iShift)
                {
                    Shift shiftSel = m_ListOfShifts[iShift];
                    m_Datagrid_Mission_Shifts data = new m_Datagrid_Mission_Shifts(shiftSel.id, shiftSel.date,
                                                                                   SoftwareObjects.HostsAndHotessesCollection.Find(x => x.id.Equals(shiftSel.id_hostorhostess)).firstname + " " +
                                                                                   SoftwareObjects.HostsAndHotessesCollection.Find(x => x.id.Equals(shiftSel.id_hostorhostess)).lastname,
                                                                                   shiftSel.start_time, shiftSel.end_time);
                    m_Datagrid_Missions_ShiftsCollection.Add(data);
                }
                Datagrid_Shifts.Items.Refresh();

                //Define content
                Define_Content();
            }
            catch (Exception exception)
            {
                m_Global_Handler.Log_Handler.WriteException(MethodBase.GetCurrentMethod().Name, exception);
                return;
            }
        }
        public static void EnsureDatabaseSeeded(this AirportContext context)
        {
            if (!context.Airplanes.Any())

            {
                Flight f1 = new Flight
                {
                    Number        = "PS101",
                    Departure     = "London",
                    DepartureTime = DateTime.Now + new TimeSpan(0, 30, 45),
                    Destination   = "Paris",
                    ArrivalTime   = DateTime.Now + new TimeSpan(3, 15, 0),
                };
                Flight f2 = new Flight
                {
                    Number        = "PS177",
                    Departure     = "London",
                    DepartureTime = DateTime.Now + new TimeSpan(0, 45, 45),
                    Destination   = "New York",
                    ArrivalTime   = DateTime.Now + new TimeSpan(3, 15, 0),
                };
                Flight f3 = new Flight
                {
                    Number        = "PS166",
                    Departure     = "London",
                    DepartureTime = DateTime.Now + new TimeSpan(1, 0, 45),
                    Destination   = "Madrid",
                    ArrivalTime   = DateTime.Now + new TimeSpan(3, 15, 0),
                };
                context.AddRange(new List <Flight> {
                    f1, f2, f3
                });
                context.SaveChanges();


                Ticket t1 = new Ticket {
                    FlightNumber = "PS101", Price = 300, FlightId = f1.Id
                };
                Ticket t2 = new Ticket {
                    FlightNumber = "PS101", Price = 300, FlightId = f1.Id
                };
                Ticket t3 = new Ticket {
                    FlightNumber = "PS101", Price = 300, FlightId = f1.Id
                };
                Ticket t4 = new Ticket {
                    FlightNumber = "PS101", Price = 300, FlightId = f1.Id
                };
                Ticket t5 = new Ticket {
                    FlightNumber = "PS177", Price = 600, FlightId = f2.Id
                };
                Ticket t6 = new Ticket {
                    FlightNumber = "PS177", Price = 600, FlightId = f2.Id
                };
                Ticket t7 = new Ticket {
                    FlightNumber = "PS177", Price = 600, FlightId = f2.Id
                };
                Ticket t8 = new Ticket {
                    FlightNumber = "PS166", Price = 400, FlightId = f3.Id
                };
                Ticket t9 = new Ticket {
                    FlightNumber = "PS166", Price = 400, FlightId = f3.Id
                };
                Ticket t10 = new Ticket {
                    FlightNumber = "PS166", Price = 400, FlightId = f3.Id
                };

                context.AddRange(new List <Ticket> {
                    t1, t2, t3, t4, t5, t6, t7, t8, t9, t9, t10
                });
                context.SaveChanges();

                Departure dep1 = new Departure
                {
                    FlightNumber = "PS101",
                    Time         = DateTime.Now + new TimeSpan(1, 15, 0)
                };
                Departure dep2 = new Departure
                {
                    FlightNumber = "PS177",
                    Time         = DateTime.Now + new TimeSpan(1, 20, 0)
                };


                context.AddRange(new List <Departure> {
                    dep1, dep2
                });
                context.SaveChanges();

                Crew crew1 = new Crew {
                    CrewNumber = 222,
                    //DepartureID = dep1.Id
                };
                Crew crew2 = new Crew {
                    CrewNumber = 665,
                    // DepartureID = dep2.Id
                };


                context.AddRange(new List <Crew> {
                    crew1, crew2
                });
                context.SaveChanges();

                Pilot pilot1 = new Pilot
                {
                    FirstName  = "John",
                    Lastname   = "Smith",
                    BirthDay   = new DateTime(1980, 2, 25),
                    Experience = 8,
                    CrewId     = crew1.Id
                };
                Pilot pilot2 = new Pilot
                {
                    FirstName  = "Paul",
                    Lastname   = "Umtiti",
                    BirthDay   = new DateTime(1973, 5, 16),
                    Experience = 6,
                    CrewId     = crew2.Id
                };

                context.AddRange(new List <Pilot> {
                    pilot1, pilot2
                });
                context.SaveChanges();

                Hostess hostess1 = new Hostess
                {
                    FirstName = "Martie",
                    Lastname  = "Rubin",
                    BirthDay  = new DateTime(1995, 1, 21),
                    CrewID    = crew1.Id
                };
                Hostess hostess2 = new Hostess
                {
                    FirstName = "Natalie",
                    Lastname  = "Martins",
                    BirthDay  = new DateTime(1990, 4, 6),
                    CrewID    = crew1.Id
                };
                Hostess hostess3 = new Hostess
                {
                    FirstName = "Kayli",
                    Lastname  = "Leibnits",
                    BirthDay  = new DateTime(1989, 6, 25),
                    CrewID    = crew2.Id
                };
                Hostess hostess4 = new Hostess
                {
                    FirstName = "Mery",
                    Lastname  = "Poppins",
                    BirthDay  = new DateTime(1993, 11, 12),
                    CrewID    = crew2.Id
                };

                context.AddRange(new List <Hostess> {
                    hostess1, hostess2, hostess3, hostess4
                });
                context.SaveChanges();

                Airplane airplane1 = new Airplane
                {
                    Name         = "UR77777",
                    CreationDate = new DateTime(2011, 6, 15),
                    Lifetime     = 3,
                    DepartureID  = dep1.Id
                };
                Airplane airplane2 = new Airplane
                {
                    Name         = "UR55555",
                    CreationDate = new DateTime(2013, 1, 20),
                    Lifetime     = 4,
                    DepartureID  = dep2.Id
                };


                context.AddRange(new List <Airplane> {
                    airplane1, airplane2
                });
                context.SaveChanges();

                AirplaneType type1 = new AirplaneType
                {
                    Model      = "Boing 747-100",
                    Capacity   = 200,
                    Cargo      = 4000,
                    AirplaneId = airplane1.Id
                };

                AirplaneType type3 = new AirplaneType
                {
                    Model      = "Boing 777",
                    Capacity   = 370,
                    Cargo      = 20000,
                    AirplaneId = airplane2.Id
                };
                context.AddRange(new List <AirplaneType> {
                    type1, type3
                });
                context.SaveChanges();
            }
        }
        /// <summary>
        /// Initialization
        /// Functions
        /// Constructor for the host and hostess main window
        /// </summary>
        public MainWindow_HostOrHostess(Handlers _Global_Handler, Database.Database _Database_Handler, XmlDocument _Cities_DocFrance,
                                        bool _IsModification, Hostess _HostAndHostess)
        {
            try
            {
                //Intialize the components
                InitializeComponent();
                this.Closing += new CancelEventHandler(Window_Closing);

                //Initialize variables
                m_Global_Handler   = _Global_Handler;
                m_Database_Handler = _Database_Handler;
                m_Cities_DocFrance = _Cities_DocFrance;
                m_IsModification   = _IsModification;

                //Define content
                if (m_Global_Handler != null)
                {
                    Define_Content();
                }

                //Select case
                if (m_IsModification == true && _HostAndHostess != null)
                {
                    m_HostOrHostess = _HostAndHostess;

                    //Fill the fields
                    Txt_HostAndHostess_Address.Text   = m_HostOrHostess.address;
                    Txt_HostAndHostess_BirthCity.Text = m_HostOrHostess.birth_city;
                    String[] birthDate = m_HostOrHostess.birth_date.Split(' ');
                    Cmb_HostAndHostess_BirthDate_Day.Text   = birthDate[0];
                    Cmb_HostAndHostess_BirthDate_Month.Text = birthDate[1];
                    Cmb_HostAndHostess_BirthDate_Year.Text  = birthDate[2];
                    Txt_HostAndHostess_CellPhone.Text       = m_HostOrHostess.cellphone;
                    Cmb_HostAndHostess_City.Text            = m_HostOrHostess.city;
                    Cmb_HostAndHostess_Country.Text         = m_HostOrHostess.country;
                    Txt_HostAndHostess_Email.Text           = m_HostOrHostess.email;
                    Txt_HostAndHostess_FirstName.Text       = m_HostOrHostess.firstname;
                    if (m_HostOrHostess.has_car == true)
                    {
                        Cmb_HostAndHostess_Car.Text = m_Global_Handler.Resources_Handler.Get_Resources("Yes");
                    }
                    else
                    {
                        Cmb_HostAndHostess_Car.Text = m_Global_Handler.Resources_Handler.Get_Resources("No");
                    }
                    if (m_HostOrHostess.has_driver_licence == true)
                    {
                        Cmb_HostAndHostess_Licence.Text = m_Global_Handler.Resources_Handler.Get_Resources("Yes");
                    }
                    else
                    {
                        Cmb_HostAndHostess_Licence.Text = m_Global_Handler.Resources_Handler.Get_Resources("No");
                    }
                    Txt_HostAndHostess_IdPaycheck.Text            = m_HostOrHostess.id_paycheck;
                    Chk_HostOrhostess_Language_English.IsChecked  = m_HostOrHostess.language_english;
                    Chk_HostOrhostess_Language_German.IsChecked   = m_HostOrHostess.language_german;
                    Chk_HostOrhostess_Language_Italian.IsChecked  = m_HostOrHostess.language_italian;
                    Txt_HostAndHostess_Language_Others.Text       = m_HostOrHostess.language_others;
                    Chk_HostOrhostess_Language_Spanish.IsChecked  = m_HostOrHostess.language_spanish;
                    Txt_HostAndHostess_LastName.Text              = m_HostOrHostess.lastname;
                    Chk_HostOrhostess_Profile_Event.IsChecked     = m_HostOrHostess.profile_event;
                    Chk_HostOrhostess_Profile_Permanent.IsChecked = m_HostOrHostess.profile_permanent;
                    Chk_HostOrhostess_Profile_Street.IsChecked    = m_HostOrHostess.profile_street;
                    Cmb_HostAndHostess_Sex.Text                  = m_HostOrHostess.sex;
                    Cmb_HostAndHostess_Size.Text                 = m_HostOrHostess.size;
                    Cmb_HostAndHostess_Sizes_Pants.Text          = m_HostOrHostess.size_pants;
                    Cmb_HostAndHostess_Sizes_Shirt.Text          = m_HostOrHostess.size_shirt;
                    Cmb_HostAndHostess_Sizes_Shoes.Text          = m_HostOrHostess.size_shoes;
                    Txt_HostAndHostess_SocialSecurityNumber.Text = m_HostOrHostess.social_number;
                    Txt_HostAndHostess_State.Text                = m_HostOrHostess.state;
                    Txt_HostAndHostess_ZipCode.Text              = m_HostOrHostess.zipcode;
                    if (Cmb_HostAndHostess_Country.SelectedItem.ToString() == "United States")
                    {
                        Lbl_HostAndHostess_State.Visibility = Visibility.Visible;
                        Txt_HostAndHostess_State.Visibility = Visibility.Visible;
                    }

                    //Get repository
                    string repository = SoftwareObjects.GlobalSettings.photos_repository + "\\" + m_HostOrHostess.id;
                    if (Directory.Exists(repository))
                    {
                        //Get photos
                        string[] files = Directory.GetFiles(repository);
                        foreach (var fileName in files)
                        {
                            m_ListOfPhotos.Add(fileName);
                        }

                        //Display the first photo
                        if (m_ListOfPhotos.Count > 0)
                        {
                            string      photoFilename = m_ListOfPhotos[0];
                            BitmapImage photoBmp      = m_Global_Handler.Image_Handler.Load_BitmapImage(photoFilename);
                            Img_HostAndHostess_Photo.Source = photoBmp;
                            Img_HostAndHostess_Photo.Tag    = 0;
                        }
                    }
                }
                else
                {
                    m_HostOrHostess = new Hostess();
                    Cmb_HostAndHostess_BirthDate_Day.Text   = "1";
                    Cmb_HostAndHostess_BirthDate_Month.Text = m_Global_Handler.Resources_Handler.Get_Resources("January");
                    Cmb_HostAndHostess_BirthDate_Year.Text  = "1995";
                    Cmb_HostAndHostess_Car.Text             = "Yes";
                    Cmb_HostAndHostess_Licence.Text         = "Yes";
                    Cmb_HostAndHostess_Size.Text            = "170";
                    Cmb_HostAndHostess_Sizes_Pants.Text     = "34";
                    Cmb_HostAndHostess_Sizes_Shirt.Text     = "S";
                    Cmb_HostAndHostess_Sizes_Shoes.Text     = "37";
                }

                //Select the text box
                Txt_HostAndHostess_FirstName.Focus();

                //Window loaded
                m_IsLoaded = true;
            }
            catch (Exception exception)
            {
                m_Global_Handler.Log_Handler.WriteException(MethodBase.GetCurrentMethod().Name, exception);
                return;
            }
        }