Example #1
0
 private void txtNuevaCategoria_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)13)
     {
         if (txtNuevaCategoria.Text.Equals("") | txtNuevaCategoria.Text.Equals(" "))
         {
             MessageBox.Show("Categoria Vacia", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             clsCategorias      obj  = new clsCategorias();
             clsDatosInventario obj2 = new clsDatosInventario();
             obj.Nombre = txtNuevaCategoria.Text;
             obj2.AgregarCategoria(obj);
             MessageBox.Show("Se agrego categoria");
             txtNuevaCategoria.Text    = "";
             txtNuevaCategoria.Visible = false;
             lblNuevaCategoria.Visible = false;
             cmbCategoria.Items.Clear();
             clsDatosInventario o = new clsDatosInventario();
             var lista            = o.listaCategorias();
             for (int i = 0; i < lista.Count; i++)
             {
                 cmbCategoria.Items.Insert(i, lista[i].Nombre);
             }
         }
     }
 }
Example #2
0
        public IActionResult todos()
        {
            clsCategorias        clscategorias = new clsCategorias();
            List <clsCategorias> categorias    = new List <clsCategorias>();

            categorias = clscategorias.TodosCategorias();
            if (categorias.Count == 0)
            {
                return(NotFound(categorias));
            }
            else
            {
                return(Ok(categorias));
            }
        }
        public IActionResult solicitarCategorias()
        {
            clsCategorias        categ = new clsCategorias();
            List <clsCategorias> todos = new List <clsCategorias>();

            todos = categ.OrdenConCatg();

            if (todos.Count == 0)
            {
                return(NotFound(todos));
            }
            else
            {
                return(Ok(todos));
            }
        }
Example #4
0
        public IActionResult buscar([FromBody] clsCategorias clsCategorias)
        {
            clsCategorias        clscategorias = new clsCategorias();
            List <clsCategorias> categorias    = new List <clsCategorias>();

            clsCategorias.id_categoria = clsCategorias.id_categoria;
            categorias = clscategorias.BuscarCategorias();
            if (categorias.Count == 0)
            {
                return(NotFound(categorias));
            }
            else
            {
                return(Ok(categorias));
            }
        }
Example #5
0
        public void AgregarCategoria(clsCategorias objCategoria)
        {
            string       sql;
            MySqlCommand cm;

            cone.conectar();
            cm = new MySqlCommand();
            cm.Parameters.AddWithValue("@idCategoria", objCategoria.Id);
            cm.Parameters.AddWithValue("@nombre", objCategoria.Nombre);

            sql            = "insert  into categoria value(@idCategoria,@nombre);";
            cm.CommandText = sql;
            cm.CommandType = CommandType.Text;
            cm.Connection  = cone.cn;
            cm.ExecuteNonQuery();
            cone.cerrar();
        }
Example #6
0
        public string getnombreCategoria(int id)
        {
            cone.conectar();
            string numeroId = "";
            List <clsCategorias> lstUsuarios = new List <clsCategorias>();
            string          sql;
            MySqlCommand    cm = new MySqlCommand();
            MySqlDataReader dr;

            sql            = "select nombre from categoria where idCategoria = '" + id + "';";
            cm.CommandText = sql;
            cm.CommandType = CommandType.Text;
            cm.Connection  = cone.cn;
            dr             = cm.ExecuteReader();
            while (dr.Read())
            {
                clsCategorias objAl = new clsCategorias();
                numeroId = dr.GetString("nombre");
            }
            cone.cerrar();
            return(numeroId);
        }
Example #7
0
        public int getIdCategoria(string nombre)
        {
            cone.conectar();
            int numeroId = 0;
            List <clsCategorias> lstUsuarios = new List <clsCategorias>();
            string          sql;
            MySqlCommand    cm = new MySqlCommand();
            MySqlDataReader dr;

            sql            = "select idCategoria from categoria where nombre = '" + nombre + "';";
            cm.CommandText = sql;
            cm.CommandType = CommandType.Text;
            cm.Connection  = cone.cn;
            dr             = cm.ExecuteReader();
            while (dr.Read())
            {
                clsCategorias objAl = new clsCategorias();
                numeroId = Convert.ToInt32(dr.GetString("idCategoria"));
            }
            cone.cerrar();
            return(numeroId);
        }
Example #8
0
        public List <clsCategorias> listaCategorias()
        {
            cone.conectar();
            List <clsCategorias> lstUsuarios = new List <clsCategorias>();
            string          sql;
            MySqlCommand    cm = new MySqlCommand();
            MySqlDataReader dr;

            sql            = "select nombre from categoria;";
            cm.CommandText = sql;
            cm.CommandType = CommandType.Text;
            cm.Connection  = cone.cn;
            dr             = cm.ExecuteReader();
            while (dr.Read())
            {
                clsCategorias objAl = new clsCategorias();
                objAl.Nombre = dr.GetString("nombre");
                lstUsuarios.Add(objAl);
            }
            cone.cerrar();
            return(lstUsuarios);
        }
Example #9
0
        static void Main(string[] args)
        {
            clsMesas      cmesas = new clsMesas();
            clsCategorias ccatg  = new clsCategorias();
            clsProductos  cprod  = new clsProductos();

            List <clsMesas>      mesass     = new List <clsMesas>();
            List <clsCategorias> categorias = new List <clsCategorias>();
            List <clsProductos>  productos  = new List <clsProductos>();

            //mesass = cmesas.buscaMesas();
            //categorias = ccatg.OrdenConCatg();
            //productos = cprod.ProductoEnCatg("1");

            categorias = ccatg.TodosCategorias();
            categorias = ccatg.BuscarCategorias();


            ReportesDeMesaCLS        reporteMesa = new ReportesDeMesaCLS();
            List <ReportesDeMesaCLS> listaMesa   = new List <ReportesDeMesaCLS>();
            // listaMesa = reporteMesa.ReporteMesas();


            ReportesDeOrdenesCLS        reporteOrden = new ReportesDeOrdenesCLS();
            List <ReportesDeOrdenesCLS> listaOrden   = new List <ReportesDeOrdenesCLS>();
            //listaOrden = reporteOrden.ReporteOrdenes();

            ReportesDeProductosCLS        reporteProductos = new ReportesDeProductosCLS();
            List <ReportesDeProductosCLS> listaProductos   = new List <ReportesDeProductosCLS>();

            listaProductos = reporteProductos.ReporteProducto();

            clsUsuario        clsUsuario   = new clsUsuario();
            List <clsUsuario> listaUsuario = new List <clsUsuario>();

            listaUsuario = clsUsuario.TodosUsuarios();
        }
Example #10
0
 public IActionResult actualizar([FromBody] clsCategorias clsCategorias)
 {
     return(Ok(clsCategorias.updateCategoria()));
 }
Example #11
0
 public IActionResult insertar([FromBody] clsCategorias clsCategorias)
 {
     return(Ok(clsCategorias.insertCategoria()));
 }
Example #12
0
 public void CargarCategoriasGv()
 {
     Logica.clsCategorias oclCategoria = new clsCategorias();
     GvCategorias.DataSource = oclCategoria.Listar_Categorias();
     GvCategorias.DataBind();
 }