Пример #1
0
        public List <Snacks> GetAllData()
        {
            List <Snacks> listOfSnacks = new List <Snacks>();

            string query = "SELECT * from Snacks";

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            while (sdr.Read())
            {
                Snacks sk = new Snacks();
                sk.Sid   = sdr["Sid"].ToString();
                sk.Sname = sdr["Sname"].ToString();

                sk.Ssell = Convert.ToInt32(sdr["Ssell"].ToString());
                // emp.PhnNumber = sdr["PhnNumber"].ToStrings();
                //  emp.Dsell = sdr["Dsell"].ToString();
                //  emp.Designation = sdr["Designation"].ToString();

                listOfSnacks.Add(sk);
            }

            dcc.CloseConnection();

            return(listOfSnacks);
        }
        public void CorrectSnackInventory()
        {
            Machine correctSnack = new Machine(new Dictionary <string, Snacks>());

            correctSnack.CreateSnackInventory();

            Snacks potatoCrisps = correctSnack.Inventory["A1"];
            Snacks moonPie      = correctSnack.Inventory["B1"];
            Snacks drSalt       = correctSnack.Inventory["C2"];
            Snacks tripleMint   = correctSnack.Inventory["D4"];

            Assert.AreEqual("Potato Crisps", potatoCrisps.SnackName);
            Assert.AreEqual(decimal.Parse("3.05"), potatoCrisps.SnackPrice);
            Assert.AreEqual("Chip", potatoCrisps.SnackType);
            Assert.AreEqual(5, potatoCrisps.SnackQuantity);

            Assert.AreEqual("Moon Pie", moonPie.SnackName);
            Assert.AreEqual(decimal.Parse("1.80"), moonPie.SnackPrice);
            Assert.AreEqual("Candy", moonPie.SnackType);
            Assert.AreEqual(5, moonPie.SnackQuantity);

            Assert.AreEqual("Dr. Salt", drSalt.SnackName);
            Assert.AreEqual(decimal.Parse("1.50"), drSalt.SnackPrice);
            Assert.AreEqual("Drink", drSalt.SnackType);
            Assert.AreEqual(5, drSalt.SnackQuantity);

            Assert.AreEqual("Triplemint", tripleMint.SnackName);
            Assert.AreEqual(decimal.Parse("0.75"), tripleMint.SnackPrice);
            Assert.AreEqual("Gum", tripleMint.SnackType);
            Assert.AreEqual(5, tripleMint.SnackQuantity);
        }
Пример #3
0
        static void Main(string[] args)
        {
            // Configuración de la pantalla
            Console.SetWindowPosition(0, 0);
            Console.SetWindowSize(Console.LargestWindowWidth / 2, Console.LargestWindowHeight - 2);


            Console.Title = "Fernanda Lencina 2 º C";

            Changuito changoDeCompras = new Changuito(6);
            Dulce     c1 = new Dulce(Producto.EMarca.Sancor, "ASD012", ConsoleColor.Black);
            Dulce     c2 = new Dulce(Producto.EMarca.Ilolay, "ASD913", ConsoleColor.Red);
            Leche     m1 = new Leche(Producto.EMarca.Pepsico, "HJK789", ConsoleColor.White);
            Leche     m2 = new Leche(Producto.EMarca.Serenisima, "IOP852", ConsoleColor.Blue, Leche.ETipo.Descremada);
            Snacks    a1 = new Snacks(Producto.EMarca.Campagnola, "QWE968", ConsoleColor.Gray);
            Snacks    a2 = new Snacks(Producto.EMarca.Arcor, "TYU426", ConsoleColor.DarkBlue);
            Snacks    a3 = new Snacks(Producto.EMarca.Sancor, "IOP852", ConsoleColor.Green);
            Snacks    a4 = new Snacks(Producto.EMarca.Sancor, "TRE321", ConsoleColor.Green);

            // Agrego 8 ítems (los últimos 2 no deberían poder agregarse ni el m1 repetido) y muestro
            changoDeCompras += c1;
            changoDeCompras += c2;
            changoDeCompras += m1;
            changoDeCompras += m1;
            changoDeCompras += m2;
            changoDeCompras += a1;
            changoDeCompras += a2;
            changoDeCompras += a3;
            changoDeCompras += a4;

            Console.WriteLine(changoDeCompras.ToString());
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Clear();

            // Quito un item y muestro
            changoDeCompras -= c1;

            Console.WriteLine(changoDeCompras.ToString());
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Clear();

            // Muestro solo Leches
            Console.WriteLine(changoDeCompras.Mostrar(changoDeCompras, Changuito.ETipo.Leche));
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Clear();

            // Muestro solo Dulces
            Console.WriteLine(changoDeCompras.Mostrar(changoDeCompras, Changuito.ETipo.Dulce));
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Clear();

            // Muestro solo Snacks
            Console.WriteLine(changoDeCompras.Mostrar(changoDeCompras, Changuito.ETipo.Snacks));
            Console.WriteLine("<-------------PRESIONE UNA TECLA PARA SALIR------------->");
            Console.ReadKey();
        }
Пример #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,SnackName,PortionSize,PricePerPortion,CaloriesPerPortion")] Snacks snacks)
        {
            if (id != snacks.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(snacks);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SnacksExists(snacks.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(snacks));
        }
Пример #5
0
        private void btnSnacks_Click(object sender, EventArgs e)
        {
            Snacks snacks = new Snacks();

            snacks.Show();
            this.Hide();
        }
Пример #6
0
    public void makeSnackMeals()
    {
        dictionarySnacks             = new Dictionary <int, List <Snacks> >();
        UserConnect.ConnectionString = connString;
        cmd = UserConnect.CreateCommand();

        try
        {
            string query = "SELECT TOP " + 21 + " name, protein, fat, Carbohydrates, calories from Ingredients where foodGroup like 'Snacks' ORDER BY NEWID();";

            cmd.CommandText = query;


            UserConnect.Open();
            reader = cmd.ExecuteReader();
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    Snacks snacks = new Snacks();

                    snacks.name          = reader["name"].ToString();
                    snacks.protein       = (int)reader["protein"];
                    snacks.fat           = Convert.ToDouble(reader["fat"]);
                    snacks.carbohydrates = Convert.ToDouble(reader["carbohydrates"]);
                    snacks.calories      = (int)reader["calories"];
                    snacks.servingSize   = 100;


                    double factor = calcSnacks / snacks.calories;
                    snacks.protein       = (int)(snacks.protein * factor);
                    snacks.fat           = snacks.fat * factor;
                    snacks.carbohydrates = snacks.carbohydrates * factor;
                    snacks.calories      = (int)(snacks.calories * factor);
                    snacks.servingSize   = (int)(snacks.servingSize * factor);
                    snackList.Add(snacks);
                }
            }
            for (int i = 0; i < 7; i++)
            {
                List <Snacks> snackMeal = new List <Snacks>();
                for (int j = 0; j < 3; j++)
                {
                    Random rdm = new Random();

                    int num = rdm.Next(0, snackList.Count - 1);
                    snackMeal.Add(snackList[num]);
                    snackList.RemoveAt(num);
                }
                dictionarySnacks.Add(i, snackMeal);
            }
        }
        finally
        {
            cmd.Dispose();
            UserConnect.Close();
        }
    }
Пример #7
0
        static void Main(string[] args)
        {
            Changuito changoDeCompras = new Changuito(5);

            Dulce  c1 = new Dulce(Producto.EMarca.Sancor, "ASD012", ConsoleColor.Black);
            Dulce  c2 = new Dulce(Producto.EMarca.Ilolay, "ASD913", ConsoleColor.Red);
            Leche  m1 = new Leche(Producto.EMarca.Pepsico, "HJK789", ConsoleColor.White);
            Leche  m2 = new Leche(Producto.EMarca.Serenisima, "IOP852", ConsoleColor.Blue, Leche.ETipo.Descremada);
            Snacks a1 = new Snacks(Producto.EMarca.Campagnola, "QWE968", ConsoleColor.Gray);
            Snacks a2 = new Snacks(Producto.EMarca.Arcor, "TYU426", ConsoleColor.DarkBlue);
            Snacks a3 = new Snacks(Producto.EMarca.Sancor, "IOP852", ConsoleColor.Green);


            // Agrego 6 ítems (los últimos 2 no deberían poder agregarse) y muestro
            changoDeCompras += c1;
            changoDeCompras += c2;
            changoDeCompras += m1;
            changoDeCompras += m2;
            changoDeCompras += a1;
            changoDeCompras += a2;
            changoDeCompras += a3;

            Console.WriteLine(changoDeCompras.ToString());
            Console.WriteLine("<---------------------------------------------->");
            Console.ReadKey();
            Console.Clear();


            // Quito un item y muestro
            changoDeCompras -= c1;

            Console.WriteLine(changoDeCompras.ToString());
            Console.WriteLine("<---------------------------------------------->");
            Console.ReadKey();
            Console.Clear();


            // Muestro solo Leches
            Console.WriteLine(changoDeCompras.Mostrar(changoDeCompras, Changuito.ETipo.Leche));
            Console.WriteLine("<---------------------------------------------->");
            Console.ReadKey();
            Console.Clear();


            // Muestro solo Dulces
            Console.WriteLine(changoDeCompras.Mostrar(changoDeCompras, Changuito.ETipo.Dulce));
            Console.WriteLine("<---------------------------------------------->");
            Console.ReadKey();
            Console.Clear();


            // Muestro solo Snacks
            Console.WriteLine(changoDeCompras.Mostrar(changoDeCompras, Changuito.ETipo.Snacks));
            Console.WriteLine("<---------------------------------------------->");
            Console.ReadKey();
        }
Пример #8
0
 public bool RemoveSnack(string snackName)
 {
     if (!Snacks.ContainsKey(snackName))
     {
         Console.WriteLine("Invalid Selection");
         return(false);
     }
     Snacks.Remove(snackName);
     return(true);
 }
Пример #9
0
        public double CalculateValueSnacks()
        {
            var snackPrices = Snacks.Select(x => x.Price).ToList();

            double valueSnacks = 0;

            snackPrices.ForEach(x => valueSnacks += x);

            return(valueSnacks);
        }
Пример #10
0
        public async Task <IActionResult> Create([Bind("Id,SnackName,PortionSize,PricePerPortion,CaloriesPerPortion")] Snacks snacks)
        {
            if (ModelState.IsValid)
            {
                _context.Add(snacks);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(snacks));
        }
Пример #11
0
 public TheGame(int numberOfPlayers, int numberOfSnacks)
 {
     NumberOfPlayers = numberOfPlayers;
     for (int i = 0; i < numberOfPlayers; i++)
     {
         Snakes.Add(new Snake(40, 20, i));
     }
     for (int i = 0; i < numberOfSnacks; i++)
     {
         Snacks.Add(new Snack());
     }
 }
Пример #12
0
        static void Main(string[] args)
        {
            Changuito changoDeCompras = new Changuito(5);

            Dulce  c1 = new Dulce(Producto.EMarca.Sancor, "ASD012", ConsoleColor.Black);
            Dulce  c2 = new Dulce(Producto.EMarca.Ilolay, "ASD913", ConsoleColor.Red);
            Leche  m1 = new Leche(Producto.EMarca.Pepsico, "HJK789", ConsoleColor.White);
            Leche  m2 = new Leche(Producto.EMarca.Serenisima, "IOP852", ConsoleColor.Blue, Leche.ETipo.Descremada);
            Snacks a1 = new Snacks(Producto.EMarca.Campagnola, "QWE968", ConsoleColor.Gray);
            Snacks a2 = new Snacks(Producto.EMarca.Arcor, "TYU426", ConsoleColor.DarkBlue);
            Snacks a3 = new Snacks(Producto.EMarca.Sancor, "IOP852", ConsoleColor.Green); //Repetido no deberia ingresar

            // Agrego 6 ítems (los últimos 2 no deberían poder agregarse) y muestro
            changoDeCompras += c1;
            changoDeCompras += c2;
            changoDeCompras += m1;
            changoDeCompras += m2;
            changoDeCompras += a1;
            changoDeCompras += a2;
            changoDeCompras += a3;

            Console.WriteLine(changoDeCompras.ToString());
            Console.WriteLine("<---------------------------------------------->");
            Console.ReadKey();
            Console.Clear();

            // Quito un item y muestro
            changoDeCompras -= c1;

            Console.WriteLine(changoDeCompras.ToString());
            Console.WriteLine("<---------------------------------------------->");
            Console.ReadKey();
            Console.Clear();

            //Se altera el Orden para que los muestre tal cual el ejecutable funcional, sino iba a imprimir primero Dulce y despues Leche
            // Muestro solo Leches //Antes Dulces
            Console.WriteLine(Changuito.Mostrar(changoDeCompras, Changuito.ETipo.Leche)); //Antes Dulces
            Console.WriteLine("<---------------------------------------------->");
            Console.ReadKey();
            Console.Clear();

            // Muestro solo Dulces //Antes Leche
            Console.WriteLine(Changuito.Mostrar(changoDeCompras, Changuito.ETipo.Dulce)); //Antes Leche
            Console.WriteLine("<---------------------------------------------->");
            Console.ReadKey();
            Console.Clear();

            // Muestro solo Snacks
            Console.WriteLine(Changuito.Mostrar(changoDeCompras, Changuito.ETipo.Snacks));
            Console.WriteLine("<---------------------------------------------->");
            Console.ReadKey();
        }
        public void PurchaseTransactionHappyPathTest()
        {
            MoneyFunctions functionstoTest = new MoneyFunctions();

            Snacks  snackBeingSold = new Snacks();
            decimal balance        = 3M;

            bool expectedResult = true;

            bool actualResult = functionstoTest.PurchaseTransaction(snackBeingSold, balance);

            Assert.AreEqual(expectedResult, actualResult);
        }
        public void PurchaseTransactionNotEnough()
        {
            MoneyFunctions functionstoTest = new MoneyFunctions();

            Snacks snackBeingSold = new Snacks();

            snackBeingSold.SnackPrice = 1.05M;
            decimal balance = 1.00M;

            bool expectedResult = false;

            bool actualResult = functionstoTest.PurchaseTransaction(snackBeingSold);

            Assert.AreEqual(expectedResult, actualResult);
        }
Пример #15
0
        public void AddSnack(Snack snack)
        {
            if (snack != null)
            {
                var apply = snack.ApplyLightPromotion(snack);
                Snacks.Add(snack);

                if (apply)
                {
                    TotalPrice += (snack.TotalPrice - (snack.TotalPrice * 0.1));
                }
                else
                {
                    TotalPrice += snack.TotalPrice;
                }
            }
        }
Пример #16
0
        //vending for lists
        // public Snack ListVend(int snackIndex)
        // {
        //     if (snackIndex < 0 || snackIndex > Snacks.Count - 1)
        //     {
        //         Console.WriteLine("Invalid Selection");
        //         return null;
        //     }
        //     Snack selection = Snacks[snackIndex];
        //     if (CurrentTransaction >= selection.Price)
        //     {
        //         CurrentTransaction -= selection.Price;
        //         return selection;
        //     }
        //     Console.WriteLine("NOT ENOUGH DOUGH");
        //     return null;
        // }



        public Snack Vend(string snackName)
        {
            //check dictionary for property
            if (!Snacks.ContainsKey(snackName))
            {
                Console.WriteLine("Invalid Selection");
                return(null);
            }
            Snack selection = Snacks[snackName];

            if (CurrentTransaction >= selection.Price)
            {
                CurrentTransaction -= selection.Price;
                return(selection);
            }
            Console.WriteLine("NOT ENOUGH DOUGH");
            return(null);
        }
Пример #17
0
 private void button1_Click(object sender, EventArgs e)
 {
     ColdDishes.TServing_size servingSize;
     Snacks.TFromWhat         fromWhat;
     if (cmbFromWhat.SelectedItem != null && cmbServingSize.SelectedItem != null)
     {
         fromWhat    = (Snacks.TFromWhat)Enum.Parse(typeof(Snacks.TFromWhat), cmbFromWhat.SelectedItem.ToString());
         servingSize = (ColdDishes.TServing_size)Enum.Parse(typeof(ColdDishes.TServing_size), cmbServingSize.SelectedItem.ToString());
     }
     else
     {
         MessageBox.Show("В комбооксах не хватает данных!!");
         return;
     }
     object[] value = Form1.GetCommonData(Name, Count, Calories, Price);
     if (value != null)
     {
         Snacks snack = new Snacks(fromWhat, servingSize, (string)value[0], (int)value[1], (double)value[2], (double)value[3]);
         Add_Display(snack, ObjectIndex);
         this.Close();
     }
 }
Пример #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Table[]  tableList = new Table[] { tbMonday, tbTuesday, tbWednesday, tbThursday, tbFriday, tbSaturday, tbSunday };
        string[] days      = new string[] { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
        mp = new MealPlanner(Convert.ToInt32(Session["sUserId"]));

        Dictionary <int, List <Protein> > prDict = mp.getProteins();
        Dictionary <int, List <Carbs> >   cbDict = mp.getCarbs();
        Dictionary <int, List <Fats> >    fDict  = mp.getFats();
        Dictionary <int, List <Snacks> >  skDict = mp.getSnacks();
        Dictionary <int, List <Vegs> >    vDict  = mp.getVegs();

        for (int t = 0; t < tableList.Length; t++)
        {
            TableRow dRow = new TableRow();
            tableList[t].Rows.Add(dRow);
            TableCell dCell = new TableCell();
            dCell.Text       = days[t];
            dCell.Font.Bold  = true;
            dCell.ColumnSpan = 6;
            dCell.ForeColor  = System.Drawing.Color.White;
            dCell.BackColor  = System.Drawing.ColorTranslator.FromHtml("#33b5e5");
            dRow.Cells.Add(dCell);

            for (int m = 0; m < mp.getMeals(); m++)
            {
                TableRow tRow = new TableRow();
                tableList[t].Rows.Add(tRow);
                TableCell tCell = new TableCell();
                tCell.Text       = "Meal" + (m + 1).ToString();
                tCell.Font.Bold  = true;
                tCell.ColumnSpan = 6;
                tCell.ForeColor  = System.Drawing.Color.White;
                tCell.BackColor  = System.Drawing.ColorTranslator.FromHtml("#0d47a1");
                tRow.Cells.Add(tCell);

                TableRow tRow2 = new TableRow();
                tableList[t].Rows.Add(tRow2);
                TableCell hCell = new TableCell();
                hCell.Text = "Name";
                TableCell hCell1 = new TableCell();
                hCell1.Text = "Total Calories";
                TableCell hCell2 = new TableCell();
                hCell2.Text = "Protein(g)";
                TableCell hCell3 = new TableCell();
                hCell3.Text = "Carbs(g)";
                TableCell hCell4 = new TableCell();
                hCell4.Text = "Fats(g)";
                TableCell hCell5 = new TableCell();
                hCell5.Text      = "Serving Size(g)";
                hCell.Font.Bold  = true;
                hCell1.Font.Bold = true;
                hCell2.Font.Bold = true;
                hCell3.Font.Bold = true;
                hCell4.Font.Bold = true;
                hCell5.Font.Bold = true;
                tRow2.Cells.Add(hCell);
                tRow2.Cells.Add(hCell1);
                tRow2.Cells.Add(hCell2);
                tRow2.Cells.Add(hCell3);
                tRow2.Cells.Add(hCell4);
                tRow2.Cells.Add(hCell5);

                TableRow tRow3 = new TableRow();
                tableList[t].Rows.Add(tRow3);
                TableCell pCell  = new TableCell();
                TableCell pCell1 = new TableCell();
                TableCell pCell2 = new TableCell();
                TableCell pCell3 = new TableCell();
                TableCell pCell4 = new TableCell();
                TableCell pCell5 = new TableCell();
                Protein   p      = prDict[t].ElementAt(m);
                pCell.Text  = p.name.ToString();
                pCell1.Text = p.calories.ToString();
                pCell2.Text = p.protein.ToString();
                pCell3.Text = Math.Round(p.carbohydrates, 2).ToString();
                pCell4.Text = Math.Round(p.fat, 2).ToString();
                pCell5.Text = Math.Round(p.servingSize, 2).ToString();
                tRow3.Cells.Add(pCell);
                tRow3.Cells.Add(pCell1);
                tRow3.Cells.Add(pCell2);
                tRow3.Cells.Add(pCell3);
                tRow3.Cells.Add(pCell4);
                tRow3.Cells.Add(pCell5);

                TableRow tRow4 = new TableRow();
                tableList[t].Rows.Add(tRow4);
                TableCell cCell  = new TableCell();
                TableCell cCell1 = new TableCell();
                TableCell cCell2 = new TableCell();
                TableCell cCell3 = new TableCell();
                TableCell cCell4 = new TableCell();
                TableCell cCell5 = new TableCell();
                Carbs     c      = cbDict[t].ElementAt(m);
                cCell.Text  = c.name.ToString();
                cCell1.Text = c.calories.ToString();
                cCell2.Text = c.protein.ToString();
                cCell3.Text = Math.Round(c.carbohydrates, 2).ToString();
                cCell4.Text = Math.Round(c.fat, 2).ToString();
                cCell5.Text = Math.Round(c.servingSize, 2).ToString();
                tRow4.Cells.Add(cCell);
                tRow4.Cells.Add(cCell1);
                tRow4.Cells.Add(cCell2);
                tRow4.Cells.Add(cCell3);
                tRow4.Cells.Add(cCell4);
                tRow4.Cells.Add(cCell5);

                TableRow tRow5 = new TableRow();
                tableList[t].Rows.Add(tRow5);
                TableCell fCell  = new TableCell();
                TableCell fCell1 = new TableCell();
                TableCell fCell2 = new TableCell();
                TableCell fCell3 = new TableCell();
                TableCell fCell4 = new TableCell();
                TableCell fCell5 = new TableCell();
                Fats      f      = fDict[t].ElementAt(m);
                fCell.Text  = f.name.ToString();
                fCell1.Text = f.calories.ToString();
                fCell2.Text = f.protein.ToString();
                fCell3.Text = Math.Round(f.carbohydrates, 2).ToString();
                fCell4.Text = Math.Round(f.fat, 2).ToString();
                fCell5.Text = Math.Round(f.servingSize, 2).ToString();
                tRow5.Cells.Add(fCell);
                tRow5.Cells.Add(fCell1);
                tRow5.Cells.Add(fCell2);
                tRow5.Cells.Add(fCell3);
                tRow5.Cells.Add(fCell4);
                tRow5.Cells.Add(fCell5);

                if (m == 2 || m == 4)
                {
                    int      mm    = m - 2;
                    TableRow tRow6 = new TableRow();
                    tableList[t].Rows.Add(tRow6);
                    TableCell sCell  = new TableCell();
                    TableCell sCell1 = new TableCell();
                    TableCell sCell2 = new TableCell();
                    TableCell sCell3 = new TableCell();
                    TableCell sCell4 = new TableCell();
                    TableCell sCell5 = new TableCell();
                    Snacks    s      = skDict[t].ElementAt(mm);
                    sCell.Text  = s.name.ToString();
                    sCell1.Text = s.calories.ToString();
                    sCell2.Text = s.protein.ToString();
                    sCell3.Text = Math.Round(s.carbohydrates, 2).ToString();
                    sCell4.Text = Math.Round(s.fat, 2).ToString();
                    sCell5.Text = Math.Round(s.servingSize, 2).ToString();
                    tRow6.Cells.Add(sCell);
                    tRow6.Cells.Add(sCell1);
                    tRow6.Cells.Add(sCell2);
                    tRow6.Cells.Add(sCell3);
                    tRow6.Cells.Add(sCell4);
                    tRow6.Cells.Add(sCell5);
                }

                TableRow tRow7 = new TableRow();
                tableList[t].Rows.Add(tRow7);
                TableCell vCell  = new TableCell();
                TableCell vCell1 = new TableCell();
                TableCell vCell2 = new TableCell();
                TableCell vCell3 = new TableCell();
                TableCell vCell4 = new TableCell();
                TableCell vCell5 = new TableCell();
                Vegs      v      = vDict[t].ElementAt(m);
                vCell.Text  = v.name.ToString();
                vCell1.Text = v.calories.ToString();
                vCell2.Text = "<b>Fiber(g):</b>  " + Math.Round(v.fiber, 2).ToString();
                vCell5.Text = Math.Round(v.servingSize, 2).ToString();

                vCell2.ColumnSpan      = 3;
                vCell2.HorizontalAlign = HorizontalAlign.Center;
                tRow7.Cells.Add(vCell);
                tRow7.Cells.Add(vCell1);
                tRow7.Cells.Add(vCell2);
                tRow7.Cells.Add(vCell5);
            }
        }
    }
Пример #19
0
 public void AddItem(Snack snack)
 {
     Snacks.Add(snack);
 }
Пример #20
0
 public void AddItem(Snack snack, int index)
 {
     Snacks.Insert(index, snack);
 }
Пример #21
0
 public void AddItem(Snack snack)
 {
     //add is the new push
     Snacks.Add(snack.Name, snack);
 }
Пример #22
0
        static void Main(string[] args)
        {
            // Configuración de la pantalla
            Console.SetWindowPosition(0, 0);
            Console.SetWindowSize(Console.LargestWindowWidth / 2, Console.LargestWindowHeight - 2);

            // Nombre del alumno
            Console.Title = "MODIA.AGUSTIN.2A.TP02";

            Changuito changoDeCompras = new Changuito(6);

            Dulce  c1 = new Dulce(Producto.EMarca.Sancor, "ASE012", ConsoleColor.Blue);
            Dulce  c2 = new Dulce(Producto.EMarca.Ilolay, "ESD913", ConsoleColor.Cyan);
            Leche  m1 = new Leche(Producto.EMarca.Pepsico, "HEK789", ConsoleColor.DarkCyan);
            Leche  m2 = new Leche(Producto.EMarca.Serenisima, "IOE852", ConsoleColor.DarkMagenta, Leche.ETipo.Entera);
            Snacks a1 = new Snacks(Producto.EMarca.Campagnola, "AWE968", ConsoleColor.Magenta);
            Snacks a2 = new Snacks(Producto.EMarca.Arcor, "TQU426", ConsoleColor.Blue);
            Snacks a3 = new Snacks(Producto.EMarca.Sancor, "IOA852", ConsoleColor.White);
            Snacks a4 = new Snacks(Producto.EMarca.Sancor, "TRA321", ConsoleColor.DarkYellow);

            // Agrego 8 ítems (los últimos 2 no deberían poder agregarse ni el m1 repetido) y muestro
            changoDeCompras += c1;
            changoDeCompras += c2;
            changoDeCompras += m1;
            changoDeCompras += m1;
            changoDeCompras += m2;
            changoDeCompras += a1;
            changoDeCompras += a2;
            changoDeCompras += a3;
            changoDeCompras += a4;

            Console.WriteLine(changoDeCompras.ToString());
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Clear();

            // Quito un item y muestro
            changoDeCompras -= c1;

            Console.WriteLine(changoDeCompras.ToString());
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Clear();

            // Muestro solo Dulces
            Console.WriteLine(Changuito.Mostrar(changoDeCompras, Changuito.ETipo.Dulce));
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Clear();

            // Muestro solo Leches
            Console.WriteLine(Changuito.Mostrar(changoDeCompras, Changuito.ETipo.Leche));
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Clear();

            // Muestro solo Snacks
            Console.WriteLine(Changuito.Mostrar(changoDeCompras, Changuito.ETipo.Snacks));
            Console.WriteLine("<-------------PRESIONE UNA TECLA PARA SALIR------------->");
            Console.ReadKey();
        }
Пример #23
0
        static void Main(string[] args)
        {
            // Configuración de la pantalla
            Console.SetWindowPosition(0, 0);
            Console.SetWindowSize(Console.LargestWindowWidth / 2, Console.LargestWindowHeight - 2);

            // Nombre del alumno
            Console.Title = "Sande Nicolas Alejandro 2°C";

            Changuito changoDeCompras = new Changuito(6);

            Dulce  d1 = new Dulce(Producto.EMarca.Sancor, "ASD012", ConsoleColor.Black);
            Dulce  d2 = new Dulce(Producto.EMarca.Ilolay, "ASD913", ConsoleColor.Red);
            Leche  l1 = new Leche(Producto.EMarca.Pepsico, "HJK789", ConsoleColor.White);
            Leche  l2 = new Leche(Producto.EMarca.Serenisima, "IOP852", ConsoleColor.Blue, Leche.ETipo.Descremada);
            Snacks s1 = new Snacks(Producto.EMarca.Campagnola, "QWE968", ConsoleColor.Gray);
            Snacks s2 = new Snacks(Producto.EMarca.Arcor, "TYU426", ConsoleColor.DarkBlue);
            Snacks s3 = new Snacks(Producto.EMarca.Sancor, "IOP852", ConsoleColor.Green);
            Snacks s4 = new Snacks(Producto.EMarca.Sancor, "TRE321", ConsoleColor.Green);

            // Agrego 8 ítems (los últimos 2 no deberían poder agregarse ni el m1 repetido) y muestro
            changoDeCompras += d1;
            changoDeCompras += d2;
            changoDeCompras += l1;
            changoDeCompras += l1;
            changoDeCompras += l2;
            changoDeCompras += s1;
            changoDeCompras += s2;
            changoDeCompras += s3;
            changoDeCompras += s4;

            Console.WriteLine(changoDeCompras.ToString());
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Beep(14000, 1000);
            Console.Clear();

            // Quito un item y muestro
            changoDeCompras -= d1;

            Console.WriteLine(changoDeCompras.ToString());
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Beep();
            Console.Clear();

            // Muestro solo Leches
            Console.WriteLine(Changuito.Mostrar(changoDeCompras, Changuito.ETipo.Leche));
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Beep();
            Console.Clear();

            // Muestro solo Dulces
            Console.WriteLine(Changuito.Mostrar(changoDeCompras, Changuito.ETipo.Dulce));
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Beep();
            Console.Clear();

            // Muestro solo Snacks
            Console.WriteLine(Changuito.Mostrar(changoDeCompras, Changuito.ETipo.Snacks));
            Console.WriteLine("<-------------PRESIONE UNA TECLA PARA SALIR------------->");
            Console.ReadKey();
            Console.Beep(14000, 1000);
        }
Пример #24
0
        static void Main(string[] args)
        {
            // Configuración de la pantalla
            Console.SetWindowPosition(0, 0);
            Console.SetWindowSize(Console.LargestWindowWidth / 2, Console.LargestWindowHeight - 2);

            // Nombre del alumno
            Console.Title = "Caballero Streppel Andrés 2ºC";

            Changuito changoDeCompras = new Changuito(6);

            Dulce  c1 = new Dulce(Producto.EMarca.Sancor, "ASD012", ConsoleColor.Black);
            Dulce  c2 = new Dulce(Producto.EMarca.Ilolay, "ASD913", ConsoleColor.Red);
            Leche  m1 = new Leche(Producto.EMarca.Pepsico, "HJK789", ConsoleColor.White);
            Leche  m2 = new Leche(Producto.EMarca.Serenisima, "IOP852", ConsoleColor.Blue, Leche.ETipo.Descremada);
            Snacks a1 = new Snacks(Producto.EMarca.Campagnola, "QWE968", ConsoleColor.Gray);
            Snacks a2 = new Snacks(Producto.EMarca.Arcor, "TYU426", ConsoleColor.DarkBlue);
            Snacks a3 = new Snacks(Producto.EMarca.Sancor, "IOP852", ConsoleColor.Green);
            Snacks a4 = new Snacks(Producto.EMarca.Sancor, "TRE321", ConsoleColor.Green);

            // Agrego 8 ítems (los últimos 2 no deberían poder agregarse ni el m1 repetido) y muestro
            changoDeCompras += c1;
            changoDeCompras += c2;
            changoDeCompras += m1;
            changoDeCompras += m1; //Ya lo agrego antes no lo debería agregar ^
            changoDeCompras += m2;
            changoDeCompras += a1;
            changoDeCompras += a2;
            changoDeCompras += a3; //Este  tiene el mismo codigo que m2
            changoDeCompras += a4; //Este tampoco (Por qué?, creo porque no debería haber más lugar)

            Console.WriteLine(changoDeCompras.ToString());
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Clear();

            // Quito un item y muestro
            changoDeCompras -= c1;

            Console.WriteLine(changoDeCompras.ToString());
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Clear();

            //En el ejecutable funcional de ejemplo, está primero Leches y después Dulces, por eso lo intercambie acá

            // Muestro solo Leches
            Console.WriteLine(changoDeCompras.Mostrar(changoDeCompras, Changuito.ETipo.Leche));
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Clear();

            // Muestro solo Dulces
            Console.WriteLine(changoDeCompras.Mostrar(changoDeCompras, Changuito.ETipo.Dulce));
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Clear();

            // Muestro solo Snacks
            Console.WriteLine(changoDeCompras.Mostrar(changoDeCompras, Changuito.ETipo.Snacks));
            Console.WriteLine("<-------------PRESIONE UNA TECLA PARA SALIR------------->");
            Console.ReadKey();
        }
Пример #25
0
        static void Main(string[] args)
        {
            // Configuración de la pantalla
            Console.SetWindowPosition(0, 0);
            Console.SetWindowSize(Console.LargestWindowWidth / 2, Console.LargestWindowHeight - 2);

            // Nombre del alumno
            Console.WriteLine("Matias Palmieri");

            Changuito changoDeCompras = new Changuito(6);

            Dulce  c1 = new Dulce(Producto.EMarca.Sancor, "ASD012", ConsoleColor.Black);
            Dulce  c2 = new Dulce(Producto.EMarca.Ilolay, "ASD913", ConsoleColor.Red);
            Leche  m1 = new Leche(Producto.EMarca.Pepsico, "HJK789", ConsoleColor.White);
            Leche  m2 = new Leche(Producto.EMarca.Serenisima, "IOP852", ConsoleColor.Blue, Leche.ETipo.Descremada);
            Snacks a1 = new Snacks(Producto.EMarca.Campagnola, "QWE968", ConsoleColor.Gray);
            Snacks a2 = new Snacks(Producto.EMarca.Arcor, "TYU426", ConsoleColor.DarkBlue);
            Snacks a3 = new Snacks(Producto.EMarca.Sancor, "IOP852", ConsoleColor.Green);
            Snacks a4 = new Snacks(Producto.EMarca.Sancor, "TRE321", ConsoleColor.Green);

            // Agrego 8 ítems (los últimos 2 no deberían poder agregarse ni el m1 repetido) y muestro
            changoDeCompras = changoDeCompras + c1;
            changoDeCompras = changoDeCompras + c2;
            changoDeCompras = changoDeCompras + m1;
            changoDeCompras = changoDeCompras + m1;
            changoDeCompras = changoDeCompras + m2;
            changoDeCompras = changoDeCompras + a1;
            changoDeCompras = changoDeCompras + a2;
            changoDeCompras = changoDeCompras + a3;
            changoDeCompras = changoDeCompras + a4;

            Console.WriteLine(changoDeCompras.ToString()); ///Preguntar si asi como lo hice esta bien onda si busca eso o que busca
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Clear();

            // Quito un item y muestro
            changoDeCompras -= c1;

            Console.WriteLine(changoDeCompras.ToString());
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Clear();

            // Muestro solo Dulces
            Console.WriteLine(changoDeCompras.Mostrar(changoDeCompras, Changuito.ETipo.Dulce));
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Clear();

            // Muestro solo Leches
            Console.WriteLine(changoDeCompras.Mostrar(changoDeCompras, Changuito.ETipo.Leche));
            Console.WriteLine("<-----------PRESIONE UNA TECLA PARA CONTINUAR----------->");
            Console.ReadKey();
            Console.Clear();

            // Muestro solo Snacks
            Console.WriteLine(changoDeCompras.Mostrar(changoDeCompras, Changuito.ETipo.Snacks));
            Console.WriteLine("<-------------PRESIONE UNA TECLA PARA SALIR------------->");
            Console.ReadKey();
            Console.Clear();

            //aca abajo pruebo el casteo explicito  de producto a string

            Console.WriteLine((string)c1);
            Console.WriteLine((string)m1);
            Console.WriteLine((string)a2);
            Console.ReadKey();
        }