Exemple #1
0
        protected void mostrar()
        {
            TipoComida tcom = new TipoComida();

            tcom.Nombre        = txtBuscar.Text;
            gvRegis.DataSource = tcom.buscar();
            gvRegis.DataBind();
        }
        protected void listarTipoComida()
        {
            TipoComida cat = new TipoComida();

            if (IsPostBack == false)
            {
                dd1.DataSource     = cat.listarTipoComida();
                dd1.DataValueField = "idTipoComida";
                dd1.DataTextField  = "nombre";
                dd1.DataBind();
                dd1.Items.Insert(0, new ListItem("Selecciona", "0"));
            }
        }
Exemple #3
0
        public List <Comida> ListarComida(int x, int y)
        {
            List <Comida>      listado     = new List <Comida>();
            AccesoDatosManager accesoDatos = new AccesoDatosManager();
            Comida             Comi        = new Comida();
            TipoComida         tipoComida  = new TipoComida();

            try
            {
                if (y == 9999)
                {
                    accesoDatos.setearConsulta("select c.IdComida, c.NombreComida, c.PrecioComida, TC.NombreTipoComida  from COMIDAS as c inner join  TIPOCOMIDA as tc on tc.IdTipoComida=c.TC where tc=@Tipo order by TC");
                    accesoDatos.Comando.Parameters.Clear();
                    accesoDatos.Comando.Parameters.AddWithValue("@Tipo", x);
                }
                else
                {
                    accesoDatos.setearConsulta("select c.IdComida, c.NombreComida, c.PrecioComida, TC.NombreTipoComida  from COMIDAS as c inner join  TIPOCOMIDA as tc on tc.IdTipoComida=c.TC where c.TC=@Tipo or c.TC=@Tipo2  order by TC");
                    accesoDatos.Comando.Parameters.Clear();
                    accesoDatos.Comando.Parameters.AddWithValue("@Tipo", x);
                    accesoDatos.Comando.Parameters.AddWithValue("@Tipo2", y);
                }
                accesoDatos.abrirConexion();
                accesoDatos.ejecutarConsulta();

                while (accesoDatos.Lector.Read())
                {
                    Comi           = new Comida();
                    Comi.Id        = (int)accesoDatos.Lector["IdComida"];
                    Comi.Nombre    = accesoDatos.Lector["NombreComida"].ToString();
                    Comi.Precio    = (decimal)accesoDatos.Lector["PrecioComida"];
                    Comi.TC        = new TipoComida();
                    Comi.TC.Id     = (int)accesoDatos.Lector["IdComida"];
                    Comi.TC.Nombre = accesoDatos.Lector["NombreTipoComida"].ToString();


                    listado.Add(Comi);
                }


                return(listado);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                accesoDatos.cerrarConexion();
            }
        }
Exemple #4
0
        protected void btnEliminar_Click(object sender, EventArgs e)
        {
            TipoComida tcom = new TipoComida();

            tcom.Id_TipoComida = Convert.ToInt32(txtIdTipoComida.Text);
            if (tcom.eliminar())
            {
                txtResp.Text = "Registro Eliminado";
            }
            else
            {
                txtResp.Text = "Error al Eliminar";
            }
        }
Exemple #5
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            TipoComida tcom = new TipoComida();

            tcom.Nombre = txtNombre.Text;
            if (tcom.guardar())
            {
                txtResp.Text = "Registro Guardado";
            }
            else
            {
                txtResp.Text = "Error al Registrar";
            }
        }
Exemple #6
0
    private void InitComidas(TipoComida comida)
    {
        scrollComidas.normalizedPosition = new Vector2(0, 1);
        tipoComida.text = comida.name;

        contentComidas.transform.Clear();
        foreach (Comida c in comida.comidas)
        {
            ComidaPrefab tempComida = Instantiate(comidaPrefab, contentComidas);
            tempComida.Config(c, comida.name);
        }

        popupPrincipal.SetActive(false);
        popupAlimentos.SetActive(true);
    }
Exemple #7
0
        protected void btnModificar_Click(object sender, EventArgs e)
        {
            TipoComida tcom = new TipoComida();

            tcom.Id_TipoComida = Convert.ToInt32(txtIdTipoComida.Text);
            tcom.Nombre        = txtNombre.Text;
            if (tcom.modificar())
            {
                txtResp.Text = "Registro Modificado";
            }
            else
            {
                txtResp.Text = "Error al Modificar";
            }
        }
Exemple #8
0
        public List <Ingrediente> ListarIngrediente()
        {
            List <Ingrediente> listado     = new List <Ingrediente>();
            AccesoDatosManager accesoDatos = new AccesoDatosManager();
            Ingrediente        Ingre       = new Ingrediente();
            TipoComida         tipoComida  = new TipoComida();

            try
            {
                accesoDatos.setearConsulta("select* from  DINGREDIENTES");
                accesoDatos.abrirConexion();
                accesoDatos.ejecutarConsulta();

                while (accesoDatos.Lector.Read())
                {
                    Ingre                     = new Ingrediente();
                    Ingre.Id                  = (int)accesoDatos.Lector["Idingrediente"];
                    Ingre.Nombre              = accesoDatos.Lector["NombreIngrediente"].ToString();
                    Ingre.Precio              = (decimal)accesoDatos.Lector["PrecioIngrediente"];
                    Ingre.Master              = (decimal)accesoDatos.Lector["MasterPack"];
                    Ingre.UM                  = new UnidadDeMedida();
                    Ingre.UM.IdUnidad         = (int)accesoDatos.Lector["IdIngrediente"];
                    Ingre.UM.DescripcionCorta = accesoDatos.Lector["Descripcioncorta"].ToString();
                    Ingre.UserAdd             = new Usuario();
                    Ingre.UserAdd.IdUsuario   = (int)accesoDatos.Lector["IdIngrediente"];
                    Ingre.UserAdd.User        = accesoDatos.Lector["Usuario"].ToString();
                    Ingre.F_Add               = (DateTime)accesoDatos.Lector["FechaCreacion"];
                    Ingre.UserMod             = new Usuario();
                    Ingre.UserMod.IdUsuario   = (int)accesoDatos.Lector["IdIngrediente"];
                    Ingre.UserMod.User        = accesoDatos.Lector["UserMod"].ToString();
                    Ingre.F_Mod               = (DateTime)accesoDatos.Lector["FechaModificacion"];


                    listado.Add(Ingre);
                }


                return(listado);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                accesoDatos.cerrarConexion();
            }
        }
Exemple #9
0
        public List <Comida> ListarComida()
        {
            List <Comida>      listado     = new List <Comida>();
            AccesoDatosManager accesoDatos = new AccesoDatosManager();
            Comida             Comi        = new Comida();
            TipoComida         tipoComida  = new TipoComida();

            try
            {
                accesoDatos.setearConsulta("select * from DCOMIDAS");
                accesoDatos.abrirConexion();
                accesoDatos.ejecutarConsulta();

                while (accesoDatos.Lector.Read())
                {
                    Comi                   = new Comida();
                    Comi.Id                = (int)accesoDatos.Lector["IdComida"];
                    Comi.Nombre            = accesoDatos.Lector["NombreComida"].ToString();
                    Comi.Precio            = (decimal)accesoDatos.Lector["PrecioComida"];
                    Comi.TC                = new TipoComida();
                    Comi.TC.Id             = (int)accesoDatos.Lector["IdComida"];
                    Comi.TC.Nombre         = accesoDatos.Lector["NombreTipoComida"].ToString();
                    Comi.UserAdd           = new Usuario();
                    Comi.UserAdd.IdUsuario = (int)accesoDatos.Lector["IdComida"];
                    Comi.UserAdd.User      = accesoDatos.Lector["Usuario"].ToString();
                    Comi.F_Add             = (DateTime)accesoDatos.Lector["FechaCreacion"];
                    Comi.UserMod           = new Usuario();
                    Comi.UserMod.IdUsuario = (int)accesoDatos.Lector["IdComida"];
                    Comi.UserMod.User      = accesoDatos.Lector["UserMod"].ToString();
                    Comi.F_Mod             = (DateTime)accesoDatos.Lector["FechaModificacion"];

                    listado.Add(Comi);
                }


                return(listado);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                accesoDatos.cerrarConexion();
            }
        }
Exemple #10
0
    public List <FreezerItens> GetFoods()
    {
        List <FreezerItens> freeze_itens = new List <FreezerItens>();
        List <FoodItem>     _foods       = SaveGameController.Instance.dataGame.dataGame.foods;

        foreach (FoodItem f in _foods)
        {
            TipoComida tipo = null;
            foreach (TipoComida t in tiposComida)
            {
                if (t.name == f.Tipo)
                {
                    tipo = t;
                    break;
                }
            }
            if (tipo == null)
            {
                break;
            }

            foreach (Comida c in tipo.comidas)
            {
                if (c.name == f.Comida)
                {
                    FreezerItens fi = new FreezerItens();
                    fi.comida     = c;
                    fi.quantidade = f.Quantidade;
                    freeze_itens.Add(fi);
                    break;
                }
            }
        }


        return(freeze_itens);
    }
Exemple #11
0
        public List <IngreditePorComida> ListarIngredienteporcomida(int id)
        {
            List <IngreditePorComida> listado     = new List <IngreditePorComida>();
            AccesoDatosManager        accesoDatos = new AccesoDatosManager();
            IngreditePorComida        Ingre       = new IngreditePorComida();
            TipoComida tipoComida = new TipoComida();

            try
            {
                accesoDatos.setearConsulta("select i.IdIngrediente, i.NombreIngrediente,  ic.Cantidad  from INGREDIENTES as i inner join INGREDIETESPORCOMIDAS as ic on i.IdIngrediente= ic.IdIngredientes	where IdComidas=@Idcomida and ic.Estado=1");
                accesoDatos.Comando.Parameters.Clear();
                accesoDatos.Comando.Parameters.AddWithValue("@Idcomida", id);
                accesoDatos.abrirConexion();
                accesoDatos.ejecutarConsulta();

                while (accesoDatos.Lector.Read())
                {
                    Ingre                    = new IngreditePorComida();
                    Ingre.Ingrediente        = new Ingrediente();
                    Ingre.Ingrediente.Id     = (int)accesoDatos.Lector["IdIngrediente"];
                    Ingre.Ingrediente.Nombre = accesoDatos.Lector["NombreIngrediente"].ToString();
                    Ingre.Cantidad           = (decimal)accesoDatos.Lector["Cantidad"];
                    listado.Add(Ingre);
                }


                return(listado);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                accesoDatos.cerrarConexion();
            }
        }
Exemple #12
0
        public List <Ingrediente> ListarIngredientecc(int id)
        {
            List <Ingrediente> listado     = new List <Ingrediente>();
            AccesoDatosManager accesoDatos = new AccesoDatosManager();
            Ingrediente        Ingre       = new Ingrediente();
            TipoComida         tipoComida  = new TipoComida();

            try
            {
                accesoDatos.setearConsulta("select DISTINCT i.Idingrediente, i.NombreIngrediente, ic.IdComidas,  ic.Cantidad from INGREDIENTES as i left join INGREDIETESPORCOMIDAS as ic on I.IdIngrediente=ic.IdIngredientes and ic.IdComidas=@comida	where  i.Estado=1 and ic.IdComidas is null");
                accesoDatos.Comando.Parameters.Clear();
                accesoDatos.Comando.Parameters.AddWithValue("@comida", id);

                accesoDatos.abrirConexion();

                accesoDatos.ejecutarConsulta();

                while (accesoDatos.Lector.Read())
                {
                    Ingre        = new Ingrediente();
                    Ingre.Id     = (int)accesoDatos.Lector["Idingrediente"];
                    Ingre.Nombre = accesoDatos.Lector["NombreIngrediente"].ToString();
                    listado.Add(Ingre);
                }


                return(listado);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                accesoDatos.cerrarConexion();
            }
        }
Exemple #13
0
        private void btnagregarcomida_Click(object sender, EventArgs e)
        {
            if (textComida.Text.Trim() == string.Empty)
            {
                lComidaNombre.Visible = true;

                pnNombrecomida.BackColor = System.Drawing.Color.Red;
                dgvlistacomida.Enabled   = false;
                return;
            }
            else
            {
                lComidaNombre.Visible = false;

                pnNombrecomida.BackColor = System.Drawing.Color.Black;
                dgvlistacomida.Enabled   = true;
            }
            if (textcomidaprecio.Text.Trim() == string.Empty || (Convert.ToDecimal(textcomidaprecio.Text)) < 1)
            {
                lComidapecio.Visible     = true;
                pnPreciocomida.BackColor = System.Drawing.Color.Red;
                dgvlistacomida.Enabled   = true;
                return;
            }
            else
            {
                lComidapecio.Visible     = false;
                pnPreciocomida.BackColor = System.Drawing.Color.Black;
                dgvlistacomida.Enabled   = true;
            }


            if (estado == false)
            {
                Comida        comida     = new Comida();
                TipoComida    tipoComida = new TipoComida();
                ComidaNegocio negocio    = new ComidaNegocio();
                try
                {
                    DateTime fecha = DateTime.Today;

                    comida.Nombre  = textComida.Text;
                    comida.Precio  = Convert.ToDecimal(textcomidaprecio.Text);
                    comida.TC      = (TipoComida)cboTipoComida.SelectedItem;
                    comida.F_Add   = fecha.ToLocalTime();
                    comida.UserAdd = Usuario.UsuarioLogin;
                    comida.F_Mod   = fecha.ToLocalTime();
                    comida.UserMod = Usuario.UsuarioLogin;
                    if (negocio.validarComida(comida))
                    {
                        lComidaexiste.Visible    = true;
                        pnNombrecomida.BackColor = System.Drawing.Color.Red;
                        dgvlistacomida.Enabled   = false;
                        return;
                    }
                    else
                    {
                        lComidaexiste.Visible    = false;
                        pnNombrecomida.BackColor = System.Drawing.Color.Black;
                        dgvlistacomida.Enabled   = true;
                    }
                    DeleteAllsc();
                    cargarGrillacomida();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
            if (estado == true)
            {
                DateTime      fecha   = DateTime.Today;
                Comida        comida  = new Comida();
                ComidaNegocio negocio = new ComidaNegocio();
                Comida        comi;
                comi           = (Comida)dgvlistacomida.CurrentRow.DataBoundItem;
                comida.Id      = comi.Id;
                comida.Nombre  = textComida.Text;
                comida.Precio  = Convert.ToDecimal(textcomidaprecio.Text);
                comida.TC      = (TipoComida)cboTipoComida.SelectedItem;
                comida.Estado  = true;
                comida.F_Mod   = fecha.ToLocalTime();
                comida.UserMod = Usuario.UsuarioLogin;
                negocio.modificarComida(comida);
                estado = false;
                DeleteAllsc();
                cargarGrillacomida();
            }
        }
Exemple #14
0
 public void OnClickTipoComida(TipoComida comida)
 {
     InitComidas(comida);
 }
Exemple #15
0
 public void setComida(TipoComida tipo)
 {
     this.comida = tipo;
 }