예제 #1
0
        public void OrdersCommand(Client player)
        {
            if (player.GetData(EntityData.PLAYER_KILLED) != 0)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_is_dead);
            }
            else if (player.GetData(EntityData.PLAYER_ON_DUTY) == 0)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_not_on_duty);
            }
            else if (player.GetData(EntityData.PLAYER_DELIVER_ORDER) != null)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.order_delivering);
            }
            else
            {
                if (player.GetData(EntityData.PLAYER_JOB) == Constants.JOB_FASTFOOD)
                {
                    // Get the fastfood deliverer orders
                    FastFood.CheckFastfoodOrders(player);
                    return;
                }

                if (player.GetData(EntityData.PLAYER_JOB) == Constants.JOB_TRUCKER)
                {
                    Trucker.CheckTruckerOrders(player);
                }
            }
        }
예제 #2
0
 public void FastFoodCanAddMenuItemWithNameAndPrice()
 {
     FastFood krustys = new FastFood();
     int BeginningNumberOfMenuItems = krustys.MenuItems.Count;
     krustys.addMenuItem("Chicken Nuggets", 4.00);
     Assert.AreEqual(BeginningNumberOfMenuItems + 1, krustys.MenuItems.Count);
 }
예제 #3
0
        public void CustomerIsReadyToOrderFromAllTypesOfRestaurants()
        {
            Customer Bob = new Customer();
            FastFood krustys = new FastFood(); //Uncomment this line after noticing what is different
            MenuItem coke = new MenuItem();
            coke.Name = "coke";
            MenuItem lasagna = new MenuItem();
            lasagna.Name = "lasagna";
            MenuItem milkshake = new MenuItem();
            milkshake.Name = "milkshake";

            krustys.MenuItems.Add(coke);
            krustys.MenuItems.Add(lasagna);
            krustys.MenuItems.Add(milkshake);

            //The object initializer syntax used for bobsOrder is a shortcut used to set properties on an object when creating it
            Order bobsOrder = new Order
            {
                Drink = "coke",
                Entree = "lasagna",
                Dessert = "milkshake"
            };
            Assert.IsTrue(bobsOrder.VerifyOrderComplete());
            Assert.IsTrue(Bob.ReadyToPlaceOrder(bobsOrder, krustys));
        }
예제 #4
0
        private void listBox3_Click(object sender, EventArgs e) //Product's Listbox for Order
        {
            AllDataContext dc         = new AllDataContext();
            int            selectedId = Convert.ToInt32(listBox3.SelectedValue);
            FastFood       cs         = dc.FastFoods.Single(c => c.Id == selectedId);

            if (txtd1.Text.Equals(""))
            {
                txtd1.Text = cs.Name;
                txtr1.Text = cs.Rate;
            }

            else if (!txtd1.Text.Equals("") && txtd2.Text.Equals(""))
            {
                txtd2.Text = cs.Name;
                txtr2.Text = cs.Rate;
            }

            else if (!txtd2.Text.Equals("") && txtd3.Text.Equals(""))
            {
                txtd3.Text = cs.Name;
                txtr3.Text = cs.Rate;
            }

            else if (!txtd3.Text.Equals("") && txtd4.Text.Equals(""))
            {
                txtd4.Text = cs.Name;
                txtr4.Text = cs.Rate;
            }
            else if (!txtd4.Text.Equals("") && txtd5.Text.Equals(""))
            {
                txtd5.Text = cs.Name;
                txtr5.Text = cs.Rate;
            }
            else if (!txtd5.Text.Equals("") && txtd6.Text.Equals(""))
            {
                txtd6.Text = cs.Name;
                txtr6.Text = cs.Rate;
            }

            else if (!txtd6.Text.Equals("") && txtd7.Text.Equals(""))
            {
                txtd7.Text = cs.Name;
                txtr7.Text = cs.Rate;
            }

            else if (!txtd7.Text.Equals("") && txtd8.Text.Equals(""))
            {
                txtd8.Text = cs.Name;
                txtr8.Text = cs.Rate;
            }
            else if (!txtd1.Text.Equals("") && !txtd2.Text.Equals("") &&
                     !txtd3.Text.Equals("") && !txtd4.Text.Equals("") &&
                     !txtd5.Text.Equals("") && !txtd6.Text.Equals("") &&
                     !txtd7.Text.Equals("") && !txtd8.Text.Equals(""))
            {
                MessageBox.Show("Receipt List are full");
            }
        }
예제 #5
0
        private void listBox2_Click(object sender, EventArgs e)     //Product ListBox
        {
            AllDataContext dc         = new AllDataContext();
            int            selectedId = Convert.ToInt32(listBox2.SelectedValue);
            FastFood       cs         = dc.FastFoods.Single(c => c.Id == selectedId);

            txtUpdatePName.Text = cs.Name;
            txtUpdatePRate.Text = cs.Rate;
        }
예제 #6
0
        public static void RunEx10_13()
        {
            FastFood   krystal   = new FastFood("Krystal");
            CoffeeShop starbucks = new CoffeeShop("Starbucks");
            Fancy      snooty    = new Fancy("Snooty Grill");

            krystal.EatOut();
            starbucks.EatOut();
            snooty.EatOut();
        }
예제 #7
0
        private void PUpdateGrid()                              //Update Product Method
        {
            AllDataContext dc         = new AllDataContext();
            int            selectedId = Convert.ToInt32(listBox2.SelectedValue);
            FastFood       ff         = dc.FastFoods.Single(c => c.Id == selectedId);

            ff.Name = txtUpdatePName.Text;
            ff.Rate = txtUpdatePRate.Text;

            dc.SubmitChanges();
        }
        public FastFood GetFastFood(int id)
        {
            BamiBreadDataContext context = new BamiBreadDataContext();
            FastFood             ff      = context.FastFoods.FirstOrDefault(x => x.ID == id);

            if (ff != null)
            {
                ff.Category = null;
            }
            return(ff);
        }
예제 #9
0
 public async Task IzmeniVrt([FromBody] FastFood res)
 {
     /* var stariRestoran= await Context.Restorani.FindAsync(res.ID);
      * stariRestoran.Kapacitet=res.Kapacitet;
      * stariRestoran.Naziv=res.Naziv;
      * stariRestoran.M=res.M;
      * stariRestoran.N=res.N;
      * stariRestoran.Cena=res.Cena;*/
     Context.Update <FastFood>(res);
     await Context.SaveChangesAsync();
 }
예제 #10
0
        private void AddProduct()                       //Add Product Method
        {
            AllDataContext dc = new AllDataContext();
            FastFood       ff = new FastFood()
            {
                Name = txtPName.Text,
                Rate = txtPRate.Text
            };

            dc.FastFoods.InsertOnSubmit(ff);
            dc.SubmitChanges();
        }
예제 #11
0
        private void btnPDelete_Click(object sender, EventArgs e)   //Delete Product
        {
            AllDataContext dc         = new AllDataContext();
            int            selectedId = Convert.ToInt32(listBox2.SelectedValue);
            FastFood       ff         = dc.FastFoods.Single(c => c.Id == selectedId);

            dc.FastFoods.DeleteOnSubmit(ff);
            dc.SubmitChanges();
            txtUpdatePName.Text = txtUpdatePRate.Text = "";
            MessageBox.Show("Product Deleted Successfully!");
            PRefreshGrid();
            OPRefreshGrid();
        }
예제 #12
0
 private void DeliveryBoy()
 {
     try
     {
         FastFood.Delivery();
         DeliveryBoy();
     }
     catch (ThreadAbortException ex)
     {
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #13
0
 private void ProcesarPedido()
 {
     try
     {
         if (FastFood.listaPedidos.Count > 0)
         {
             FastFood.ProcesarPedido();
         }
         ProcesarPedido();
     }
     catch (ThreadAbortException ex)
     {
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #14
0
 private void GenerarPedido()
 {
     try
     {
         FastFood.GenerarPedido();
         cantVentas++;
         Thread.Sleep(5000);
         if (cantVentas < 20)
         {
             this.GenerarPedido();
         }
     }
     catch (ThreadAbortException ex)
     {
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #15
0
 public async Task UpisiRestoran([FromBody] FastFood res)
 {
     Context.Restorani.Add(res);
     await Context.SaveChangesAsync();
 }
예제 #16
0
 private void btnGenerarPedido_Click(object sender, EventArgs e)
 {
     FastFood.GenerarPedido();
 }
예제 #17
0
 public void FastFoodCanSetDriveThrough()
 {
     FastFood krustys = new FastFood();
     krustys.HasDriveThrough = true;
     Assert.IsTrue(krustys.HasDriveThrough);
 }
예제 #18
0
        private Card RandomCard(Vector2 position, bool front, int playerID)
        {
            Card c = null;

            if (Globals.r.Next(4) == 0)
            {
                int cardsCount = 31;
                int rn         = Globals.r.Next(cardsCount);
                switch (rn)
                {
                case 0:
                    c = new Actor(position, front, playerID);
                    break;

                case 1:
                    c = new Artist(position, front, playerID);
                    break;

                case 2:
                    c = new Astrophysicist(position, front, playerID);
                    break;

                case 3:
                    c = new Babysitter(position, front, playerID);
                    break;

                case 4:
                    c = new BabysitterU(position, front, playerID);
                    break;

                case 5:
                    c = new BusDriver(position, front, playerID);
                    break;

                case 6:
                    c = new Conman(position, front, playerID);
                    break;

                case 7:
                    c = new DeliveryPerson(position, front, playerID);
                    break;

                case 8:
                    c = new DrugDealer(position, front, playerID);
                    break;

                case 9:
                    c = new FastFoodEmployee(position, front, playerID);
                    break;

                case 10:
                    c = new Hacker(position, front, playerID);
                    break;

                case 11:
                    c = new Hitman(position, front, playerID);
                    break;

                case 12:
                    c = new HumanTrafficker(position, front, playerID);
                    break;

                case 13:
                    c = new IndieGameDev(position, front, playerID);
                    break;

                case 14:
                    c = new Influencer(position, front, playerID);
                    break;

                case 15:
                    c = new InstaModel(position, front, playerID);
                    break;

                case 16:
                    c = new InternDev(position, front, playerID);
                    break;

                case 17:
                    c = new JuniorDev(position, front, playerID);
                    break;

                case 18:
                    c = new Musician(position, front, playerID);
                    break;

                case 19:
                    c = new OnlyFans(position, front, playerID);
                    break;

                case 20:
                    c = new Referee(position, front, playerID);
                    break;

                case 21:
                    c = new RiceFarmer(position, front, playerID);
                    break;

                case 22:
                    c = new Santa(position, front, playerID);
                    break;

                case 23:
                    c = new Shelfstacker(position, front, playerID);
                    break;

                case 24:
                    c = new Shoplifter(position, front, playerID);
                    break;

                case 25:
                    c = new Sporter(position, front, playerID);
                    break;

                case 27:
                    c = new Streamer(position, front, playerID);
                    break;

                case 28:
                    c = new SugarDaddy(position, front, playerID);
                    break;

                case 29:
                    c = new TaxiDriver(position, front, playerID);
                    break;

                case 30:
                    c = new Writer(position, front, playerID);
                    break;

                case 26:
                    c = new YogaInstructor(position, front, playerID);
                    break;
                }
            }
            else
            {
                int cardsCount = 12;
                int rn         = Globals.r.Next(cardsCount);
                switch (rn)
                {
                case 0:
                    c = new Alcohol(position, front, playerID);
                    break;

                case 1:
                    c = new Drugs(position, front, playerID);
                    break;

                case 2:
                    c = new EatingOut(position, front, playerID);
                    break;

                case 3:
                    c = new FastFood(position, front, playerID);
                    break;

                case 4:
                    c = new Gambling(position, front, playerID);
                    break;

                case 5:
                    c = new Gaming(position, front, playerID);
                    break;

                case 6:
                    c = new Joint(position, front, playerID);
                    break;

                case 7:
                    c = new PomXML(position, front, playerID);
                    break;

                case 8:
                    c = new Shopping(position, front, playerID);
                    break;

                case 9:
                    c = new Smoking(position, front, playerID);
                    break;

                case 10:
                    c = new SocialMedia(position, front, playerID);
                    break;

                case 11:
                    c = new Streaming(position, front, playerID);
                    break;
                }
            }

            return(c);
        }
예제 #19
0
 public void FastFoodEnsureICanCreateInstance()
 {
     FastFood krustys = new FastFood();
     Assert.IsNotNull(krustys);
 }
예제 #20
0
 private void btnProcesarPedido_Click(object sender, EventArgs e)
 {
     FastFood.ProcesarPedido();
 }
예제 #21
0
        public async Task <FastFoodOrder> OrderFastFood(int productId, string userId, FastFood fastFoodDto)
        {
            try
            {
                var foodToBeOrdered = await _context.Products.FirstOrDefaultAsync(x => x.Id == productId);

                if (foodToBeOrdered == null)
                {
                    return(null);
                }
                if (fastFoodDto.Quantity <= 0)
                {
                    return(null);
                }
                FastFoodOrder fastFoodOrder = new FastFoodOrder
                {
                    DeliveryAddress = fastFoodDto.DeliveryAddress,
                    ProductId       = productId,
                    UserId          = userId,
                    Quantity        = fastFoodDto.Quantity,
                    TotalAmount     = (foodToBeOrdered.Amount * fastFoodDto.Quantity) + foodToBeOrdered.ConvinienceFee
                };
                _context.FastFoodOrders.Add(fastFoodOrder);
                if (await _context.SaveChangesAsync() > 0)
                {
                    return(fastFoodOrder);
                }
                return(null);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.InnerException.ToString());
                return(null);
            }
        }