private void btnEliminar_Click(object sender, EventArgs e) { NegocioProducto negP = new NegocioProducto(); DialogResult dialogResult = MessageBox.Show(this, "¿Esta seguro que desea eliminar el Producto: \n" + this.txtNombre.Text.Trim() + "?", "Confirmar", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { int idProd = 0; if (!this.txtCodMc.Text.Trim().Equals("")) { idProd = negP.getIdProductoMc(this.txtCodMc.Text.Trim()); } else if (!this.txtCodPrelude.Text.Trim().Equals("")) { idProd = negP.getIdProductoPrelude(this.txtCodPrelude.Text.Trim()); } negP.eliminarProducto(idProd); MessageBox.Show(this, "Producto: " + this.txtNombre.Text.Trim() + "\n¡Eliminado con exito!", "¡Exito!"); limpiarCampos(); } }
public ActionResult DetalleProducto(int productoId = 0) { if ((String)Session["PerfilUsuario"] != "WebMaster" && productosValidos.Contains(productoId) == true) { var ln = new NegocioProducto(); TraducirPagina((String)Session["IdiomaApp"]); var producto = ln.BuscarPorId(productoId); ViewBag.CodigoProducto = producto.Codigo.ToString(); ViewBag.Imagen = producto.Imagen; if ((String)Session["IdiomaApp"] == "Esp" || (String)Session["IdiomaApp"] == null) { ViewBag.Titulo = producto.Titulo; ViewBag.Descripcion = producto.Descripcion; } else { ViewBag.Titulo = producto.Titulo_Eng; ViewBag.Descripcion = producto.Descripcion_Eng; } ViewBag.Modelo = producto.Modelo; ViewBag.Precio = producto.Precio.ToString(); return(View()); } return(RedirectToAction("Index", "Home")); }
public bool UpdateWithValues(int id, int id_tipo, string nombre, string descripcion) { //FALTA ID TIPO PRODUCTO QUE ES FORANEO NegocioProducto negocioProducto = new NegocioProducto(); return(negocioProducto.Update(id, id_tipo, nombre, descripcion)); }
private void guardarexistente() { try { int iddecuenta = 0; NegocioCuenta_Producto cue = new NegocioCuenta_Producto(); NegocioCuenta cu = new NegocioCuenta(); NegocioProducto prod = new NegocioProducto(); foreach (int item in cuentas) { iddecuenta = item; Cuenta cuent = cu.buscarCuenta(iddecuenta); ArrayList cep = cue.getCuenta_ProductoxCuenta1(cuent._ID_Cuenta); foreach (Cuenta_Producto cp in cep) { cue.eliminarCuenta_Producto(cp._ID_Lista); } cu.eliminarCuenta(cuent._ID_Cuenta); } Grabar(); } catch { MessageBox.Show("Error de sobreescribir asegurece de que" + "todos los datos fueron ingresados correctamente.", "Error de comanda", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected void grdProductos_RowUpdating(object sender, GridViewUpdateEventArgs e) { //Buscar los datos del edititemplate String s_Idproc = ((Label)grdProductos.Rows[e.RowIndex].FindControl("lblet_Cod_pro")).Text; String s_pu = ((TextBox)grdProductos.Rows[e.RowIndex].FindControl("txtEi_PU_Pro")).Text; String s_stock = ((TextBox)grdProductos.Rows[e.RowIndex].FindControl("txt_Stock")).Text; //String s_categoria = ((TextBox)grdProductos.Rows[e.RowIndex].FindControl("txtet_Categoria")).Text; //String s_descripcion = ((TextBox)grdProductos.Rows[e.RowIndex].FindControl("txtei_Descripcion")).Text; String s_imagen = ((TextBox)grdProductos.Rows[e.RowIndex].FindControl("TextBox1")).Text; NegocioProducto neg = new NegocioProducto(); //lblSelecciono.Text = s_Idproc + s_pu + s_stock + s_imagen; int stock = Convert.ToInt32(s_stock); bool estado = false; decimal Precio = Convert.ToDecimal(s_pu); estado = neg.actualizarProducto(s_Idproc, Precio, stock, s_imagen); if (estado == true) { lblSelecciono.Text = "SE Actaulizo el producto corrrectamente "; } else { lblSelecciono.Text = "NO SE PUDO ACTUALIZAR "; } //GestionLibros glibros = new GestionLibros(); //glibros.ActualizarLibro(lib); grdProductos.EditIndex = -1; cargarGridView(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { _negocioProducto = new NegocioProducto(); // ListaArticulos = new ObservableCollection<Articulo>(_negocioProducto.ObtenerArticulos()); _negTipo = new NegociotipoArticulo(); ListaProductos = _negTipo.ObtenertiposArticulos(); ListaTipoArticulos = new ObservableCollection <TipoArticulo>(_negTipo.ListadoTipos()); especi = new Dictionary <int, string>(); // especi.Add(0, "Null"); foreach (TipoArticulo tp in ListaTipoArticulos) { especi.Add(tp.TipoArticuloID, tp.Descripcion); } especi[0] = "Null"; ComboTipo.ItemsSource = ListaTipoArticulos; // ComboTipo.Text = "Null"; ComboTipo.SelectedIndex = 0; }
public void cargarGridView() { NegocioProducto neg = new NegocioProducto(); grdProductos.DataSource = neg.GenerarTabla_Productos(); grdProductos.DataBind(); }
public ActionResult Producto(Producto producto, string idTipoProducto, string idSucursal) { if (ModelState.IsValid) { NegocioProducto auxProducto = new NegocioProducto(); int idTipoProduc = Convert.ToInt32(idTipoProducto); int idSucur = Convert.ToInt32(idSucursal); bool resultado = false; producto.TipoProducto.IdTipoProducto = idTipoProduc; producto.Sucursal.IdSucursal = idSucur; resultado = auxProducto.insertarProducto(producto); if (resultado == true) { ModelState.AddModelError("", "Datos Correctos"); Limpiar(producto); } else { ModelState.AddModelError("", "Error datos invalidos"); } ViewBag.listaTipoProducto = obtenerTipoProducto(); ViewBag.listaSucursal = obtenerSucursal(); // } return(View()); }
private void btnEliminar_Click(object sender, EventArgs e) { try { string respuesta = ""; DialogResult opcion; opcion = MessageBox.Show("¿Seguro que desea eliminar el Producto?", "Eliminar Producto", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (opcion == DialogResult.OK) { respuesta = NegocioProducto.eliminarProducto(this.txtCodigo.Text); if (respuesta.Equals("OK")) { this.MensajeOK("Registro eliminado exitosamente"); } else { this.MensajeError(respuesta); } } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } this.limpiarCampos(); btnEliminar.Visible = false; this.mostrarProductos(); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { _negocioLinped = new NegocioLinped(); _negocioPedido = new NegocioPedido(); _negProducto = new NegocioProducto(); _listaPedidos = new List <Pedido>(); _listaPedidos = new List <Pedido>(); _listaArticulos = new List <Articulo>(); _listaLinpeds = _negocioLinped.ObtenerLinped(); _listaPedidos = _negocioPedido.ObtenerPedido(); _listaArticulos = _negProducto.ObtenerArticulos(); var listaFecha = _listaPedidos .Select(i => i.Fecha) .Distinct() .OrderByDescending(s => s) .ToList(); CalendarioFechas.DisplayDate = DateTime.Now; // AddSelectedDates(listaFecha); }
private void btnGuardar_Click(object sender, EventArgs e) { try { string respuesta = ""; if (this.txtCantidad.Text == string.Empty || this.txtPrecioCompra.Text == string.Empty || this.txtPrecioVenta.Text == string.Empty) { MensajeError("Falta ingresar algunos datos"); } else { int nuevoStock; nuevoStock = this.actualizarStock(); respuesta = NegocioProducto.actualizarProducto(this.txtCodigo.Text.ToUpper(), nuevoStock, float.Parse(this.txtPrecioCompra.Text), float.Parse(this.txtPrecioVenta.Text), this.pickerFechaRegistroCompra.Text, this.pickerFechaRegistroVenta.Text); this.MensajeOK("Registro actualizado exitosamente"); this.limpiarCampos(); this.bloquearCampos(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
public FormularioPedidos() { InitializeComponent(); _pedido = new NegocioPedido(); _negproducto = new NegocioProducto(); _articulo = new Articulo(); _listArticulos = new List <Articulo>(); _negLinped = new NegocioLinped(); }
protected void Page_Load(object sender, EventArgs e) { Presupuestos pre = new Presupuestos(); NegocioProducto np = new NegocioProducto(); if (Session["Alias"] != null) { HyperLink3.NavigateUrl = "~/YaMaquetado/Cuenta.aspx"; lblMensaje.Text = Session["Alias"].ToString(); } }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { _negproducto = new NegocioProducto(); _listArticulos = new List <Articulo>(); _negociotipoArticulo = new NegociotipoArticulo(); TxTFecha.SelectedDate = DateTime.Now; // ListaProductos = _negociotipoArticulo.ListadoTipos(); // listArticulosStock.ItemsSource = ListaProductos; }
private void btnBuscar_Click(object sender, EventArgs e) { DataTable tablaProducto = NegocioProducto.consultarProductoTabla(this.txtCodigo.Text); if (tablaProducto.Rows.Count == 0) { desbloquearCampos(); } else { MessageBox.Show("Producto ya registrado", "Registrar Producto", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void cargarProductos() { NegocioCategorias negCli = new NegocioCategorias(); System.Collections.IEnumerator mostrar = negCli.getCate().GetEnumerator(); while (mostrar.MoveNext()) { Cate ca = (Cate)mostrar.Current; TabPage tab = new TabPage(); tab.Text = ca._nombre; tab.Name = ca._ID_Cate + ""; tbcProducts.Controls.Add(tab); } NegocioProducto negPro = new NegocioProducto(); IEnumerator tabpages = tbcProducts.TabPages.GetEnumerator(); while (tabpages.MoveNext()) { int izq = 10; int ar = 10; TabPage tab = (TabPage)tabpages.Current; ArrayList productos = negPro.getProductosxcate(int.Parse(tab.Name)); foreach (Producto itpro in productos) { Label lbl = new Label(); lbl.Name = itpro._ID_Producto + ""; lbl.Text = itpro._nombre; lbl.TextAlign = ContentAlignment.MiddleCenter; lbl.Width = 50; lbl.Left = izq; if (izq > tab.Width) { izq = 0; ar += 20; } lbl.Top = ar; AsignarEventos(lbl); tab.Controls.Add(lbl); izq += 50; } } }
private void btnBuscarMC_Click(object sender, EventArgs e) { NegocioProducto NegP = new NegocioProducto(); NegocioCuenta negC = new NegocioCuenta(); Producto p = NegP.getProductoMcelroy(this.txtBuscarNombre.Text.Trim(), this.txtBuscarCodMc.Text.Trim()); if (NegP.existeProducto(this.txtBuscarCodMc.Text, this.txtBuscarCodPrelude.Text) == false) { MessageBox.Show(this, "No se encontraron resultados", "Error, no hay resultados"); return; } ResultadoBusqueda rs = new ResultadoBusqueda(p, "ingresarExistencia"); rs.StartPosition = FormStartPosition.CenterScreen; rs.ShowDialog(); }
public FormularioBusquedaProducto(string opcion) { InitializeComponent(); if ("Pedido" == opcion) { btnActualizar.Enabled = false; btnActualizar.Visible = false; } dt = new DataTable(); _neg = new NegocioProducto(); _negTipo = new NegociotipoArticulo(); _negEspecificaciones = new NegocioEspecificaciones(); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { _pedido = new NegocioPedido(); _negproducto = new NegocioProducto(); _listArticulos = new List <Articulo>(); _negLinped = new NegocioLinped(); _negociotipoArticulo = new NegociotipoArticulo(); // ListaProductos = _negociotipoArticulo.ListadoTipos(); // listArticulosStock.ItemsSource = ListaProductos; pedido = new Pedido(); }
protected void btnAgregar_Click(object sender, EventArgs e) { NegocioProducto neg = new NegocioProducto(); int stock = Convert.ToInt32(TxtStock.Text); bool estado = false; decimal Precio = Convert.ToDecimal(txtprecio.Text); estado = neg.agregarProducto(txtcodpro.Text, Precio, stock, txtcategoria.Text, txtcategoria.Text, txtImagen.Text); if (estado == true) { lblSelecciono.Text = "se agrego producto"; } else { lblSelecciono.Text = "NO se agrego producto"; } }
public FormularioBusquedaProducto(bool habilitar) { InitializeComponent(); dt = new DataTable(); dv = new DataView(); _neg = new NegocioProducto(); _negTipo = new NegociotipoArticulo(); _negEspecificaciones = new NegocioEspecificaciones(); if (habilitar == true) { btnSeleccionar.Enabled = true; btnSeleccionar.Visible = true; } }
private void rellenarGrilla() { NegocioCuenta negC = new NegocioCuenta(); NegocioProducto negP = new NegocioProducto(); List <Producto> lista = negP.getListaTodosProductos(); this.dgvProducto.Rows.Clear(); foreach (Producto prod in lista) { this.dgvProducto.Rows.Add(prod.NOMBRE, prod.PROVEEDOR_NOMBRE, prod.TIPOEQUIPAMIENTO_NOMBRE, prod.CUENTA = negC.getNombreCuenta(prod.CUENTA) + " (" + prod.CUENTA + ")", prod.CODIGOMC, prod.CODIGOPRELUDE); } }
protected void grdProductos_RowDeleting(object sender, GridViewDeleteEventArgs e) { String s_codpro = ((Label)grdProductos.Rows[e.RowIndex].FindControl("lblit_Cod_pro")).Text; bool estado = false; NegocioProducto proc = new NegocioProducto(); lblSelecciono.Text = s_codpro; estado = proc.eliminarProducto(s_codpro); //if(estado == true) //{ // lblSelecciono.Text = "EL PRODUCTO "+s_codpro+" FUE eliminado"; //} //else //{ // lblSelecciono.Text = "NO SE PUDO ELIMINAR "; //} cargarGridView(); }
public List <SelectListItem> obtenerSucursal() { List <SelectListItem> list = new List <SelectListItem>(); List <Sucursal> listSucursal; NegocioProducto auxNegocio = new NegocioProducto(); listSucursal = auxNegocio.retornaSucursal(); foreach (var li in listSucursal) { list.Add(new SelectListItem() { Text = li.Nombre, Value = li.IdSucursal.ToString() }); } return(list); }
public List <SelectListItem> obtenerTipoProducto() { List <SelectListItem> list = new List <SelectListItem>(); List <TipoProducto> listTipoProducto = new List <TipoProducto>(); NegocioProducto auxNegocio = new NegocioProducto(); listTipoProducto = auxNegocio.retornaTipoProducto(); foreach (var li in listTipoProducto) { list.Add(new SelectListItem() { Text = li.Nombre, Value = li.IdTipoProducto.ToString() }); } return(list); }
private void solicitarProducto(object sender, EventArgs e) { Control aki = (Control)sender; Label lbl = (Label)aki; int id = int.Parse(lbl.Name.ToString()); NegocioProducto neg = new NegocioProducto(); Producto pro = neg.buscarProducto(id); TabPage tab = tcCuentas.SelectedTab; string nombre = tab.Name.ToString(); Control[] ctl = tab.Controls.Find("dgv" + nombre, false); DataGridView dgv = (DataGridView)ctl[0]; dgv.Rows.Add(pro._descripcion, pro._nombre, "1", pro._precio, pro._precio, ""); calcularTotal(tab); }
private void btnBuscar_Click(object sender, EventArgs e) { NegocioProducto.consultarProductoTabla(this.txtCodigo.Text); if (this.tablaProducto.Rows.Count != 0) { this.txtCodigo.Text = Convert.ToString(this.tablaProducto.CurrentRow.Cells["CODIGOPRODUCTO"].Value); this.lblNombreProducto.Text = Convert.ToString(this.tablaProducto.CurrentRow.Cells["NOMBREPRODUCTO"].Value); this.lblDescripcion.Text = Convert.ToString(this.tablaProducto.CurrentRow.Cells["DESCRIPCIONPRODUCTO"].Value); this.lblCategoria.Text = Convert.ToString(this.tablaProducto.CurrentRow.Cells["CATEGORIAPRODUCTO"].Value); this.lblCantidad.Text = Convert.ToString(this.tablaProducto.CurrentRow.Cells["CANTIDADPRODUCTO"].Value); this.lblPrecioCompra.Text = Convert.ToString(this.tablaProducto.CurrentRow.Cells["PRECIOCOMPRAPRODUCTO"].Value); this.lblPrecioVenta.Text = Convert.ToString(this.tablaProducto.CurrentRow.Cells["PRECIOVENTAPRODUCTO"].Value); this.lblFechaRegistroPrecioCompra.Text = Convert.ToString(this.tablaProducto.CurrentRow.Cells["FECHAREGISTROPRECIOCOMPRA"].Value); this.lblFechaRegistroPrecioVenta.Text = Convert.ToString(this.tablaProducto.CurrentRow.Cells["FECHAREGISTROPRECIOVENTA"].Value); } else { this.limpiarCampos(); this.mostrarProductos(); MessageBox.Show("Producto no registrado", "Consultar Producto", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void btnInsertar_Click(object sender, EventArgs e) { if (this.txtCodigo.Text == String.Empty || this.txtDescuento.Text == String.Empty || this.txtCantidadVender.Text == String.Empty) { MessageBox.Show("Falta ingresar algunos campos", "Ingresar Producto", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (Convert.ToInt32(this.lblCantidad.Text) < Convert.ToInt32(this.txtCantidadVender.Text)) { MessageBox.Show("Producto Insuficiente", "Ingresar Producto", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { FormularioNueva_FacturaVenta factura = new FormularioNueva_FacturaVenta(); NegocioProducto.consultarProductoTabla(this.txtCodigo.Text); if (this.tablaProducto.Rows.Count != 0) { DataRow row = FormularioNueva_FacturaVenta.tablaDetalle.NewRow(); row["IDFACTURA"] = Int32.Parse((factura.lblNumeroFacturaVenta.Text)); row["IDPRODUCTO"] = Int32.Parse(Convert.ToString(this.tablaProducto.CurrentRow.Cells["IDPRODUCTO"].Value)); row["IDMANTENIMIENTO"] = 1; row["CÓDIGO"] = this.txtCodigo.Text; row["CANTIDAD"] = Convert.ToInt32(this.txtCantidadVender.Text); row["DETALLE"] = this.lblDescripcion.Text; row["VALOR UNITARIO"] = Convert.ToSingle(this.lblPrecioVenta.Text); row["DESCUENTO"] = Convert.ToSingle(this.lblPrecioVenta.Text) * Convert.ToInt32(this.txtCantidadVender.Text) * (float.Parse(this.txtDescuento.Text) / 100); row["VALOR TOTAL"] = (Convert.ToSingle(row["VALOR UNITARIO"].ToString()) * (Convert.ToSingle(row["CANTIDAD"].ToString())) - (Convert.ToSingle(row["DESCUENTO"].ToString()))); FormularioNueva_FacturaVenta.tablaDetalle.Rows.Add(row); this.Hide(); } } } }
private void guardarToolStripMenuItem_Click(object sender, EventArgs e) { try { string respuesta = ""; if (this.txtCodigo.Text == string.Empty || this.txtNombreProducto.Text == string.Empty || this.txtDescripcion.Text == string.Empty || this.txtCategoria.Text == string.Empty || this.txtCantidad.Text == string.Empty || this.txtPrecioCompra.Text == string.Empty || this.txtPrecioVenta.Text == string.Empty) { MensajeError("Falta ingresar algunos datos"); } else { respuesta = NegocioProducto.insertarProducto(this.txtCodigo.Text.ToUpper(), this.txtNombreProducto.Text.ToUpper(), this.txtDescripcion.Text.ToUpper(), this.txtCategoria.Text.ToUpper(), Int32.Parse(this.txtCantidad.Text), float.Parse(this.txtPrecioCompra.Text), float.Parse(this.txtPrecioVenta.Text), this.pickerFechaRegistroCompra.Text, this.pickerFechaRegistroVenta.Text); this.MensajeOK("Registro ingresado exitosamente"); this.limpiarCampos(); this.bloquearCampos(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void rdProducto_CheckedChanged(object sender, EventArgs e) { try { if (!rdProducto.Checked) { } else { NegocioProducto produc = new NegocioProducto(); if (produc.listarProductos().Tables[0].Rows.Count > 0) { cbxProducto.DataSource = produc.listarProductos().Tables[0]; //validar q contenga datos cbxProducto.DisplayMember = "nombre"; cbxProducto.ValueMember = "id_producto"; cbxProducto.SelectedIndex = -1; if (cbxProducto.SelectedIndex == -1) { cbxProducto.Text = "Seleccione un producto"; } } else { //rdMedicina.Enabled = false; //cbxMedicina.Enabled = false; MessageBox.Show("No hay productos ingresados"); } } } catch (Exception) { throw; } }