public abstract class Predicate_Class
public abstract void BankRegister();
public class Predicate : Predicate_Class
public override void BankRegister()
Console.WriteLine("\nEnter The Name of the Account Holder : ");
string name = Console.ReadLine();
Console.WriteLine("\nEnter the Registered Bank Account Phone Number : ");
long phoneno = Convert.ToInt64(Console.ReadLine());
Console.WriteLine("\nEnter the last 4 digits of your Bank Account : ");
long lastdigits = Convert.ToInt64(Console.ReadLine());
Console.WriteLine("Enter your Registered Email ID : ");
string emailid = Console.ReadLine();
Console.WriteLine("\nSuccessful Registration and Updation to Database for Email ID " + emailid + " and Phone Number " + phoneno);
public class Branch_Decorator : Predicate
Predicate p = new Predicate();
Console.WriteLine("\nDo you really wish to register for our Online Banking Portal (1 for Yes/2 for No) ?");
choice = Convert.ToInt64(Console.ReadLine());
Console.WriteLine("\nThank you !! But you have chosen to not register with our Online Portal");
Console.WriteLine("\nINVALID CHOICE");
Predicate p = new Predicate();
Console.WriteLine("\nThe Online Banking Portal has been activated and is ready for the features such as New User Registration");
Console.WriteLine("\nWe urge all our customers to register and login with their respective credentials for availing essential online services");
Predicate p = new Predicate();
Console.WriteLine("\n{0} user has now registered successfully into the Online Banking Portal");
Console.WriteLine("\nThe Online Banking Portal has been activated and is ready for the features such as New User Registration");
Console.WriteLine("\n We urge all our customers to register and login with their respective credentials for availing essential online services");
DateTime start = DateTime.Now;
DateTime end = DateTime.Now;
TimeSpan ts = (end - start);
Console.WriteLine("Elapsed Time is {0} ms", ts.TotalMilliseconds);
public static void Main()
Console.WriteLine("\nONLINE BANKING PORTAL - AT YOUR SERVICE (6 DECORATORS PROGRAM)");
Console.WriteLine("\n1. New User Registration (Predicate Decorator)\n2. New User Registration (Branch Decorator)\n3. New User Registration (Lazy Decorator)\n4. Updation of Registration (Logging Decorator)\n5. Checking the Time Elapsed (Profiling Decorator)\n6. New User Registration (Asynchronous Decorator)\n7. Exit");
Console.WriteLine("\nEnter your required choice of displaying decorator function : ");
choice = Convert.ToInt64(Console.ReadLine());
case 1: Predicate p = new Predicate();
case 2: Branch_Decorator bd = new Branch_Decorator();
case 3: Lazy l = new Lazy();
case 4: Logging lg = new Logging();
case 5: Profiling pg = new Profiling();
case 6: Lazy ly = new Lazy();
case 7: Console.WriteLine("\nEXITING");
default: Console.WriteLine("\nINVALID CHOICE");
Console.WriteLine("Do you wish to Continue (1 for Yes/2 for No) ?");
cho = Convert.ToInt64(Console.ReadLine());