Exemplo n.º 1
0
        public void AddLoyalCustomer_ValidEmail_ReturnTrue()
        {
            //Arrange
            var addloyalcustomer = new LoyalCustomer();

            //Act
            addloyalcustomer.Email = "*****@*****.**";
            var result = addloyalcustomer.AddLoyalCustomer();

            //Assert
            Assert.IsTrue(result);
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
0
        private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            int id;

            if (int.TryParse((sender as TextBox).Text, out id))
            {
                LoyalCustomer customer = CustomersStorage.Instance.GetCustomerByID(id);
                if (customer != null)
                {
                    TotalPrice.Text = (originalPrice - originalPrice * customer.GetLoyaltyPercentDiscount() / 100).ToString();
                }
                else
                {
                    TotalPrice.Text = originalPrice.ToString();
                }
            }
            else
            {
                TotalPrice.Text = originalPrice.ToString();
            }
        }
Exemplo n.º 4
0
        public override string ToString()
        {
            string ID                 = "ID" + this.ID.ToString();
            string customerName       = "Name: " + Name.ToString();
            string dateOfRegistration = "Date Of Registration: " + DateOfRegistration.ToString();
            string enteranceDate      = "";

            if (EntranceDate == DateTime.MinValue)
            {
                enteranceDate = "No Enterance Date";
            }
            else
            {
                enteranceDate = EntranceDate.ToString();
            }

            string loyalCustomer = "Loyal Customer: " + LoyalCustomer.ToString();
            string rate          = "Rate: €" + Rate.ToString();
            string balance       = "Balance: €" + Balance.ToString();
            string cardnumbers   = "Cardnumbers: <";

            foreach (string s in Cardnumbers)
            {
                cardnumbers += s + ", ";
            }
            cardnumbers = cardnumbers.Remove(cardnumbers.Length - 2, 2) + ">";

            string spotInfo = ID + ", " +
                              customerName + ", " +
                              DateOfRegistration + ", " +
                              enteranceDate + ", " +
                              loyalCustomer + ", " +
                              rate + ", " +
                              balance + ", " +
                              cardnumbers;

            return(spotInfo);
        }