Example #1
0
 private void num_CantidadTacos_ValueChanged(object sender, EventArgs e)
 {
     if (cbx_Tacos.Text == "")
     {
     }
     else
     {
         //Crear Entidad Taco
         Tacos tacos = new Tacos();
         tacos.Relleno      = cbx_Tacos.Text.ToString();
         tacos.Precio       = tacos.Precios(tacos.Relleno);
         txt_ValorTaco.Text = (tacos.Precio * num_CantidadTacos.Value).ToString();
     }
 }
Example #2
0
        //
        #endregion
        //
        //
        #region tacos
        private void btn_agregartaco_Click(object sender, EventArgs e)
        {
            //Limpiar variables
            ListaExtras2.Clear();
            descripcion         = "";
            total               = 0;
            valorextra          = 0;
            txt_ValorFinal.Text = "0";

            listView2.Items.Clear();
            //

            //Validar Checkbox de Extras
            if (ckbx_Pollo1.Checked.Equals(true))
            {
                //Si checkbox esta activado
                descripcion = descripcion + ckbx_Pollo1.Text;
                Extras ext = new Extras();
                ext.Tipo     = "Extra";
                ext.Nombre   = ckbx_Pollo1.Text.ToString();
                ext.Precio   = ext.Precios(ext.Nombre);
                ext.Cantidad = (int)num_CantidadTacos.Value;
                ListaExtras2.Add(ext);
            }
            if (ckbx_Atun1.Checked.Equals(true))
            {
                //Si checkbox esta activado
                descripcion = descripcion + " " + ckbx_Atun1.Text;
                Extras ext = new Extras();
                ext.Tipo     = "Extra";
                ext.Nombre   = ckbx_Atun1.Text.ToString();
                ext.Precio   = ext.Precios(ext.Nombre);
                ext.Cantidad = (int)num_CantidadTacos.Value;
                ListaExtras2.Add(ext);
            }
            if (ckbx_Vacuno1.Checked.Equals(true))
            {
                //Si checkbox esta activado
                descripcion = descripcion + " " + ckbx_Vacuno1.Text;
                Extras ext = new Extras();
                ext.Tipo     = "Extra";
                ext.Nombre   = ckbx_Vacuno1.Text.ToString();
                ext.Precio   = ext.Precios(ext.Nombre);
                ext.Cantidad = (int)num_CantidadTacos.Value;
                ListaExtras2.Add(ext);
            }
            if (ckbx_Bebida1.Checked.Equals(true))
            {
                //Si checkbox esta activado
                descripcion = descripcion + " " + ckbx_Bebida1.Text;
                Extras ext = new Extras();
                ext.Tipo     = "Extra";
                ext.Nombre   = ckbx_Bebida1.Text.ToString();
                ext.Precio   = ext.Precios(ext.Nombre);
                ext.Cantidad = (int)num_CantidadTacos.Value;
                ListaExtras2.Add(ext);
            }

            //Enviar datos a la lista

            foreach (Extras ext in ListaExtras2)
            {
                extratotalT          = extratotalT + ext.CalcularSubtotal();
                valorextra           = valorextra + ext.CalcularSubtotal();
                txt_valorExtraT.Text = extratotalT.ToString();
            }
            Tacos tac = new Tacos();

            tac.Tipo        = "Tacos";
            tac.Relleno     = cbx_Tacos.Text;
            tac.Extras      = descripcion;
            tac.Cantidad    = (int)num_CantidadTacos.Value;
            tac.Precio      = tac.Precios(tac.Relleno) * (int)num_CantidadTacos.Value;
            tac.ValorExtras = valorextra;
            ListaTacos.Add(tac);
            foreach (Tacos taco in ListaTacos)
            {
                ListViewItem item = new ListViewItem();
                item = listView2.Items.Add(taco.Tipo.ToString());
                item.SubItems.Add(taco.Relleno);
                item.SubItems.Add(taco.Extras);
                item.SubItems.Add(taco.Cantidad.ToString());
                item.SubItems.Add(taco.Precio.ToString());
                item.SubItems.Add(taco.ValorExtras.ToString());
                total = total + taco.Precio;
                txt_valortacosF.Text = total.ToString();
            }
            valorfinal                    = Int32.Parse(txt_valortacosF.Text) + Int32.Parse(txt_ValorPizzas.Text) + Int32.Parse(txt_ValorExtra.Text) + Int32.Parse(txt_valorExtraT.Text);
            txt_ValorFinal.Text           = valorfinal.ToString();
            num_CantidadTacos.Value       = 1;
            ckbx_HabilitarExtras1.Checked = false;
        }