예제 #1
0
 private void cargarProducto()
 {
     cbProducto.DataSource    = NProducto.MostrarProductoDescuento();
     cbProducto.ValueMember   = "Codigo";
     cbProducto.DisplayMember = "Nombre";
     cbProducto.SelectedIndex = -1;
 }
        private void btnGuardar_Click(object sender, EventArgs e)
        {     //inicio boton guardar de Industriales
            try
            { //inicio try
                string rpta = "";
                if (this.txtIdProducto.Text != string.Empty)
                {//inicio if
                 //MensajeError("Falta ingresar algunos datos, serán recargados");
                 //errorIcono.SetError(txtDescripcion, "Ingrese la denoinacion del producto");
                }//fin if
                else
                {//inicio else
                    decimal valor_Decimal = 0;

                    if (this.isNuevo)
                    {//inicio if
                        MessageBox.Show("Estoy entrando por el metodo INSERTAR");
                        //rpta = NProducto.Insertar(5001, 2005, "Producto de prueba", 15, 2,
                        //  150, 5, "18/10/2005", 1, 1);
                        MessageBox.Show("Estoy entrando por el metodo INSERTAR");
                        rpta = NProducto.Insertar(5000, Convert.ToInt32(this.txtCodigoBarra.Text), this.txtDescripcion.Text.Trim().ToUpper(), Convert.ToDecimal(this.txtPrecioKilo.Text), Convert.ToDecimal(this.txtPrecioUnidad.Text),
                                                  Convert.ToInt32(this.txtStock.Text), Convert.ToInt32(this.txtStockMinimo.Text), "12/10/2005", Convert.ToInt32(this.cmbTaller.SelectedValue), Convert.ToInt32(this.txtMateriaPrrima.Text));
                    }//fin if
                    else
                    {//inicio else
                        MessageBox.Show("Estoy entrando por el metodo EDITAR");
                        rpta = NProducto.Editar(Convert.ToInt32(this.txtIdProducto.Text), Convert.ToInt32(this.txtCodigoBarra.Text), this.txtDescripcion.Text.Trim().ToUpper(), Convert.ToDecimal(this.txtPrecioKilo.Text), Convert.ToDecimal(this.txtPrecioUnidad.Text),
                                                Convert.ToInt32(this.txtStock.Text), Convert.ToInt32(this.txtStock.Text), this.txtFechaVencimiento.Text.Trim().ToUpper(), Convert.ToInt32(this.cmbTaller.SelectedValue), Convert.ToInt32(this.cmbMateriaPrima.SelectedValue));
                    }//fin else

                    if (rpta.Equals("OK"))
                    {     //inicio if rpta
                        if (this.isNuevo)
                        { //inicio if IsNuevo
                            this.MensajeOk("Se insertó correctamnte el Registro");
                        }//fin if IsNuevo

                        else
                        {//inicio else IsNuevo
                            this.MensajeOk("Se actualizó correctamnte el Registro");
                        }//Fin else IsNuevo
                    }//fin rpta
                    else
                    {//inicio else rpta
                        this.MensajeError("Se introdujo un número de dni o legajo duplicado a continuación se muestra el número duplicado: " + rpta);
                    }//fin else rpta

                    this.isNuevo  = false;
                    this.isEditar = false;
                    this.Botones();
                    this.Limpiar();
                    this.Mostrar();
                } //fin else
            }     //fin try
            catch (Exception ex)
            {//inicio catch
                MessageBox.Show(ex.Message, ex.StackTrace);
                MessageBox.Show("El error esta por esta salida");
            } //fin catch
        }     //fin boton guardar de Industriales
예제 #3
0
 public void Buscar()
 {
     this.DataListado.DataSource = NProducto.Buscar(this.txtBuscar.Text);
     this.OcultarColumnas();
     this.DiseñoColumnas();
     lblRegistros.Text = "Registros Encontrados : " + Convert.ToString(DataListado.Rows.Count);
 }
예제 #4
0
 private void Contar()
 {
     this.label11.Text = NCliente.Contar();
     this.label19.Text = NProveedor.Contar();
     this.label15.Text = NCompra.Contar();
     this.label7.Text  = NProducto.Contar();
 }
예제 #5
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {     //inicio boton guardar de Industriales
            try
            { //inicio try
                MessageBox.Show("Estoy entrando por el metodo INSERTAR");
                string rpta = "";
                if (this.txtIdProducto.Text == string.Empty)
                {//inicio if
                 //MensajeError("Falta ingresar algunos datos, serán recargados");
                 //errorIcono.SetError(txtDescripcion, "Ingrese la denoinacion del producto");
                }//fin if
                else
                {//inicio else
                    decimal valor_Decimal = 0;
                    //imagen foto
                    //System.IO.MemoryStream ms = new System.IO.MemoryStream();
                    //this.pbCliente.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    //Byte[] foto = ms.GetBuffer();
                    if (this.isNuevo)
                    {//inicio if
                        MessageBox.Show("Estoy entrando por el metodo INSERTAR");
                        rpta = NProducto.Insertar(Convert.ToInt32(this.txtIdProducto.Text), Convert.ToInt32(this.txtCodigoBarra.Text), this.txtDescripcion.Text.Trim().ToUpper(), Convert.ToDecimal(this.txtPrecioVenta.Text.Trim().ToUpper()),
                                                  Convert.ToInt32(this.txtStock.Text), Convert.ToInt32(this.txtStock.Text), this.txtFechaVencimiento.Text.Trim().ToUpper(), Convert.ToInt32(this.cmbTaller.SelectedValue), Convert.ToInt32(this.cmbMateriaPrima.SelectedValue));
                    }//fin if
                    else
                    {//inicio else
                        MessageBox.Show("Estoy entrando por el metodo EDITAR");
                        rpta = NProducto.Editar(Convert.ToInt32(this.txtIdProducto.Text), Convert.ToInt32(this.txtCodigoBarra.Text), this.txtDescripcion.Text.Trim().ToUpper(), Convert.ToDecimal(this.txtPrecioVenta.Text.Trim().ToUpper()),
                                                Convert.ToInt32(this.txtStock.Text), Convert.ToInt32(this.txtStock.Text), this.txtFechaVencimiento.Text.Trim().ToUpper(), Convert.ToInt32(this.cmbTaller.SelectedValue), Convert.ToInt32(this.cmbMateriaPrima.SelectedValue));
                    }//fin else

                    if (rpta.Equals("OK"))
                    {     //inicio if rpta
                        if (this.isNuevo)
                        { //inicio if IsNuevo
                            this.MensajeOk("Se insertó correctamnte el Registro");
                        }//fin if IsNuevo

                        else
                        {//inicio else IsNuevo
                            this.MensajeOk("Se actualizó correctamnte el Registro");
                        }//Fin else IsNuevo
                    }//fin rpta
                    else
                    {//inicio else rpta
                        this.MensajeError("Se introdujo un número de dni o legajo duplicado a continuación se muestra el número duplicado: " + rpta);
                    }//fin else rpta

                    this.isNuevo  = false;
                    this.isEditar = false;
                    this.Botones();
                    this.Limpiar();
                    this.Mostrar();
                } //fin else
            }     //fin try
            catch (Exception ex)
            {//inicio catch
                MessageBox.Show(ex.Message, ex.StackTrace);
            } //fin catch
        }     //fin boton guardar de Industriales
예제 #6
0
 private void btnEliminar_Click(Object sender, EventArgs e)
 {
     try
     {
         DialogResult opt;
         opt = MessageBox.Show("¿Eliminar los Registros?", "Sistema de Ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
         if (opt == DialogResult.OK)
         {
             string code;
             string rpta = "";
             foreach (DataGridViewRow row in dataLista.Rows)
             {
                 if (Convert.ToBoolean(row.Cells[0].Value))
                 {
                     code = Convert.ToString(row.Cells[1].Value);
                     rpta = NProducto.Eliminar(Convert.ToInt32(code));
                     if (rpta.Equals("OK"))
                     {
                         this.MensajeConfirmacion("Eliminado");
                     }
                     else
                     {
                         this.MensajeError(rpta);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
     this.Consultar();
 }
예제 #7
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = string.Empty;
                if (this.txtNombre.Text == string.Empty || this.txtIdProducto.Text == string.Empty || this.txtPrecio.Text == string.Empty || this.txtTipo.Text == string.Empty)
                {
                    MensajeError("Ingresar los datos faltantes");
                    this.ErrorIcono.SetError(txtIdProducto, "Ingresar datos");
                    this.ErrorIcono.SetError(txtNombre, "Ingresar datos");
                    this.ErrorIcono.SetError(txtPrecio, "Ingresar datos");
                    this.ErrorIcono.SetError(txtTipo, "Ingresar datos");
                }

                if (this.IsNuevo)
                {
                    rpta = NProducto.Insertar(
                        this.txtCodigoVenta.Text.Trin().ToUpper(),
                        this.txtNombre.Text.Trim().ToUpper(),
                        Convert.ToInt32(this.txtIdProducto.Text.Trim().ToUpper()),
                        Convert.ToInt32(this.cbIdPresentacion.SelectedValue));
                }
                else
                {
                    if (this.IsEditar)
                    {
                        rpta = NProducto.Modificar(Convert.ToInt32(this.txtIdProducto.Text.Trim()),
                                                   this.txtCodigoVenta.Text.Trim().ToUpper(),
                                                   this.txtNombre.Text.Trim().ToUpper(),
                                                   Convert.ToInt32(this.txtIdProducto.Text.Trim().ToUpper()),
                                                   Convert.ToInt32(this.cbIdPresentacion.SelectedValue));
                    }
                }
                if (rpta.Equals("OK"))
                {
                    if (this.IsNuevo)
                    {
                        this.MensajeConfirmacion("Registro Exitoso");
                    }
                    else if (this.IsEditar)
                    {
                        this.MensajeConfirmacion("Actualización Exitosa");
                    }
                }
                else
                {
                    this.MensajeError(rpta);
                }
                this.IsNuevo  = false;
                this.IsEditar = false;
                this.Buttons();
                this.Limpiar();
                this.Consultar();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
예제 #8
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            /*if (!this.txtIdProducto.Text.Equals(""))
             * {
             *  this.tabControl2.SelectedIndex = 1;
             *  this.IsEditar = true;
             *  this.Botones();
             *  this.Habilitar(true);
             *  this.txtNombre.Focus();
             * }
             * else
             * {
             *  this.MensajeError("Seleccione un registro");
             * }*/

            cbQuitar.Checked = false;
            if (!this.txtIdProducto.Text.Equals(""))
            {
                this.tabControl2.SelectedIndex = 1;
                this.IsEditar = true;
                this.Botones();
                this.Habilitar(true);
                this.txtNombre.Focus();

                gbMenu.Visible = true;
                decimal suma = 0;

                //crearTabla();
                dtDetalle = NProducto.MostrarDetalleProducto(Convert.ToInt32(this.txtIdProducto.Text));
                //dataListado.DataSource = NProducto.MostrarDetalleProducto(Convert.ToInt32(this.txtIdProducto.Text));
                dataListadoDetalle.DataSource = dtDetalle;
                btnReceta.Enabled             = false;
                dataListadoDetalle.ClearSelection();
                this.lblNroFilas.Text = Convert.ToString(dataListadoDetalle.Rows.Count);
                if (lblNroFilas.Text != "0")
                {
                    for (int i = 0; i < Convert.ToInt32(this.lblNroFilas.Text); i++)
                    {
                        suma = suma + Convert.ToDecimal(dataListadoDetalle.Rows[i].Cells[5].Value.ToString());
                        this.dataListadoDetalle.Columns[6].Visible = false;
                    }
                    this.lblTotalVenta.Text = suma.ToString();
                    this.dataListadoDetalle.Columns[0].Visible = false;
                }

                if (lblTipo.Text == "MSA" || lblTipo.Text == "DSA")//MENU: DESAYUNO
                {
                    gbMenu.Show();
                }
                else
                {
                    gbMenu.Visible = false;
                }
            }
            else
            {
                this.MensajeError("Seleccione un registro");
            }
        }
        }     //fin boton guardar de Industriales

        private void btnImprimir_Click(object sender, EventArgs e)
        {
            string rpta = "";

            MessageBox.Show("Estoy entrando por el metodo INSERTAR");
            rpta = NProducto.Insertar(5000, 2005, "Producto de prueba", 15, 2,
                                      150, 5, "18/10/2005", 1, 1);
        }
 private void cargarProducto()
 {
     cbProducto.DataSource    = NProducto.MostrarArticuloReporte();
     cbProducto.ValueMember   = "Codigo";
     cbProducto.DisplayMember = "Nombre";
     cbProducto.SelectedIndex = -1;
     //lblPrueba.Text = cbCategoria.SelectedValue.ToString();
 }
예제 #11
0
 private void limpiar()
 {
     IdProducto.Clear();
     NProducto.Clear();
     Precio.Clear();
     IdProducto.Focus();
     IdProducto.Enabled = true;
 }
예제 #12
0
 private void Mostrar()
 {
     this.DataListado.DataSource = NProducto.Mostrar();
     this.OcultarColumnas();
     this.DiseñoColumnas();
     this.Eliminar();
     lblRegistros.Text = "Total de Registros : " + Convert.ToString(DataListado.Rows.Count);
 }
 private bool Mostrar()
 {
     if (NProducto.Mostrar(dgvVistaStock))
     {
         lblTotalRegistros.Text = "Registros: " + dgvVistaStock.Rows.Count.ToString();
         return(true);
     }
     return(false);
 }
예제 #14
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = "";
                int    idCategoria, idUnidad, idMarca;

                if (this.cbCategoria.SelectedIndex == -1)
                {
                    MensajeError("Seleccione una categoría");
                    errorIcono.SetError(cbCategoria, "Seleccione una categoría");
                }
                else if (this.cbMarca.SelectedIndex == -1)
                {
                    MensajeError("Seleccione una marca");
                    errorIcono.SetError(cbMarca, "Seleccione una marca");
                }
                else if (this.cbUnidad.SelectedIndex == -1)
                {
                    MensajeError("Seleccione una medida");
                    errorIcono.SetError(cbCategoria, "Seleccione una medida");
                }
                else if (this.txtNombre.Text.Trim() == string.Empty)
                {
                    MensajeError("Ingrese el nombre");
                    errorIcono.SetError(txtNombre, "Ingrese el nombre");
                }

                else
                {
                    string imprimir = "";

                    idCategoria = Convert.ToInt32(this.cbCategoria.SelectedValue.ToString());
                    idUnidad    = Convert.ToInt32(this.cbUnidad.SelectedValue.ToString());
                    idMarca     = Convert.ToInt32(this.cbMarca.SelectedValue.ToString());

                    rpta = NProducto.Insertar(this.txtNombre.Text.Trim().ToUpper(), "", 0, 00.00m, "A", "A", idCategoria, imprimir, 0, 00.00m, idUnidad, 00.00m, idMarca);

                    if (rpta.Equals("OK"))
                    {
                        this.MensajeOK("Se insertó correctamente");
                    }
                    else
                    {
                        this.MensajeError(rpta);
                    }

                    frmVistaProductoIngreso.f1.Mostrar();
                    this.Hide();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
예제 #15
0
 public MainCasosNegocio()
 {
     Categoria     = new NCategoria();
     Empresa       = new NEmpresa();
     Local         = new NLocal();
     Oferta        = new NOferta();
     OpinionOferta = new NOpinionOferta();
     Producto      = new NProducto();
     Usuario       = new NUsuario();
 }
예제 #16
0
 private void BtnSeleccionar_Click(object sender, EventArgs e)
 {
     if (DgvProducto.SelectedRows.Count > 0)
     {
         int rowindex = DgvProducto.CurrentRow.Index;
         if (rowindex != -1)
         {
             try
             {
                 Frm_Registrar_Venta frm = Owner as Frm_Registrar_Venta;
                 string codigoproducto   = DgvProducto.CurrentRow.Cells[3].Value.ToString();
                 frm.TxtProducto.Text = codigoproducto;
                 NProducto boProducto = new NProducto();
                 EProducto producto   = boProducto.Seleccionar(codigoproducto);
                 if (string.IsNullOrEmpty(producto.Codigo))
                 {
                     MessageBox.Show("No Existe Producto", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 }
                 else
                 {
                     NInventario boInventario = new NInventario();
                     EInventario inventario   = boInventario.Seleccionar(producto.Codigo);
                     if (!string.IsNullOrEmpty(inventario.Producto))
                     {
                         if (inventario.Existencias > 0)
                         {
                             double utilidad    = Frm_Principal.ValorUtilidad;
                             double precioventa = Math.Round((inventario.ValorUnitario * utilidad), 2);
                             frm.AddItems(producto, 1, precioventa);
                             //Mostrar imagen
                             if (!string.IsNullOrEmpty(producto.Imagen))
                             {
                                 frm.PbxImgProducto.Image = Image.FromFile(CarpetaImagen + "/" + producto.Imagen);
                             }
                         }
                         else
                         {
                             MessageBox.Show("No hay Cantidad Suficiente");
                         }
                     }
                 }
                 Close();
             }
             catch
             {
                 //
             }
         }
     }
     else
     {
         MessageBox.Show("Seleccione un registro");
     }
 }
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            Habilitar_Editar_Eliminar(false);
            DialogResult result = MessageBox.Show(string.Format("¿Esta seguro de eliminar '{0}' permamentemente? ", AuxiliarNombreProducto), "Advertencia!", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                MessageBox.Show(NProducto.Eliminar(Obtener_Id_Producto(AuxiliarNombreProducto)));
                Mostrar();
            }
        }
        private void btnGuardar_Click_1(object sender, EventArgs e)
        {
            if (Editar == true)
            {
                if (Comprobar_Campos() == "")
                {
                    if (AuxiliarNombreProducto.Equals(tbNombre.Text))
                    {
                        MessageBox.Show(NProducto.Editar(Obtener_Id_Producto(AuxiliarNombreProducto), Obtener_Id_Categoria(cbCategoria.Text), tbNombre.Text, tbMarca.Text, int.Parse(tbStock.Text), tbCodigo.Text, decimal.Parse(tbPrecioCompra.Text), decimal.Parse(tbPrecioVenta.Text), Obtener_Id_Proveedor(cbProveedor.Text)));
                        Limpiar_Campos();
                        Editar = false;
                        Mostrar();
                        return;
                    }
                    else
                    {
                        if (NProducto.NombreExistente(tbNombre.Text))
                        {
                            MessageBox.Show(string.Format("El nombre: '{0}' ya se encuentra en uso!", tbNombre.Text));
                        }
                    }

                    MessageBox.Show(NProducto.Editar(Obtener_Id_Producto(AuxiliarNombreProducto), Obtener_Id_Categoria(cbCategoria.Text), tbNombre.Text, tbMarca.Text, int.Parse(tbStock.Text), tbCodigo.Text, decimal.Parse(tbPrecioCompra.Text), decimal.Parse(tbPrecioVenta.Text), Obtener_Id_Proveedor(cbProveedor.Text)));
                    Limpiar_Campos();
                    Editar = false;
                    Mostrar();
                }

                else
                {
                    MessageBox.Show(Comprobar_Campos());
                }
            }
            else
            {
                if (Comprobar_Campos() == "")
                {
                    if (NProducto.NombreExistente(tbNombre.Text))
                    {
                        MessageBox.Show(string.Format("El nombre: '{0}' ya se encuentra en uso!", tbNombre.Text));
                    }
                    else
                    {
                        MessageBox.Show(NProducto.Insertar(Obtener_Id_Categoria(cbCategoria.Text), tbNombre.Text, tbMarca.Text, int.Parse(tbStock.Text), tbCodigo.Text, decimal.Parse(tbPrecioCompra.Text), decimal.Parse(tbPrecioVenta.Text), Obtener_Id_Proveedor(cbProveedor.Text)));
                        Limpiar_Campos();
                        Mostrar();
                    }
                }
                else
                {
                    MessageBox.Show(Comprobar_Campos());
                }
            }
        }
예제 #19
0
 private void tbBuscarProductosFacturacion_TextChanged(object sender, EventArgs e)
 {
     if (rbNombreDescripcion.Checked)
     {
         NProducto.BuscarPorNombreFacturacion(dgvVistaProdFact, tbBuscarProductosFacturacion.Text);
     }
     else if (rbCodigo.Checked)
     {
         NProducto.BuscarPorCodigoFacturacion(dgvVistaProdFact, tbBuscarProductosFacturacion.Text);
     }
 }
예제 #20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         NProducto negocio = new NProducto();
         listaProductos = negocio.listarProductos();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #21
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = "";

                this.errores();

                if (this.errores())
                {
                    if (this.IsNuevo)
                    {
                        rpta = NProducto.Insertar(this.txtModelo.Text.Trim(),
                                                  this.txtDescripcion.Text.Trim(), Convert.ToSingle(this.txtPrecio.Text), Convert.ToInt32(txtStock.Text)
                                                  , this.txtMarca.Text.Trim(), this.txtCategoria.Text.Trim());
                    }
                    else
                    {
                        rpta = NProducto.Editar(Convert.ToInt32(this.txtIdProducto.Text), this.txtModelo.Text.Trim(),
                                                this.txtDescripcion.Text.Trim(), Convert.ToSingle(this.txtPrecio.Text), Convert.ToInt32(txtStock.Text)
                                                , this.txtMarca.Text.Trim(), this.txtCategoria.Text.Trim());
                    }

                    if (rpta.Equals("OK"))
                    {
                        if (this.IsNuevo)
                        {
                            this.MensajeOk("Se inserto Correctamente El Registro");
                        }
                        else
                        {
                            this.MensajeOk("Se Actualizo Correctamente El Registro");
                        }
                    }
                    else
                    {
                        this.MensajeError(rpta);
                    }
                    this.IsNuevo  = false;
                    this.IsEditar = false;
                    this.Botones();
                    this.Limpiar();
                    this.Mostrar();
                    this.pRegistro.Visible = false;
                    this.pListas.Visible   = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
예제 #22
0
        public static AutoCompleteStringCollection LoadAutoCompleteNombre()
        {
            NProducto getLista = new NProducto();



            AutoCompleteStringCollection stringCol = new AutoCompleteStringCollection();

            foreach (String row in getLista.Listar("", "Nombre").Select(p => p.Nombre))
            {
                stringCol.Add(row);
            }
            return(stringCol);
        }
예제 #23
0
        public static AutoCompleteStringCollection LoadAutoCompleteCaracteristicaValor(string tipo)
        {
            NProducto getLista = new NProducto();



            AutoCompleteStringCollection stringCol = new AutoCompleteStringCollection();

            foreach (String row in getLista.ListarCaracteristicas(tipo))
            {
                stringCol.Add(row);
            }
            return(stringCol);
        }
예제 #24
0
        private void CargarCombo()
        {
            NProducto negocioProducto = new NProducto();

            ddlProducto.DataSource = negocioProducto.ToListModel();

            ddlProducto.Items.Add(new ListItem("Seleccione Un Producto", "0"));

            foreach (var item in negocioProducto.ToListModel())
            {
                ListItem i = new ListItem(item.Nombre, item.IdProducto.ToString());
                ddlProducto.Items.Add(i);
            }
        }
예제 #25
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         string rpta = "";
         if (this.txtNombre.Text == string.Empty || this.txtMarca.Text == "             " || this.txtNombreCategoria.Text == string.Empty || this.txtNombrePresentacion.Text == string.Empty)
         {
             MensajeError("Falta el Nombre");
             errorProvider1.SetError(AltoButton, "Ingrese el Nombre");
         }
         else
         {
             if (this.IsNuevo)
             {
                 rpta = NProducto.Insertar(this.txtNombre.Text.Trim().ToUpper(), this.txtMarca.Text.Trim().ToUpper(), Convert.ToInt32(this.txtIdCategoria.Text), Convert.ToInt32(this.txtIdPresentacion.Text), Convert.ToInt32(this.txtMedida.Text));
             }
             else
             {
                 rpta = NProducto.Editar(Convert.ToInt32(this.txtIdProducto.Text), this.txtNombre.Text.Trim().ToUpper(), this.txtMarca.Text.Trim().ToUpper(), Convert.ToInt32(this.txtIdCategoria.Text), Convert.ToInt32(this.txtIdPresentacion.Text), Convert.ToInt32(this.txtMedida.Text));
             }
             if (rpta.Equals("Ok"))
             {
                 if (this.IsNuevo)
                 {
                     this.MensajeOK("Guardado Correctamente");
                 }
                 else
                 {
                     this.MensajeOK("Actualizado Correctamente");
                 }
                 errorProvider1.Clear();
             }
             else
             {
                 this.MensajeError(rpta);
             }
         }
         this.IsNuevo  = false;
         this.IsEditar = false;
         this.Mostrar();
         this.Botones();
         this.Limpiar();
         this.Habilitar(false);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
예제 #26
0
        public void Mostrar()
        {
            this.dataListado.DataSource = NProducto.MostrarPlatosMenu();
            this.ocultarColumnas();


            if (this.dataListado.Rows.Count == 0)
            {
                this.dataListado.Visible = false;
            }
            else
            {
                this.dataListado.Visible = true;
            }
        }
예제 #27
0
        public void Mostrar()
        {
            this.dataListado.DataSource = NProducto.MostrarTodos();
            this.ocultarColumnas();
            lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);

            if (this.dataListado.Rows.Count == 0)
            {
                this.dataListado.Visible = false;
            }
            else
            {
                this.dataListado.Visible = true;
            }
        }
        private void Guardar()
        {
            string    filename = PtbImagen.Image != null ? TxtCodigo.Text + ".jpg" : "default.jpg";
            EProducto be       = new EProducto
            {
                Categoria      = Convert.ToInt32(CbxCategoria.SelectedValue),
                SubCategoria   = Convert.ToInt32(CbxSubCategoria.SelectedValue),
                Codigo         = TxtCodigo.Text,
                Nombre         = TxtNombre.Text,
                Imagen         = filename,
                TipoExistencia = CbxTipoExistencia.SelectedValue.ToString(),
                UnidadMedida   = CbxUnidadMedida.SelectedValue.ToString(),
                Marca          = Convert.ToInt32(CbxMarca.SelectedValue),
                Estado         = 1
            };
            NProducto bo = new NProducto();

            if (modificar == 0)
            {
                if (bo.Agregar(be))
                {
                    GuardarImagen(be.Codigo);
                    Frm_Buscar_Productos frm = Owner as Frm_Buscar_Productos;
                    frm.Listar();
                    Close();
                    Frm_Principal.Main.ChangeMessage("Producto agregado correctamente", "Success");
                }
                else
                {
                    Frm_Principal.Main.ChangeMessage("Algo salio mal, Intente de nuevo", "Failed");
                }
            }
            else if (modificar == 1)
            {
                if (bo.Modificar(be))
                {
                    GuardarImagen(be.Codigo);
                    Frm_Buscar_Productos frm = Owner as Frm_Buscar_Productos;
                    frm.Listar();
                    Close();
                    Frm_Principal.Main.ChangeMessage("Producto modificado correctamente", "Success");
                }
                else
                {
                    Frm_Principal.Main.ChangeMessage("Algo salio mal, Intente de nuevo", "Failed");
                }
            }
        }
예제 #29
0
        private void txtNombre_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyValue == Convert.ToChar(Keys.Enter))
            {
                mstock = false;
                // MessageBox.Show("Enter");
                e.Handled = false;

                dtConsulta.EndEdit();
                NProducto getProducto = new NProducto();



                List <Datos.TProducto_Caracteristica_Foreign> tlist = getProducto.Listar(txtNombre.Text, "Nombre");


                // MessageBox.Show(tlist.Count+" }}");

                if (tlist.Count == 1)
                {
                    fillDatos((int)tlist[0].Codigo);



                    // MessageBox.Show(tlist[0].Codigo+"}}}");



                    //dtConsulta.EndEdit();
                    //dtConsulta.CurrentCell = dtConsulta.Rows[r].Cells[c];


                    // dtConsulta.Rows.Add();
                    //dtConsulta.CurrentCell = dtConsulta.CurrentRow.Cells[4];
                }
                else
                {
                    dtConsulta.Rows.Clear();
                    dtNombre.Rows.Clear();
                    dtAlmacen.Rows.Clear();
                    dtCaracteristicaR.Rows.Clear();

                    dtConsulta.Rows.Add(1);
                    dtNombre.Rows.Add(1);
                    dtAlmacen.Rows.Add(1);
                }
            }
        }
 //inicio metodo BuscarProductoVentas
 private void BuscarProductoVentas()
 {
     try
     {
         this.dataListadoProductos.DataSource = NProducto.Buscar(this.txtBuscarProductos.Text);
         this.lblStock.Text = "Stock: " + Convert.ToString(this.dataListadoProductos.CurrentRow.Cells["stock"].Value);
         //this.dataListadoProductos.Columns[0].Visible = false;
         this.dataListadoProductos.Columns[1].Visible = false;
         this.dataListadoProductos.Columns[6].Visible = false;
         this.dataListadoProductos.Columns[8].Visible = false;
         this.dataListadoProductos.Columns[9].Visible = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Los productos no coinciden con las letras ingresadas, vuelva a ingresar el nombre del producto o agreguelo desde el boton nuevo producto");
     }
 }//fin metodo BuscarProductoVentas