Beispiel #1
0
    static void Main(string[] args)
    {
        Guest g1 = new Guest(0, 0);

        g1.Create();
        LoggedUser l1 = new LoggedUser(5, 0991111111);

        l1.Create();
        Operator m1 = new Operator(901, 0992111111);

        m1.Create();
        CentalOperator a1 = new CentalOperator(1001, 0993111111);

        a1.Create();
        SuperUser su1 = new SuperUser(1, 1);

        su1.Create();
        Facade facade1 = new Facade(new Add_Sit(), new Calling());

        facade1.Operation1();
        facade1.Operation2();
        Calling cmntr1 = new Calling();
        Add_Sit artcl  = new Add_Sit();

        su1.SetCommand(new ArticleOnCommand(artcl));
        su1.DoSomething();
        su1.UndoSomething();
        su1.SetCommand(new CommentaryOnCommand(cmntr1));
        su1.DoSomething();
        su1.UndoSomething();

        Console.ReadLine();
    }
Beispiel #2
0
    static void Main(string[] args)
    {
        //Factory
        Guest g1 = new Guest(10, "guest10");

        g1.Create();
        LoggedUser l1 = new LoggedUser(11, "user007");

        l1.Create();
        Moderator m1 = new Moderator(12, "mod01");

        m1.Create();
        Admin a1 = new Admin(13, "adminushka2345");

        a1.Create();
        //Singleton
        SuperUser su1 = new SuperUser(14, "owner0987");

        su1.Create();
        //Facade
        Facade facade1 = new Facade(new Article(), new Commentary());

        facade1.Operation1();
        facade1.Operation2();
        //Command
        Commentary cmntr1 = new Commentary();
        Article    artcl  = new Article();

        su1.SetCommand(new ArticleOnCommand(artcl));
        su1.DoSomething();
        su1.UndoSomething();
        su1.SetCommand(new CommentaryOnCommand(cmntr1));
        su1.DoSomething();
        su1.UndoSomething();
        //Mediator
        ManagerMediator mediator = new ManagerMediator();
        SystemUser      customer = new CustomerSystemUser(mediator);
        SystemUser      moder    = new ModeratingSystemUser(mediator);

        mediator.Customer = customer;
        mediator.Moder    = moder;
        customer.Send("Please, add article on this topic...");
        moder.Send("Okay, here it is...");

        Console.ReadLine();
    }
    static void Main(string[] args)
    {
        Guest g1 = new Guest(0, 0);

        g1.Create();
        LoggedUser l1 = new LoggedUser(11, 0991111111);

        l1.Create();
        Operator m1 = new Operator(901, 0992111111);

        m1.Create();
        CentralOperator a1 = new CentralOperator(1001, 0993111111);

        a1.Create();

        SuperUser su1 = new SuperUser(1, 1);

        su1.Create();

        Facade facade1 = new Facade(new Add_Sit(), new Calling());

        facade1.Operation1();
        facade1.Operation2();

        Calling cmntr1 = new Calling();
        Add_Sit artcl  = new Add_Sit();

        su1.SetCommand(new ArticleOnCommand(artcl));
        su1.DoSomething();
        su1.UndoSomething();
        su1.SetCommand(new CommentaryOnCommand(cmntr1));
        su1.DoSomething();
        su1.UndoSomething();

        ManagerIntermediator intermediator = new ManagerIntermediator();
        SystemUser           customer      = new CustomerSystemUser(intermediator);
        SystemUser           moder         = new IntermoderatingSystemUser(intermediator);

        intermediator.Customer = customer;
        intermediator.Moder    = moder;
        customer.Send("I want to add a situation to the map");
        moder.Send("We checked it, everything is in order, it is already on the map");
        Console.ReadLine();
    }