public async Task <ActionResult> Details(int flightNo, string firstname, string lastname, float basePrice, bool popcorn, bool film, bool mojito)
        {
            /* --- PASSENGER MNGMT --- */
            /*Check if passenger exist*/
            var passenger = new Passenger();

            try
            {
                passenger = await ApiClientFactory.Instance.GetPassenger(firstname, lastname);
            }
            catch (Exception e)
            {
                //Console.WriteLine("No passenger found." + e.Message);

                TempData["error"] = "noAccount";

                return(RedirectToAction("Details", new { id = flightNo }));
            }

            /* --- BOOKING MNGMT --- */
            // Create booking to database
            Booking b = new Booking();

            b.FlightNo    = flightNo;
            b.PassengerID = passenger.PersonID;
            b.SalesPrice  = basePrice;

            //HTTP POST
            var postBooking = await ApiClientFactory.Instance.PostBooking(b);

            /* --- FLIGHT MNGMT --- */
            /*Update flight*/
            //HTTP PUT
            var flight = await ApiClientFactory.Instance.GetFlight(flightNo);

            var putFlight = await ApiClientFactory.Instance.PutFlight(flightNo, flight);

            /* Pattern Decorator*/
            Models.Decorator.Flight f = new Models.Decorator.Flight();

            if (popcorn)
            {
                f = new Popcorn(f);
            }

            if (film)
            {
                f = new Film(f);
            }

            if (mojito)
            {
                f = new Mojito(f);
            }


            String _description = f.GetDescription();

            return(RedirectToAction("BookingDetails", new { id = flightNo, firstname, lastname, price = basePrice, description = _description }));
        }
예제 #2
0
        public Form1()
        {
            InitializeComponent();
            Class1  obj     = new Class1();
            Popcorn popcorn = obj.giveMePopcorn(0, "salty");

            MessageBox.Show(popcorn.tellMe());
        }
예제 #3
0
        static void Facade()
        {
            Screen            screen    = new Screen();
            Tuner             tuner     = new Tuner();
            DVDPlayer         dvdplayer = new DVDPlayer();
            Popcorn           popcorn   = new Popcorn();
            Amplifier         amp       = new Amplifier();
            HomeTheaterFacade facade    = new HomeTheaterFacade(screen, tuner, dvdplayer, popcorn, amp);

            facade.WatchMovie();
            Console.WriteLine();
            facade.EndMovie();
        }
예제 #4
0
    // Use this for initialization
    void Start()
    {
        rand = new System.Random();

        indexIcon = rand.Next(0, 12);
        noEffect  = new Effect("No Disease", 0, false);

        purifyEffect = new Effect("Cure", 1, false);

        malaria = new Effect("Malaria", -1, false);

        bilharzia = new Effect("Bilharzia", -2, false);

        effectExp1 = "lose 1 HP every turn";
        effectExp2 = "Cure all disease and +1 HP";
        effectExp3 = "lose 2 HP every turn";

        effectsActive = new ArrayList();
        foods         = new ArrayList();

        birdseed = new BirdSeed("Bird Seed", 1, noEffect, 0);
        oat      = new Oat("Oat", 1, malaria, 1);
        Lettuce             lettuce             = new Lettuce("Lettuce", 3, bilharzia, 2); // lose speed -> speed/2
        Rice                rice                = new Rice("Rice", 1, purifyEffect, 3);
        RottenGrape         rottenGrape         = new RottenGrape("Rotten Grape", -2, malaria, 4);
        PollutedCrackedCorn pollutedCrackedCorn = new PollutedCrackedCorn("Polluted Cracked Corn", -2, malaria, 5);
        Avocado             avocado             = new Avocado("Avocado", -2, malaria, 6);
        Onion               onion               = new Onion("Onion", -2, purifyEffect, 7);
        Nuts                nuts                = new Nuts("Nuts", -2, purifyEffect, 8);
        Chocolate           chocolate           = new Chocolate("Chocolate", -2, purifyEffect, 9);
        Popcorn             popcorn             = new Popcorn("Popcorn", -2, bilharzia, 10);
        Bread               bread               = new Bread("Bread", -2, malaria, 11);



        for (int i = 0; i < 3; i++)
        {
            foods.Add(birdseed);
            foods.Add(oat);
            foods.Add(lettuce);
            foods.Add(rice);
            foods.Add(rottenGrape);
            foods.Add(pollutedCrackedCorn);
            foods.Add(avocado);
            foods.Add(onion);
            foods.Add(nuts);
            foods.Add(chocolate);
            foods.Add(popcorn);
            foods.Add(bread);
        }
    }
예제 #5
0
파일: Guest.cs 프로젝트: gbrosman27/Theater
        /// <summary>
        /// Buys a bag of popcorn.
        /// </summary>
        /// <param name="popcornStand">The stand from which to purchase the popcorn.</param>
        /// <returns>The bag of popcorn.</returns>
        private Popcorn BuyPopcorn(PopcornStand popcornStand)
        {
            // Define result variable.
            Popcorn result = null;

            // Get the price.
            decimal popcornPrice = popcornStand.ItemPrice;

            decimal popcornPayment = this.wallet.RemoveMoney(popcornPrice);

            result = popcornStand.BuyPopcorn(popcornPayment);

            // Return result
            return(result);
        }
예제 #6
0
        public void When_FoodName_Is_Invalid()
        {
            //1. Acomodo

            //Se generan palomitas, que es una clase que hereda las propiedades de la clase comida.
            Popcorn saladPopcorn = new Popcorn
            {
                Price = 700,
                Name  = "Palomitas Saladas $"
            };

            //2. Acción: Se ejecuta la función que busca si el nombre tiene carácteres de valor de moneda.
            var validation = saladPopcorn.VerifyChars();

            //3. Aserción: Aca se verífica que el sea cierto la busqueda de errores en el nombre.
            Assert.IsTrue(validation);
        }
예제 #7
0
        /// <summary>
        /// Buys a bag of popcorn.
        /// </summary>
        /// <param name="payment">The amount paid for the popcorn.</param>
        /// <returns>A bag of popcorn.</returns>
        public Popcorn BuyPopcorn(decimal payment)
        {
            // Define result variable
            Popcorn result = null;

            if (payment == this.ItemPrice)
            {
                this.AddMoney(payment);
                result = new Popcorn();
            }
            else
            {
                throw new Exception("Not enough money to buy popcorn.");
            }

            // Return result
            return(result);
        }
예제 #8
0
파일: Guest.cs 프로젝트: gbrosman27/Theater
        /// <summary>
        /// Buys concessions.
        /// </summary>
        /// <param name="popcornStand">The stand from which to purchase popcorn.</param>
        /// <param name="sodaCupStand">The stand from which to purchase a soda cup.</param>
        /// <param name="sodaStand">The stand from which to fill a soda cup.</param>
        public void BuyConcessions(PopcornStand popcornStand, SodaCupStand sodaCupStand, SodaStand sodaStand)
        {
            // Buy popcorn
            Popcorn popcorn = this.BuyPopcorn(popcornStand);

            popcorn.AddButter();
            popcorn.AddSalt();
            popcorn.AddSalt();
            this.concessionItems.Add(popcorn);

            // Buy soda
            SodaCup sodaCup = this.BuySoda(sodaCupStand, sodaStand);

            this.concessionItems.Add(sodaCup);

            foreach (ConcessionItem ci in this.concessionItems)
            {
                ci.Consume();
            }
        }
예제 #9
0
        public UserControl_Information(int i, string selectedMovieName, DateTime selectedShowTime, int selectedShowID, int[] chosenSeats)
        {
            InitializeComponent();

            Texts(i, selectedMovieName, selectedShowTime);

            MoviewShowID = selectedShowID;
            chosenSeats2 = new int[i];

            for (int n = 0; n < chosenSeats2.Length; n++)
            {
                chosenSeats2[n] = chosenSeats[n];
            }

            for (int k = 0; k < 4; k++)
            {
                Popcorn popcorn = new Popcorn();
                panelPopcorn.Controls.Add(popcorn);
                popcorn.Left = k * popcorn.Width + 55;
            }
        }
예제 #10
0
 public void spawner()
 {
     if (popEnabled)
     {
         popRemoved = false;
         if (popcornCounter < spawnAmount)
         {
             allPopcorn[popcornCounter] = (GameObject)GameObject.Instantiate(popcorn, new Vector3(transform.position.x + UnityEngine.Random.Range(-spawnWidth, spawnWidth), transform.position.y + UnityEngine.Random.Range(0.0f, spawnHeight), transform.position.z + UnityEngine.Random.Range(-spawnDepth, spawnDepth)), UnityEngine.Random.rotation);
             Popcorn pp = allPopcorn[popcornCounter].GetComponent <Popcorn>();
             pp.popper = this;
             if (!showCorn && (pp.GetComponent <Popcorn>().corn != null))
             {
                 pp.GetComponent <Popcorn>().corn.GetComponent <Renderer>().enabled = false;
             }
             if (popEnabled && popAtOnce)
             {
                 StartCoroutine(pp.GetComponent <Popcorn>().pop(delayMin, delayMax));
             }
             popcornCounter++;
         }
         else
         {
             CancelInvoke("spawner");
             StartCoroutine(removePopcorn());
             if (!popAtOnce)
             {
                 StartCoroutine(popAll(1));
             }
         }
         if (!merging)
         {
             //Debug.Log("merge enabled");
             InvokeRepeating("combineMeshes", this.mergeDelay, .15f);
             merging = true;
         }
     }
 }
예제 #11
0
        /// <summary>
        /// Gets the guest wallet.
        /// </summary>
        //public Wallet Wallet
        //{
        //    get
        //    {
        //        return this.wallet;
        //    }
        //}

        ///// <summary>
        ///// The movie the guest wants to see.
        ///// </summary>
        ///// <param name="movie"></param>
        //public void AddMovieSeen(Movie movie)
        //{

        //}

        ///// <summary>
        ///// Sells the guest concessions.
        ///// </summary>
        ///// <param name="popcornStand"></param>
        ///// <param name="sodaCupStand"></param>
        ///// <param name="sodaStand"></param>
        //public void BuyConcessions(PopcornStand popcornStand, SodaCupStand sodaCupStand, SodaStand sodaStand)
        //{

        //}

        /// <summary>
        /// Lets the guest buy popcorn.
        /// </summary>
        /// <param name="popcorn"></param>
        /// <returns></returns>
        private Popcorn BuyPopcorn(PopcornStand popcorn)
        {
            Popcorn pCorn = new Popcorn();

            return(pCorn);
        }
예제 #12
0
 void Start()
 {
     this.popcorn = GetComponent <Popcorn> ();
     elapsedTime  = REG_TIME;
     regCount     = 0;
 }
예제 #13
0
 public HomeComputerFacade(Computer computer, Popcorn popcorn)
 {
     this.computer = computer;
     this.popcorn  = popcorn;
 }