public void AddLoyalCustomer_ValidEmail_ReturnTrue() { //Arrange var addloyalcustomer = new LoyalCustomer(); //Act addloyalcustomer.Email = "*****@*****.**"; var result = addloyalcustomer.AddLoyalCustomer(); //Assert Assert.IsTrue(result); }
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; }
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(); } }
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); }