Esempio n. 1
0
        private void consultaDeProductoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ConsultaProducto consultaProducto = new ConsultaProducto();

            consultaProducto.Show();
            consultaProducto.MdiParent = this;
        }
        public IActionResult OnGet(int?Id, int?Pagina, int?CantidadPorFila, int?Maximo, string NombreOCodigo, int?IdCategoria, int?IdMarca, bool?Boton)
        {
            this.Boton = Boton;
            if (Pagina != null)
            {
                this.Pagina = Pagina.Value;
            }
            if (CantidadPorFila != null)
            {
                this.CantidadPorFila = CantidadPorFila.Value;
            }
            if (Maximo != null)
            {
                this.Maximo = Maximo.Value;
            }
            List <string>         whereIn = new List <string>();
            List <MySqlParameter> wParams = new List <MySqlParameter>();

            //un producto especifico
            if (Id != null)
            {
                whereIn.Add("p.Id = @Id");
                wParams.Add(new MySqlParameter("@Id", Id));
            }
            else
            {
                if (IdMarca != null)
                {
                    whereIn.Add("IdMarca = @IdMarca");
                    wParams.Add(new MySqlParameter("@IdMarca", IdMarca.Value));
                }
                if (IdCategoria != null)
                {
                    whereIn.Add("IdCategoria = @IdCategoria");
                    wParams.Add(new MySqlParameter("@IdCategoria", IdCategoria.Value));
                }
                if (NombreOCodigo != null && NombreOCodigo != "")
                {
                    whereIn.Add("p.Nombre like @NombreOCodigo or p.Codigo like @NombreOCodigo");
                    wParams.Add(new MySqlParameter("@NombreOCodigo", "%" + NombreOCodigo + "%"));
                }
            }
            string str   = String.Join(" and ", whereIn.ToArray());
            string limit = " limit " + this.Pagina * this.Maximo + "," + this.Maximo;

            /*
             * MySqlParameter mysqlp;
             * mysqlp = new MySqlParameter("@NombreOCodigo", "%Cuaderno%");
             * string lquery = "Select * from Producto where Nombre LIKE @NombreOCodigo or Codigo LIKE @NombreOCodigo";
             * var list = _context.Productos.FromSql(lquery, mysqlp).ToList();
             */
            string sql = ConsultaProducto.sqlAll(str, limit);

            Console.WriteLine(sql);
            this.ListProductos = _context.ConsultaProducto.FromSql(sql, wParams.ToArray())
                                 .ToList();
            sql   = ConsultaProducto.sqlAll(str);
            Total = _context.ConsultaProducto.FromSql(sql, wParams.ToArray()).Count();
            return(Page());
        }
Esempio n. 3
0
        private void ArticulosToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            Form formulario = new ConsultaProducto();

            formulario.MdiParent = this;
            formulario.Show();
        }
Esempio n. 4
0
        private void btnConsultar_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            ConsultaProducto consP = new ConsultaProducto();

            consP.Show();
        }
Esempio n. 5
0
        private async void Button1_Click(object sender, EventArgs e)
        {
            ConsultaProducto objpersona = new ConsultaProducto();
            int id = 1;
            //string result = await programa.GetHttp("https://localhost:44395/api/obtenerProductos");

            string result = programa.Send <ConsultaProducto>("http://ApiProCamp.somee.com/api/obtenerProductos", null, "GET");
            //string result = programa.Send<ConsultaProducto>("https://localhost:44395/api/obtenerProductoUsuario/1", null, "GET");
            //string result = programa.Send<ConsultaProducto>("https://localhost:44395/api/obtenerProductoUsuario/id?id=" + HttpUtility.UrlEncode("con espacios"), objpersona, "GET");

            DataSet data = new DataSet();

            data.Tables.Add(JsonConvert.DeserializeObject <DataTable>(result));
            dataGridView1.DataSource = data.Tables[0];
        }
Esempio n. 6
0
        public void EvaluarTecla(object sender, KeyEventArgs e)
        {
            if (Key.F6 == e.Key)
            {
                ConsultaProducto cp = new ConsultaProducto();
                cp.Show();
            }
            if (Key.A == e.Key)
            {
                this.Close();
            }
            if (Key.F == e.Key)
            {
                RealizarVenta();
            }

            if (Key.F4 == e.Key)
            {
                AgregarProducto();
            }
            if (Key.D == e.Key)
            {
                if (dataGrid.Items.Count > 0)
                {
                    Mensaje.MensajeCaptura M = new Mensaje.MensajeCaptura("Eliminar producto", "Capture el # registro del producto a eliminar:", "S=Eliminar", "N=Cancelar", true, "int");
                    M.ShowDialog();
                    if (M.Opc)
                    {
                        if (M.valor != 0 && Vm.ListaProducto.Exists(c => c.Registro == M.valor))
                        {
                            Vm.valor = M.valor;   //registro a eliminar
                            Eliminar();
                        }
                        else
                        {
                            MessageBox.Show("No existe el # registro:" + M.valor.ToString(), "Mensaje");
                            Mensaje.MensajeCaptura Mm = new CapaPresentacion.Mensaje.MensajeCaptura("Eliminar producto", "Capture el # registro del producto a eliminar:", "S=Elimnar", "N=Cancelar", true, "int");
                            Mm.ShowDialog();
                        }
                    }
                }
            }
            if (Key.C == e.Key && dataGrid.Items.Count > 0)
            {
                CancelarVenta();
            }
        }
Esempio n. 7
0
        public IActionResult consultaConProcedimientos2()
        {
            List <ConsultaProducto> lista     = new List <ConsultaProducto>();
            ConsultaProducto        respuesta = null;
            string connectionString           =
                @"Data Source=DESKTOP-MG3N9KE;Initial Catalog=AdventureWorks2017;User Id = ronald; Password=ronald2016";

            string queryString = "dbo.obtenerIngresoProductos";

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand comando = new SqlCommand(queryString, connection);
                comando.CommandType = System.Data.CommandType.StoredProcedure;


                try
                {
                    connection.Open();
                    SqlDataReader lector = comando.ExecuteReader();

                    while (lector.Read())
                    {
                        respuesta = new ConsultaProducto()
                        {
                            ProductId = (int)lector[0], Descripcion = (string)lector[1], Total = (decimal)lector[2]
                        };
                        lista.Add(respuesta);
                    }
                    lector.Close();
                    return(Ok(lista));
                }
                catch (Exception e)
                {
                    return(BadRequest(e));
                }
            }
        }
Esempio n. 8
0
 public IActionResult OnGet()
 {
     this.ListProductos = _context.ConsultaProducto.FromSql(ConsultaProducto.agotados()).ToList();
     return(Page());
 }