Пример #1
0
        public string GenerateMemeberId()
        {
            Random rand = new Random();

            string[] registrationDateSplited = DateOfRegistration.ToString("dd/MM/yyyy").Split("-");
            string   memberNumber            = String.Concat($"{registrationDateSplited[0]}{registrationDateSplited[1]}{registrationDateSplited[2]}_{rand.Next(100, 1000)}");

            return(memberNumber);
        }
Пример #2
0
 public User(string firstName, string lastName, int age, string userName, string password, int phoneNumber)
     : base(firstName, lastName, age, userName, password, phoneNumber)
 {
     DateOfRegistration = DateTime.Now;
     if (TypeOfSubscription == TypeOfSubscription.Annually)
     {
         ExpireDate = DateTime.Now.AddDays(30);
     }
     else if (TypeOfSubscription == TypeOfSubscription.Monthly)
     {
         ExpireDate = DateOfRegistration.AddDays(30);
     }
 }
Пример #3
0
 public User(string firstName, string lastName, int age, string username, string password, int phoneNumber, SubscriptionType subscriptionType)
     : base(firstName, lastName, age, username, password, phoneNumber)
 {
     if (subscriptionType == SubscriptionType.Annual)
     {
         EndOfRegistration = DateOfRegistration.AddYears(1);
     }
     else if (subscriptionType == SubscriptionType.Monthly)
     {
         EndOfRegistration = DateOfRegistration.AddMonths(1);
     }
     Role   = Role.User;
     Movies = new Movie[0];
 }
Пример #4
0
 public User()
 {
     DateOfRegistration = DateTime.Now;
     if (SubscriptionType == SubscriptionType.Annual)
     {
         EndOfRegistration = DateTime.Now.AddDays(365);
     }
     else if (SubscriptionType == SubscriptionType.Monthly)
     {
         EndOfRegistration = DateOfRegistration.AddDays(30);
     }
     Role   = Role.User;
     Movies = new Movie[0];
 }
Пример #5
0
        public void SeeMembershipInfo()
        {
            DateTime oneMonthFromNow = DateOfRegistration.AddMonths(1);

            DateTime oneYearFromNow = DateOfRegistration.AddYears(1);

            TimeSpan daysUntilExpirationOfMembership;

            Console.WriteLine($"\nThis is your membership info:");

            Console.WriteLine($"\nName: { FirstName} { LastName}\n\nUsername: {UserName}");

            Console.Write($"\nYour subscription is:");

            if (TypeOfSubscription == Subscription.Monthly)
            {
                Console.WriteLine(" Monthly;");
                daysUntilExpirationOfMembership = oneMonthFromNow.Subtract(DateTime.Now);
            }

            else
            {
                Console.WriteLine(" Annual;");
                daysUntilExpirationOfMembership = oneYearFromNow.Subtract(DateTime.Now);
            }

            if ((int)daysUntilExpirationOfMembership.TotalDays < 1)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("\nPlease renew your subscription. Your membership has expired.");
                Console.ResetColor();
            }

            else
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine($"\nYou have {(int)daysUntilExpirationOfMembership.TotalDays} days until your membership expires.");
                Console.ResetColor();
            }
        }
Пример #6
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);
        }
Пример #7
0
 public void DisplayInfo()
 {
     Console.WriteLine($"{FirstName} {LastName} | Registered on: {DateOfRegistration.ToShortDateString()}");
 }
Пример #8
0
        public void DisplayInfo()
        {
            string formattedDate = DateOfRegistration.ToString("dd-MMM-yyyy");

            Console.WriteLine($"{FirstName} {LastName} | Registered on: {formattedDate}");
        }
Пример #9
0
        public override string ToString()
        {
            string output = Name + ", " + NumberOfPurchases + ", " + TotalSumOfPurchases + ", " + DateOfRegistration.ToString("dd.MM.yyyy") + ", " + GetRating();

            return(output.ToString());
        }