Example #1
0
        static void Main(string[] args)
        {
            BankAccountFacade accessingBank = new BankAccountFacade(12345678, 1234);

            accessingBank.WithdrawCash(50.00);
            accessingBank.WithdrawCash(990.00);
        }
Example #2
0
        private static void Facade()
        {
            BankAccountFacade accessingBank = new BankAccountFacade(123456, 1234);

            accessingBank.WithDrawCash(50);
            accessingBank.WithDrawCash(60);
            accessingBank.DepositCash(60);
            accessingBank.WithDrawCash(60);
        }
Example #3
0
        static void Main(string[] args)
        {
            BankAccountFacade ba = new BankAccountFacade(12345678, 1234);

            ba.Withdrawn(100);
            ba.Withdrawn(950);

            ba.Deposit(100);
            ba.Withdrawn(200);
        }
Example #4
0
        public static void Run()
        {
            BankAccountFacade facade = new BankAccountFacade(12345678, 1234);

            facade.Withdraw(60);
            facade.Deposit(60);


            facade.Withdraw(1001);
        }
        public ActionResult Index()
        {
            #region Singleton
            Singleton.getInstance().userID   = "180001";
            Singleton.getInstance().userPwd  = "Pwd18001";
            Singleton.getInstance().userName = "******";
            string userID   = Singleton.getInstance().userID;
            string userPwd  = Singleton.getInstance().userPwd;
            string userName = Singleton.getInstance().userName;
            #endregion

            #region Facade
            BankAccountFacade accessingBank = new BankAccountFacade(12345678, 1234);
            string            ResultFacade  = string.Empty;

            ResultFacade += accessingBank.withdrawCash(50.00);

            ResultFacade += accessingBank.withdrawCash(900.00);

            ResultFacade += accessingBank.depositCash(200.00);
            #endregion

            #region Factory Method

            EnemyShipFactory shipFactory = new EnemyShipFactory();
            EnemyShip        theEnemy    = null;
            theEnemy = shipFactory.makeEnemyShip("B");
            string resultFac = doStuffEnemy(theEnemy);


            #endregion

            #region Abstract Factory

            string resultAbstractFac = AbstractFactory.MainFn();

            #endregion

            #region Builder

            RobotBuilder  oldStyleRobot = new OldRobotBuilder();
            RobotEngineer robotEngineer = new RobotEngineer(oldStyleRobot);
            robotEngineer.makeRobot();
            Robot  firstRobot    = robotEngineer.getRobot();
            string resultBuilder = string.Empty;
            resultBuilder += firstRobot.getRobotHead() + "\n";
            resultBuilder += firstRobot.getRobotTorso() + "\n";
            resultBuilder += firstRobot.getRobotArms() + "\n";
            resultBuilder += firstRobot.getRobotLegs() + "\n";

            RobotBuilder  newStyleRobot    = new NewRobotBuilder();
            RobotEngineer robotEngineerNew = new RobotEngineer(newStyleRobot);
            robotEngineerNew.makeRobot();
            Robot  secondRobot      = robotEngineerNew.getRobot();
            string resultBuilderNew = string.Empty;
            resultBuilderNew += secondRobot.getRobotHead() + "\n";
            resultBuilderNew += secondRobot.getRobotTorso() + "\n";
            resultBuilderNew += secondRobot.getRobotArms() + "\n";
            resultBuilderNew += secondRobot.getRobotLegs() + "\n";
            #endregion

            #region State

            #endregion



            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application. <br />User ID : "
                              + userID + " <br />User Pwd : " + userPwd + " <br />User Name : " + userName;

            return(View());
        }