protected void cargarGrillaProductos() { grillaProductos.DataSource = GestorProducto.listarProductos(""); string[] keys = new string[] { "CodigoProducto" }; grillaProductos.DataKeyNames = keys; grillaProductos.DataBind(); }
protected void sendEditar_Click(object sender, EventArgs e) { bool Modificado = GestorProducto.Modificar( int.Parse(Id.Text.Trim()), upc.Text.Trim(), nombre.Text.Trim(), descripcion.Text.Trim(), categoria.Text.Trim(), tipoInstrumento.Text.Trim(), //int.Parse(idMarca.Text.Trim()), modelo.Text.Trim(), codProv.Text.Trim(), //int.Parse(idProv.Text.Trim()), color.Text.Trim(), estado.Text.Trim(), precio.Text.Trim()); if (Modificado) { GestorBitacora.Agregar(DateTime.Now, "Se edito un registro", "RespCompras", "Producto"); Response.Write("<script>alert('Los cambios se guardaron correctamente')</script>"); return; //Response.Redirect("/ABMC-Productos"); } }
protected void cargarTiposProductos() { combo_tipo_producto.DataSource = GestorProducto.listarTiposProductos(); combo_tipo_producto.DataTextField = "Nombre"; combo_tipo_producto.DataValueField = "Id"; combo_tipo_producto.DataBind(); }
private void CargarDatosPreguntas() { try { var UserCliente = $"{((BE.Usuario)Session["usuarioCliente"])?.User}"; var Preguntas = GestorProducto.ListarPreguntasCliente(UserCliente); foreach (var item in Preguntas) { HtmlGenericControl DivContenedor = new HtmlGenericControl("div"); HtmlGenericControl DivContenedorInterno1 = new HtmlGenericControl("div"); HtmlGenericControl DivContenedorInterno2 = new HtmlGenericControl("div"); DivContenedor.Attributes.Add("class", "panel panel-default"); DivContenedorInterno1.Attributes.Add("class", "panel-heading"); DivContenedorInterno2.Attributes.Add("class", "panel-body"); DivContenedorInterno1.InnerText = item.Pregunta; DivContenedorInterno2.InnerText = item.Respuesta; DivContenedor.Controls.Add(DivContenedorInterno1); DivContenedor.Controls.Add(DivContenedorInterno2); this.peopleComment.Controls.Add(DivContenedor); } } catch (Exception) { throw; } }
protected void CargarProductos() { HtmlGenericControl DivContenedor = new HtmlGenericControl("div"); DivContenedor.InnerHtml = $"<div>"; int cont = 0; foreach (var item in GestorProducto.ObtenerCatalogo()) { if (cont == 0) { DivContenedor.InnerHtml += "<div clas='row'>"; } if (cont < 3) { DivContenedor.InnerHtml += CrearCardProducto(item.Nombre, item.Modelo, item.Precio.ToString(), item.Descripcion, GestorProducto.GestionImagen(item.Nombre, "sin categoria")); } else { DivContenedor.InnerHtml += CrearCardProducto(item.Nombre, item.Modelo, item.Precio.ToString(), item.Descripcion, GestorProducto.GestionImagen(item.Nombre, "sin categoria")) + "</div>"; cont = 0; } cont++; } DivContenedor.InnerHtml += "</div>"; this.contenedor.Controls.Add(DivContenedor); }
private void AgregarNombreProducto() { try { using (GestorProducto producto = new GestorProducto()) { dsVentas = producto.ConsultarProductoCodigo(txt_codigoProducto.Text); dtVentas = dsVentas.Tables[0]; id_producto = int.Parse(dtVentas.Rows[0]["id_productos"].ToString()); codigoProd = dtVentas.Rows[0]["codigo"].ToString(); monto = int.Parse(dtVentas.Rows[0]["monto"].ToString()); cantidad = int.Parse(dtVentas.Rows[0]["cantidad"].ToString()); tipo = dtVentas.Rows[0]["iva"].ToString(); if (cantidad == 0) { MessageBox.Show("Existencias del Producto agotadas", caption: "Alerta", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Error); } else { lbl_nombreProducto.Text = dtVentas.Rows[0]["nombre"].ToString(); txt_cantidad.Focus(); } } } catch (Exception ex) { MessageBox.Show("Digite un código de producto valido" + ex, caption: "Alerta", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Error); } }
protected void btn_eliminar_Click(object sender, GridViewDeleteEventArgs e) { String keyCod = grillaProductos.DataKeys[Convert.ToInt32(e.RowIndex)].Value.ToString(); int codigo = int.Parse(keyCod); try { if (GestorProducto.eliminarProducto(codigo)) { lbl_success.Text = "Producto Eliminado con exito!"; lbl_success.Visible = true; } else { lbl_error.Text = "No existe el producto a eliminar"; lbl_error.Visible = true; } } catch (Exception ex) { lbl_error.Text = "Ha surgido un error inesperado, contacte a su administrador"; lbl_error.Visible = true; } cargarGrillaProductos(); }
private void txt_codigo_Producto_KeyUp(object sender, KeyEventArgs e) { bloquearCamposProducto(); string buscar = txt_codigo_Producto.Text; gbx_datosProducto.Visible = true; gbx_datosProducto.Enabled = true; btn_guardarProducto.Visible = false; lbl_guardarProducto.Visible = false; using (GestorProducto producto = new GestorProducto()) { this.dsProductos = producto.ConsultarProducto(buscar); this.dtProductos = this.dsProductos.Tables[0]; dgvProductos.DataSource = this.dtProductos; dgvProductos.Columns["id_productos"].Visible = false; dgvProductos.Columns["codigo"].HeaderText = "CODIGO"; dgvProductos.Columns["nombre"].HeaderText = "NOMBRE"; dgvProductos.Columns["detalle"].HeaderText = "DETALLE"; dgvProductos.Columns["monto"].HeaderText = "MONTO"; dgvProductos.Columns["cantidad"].HeaderText = "CANTIDAD"; dgvProductos.Columns["marca"].HeaderText = "MARCA"; dgvProductos.Columns["tipo"].HeaderText = "TIPO"; dgvProductos.Columns["iva"].HeaderText = "IVA"; dgvProductos.Columns["estado"].Visible = false; } CargarDatosProducto(); }
// GET: api/Producto public IHttpActionResult Get(string Nombre = "", bool?EnUso = null, int numeroPagina = 1, string NumeroOrden = "") ///NUNCA CAMBIAR EL NOMBRE DEL METODO SI LO Q RETURNEA { int RegistrosTotal; var Lista = GestorProducto.GetProductos(Nombre, EnUso, numeroPagina, NumeroOrden, out RegistrosTotal); return(Ok(new { Lista = Lista, RegistrosTotal = RegistrosTotal })); }
void Btn_EliminarProductoClick(object sender, EventArgs e) { gbx_datosProducto.Visible = true; gbx_datosProducto.Enabled = true; if (string.IsNullOrWhiteSpace(txt_codigoProducto.Text) || string.IsNullOrWhiteSpace(txt_nombreProducto.Text) || string.IsNullOrWhiteSpace(txt_detalleProducto.Text) || string.IsNullOrWhiteSpace(txt_cantidadProducto.Text) || string.IsNullOrWhiteSpace(txt_montoProducto.Text)) { MessageBox.Show("Hay Uno o mas Campos Vacios!", "Campos Vacios!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { using (GestorProducto producto = new GestorProducto()) { DialogResult result = MessageBox.Show("Seguro que desea eliminar el producto", "Eliminar", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (result == DialogResult.Yes) { producto.InactivarProducto(txt_codigoProducto.Text); } } bloquearCamposProducto(); gbx_datosProducto.Visible = false; limpiarCamposProducto(); cargarGridProductos(); grb_menuProducto.Visible = true; } }
private void CargarDatosPreguntas() { try { string nombre = Request.QueryString["Nombre"]?.ToString(); string modelo = Request.QueryString["Modelo"]?.ToString(); var Preguntas = GestorProducto.ListarPreguntas(nombre, modelo); foreach (var item in Preguntas) { HtmlGenericControl DivContenedor = new HtmlGenericControl("div"); HtmlGenericControl DivContenedorInterno1 = new HtmlGenericControl("div"); HtmlGenericControl DivContenedorInterno2 = new HtmlGenericControl("div"); DivContenedor.Attributes.Add("class", "panel panel-default"); DivContenedorInterno1.Attributes.Add("class", "panel-heading"); DivContenedorInterno2.Attributes.Add("class", "panel-body"); DivContenedorInterno1.InnerText = item.Pregunta; DivContenedorInterno2.InnerText = item.Respuesta; DivContenedor.Controls.Add(DivContenedorInterno1); DivContenedor.Controls.Add(DivContenedorInterno2); this.peopleComment.Controls.Add(DivContenedor); } } catch (Exception) { throw; } }
private void cargarCombos() { try { using (GestorProducto elLente = new GestorProducto()) { cbx_Prod_Lentes.DataSource = elLente.ListarProductosLentes(); cbx_Prod_Lentes.ValueMember = "id_productos"; cbx_Prod_Lentes.DisplayMember = "nombre"; label21.Text = (string)elLente.ListarProductosLentes().Rows[0][4].ToString(); } } catch (Exception e) { MessageBox.Show("Error de SQL: " + e.Message); } try { using (GestorProducto elArmazon = new GestorProducto()) { cbx_Prod_Armazon.DataSource = elArmazon.ListarProductosArmazon(); cbx_Prod_Armazon.ValueMember = "id_productos"; cbx_Prod_Armazon.DisplayMember = "nombre"; label22.Text = (string)elArmazon.ListarProductosArmazon().Rows[0][4].ToString(); } } catch (Exception e) { MessageBox.Show("Error de SQL: " + e.Message); } }
protected void sendPreguntar_Click(object sender, EventArgs e) { var CLIENTE = $"{((BE.Usuario)Session["usuarioCliente"])?.User}"; GestorProducto.InsertarPreguntaPersonal(pregunta.Text, CLIENTE); pregunta.Text = ""; }
public void TestNombre() { string nombre = "81WB00S6AR"; var Validacion = GestorProducto.ValidarNombre(nombre); Assert.IsTrue(Validacion); }
private void btn_guardarProducto_Click(object sender, EventArgs e) { switch (accion) { case "editar": if (string.IsNullOrWhiteSpace(txt_codigoProducto.Text) || string.IsNullOrWhiteSpace(txt_nombreProducto.Text) || string.IsNullOrWhiteSpace(txt_detalleProducto.Text) || string.IsNullOrWhiteSpace(txt_cantidadProducto.Text) || string.IsNullOrWhiteSpace(txt_montoProducto.Text) || string.IsNullOrWhiteSpace(txt_marcaProducto.Text) || string.IsNullOrWhiteSpace(cbx_tipoProducto.SelectedItem.ToString()) || string.IsNullOrWhiteSpace(cbx_ivaProducto.SelectedItem.ToString())) { MessageBox.Show("Hay Uno o mas Campos Vacios!", "Campos Vacios!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { using (GestorProducto producto = new GestorProducto()) { producto.ModificarProducto(codig.ToUpper(), txt_codigoProducto.Text.ToUpper(), txt_nombreProducto.Text.ToUpper(), txt_detalleProducto.Text.ToUpper(), int.Parse(txt_montoProducto.Text), int.Parse(txt_cantidadProducto.Text), txt_marcaProducto.Text.ToUpper(), cbx_tipoProducto.SelectedItem.ToString().ToUpper(), cbx_ivaProducto.SelectedItem.ToString().ToUpper(), "A"); } bloquearCamposProducto(); MessageBox.Show("Datos Modificados Satisfactoriamente", "EXITO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); gbx_datosProducto.Visible = false; limpiarCamposProducto(); cargarGridProductos(); } break; case "insertar": if (string.IsNullOrWhiteSpace(txt_codigoProducto.Text) || string.IsNullOrWhiteSpace(txt_nombreProducto.Text) || string.IsNullOrWhiteSpace(txt_detalleProducto.Text) || string.IsNullOrWhiteSpace(txt_cantidadProducto.Text) || string.IsNullOrWhiteSpace(txt_montoProducto.Text) || string.IsNullOrWhiteSpace(txt_marcaProducto.Text) || string.IsNullOrWhiteSpace(cbx_tipoProducto.SelectedItem.ToString()) || string.IsNullOrWhiteSpace(cbx_ivaProducto.SelectedItem.ToString())) { MessageBox.Show("Hay Uno o mas Campos Vacios!", "Campos Vacios!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { using (GestorProducto producto = new GestorProducto()) { producto.InsertarProducto(txt_codigoProducto.Text.ToUpper(), txt_nombreProducto.Text.ToUpper(), txt_detalleProducto.Text.ToUpper(), int.Parse(txt_montoProducto.Text), int.Parse(txt_cantidadProducto.Text), txt_marcaProducto.Text.ToUpper(), cbx_tipoProducto.SelectedItem.ToString().ToUpper(), cbx_ivaProducto.SelectedItem.ToString().ToUpper(), "A"); } bloquearCamposProducto(); MessageBox.Show("Datos Registrados Satisfactoriamente", "EXITO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); gbx_datosProducto.Visible = false; limpiarCamposProducto(); cargarGridProductos(); } break; default: break; } }
protected void btn_producto_guardar_Click(object sender, EventArgs e) { if (Page.IsValid) { try { Producto producto = new Producto(); producto.Nombre = txt_producto_nombre.Text; TipoProducto tipo = new TipoProducto(); tipo.Id = int.Parse(combo_tipo_producto.SelectedValue); tipo.Nombre = combo_tipo_producto.SelectedItem.Text; producto.Tipo_Producto = tipo; if (!string.IsNullOrWhiteSpace(txt_agregados.Text)) { producto.Agregados = int.Parse(txt_agregados.Text); } int codigo = int.Parse(txt_codigo_producto.Text); producto.Codigo_Producto = codigo; producto.Precio = float.Parse(txt_precio.Text); producto.Fecha_Alta = Convert.ToDateTime(txt_fecha_alta.Text); producto.Vigente = chk_vigente.Checked; if (GestorProducto.modificarProducto(producto)) { lbl_success.Text = "Producto Modificado con exito!"; lbl_success.Visible = true; lbl_warning.Visible = false; lbl_error.Visible = false; } else { lbl_error.Text = "No existe el producto a modificar"; lbl_error.Visible = true; } cargarGrillaProductos(); limpiar(); } catch (Exception ex) { lbl_error.Text = "Ha surgido un error inesperado, contacte a su administrador"; lbl_error.Visible = true; } } btn_producto_guardar.Visible = false; btn_producto_registrar.Visible = true; }
protected void cargarProductos() { combo_producto.DataSource = GestorProducto.listaProductosVendibles(); combo_producto.DataTextField = "Nombre"; combo_producto.DataValueField = "Id"; combo_producto.DataBind(); combo_producto.Items.Add(new ListItem("Sin seleccion", "Todos")); combo_producto.Items.FindByText("Sin seleccion").Selected = true; }
public void CargarComboTipoInstrumento() { List <Producto> lista = GestorProducto.ListarTipoInstrumentos(); lista.Insert(0, new Producto { TipoInstrumento = Constantes.SeleccionarTipo }); listTipoInstrumento.DataSource = lista; listTipoInstrumento.DataTextField = "TipoInstrumento"; listTipoInstrumento.DataValueField = "TipoInstrumento"; listTipoInstrumento.DataBind(); }
public void CargarComboCategoria() { List <Producto> lista = GestorProducto.ListarCategorias(); lista.Insert(0, new Producto { Categoria = Constantes.SeleccionarCategoria }); listCategoria.DataSource = lista; listCategoria.DataTextField = "Categoria"; listCategoria.DataValueField = "Categoria"; listCategoria.DataBind(); }
public decimal Calcular() { string nombre = Request.QueryString["Nombre"]?.ToString(); var lista = GestorProducto.ListarValoraciones(nombre); decimal total = 0; foreach (var item in lista) { total = total + item.Valoracion; } return(total / Convert.ToDecimal(lista.Count)); }
protected void btnDelete_Click(object sender, EventArgs e) { GridViewRow row = (sender as Button).NamingContainer as GridViewRow; string Id = row.Cells[0].Text.Trim(); bool eliminado = GestorProducto.Eliminar(int.Parse(Id)); if (eliminado) { GestorBitacora.Agregar(DateTime.Now, "Se elimino un registro", "RespCompras", "Producto"); } Response.Redirect("/ABMC-Productos.aspx"); }
protected void btnDelete_Click(object sender, EventArgs e) { GridViewRow row = (sender as Button).NamingContainer as GridViewRow; string Id = row.Cells[0].Text.Trim(); bool eliminado = GestorProducto.EliminarPregunta(int.Parse(Id)); if (eliminado) { GestorBitacora.Agregar(DateTime.Now, "Se elimino un registro", "Admin", "GestionPreguntas"); } Response.Write("<script>alert('Se ha eliminado el registro')</script>"); Response.Redirect("/ABMC-Marca.aspx"); }
public void TestArticulo() { int totalArticulos = GestorProducto.MostrarArticulos(); var JSON = File.ReadAllText("JSON - Catálogo.txt"); List <Producto> articulosJSON = JsonConvert.DeserializeObject <List <Producto> > (JSON); foreach (var articulo in articulosJSON) { GestorProducto.JSON.Add(new Producto(articulo.IdArticulo, articulo.Nombre, articulo.Marca, articulo.Precio, articulo.Descripcion, articulo.Stock)); } Assert.AreEqual(GestorProducto.ListaArticulos.Count, totalArticulos); }
protected void sendEditar_Click(object sender, EventArgs e) { var userbk = Session["usuariobackend"].ToString(); bool Modificado = GestorProducto.AgregarRespuesta(int.Parse(id.Text.Trim()), respuesta.Text.Trim()); if (Modificado) { GestorBitacora.Agregar(DateTime.Now, "Se agregó una respuesta al cliente", userbk, "Cliente"); Response.Write("<script>alert('Los cambios se guardaron correctamente')</script>"); return; //Response.Redirect("/ABMC-Usuarios"); } }
protected void combo_producto_SelectedIndexChanged(object sender, EventArgs e) { if (combo_producto.SelectedValue != "Todos") { int id = int.Parse(combo_producto.SelectedValue); int cantidad = GestorProducto.obtenerAgregados(id); List <Producto> sabores = GestorProducto.listaSabores(); //Limpio previo a mostrar limpiar(); contenedorSabores.Visible = true; for (int i = 1; i < cantidad; i++) { List <DropDownList> dropdowns = new List <DropDownList>(); GetControlList <DropDownList>(Page.Controls, dropdowns); string nombre = "ddl_" + i; foreach (var combo in dropdowns) { if (combo.ID == nombre) { combo.DataSource = sabores; combo.DataTextField = "Nombre"; combo.DataValueField = "ID"; combo.DataBind(); combo.Visible = true; } } } if (cantidad > 0) { lbl_sabores.Visible = true; } } else { contenedorSabores.Visible = false; } }
protected void sendPreguntar_Click(object sender, EventArgs e) { string nombre = Request.QueryString["Nombre"].ToString(); string modelo = Request.QueryString["Modelo"].ToString(); var CLIENTE = $"{((BE.Usuario)Session["usuarioCliente"])?.User}"; if (!string.IsNullOrEmpty(CLIENTE)) { GestorProducto.InsertarPregunta(nombre, modelo, pregunta.Text, CLIENTE); } else { Response.Write("<script>alert('Para realizar una pregunta debe iniciar sesión')</script>"); } Response.Redirect($"/DescripcionProducto.aspx?Nombre={nombre}&Modelo={modelo}"); }
private void cargarGridProductos() { using (GestorProducto producto = new GestorProducto()) { dgvProductos.DataSource = producto.ListarProductos(); dgvProductos.Columns["id_productos"].Visible = false; dgvProductos.Columns["codigo"].HeaderText = "CODIGO"; dgvProductos.Columns["nombre"].HeaderText = "NOMBRE"; dgvProductos.Columns["detalle"].HeaderText = "DETALLE"; dgvProductos.Columns["monto"].HeaderText = "MONTO"; dgvProductos.Columns["cantidad"].HeaderText = "CANTIDAD"; dgvProductos.Columns["marca"].HeaderText = "MARCA"; dgvProductos.Columns["tipo"].HeaderText = "TIPO"; dgvProductos.Columns["iva"].HeaderText = "IVA"; dgvProductos.Columns["estado"].Visible = false; } }
protected void sendconfirmar_Click(object sender, EventArgs e) { var Comentario = comentario.Text; int puntaje = 0; if (CheckPunt1.Checked == true) { puntaje = 1; } else if (CheckPunt2.Checked == true) { puntaje = 2; } else if (CheckPunt3.Checked == true) { puntaje = 3; } else if (CheckPunt4.Checked == true) { puntaje = 4; } else if (CheckPunt5.Checked == true) { puntaje = 5; } var Usuario = $"{((BE.Usuario)Session["usuarioCliente"])?.User}"; var IDCliente = GestorCliente.ObtenerCodCliente(Usuario); var NroNP = Request.QueryString["NroNP"]; var Productos = GestorNP.ListarProdxNP(int.Parse(NroNP)); foreach (var item in Productos) { GestorProducto.AgregarValoracion(puntaje, Comentario, IDCliente.CodCliente, item.Nombre, Usuario); } Response.Write("<script>alert('Muchas gracias por sus comentarios')</script>"); }
protected void Page_Load(object sender, EventArgs e) { string parametros = string.Empty; for (int i = 0; i < Request.QueryString.Count; i++) { parametros = Request.QueryString[i].ToString().Replace("%20", " "); var item = GestorProducto.ListarProductosAComparar(parametros); if (item.Count > 0) { CargarComparador(item.FirstOrDefault()?.Nombre, item.FirstOrDefault()?.Modelo, item.FirstOrDefault()?.Precio, item.FirstOrDefault()?.Descripcion, item.FirstOrDefault()?.urlImg); } } parametros.TrimEnd(','); }
protected void UploadButton_Click(object sender, EventArgs e) { var nombreProd = nombre.Text.Trim(); var Tipo = listTipoInstrumento.SelectedItem.ToString(); string ruta; if (string.IsNullOrEmpty(nombreProd)) { Response.Write("<script>alert('Debe completar los datos del producto')</script>"); } else { switch (Tipo) { case "Cuerdas": ruta = @"/Imagenes/Catalogo/Cuerdas"; FileUpload.SaveAs(Server.MapPath(".") + "/Imagenes/Catalogo/Cuerdas"); GestorProducto.AgregarImg(nombreProd, "Sin categoria", ruta); break; case "Electronico": ruta = @"/Imagenes/Catalogo/Electronicos"; FileUpload.SaveAs(ruta); GestorProducto.AgregarImg(nombreProd, "Sin categoria", ruta); break; case "Viento": ruta = @"/Imagenes/Catalogo/Viento"; FileUpload.SaveAs(ruta); GestorProducto.AgregarImg(nombreProd, "Sin categoria", ruta); break; case "Percusion": ruta = @"/Imagenes/Catalogo/Percusion"; FileUpload.SaveAs(ruta); GestorProducto.AgregarImg(nombreProd, "Sin categoria", ruta); break; } } }