예제 #1
0
        private void OnBackButton_Click(object sender, RoutedEventArgs e)
        {
            OperatorPanel operatorPanel = new OperatorPanel(window);

            window.DataContext = operatorPanel.DataContext;
            window.Content     = operatorPanel.Content;
        }
        private void OnFinishButton_Click(object sender, RoutedEventArgs e)
        {
            if (BirthDate.SelectedDate != null && BirthDate.SelectedDate < DateTime.Now)
            {
                //Трябва да се изпозлва Eployee инстанция и чрез метода AddCustomer се създава клиент и автоматично се записва и в файла. Id-то се генерира автоматично
                Employee lelka = new Employee("lelka", "lelka");
                lelka.AddCustomer(CustomerName.Text, CustomerEmail.Text, BirthDate.DisplayDate, 1);
            }
            else
            {
                MessageBox.Show("Wrong date!");
            }

            OperatorPanel operatorPanel = new OperatorPanel(window);

            window.Content = operatorPanel.Content;
        }
예제 #3
0
        private void OnFinishButton_Click(object sender, RoutedEventArgs e)
        {
            Employee lelka = new Employee("lelka", "lelka");

            string[]   seatsString = Seats.Text.Split(',');
            List <int> seats       = new List <int>();

            for (int i = 0; i < seatsString.Length; i++)
            {
                seats.Add(int.Parse(seatsString[i]));
            }

            lelka.SavePlaces(movieName.Text, projectionHour.Text, seats);

            int id;

            if (int.TryParse(ID.Text, out id))
            {
                LoyalCustomer customer = CustomersStorage.Instance.GetCustomerByID(id);
                if (customer != null)
                {
                    customer.LoyaltyPoints += seats.Count;
                    CustomersStorage.Instance.SetInformation();
                }
            }

            //Ticket Add
            Accountant.Instance.AddTicket(seats.Count, projectionHour.Text, DateTime.Now.DayOfWeek.ToString(), double.Parse(TotalPrice.Text));

            //Statistics calculation
            Accountant.Instance.CalculateTotalStatistic(int.Parse(TotalPrice.Text));

            if (ID.Text != null)
            {
                Accountant.Instance.CalculateLoyalStatistic((ulong)seats.Count);
            }

            Accountant.Instance.CalculateDiscountedStatistic(int.Parse(DiscountedSeats.Text));


            OperatorPanel operatorPanel = new OperatorPanel(window);

            window.DataContext = operatorPanel.DataContext;
            window.Content     = operatorPanel.Content;
        }
예제 #4
0
        private void OnLogInButton_Click(object sender, RoutedEventArgs e)
        {
            if (LogInName.Text == "admin" && LogInPassword.Password == "admin")
            {
                AdminPanel main;

                if (window != null)
                {
                    main               = new AdminPanel(window);
                    window.Content     = main.Content;
                    window.DataContext = main.DataContext;
                }
                else
                {
                    main             = new AdminPanel(this);
                    this.Content     = main.Content;
                    this.DataContext = main.DataContext;
                }
            }

            else if (LogInName.Text == "lelka" && LogInPassword.Password == "lelka")
            {
                OperatorPanel main;

                if (window != null)
                {
                    main               = new OperatorPanel(window);
                    window.Content     = main.Content;
                    window.DataContext = main.DataContext;
                }
                else
                {
                    main             = new OperatorPanel(this);
                    this.Content     = main.Content;
                    this.DataContext = main.DataContext;
                }
            }
            else
            {
                MessageBox.Show("Wron username and password!");
            }
        }