Ejemplo n.º 1
0
    static void Main()
    {
        List <Pastel> pasteles = new List <Pastel>();

        string[] pastelesAzucar   = Console.ReadLine().Split();
        int      cantidadPasteles = Convert.ToInt32(pastelesAzucar[0]);
        int      azucarLimite     = Convert.ToInt32(pastelesAzucar[1]);

        for (int i = 0; i < cantidadPasteles; i++)
        {
            string[] detallesPastel = Console.ReadLine().Split();
            int      aa             = Convert.ToInt32(detallesPastel[0]);
            int      an             = Convert.ToInt32(detallesPastel[1]);
            int      ap             = Convert.ToInt32(detallesPastel[2]);
            if (aa + an <= azucarLimite)
            {
                Pastel pastel = new Pastel(aa, an, ap);
                pasteles.Add(pastel);
            }
        }

        pasteles.Sort();
        int p;

        // Console.WriteLine("Respuesta: ");
        for (p = 0; p < pasteles.Count; p++)
        {
            Console.WriteLine(pasteles[p].AA + " " +
                              pasteles[p].AN + " " +
                              pasteles[p].AP);
        }
    }
Ejemplo n.º 2
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            try
            {
                pastel          = new Pastel();
                pastel.Message += new Pastel.MessageHandler(pastel_Message);
                pastel.InitialisePastel();
                String msg;
                pastel_Message(this, new PastelArgs("Mail Receiver"));
                receiver = new MailReceiver(out msg);
                pastel_Message(this, new PastelArgs("SMS Poll"));
                smsPoll = new SMSPoll();
                smsPoll.NewMessageEvent += new EventHandler <MessageArgs>(smsPoll_NewMessageEvent);
                smsPoll.InitializePolling();
                pastel_Message(this, new PastelArgs("Statement Runner"));
                statementRunner          = new Statement();
                statementRunner.Message += new Statement.MessageHandler(statementRunner_Message);

                pastel_Message(this, new PastelArgs("Purger"));
                Purger purger = new Purger();
            }
            catch (Exception ex)
            {
                pastel_Message(this, new PastelArgs("Startup Error: " + ex.Message));
            }

            pastel_Message(this, new PastelArgs("Startup Completed"));
        }
Ejemplo n.º 3
0
 public static void RunProgram()
 {
     mainF       = new frmMain();
     dataHandler = new SqlDataHandler();
     Login();
     pastel = new Pastel();
 }
Ejemplo n.º 4
0
        public ActionResult Registrar(Pastel pastel)
        {
            pastel.ID_CATALOGO = 1;


            _repositorio.Agregar(pastel);

            return(View());
        }
Ejemplo n.º 5
0
 [HttpPost] //Cadastra as informações no banco de dados
 public ActionResult Cadastrar(Pastel pastel)
 {
     //Cadastrar um pastel no banco de dados
     banco.Pasteis.Add(pastel);
     //Salvar as alterações
     banco.SaveChanges();
     //Mostrar uma mensagem de sucesso
     TempData["msg"] = "Cadastrado!";
     return(View());
 }
 public PastelResource ConvertToResource(Pastel pastel)
 {
     return(new PastelResource
     {
         Id = pastel.Id,
         Ingredients = pastel.Ingredients,
         Price = pastel.Price,
         CreatedById = pastel.CreatedById,
         CreatedOn = pastel.CreatedOn,
         LastModifiedById = pastel.LastModifiedById,
         LastModifiedOn = pastel.LastModifiedOn,
         Name = pastel.Name,
         FlavorImageUrl = pastel.FlavorImageUrl
     });
 }
Ejemplo n.º 7
0
        public void AgregarAlCarrito(Pastel pastel, int cantidad)
        {
            var articulo = db.ArticulosCarritoCompras.SingleOrDefault(
                s => s.Pastel.PastelId == pastel.PastelId && s.CarritoComprasId == IdCarritoCompras);

            if (articulo == null)
            {
                articulo = new ArticuloCarritoCompras
                {
                    CarritoComprasId = IdCarritoCompras,
                    Pastel           = pastel,
                    Cantidad         = 1
                };
                db.ArticulosCarritoCompras.Add(articulo);
            }
            else
            {
                articulo.Cantidad++;
            }
            db.SaveChanges();
        }
Ejemplo n.º 8
0
        public int RetirarDeCarrito(Pastel pastel)
        {
            var articulo = db.ArticulosCarritoCompras.SingleOrDefault(
                s => s.Pastel.PastelId == pastel.PastelId && s.CarritoComprasId == IdCarritoCompras);

            var cantidadLocal = 0;

            if (articulo != null)
            {
                if (articulo.Cantidad > 1)
                {
                    articulo.Cantidad--;
                    cantidadLocal = articulo.Cantidad;
                }
                else
                {
                    db.ArticulosCarritoCompras.Remove(articulo);
                }
            }
            db.SaveChanges();
            return(cantidadLocal);
        }
    public override void escolhersalgado()
    {
        Pastel pastel = new Pastel("Pastel", "3.50 R$");

        lojaSV.salgado = pastel;
    }