Esempio n. 1
0
        private static Refeicao escolherRefeicao(int IdRefeicao)
        {
            Refeicao refeicao = null;
            switch (IdRefeicao)
            {
                case 0:
                    refeicao = new Cafe();
                    break;
                case 1:
                    refeicao = new LancheManha();
                    break;
                case 2:
                    refeicao = new Almoco();
                    break;
                case 3:
                    refeicao = new LancheTarde();
                    break;
                case 4:
                    refeicao = new Janta();
                    break;
                case 5:
                    refeicao = new Ceia();
                    break;
            }

            return refeicao;

        }
Esempio n. 2
0
 //-------------------------------SUPPLIER TABLE-------------------------------
 private string GetCafeSup(Cafe cafe, Supplier supplier)
 {
     if (cafe.idcafe == supplier.cafe.idcafe)
     {
         return(cafe.address);
     }
     return("0");
 }
Esempio n. 3
0
        public string Cadastrar(Cafe cafe)
        {
            RepositórioCafe repositório = new RepositórioCafe();

            var resposta = repositório.Create(cafe);

            return(resposta);
        }
Esempio n. 4
0
        public ActionResult DeleteConfirmed(int id)
        {
            Cafe cafe = db.Cafes.Find(id);

            db.Cafes.Remove(cafe);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        //Seed Data
        public void SeedList()
        {
            Cafe ChickenCurry = new Cafe(5, 6.99, "Chicken Curry", "chicken with curry sauce and rice", new List <string> {
                "curry", "chicken"
            });

            _menuRepo.AddMeal(ChickenCurry);//ask why it isnt showing seed data
        }
Esempio n. 6
0
 private static bool GetCafeSup(Cafe cafe, Supplier supplier)
 {
     if (cafe.idcafe == supplier.cafe.idcafe)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 7
0
 //---------------------------------------------SERVE TABLE--------------------------------------------------------------
 private string GetCafeServe(Cafe cafe, Serve serve)
 {
     if (cafe.idcafe == serve.cafe.idcafe)
     {
         return(cafe.address);
     }
     return("0");
 }
Esempio n. 8
0
 //-------------------------------MENU TABLE-------------------------------
 private string GetCafeDish(Cafe cafe, Dish dish)
 {
     if (cafe.idcafe == dish.cafe.idcafe)
     {
         return(cafe.address);
     }
     return("0");
 }
Esempio n. 9
0
 private void Form1_Load(object sender, EventArgs e)
 {
     //Console.Title = "CAFE";
     //Cafe start = new Cafe();
     cafe = new Cafe();
     Balance_Label.Text = "Balance: " + cafe.GetBalance().ToString();
     NewRoundView();
 }
        //view a single menu item
        private void ViewSingleMenuItem()
        {
            Console.Clear();

            Console.WriteLine("Please enter the meal name or number:");

            string input = Console.ReadLine();

            int singleNum;

            bool isItNumber = Int32.TryParse(input, out singleNum);


            if (isItNumber == true)
            {
                Cafe item = _menuRepo.GetItemsByNumber(singleNum);
                if (item != null)
                {
                    string writeIngredients = null;
                    foreach (string ingredients in item.Ingredients)
                    {
                        writeIngredients = ingredients;
                    }
                    Console.WriteLine($"Meal Number: {item.MealNumber}\n" +
                                      $"Meal Name: {item.MealName}\n" +
                                      $"Description: {item.Description}\n" +
                                      $"Ingredients: {writeIngredients}\n" +
                                      $"Price: {item.Price}\n" +
                                      $"\n");
                }
                else
                {
                    Console.WriteLine("There was no meal attributed to that number. \n");
                }
            }
            else
            {
                Cafe item = _menuRepo.GetItemsByName(input);
                if (item != null)
                {
                    string writeIngredients = null;
                    foreach (string ingredients in item.Ingredients)
                    {
                        writeIngredients = ingredients;
                    }
                    Console.WriteLine($"Meal Number: {item.MealNumber}\n" +
                                      $"Meal Name: {item.MealName}\n" +
                                      $"Description: {item.Description}\n" +
                                      $"Ingredients: {writeIngredients}\n" +
                                      $"Price: {item.Price}\n" +
                                      $"\n");
                }
                else
                {
                    Console.WriteLine("There was no meal attributed to that number. \n");
                }
            }
        }
        public void Arrange()
        {
            _repo = new CafeRepo();
            _item = new Cafe(9, "Chicken Tenders", "Best Kid's Meal In House", new List <string> {
                "Chicken tenders", "your choice of potato", "your choice of dipping sauce"
            }, 5.00m);

            _repo.AddItemToCafe(_item);
        }
 public static CafeViewModel GetViewModel(Cafe cafe, ICountryRepository countryRepository, IPageAttachmentUrlRetriever attachmentUrlRetriever)
 {
     return(new CafeViewModel
     {
         PhotoPath = cafe.Fields.Photo == null ? null : attachmentUrlRetriever.Retrieve(cafe.Fields.Photo).RelativePath,
         Note = cafe.Fields.AdditionalNotes,
         Contact = ContactViewModel.GetViewModel(cafe, countryRepository)
     });
 }
Esempio n. 13
0
        public static void ImportFixedData(string path)
        {
            //var excelFile = new ExcelQueryFactory(path) { TrimSpaces = TrimSpacesType.Both, ReadOnly = true };
            //foreach (var row in excelFile.GetWorksheetNames()
            //    .Select(worksheet => (from row in excelFile.Worksheet(worksheet) select row)).SelectMany(rows => rows))
            {
                using (var ds = FillDataSet(path))
                {
                    for (var i = 1; i < ds.Tables[0].Rows.Count; i++)
                    {
                        using (var db = new SqLiteDbContext())
                        {
                            var local = ds.Tables[0].Rows[i][1].ToString();
                            switch (local)
                            {
                            case "Klub":
                                var club = new Club();
                                SetCommonData(club, ds.Tables[0].Rows[i], db);
                                SetClubData(club, ds.Tables[0].Rows[i], db);
                                db.Clubs.AddOrUpdate(x => x.Code, club);
                                break;

                            case "Pub":
                                var pub = new Pub();
                                SetCommonData(pub, ds.Tables[0].Rows[i], db);
                                SetPubData(pub, ds.Tables[0].Rows[i], db);
                                db.Pubs.AddOrUpdate(x => x.Code, pub);
                                break;

                            case "Restaurant":
                                var restaurant = new Restaurant();
                                SetCommonData(restaurant, ds.Tables[0].Rows[i], db);
                                SetRestaurantData(restaurant, ds.Tables[0].Rows[i], db);
                                db.Restaurants.AddOrUpdate(x => x.Code, restaurant);
                                break;

                            case "Kawiarnie":
                                var café = new Cafe();
                                SetCommonData(café, ds.Tables[0].Rows[i], db);
                                SetCaféData(café, ds.Tables[0].Rows[i], db);
                                db.Cafes.AddOrUpdate(x => x.Code, café);
                                break;

                            case "Hotel":
                                var hotel = new Hotel();
                                SetCommonData(hotel, ds.Tables[0].Rows[i], db);
                                SetHotelData(hotel, ds.Tables[0].Rows[i], db);
                                db.Hotels.AddOrUpdate(x => x.Code, hotel);
                                break;
                            }
                            db.SaveChanges();
                        }
                    }
                }
            }
        }
 private void Populate(Cafe model)
 {
     this.Id            = model.Id;
     this.Name          = model.Name;
     this.Address       = model.Address;
     this.Longitude     = model.Longitude;
     this.Latitude      = model.Latitude;
     this.Rating        = (model.CoffeeRating + model.AtmosphereRating) / 2;
     this.NumberOfVotes = model.NumberOfVotes;
 }
        public async Task <ActionResult> UpdateCafeAsync(string id, [FromBody] Cafe updatedCafe)
        {
            bool isUpdateSuccessful = await _cafeService.UpdateCafeAsync(id, updatedCafe);

            if (isUpdateSuccessful)
            {
                return(NoContent());
            }
            return(BadRequest());
        }
        public async Task <ActionResult <Cafe> > GetCafeByIdAsync(string id)
        {
            Cafe cafe = await _cafeService.GetCafeByIdAsync(id);

            if (cafe == null)
            {
                return(NotFound());
            }
            return(Ok(cafe));
        }
Esempio n. 17
0
        public List <Booking> Get(GetAllCafeBookingsRequest request)
        {
            var bookingCtr = new BookingCtr();
            var cafeData   = new Cafe
            {
                ID = request.CafeID,
            };

            return(bookingCtr.GetAllCafeBookings(cafeData));
        }
Esempio n. 18
0
 public async Task CreateValue(Cafe value)
 {
     var docRef = _db.Collection("cafes").Document();
     var user   = new Dictionary <string, object>
     {
         { "name", value.Name },
         { "city", value.City }
     };
     await docRef.SetAsync(user);
 }
Esempio n. 19
0
        public void OnDeparture(Room room, Person person)
        {
            Cafe cafe = room as Cafe;

            if (person is Guest)
            {
                person.FindAndTargetRoom(x => x == (person as Guest).Room);
                cafe.PeopleCount--;
            }
        }
Esempio n. 20
0
 /// <summary>
 /// Gets ViewModel for <paramref name="cafe"/>.
 /// </summary>
 /// <param name="cafe">Cafe.</param>
 /// <param name="attachmentUrlRetriever">Attachment URL retriever.</param>
 /// <returns>Hydrated view model.</returns>
 public static CafeCardViewModel GetViewModel(Cafe cafe, IPageAttachmentUrlRetriever attachmentUrlRetriever)
 {
     return(cafe == null
         ? new CafeCardViewModel()
         : new CafeCardViewModel
     {
         Name = cafe.Fields.Name,
         PhotoPath = cafe.Fields.Photo == null ? null : attachmentUrlRetriever.Retrieve(cafe.Fields.Photo).RelativePath
     });
 }
Esempio n. 21
0
 public ActionResult Edit([Bind(Include = "Id,Name,Address,Area,Tradingname,Industry_Description,Latitude,Longitude")] Cafe cafe)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cafe).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cafe));
 }
        public Cafe UpdateCafe(Cafe cafe)
        {
            var updateCafe = GetCafeById(cafe.Id);

            updateCafe.Name = cafe.Name;
            updateCafe.City = cafe.City;
            _cafeDbContext.Update(cafe);
            _cafeDbContext.SaveChanges();
            return(cafe);
        }
        public void Arrange()
        {
            Cafe Burger = new Cafe(5, "Burger", "Single Beef Burger", "Bun, Beefpatty", 5.00);

            _repo.AddNewMenuItems(Burger);

            Cafe eggs = new Cafe(6, "Eggs", "2 Eggs", "Eggs", 4.25);

            _repo.AddNewMenuItems(eggs);
        }
Esempio n. 24
0
        private void btnCadCafe_Click(object sender, EventArgs e)
        {
            Cafe cafe = new Cafe(txbCoffee.Text);

            ServiçoCafe serviço = new ServiçoCafe();

            var resposta = serviço.Cadastrar(cafe);

            MessageBox.Show(resposta);
        }
        public void AddNewMenuItems_ShouldReturnTrue()
        {
            Cafe club        = new Cafe(7, "Bacon", "Side of Bacon", "Bacon", 3.75);
            int  beforeCount = _repo.GetMenuList().Count;

            _repo.AddNewMenuItems(club);
            int afterCount = _repo.GetMenuList().Count;

            Assert.IsTrue(afterCount > beforeCount);
        }
Esempio n. 26
0
        public IActionResult Post([FromBody] Cafe value)
        {
            if (value == null)
            {
                return(BadRequest());
            }
            var createdCafe = _cafeService.CreateCafe(value);

            return(CreatedAtRoute("GetCafe", new{ id = createdCafe.Id }, createdCafe));
        }
 /// <summary>
 /// Gets ViewModel for <paramref name="cafe"/>.
 /// </summary>
 /// <param name="cafe">Cafe.</param>
 /// <returns>Hydrated view model.</returns>
 public static CafeCardViewModel GetViewModel(Cafe cafe)
 {
     return(cafe == null
         ? new CafeCardViewModel()
         : new CafeCardViewModel
     {
         Name = cafe.Fields.Name,
         Photo = cafe.Fields.Photo
     });
 }
Esempio n. 28
0
        public List <Table> Get(GetAllTablesInCafeRequest request)
        {
            var tableCtr = new TableCtr();
            var cafeData = new Cafe
            {
                ID = request.ID
            };

            return(tableCtr.GetAllTablesInCafe(cafeData));
        }
Esempio n. 29
0
        static void Main(string[] args)
        {
            try
            {
                //breakfastmenu
                if (DateTime.Now.Hour >= 7 && DateTime.Now.Hour <= 11)
                {
                    Cafe cafe = new Cafe(new BreakfastMenu());

                    Console.WriteLine($"Good morning! It's {DateTime.Now.ToString("HH:mm")} o'clock, today's menu:\n");
                    Console.WriteLine(cafe.ToString());
                    Console.WriteLine("You can also try our lunch menu, come here from 12 to 15 hours");
                    //just for test
                    cafe.Main.DoMain();
                    cafe.Salad.DoSalad();
                    cafe.Dessert.DoDessert();
                    cafe.Drink.DoDrink();
                }
                //lunchmenu
                else if (DateTime.Now.Hour >= 12 && DateTime.Now.Hour <= 14)
                {
                    Cafe cafe = new Cafe(new LunchMenu());

                    Console.WriteLine($"Good afternoon! It's {DateTime.Now.ToString("HH: mm")} o'clock, today's menu:\n");
                    Console.WriteLine(cafe.ToString());
                    Console.WriteLine("You can also try our supper menu, come here from 15 to 19 hours");
                    //just for test
                    cafe.Main.DoMain();
                    cafe.Salad.DoSalad();
                    cafe.Dessert.DoDessert();
                    cafe.Drink.DoDrink();
                }
                //suppermenu
                else if (DateTime.Now.Hour >= 15 && DateTime.Now.Hour <= 18)
                {
                    Cafe cafe = new Cafe(new SupperMenu());

                    Console.WriteLine($"Good evening! It's {DateTime.Now.ToString("HH: mm")} o'clock, today's menu:\n");
                    Console.WriteLine(cafe.ToString());
                    Console.WriteLine("You can also try our breakfast menu, come here tommorow from 7 to 12 hours");
                    //just for test
                    cafe.Main.DoMain();
                    cafe.Salad.DoSalad();
                    cafe.Dessert.DoDessert();
                    cafe.Drink.DoDrink();
                }
                else
                {
                    Console.WriteLine("The Cafe is not working at the moment");
                }
            } catch (Exception e)
            {
                Console.WriteLine($"{e.ToString()}");
            }
        }
        public void AddToCafe_ShouldGetNotNull()
        {
            //Arrange

            //Act
            _repo.AddItemToCafe(_item);
            Cafe itemFromDirectory = _repo.GetItemByNumber(9);

            //Assert
            Assert.IsTrue(_repo.GetCafeItemList().Contains(itemFromDirectory));
        }
Esempio n. 31
0
        public ActionResult Create([Bind(Include = "Id,Name,Address,Area,Tradingname,Industry_Description,Latitude,Longitude")] Cafe cafe)
        {
            if (ModelState.IsValid)
            {
                db.Cafes.Add(cafe);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(cafe));
        }