Пример #1
0
        private void TxtCodigo_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    DataTable Tabla = new DataTable();
                    Tabla = NArticulo.BuscarCodigo(txtCodigo.Text.Trim());

                    if (Tabla.Rows.Count <= 0)
                    {
                        this.MensajeError("No existe articulo con ese codigo de barras.");
                    }
                    else
                    {
                        //agregar al detalle
                        this.AgreagarDetalle(Convert.ToInt32(Tabla.Rows[0][0]), Convert.ToString(Tabla.Rows[0][1]), Convert.ToString(Tabla.Rows[0][2]), Convert.ToDecimal(Tabla.Rows[0][3]));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult Opcion;
                Opcion = MessageBox.Show("Realmente Eliminar Registros", "Sistema de Ventas Ledezma", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (Opcion == DialogResult.OK)
                {
                    string Codigo;
                    string Rpta = "";

                    foreach (DataGridViewRow row in dataListado.Rows)
                    {
                        if (Convert.ToBoolean(row.Cells[0].Value))
                        {
                            Codigo = Convert.ToString(row.Cells[1].Value);
                            Rpta   = NArticulo.Eliminar(Convert.ToInt32(Codigo));
                            if (Rpta.Equals("OK"))
                            {
                                this.MensajeOk("Se elimino Correctamente el registro");
                            }
                            else
                            {
                                this.MensajeError(Rpta);
                            }
                        }
                    }
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
 private void textoCodigoBarras_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         switch (e.KeyCode)
         {
         case Keys.Enter:
             DataTable tabla = new DataTable();
             tabla = NArticulo.BuscarCodigo(textoCodigoBarras.Text.Trim());
             if (tabla.Rows.Count <= 0)
             {
                 this.MensajeError("No existe el articulo con ese codigo");
             }
             else
             {
                 this.agregarDetalle(Convert.ToInt32(tabla.Rows[0][0]), Convert.ToString(tabla.Rows[0][1]),
                                     Convert.ToString(tabla.Rows[0][2]), Convert.ToDecimal(tabla.Rows[0][3]));
             }
             break;
         }
     }
     catch (Exception exe)
     {
         MessageBox.Show(exe.Message + exe.StackTrace);
     }
 }
Пример #4
0
 private void TxtBuscarDetalle_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.KeyCode == Keys.Enter)
         {
             DataTable Tabla = new DataTable();
             Tabla = NArticulo.Buscar(TxtBuscarDetalle.Text.Trim());
             if (Tabla.Rows.Count <= 0)
             {
                 this.MensajeError("El articulo no existe con ese nombre");
             }
             else
             {
                 DgvArticulos.DataSource = NArticulo.Buscar(TxtBuscarDetalle.Text.Trim());
                 this.FormatoArticulos();
                 LblTotalArticulo.Text = "Total registro: " + Convert.ToString(DgvArticulos.Rows.Count);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #5
0
 private void InsertarArticulo()
 {
     if (string.IsNullOrEmpty(txtNombre.Text))
     {
         txtNombre.Focus();
         epArticulo.SetError(txtNombre, "Campo obligatorio - ingrese nombre del articulo");
     }
     else if (string.IsNullOrEmpty(txtNeto.Text))
     {
         txtNeto.Focus();
         epArticulo.SetError(txtNeto, "Campo obligatorio - ingrese neto de la presentacion: ejm. Kg 200");
     }
     else
     {
         bool rpta = NArticulo.Insertar(
             txtCodigo.Text.Trim(), txtNombre.Text.Trim(),
             Convert.ToInt32(cboCategoria.SelectedValue), Convert.ToInt32(cboPresentacion.SelectedValue), txtNeto.Text.Trim(),
             txtDescripcion.Text.Trim(), ImageToByteArray(pbImagen.Image)
             );
         if (rpta)
         {
             mensajeYes("Articulo insertado correctamente");
             Limpiar();
             txtCodigo.Focus();
         }
         else
         {
             mensajeError("Error al insertar el articulo");
         }
     }
 }
Пример #6
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = "";
                if (this.txtNombre.Text == string.Empty || this.txtIdcategoria.Text == string.Empty || this.txtCodigo.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos, serán remarcados");
                    errorIcono.SetError(txtNombre, "Ingrese un Valor");
                    errorIcono.SetError(txtCodigo, "Ingrese un Valor");
                    errorIcono.SetError(txtCategoria, "Ingrese un Valor");
                }
                else
                {
                    //para enviar la imagen
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
                    this.pxImagen.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);

                    byte[] imagen = ms.GetBuffer();



                    if (this.IsNuevo == true)
                    {
                        rpta = NArticulo.Insertar(this.txtCodigo.Text, this.txtNombre.Text.Trim().ToUpper(), this.txtDescripcion.Text.Trim(), imagen, Convert.ToInt32(this.txtIdcategoria.Text), Convert.ToInt32(this.cbIdpresentacion.SelectedValue));
                    }
                    else
                    {
                        rpta = NArticulo.Editar(Convert.ToInt32(this.txtIdarticulo.Text), this.txtCodigo.Text, this.txtNombre.Text.Trim().ToUpper(), this.txtDescripcion.Text.Trim(), imagen, Convert.ToInt32(this.txtIdcategoria.Text), Convert.ToInt32(this.cbIdpresentacion.SelectedValue));
                    }

                    if (rpta.Equals("OK"))
                    {
                        if (this.IsNuevo)
                        {
                            this.MensajeOk("Se Insertó de forma correcta el registro");
                        }
                        else
                        {
                            this.MensajeOk("Se Actualizó de forma correcta el registro");
                        }
                    }

                    else
                    {
                        this.MensajeError(rpta);
                    }

                    this.IsNuevo  = false;
                    this.IsEditar = false;
                    this.Botones();
                    this.Limpiar();
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Пример #7
0
        private void BtnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult opciones;
                opciones = MessageBox.Show("Quieres Eliminar Registro", "Eliminar", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (opciones == DialogResult.OK)
                {
                    string codigo;
                    foreach (DataGridViewRow filas in DgvListado.Rows)
                    {
                        if (Convert.ToBoolean(filas.Cells[0].Value))
                        {
                            codigo = filas.Cells[1].Value.ToString();
                            NArticulo.Eliminar(Convert.ToInt32(codigo));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
                MessageBox.Show("no se pudo eliminar");
            }

            this.mostrar_articulo();
        }
Пример #8
0
 private void BtnDesactivar_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult Opcion;
         Opcion = MessageBox.Show("Realmente deseas desactivar el registro", "Sistema de registro", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
         if (Opcion == DialogResult.OK)
         {
             int    Codigo;
             string Rpta = "";
             foreach (DataGridViewRow row in DgvListado.Rows)
             {
                 if (Convert.ToBoolean(row.Cells[0].Value))
                 {
                     Codigo = Convert.ToInt32(row.Cells[1].Value);
                     Rpta   = NArticulo.Desactivar(Codigo);
                     if (Rpta.Equals("OK"))
                     {
                         this.MensajeOK("Se desactivó el registro: " + Convert.ToString(row.Cells[2].Value));
                     }
                     else
                     {
                         this.MensajeError(Rpta);
                     }
                 }
             }
             this.Listar();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
Пример #9
0
 //metodo mosrar
 private void Mostrar()
 {
     this.dataListado.DataSource = NArticulo.Mostrar();
     this.OcultarColumnas();
     lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);
     //Metodo BuscarNombre
 }
Пример #10
0
 private void txtCodigoBarras_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (13))
     {
         this.dataListadoArticulos.DataSource = NArticulo.BuscarCodigoIngresos(this.txtCodigoBarras.Text);
     }
 }
        private void BtnAgregarA_Click(object sender, EventArgs e)
        {
            NArticulo negocioArticulo = new NArticulo();
            Articulo  articulo        = new Articulo();

            try
            {
                articulo.Codigo      = txtCodigoArt.Text;
                articulo.Nombre      = txtNombre.Text;
                articulo.Descripcion = txtDescripcion.Text;
                articulo.Precio      = float.Parse(txtPrecio.Text);
                articulo.Imagen      = "URL DE LA IMAGEN";

                articulo.Marca     = (Marca)cboMarca.SelectedItem;
                articulo.Categoria = (Categoria)cboCategoria.SelectedItem;
                //Llama a funcion agregar y le mando por parametro el articulo a agregar

                negocioArticulo.AltaArticulo(articulo);
                MessageBox.Show("El Articulo se agrego correctamente");
                Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                //throw;
            }
        }
Пример #12
0
        private void BtnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = "";
                if (this.txtNombre.Text == string.Empty || this.txtIdCategoria.Text == string.Empty || this.txtCodigo.Text == string.Empty)
                {
                    MensajeError("Falta ingresar datos, seran remarcados");
                    errorProviderIcono.SetError(txtNombre, "Ingrese un nombre");
                    errorProviderIcono.SetError(txtCodigo, "Ingrese un Codigo");
                    errorProviderIcono.SetError(txtCategoria, "Ingrese un Categoria");
                }
                else
                {
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
                    this.pxImagen.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);

                    byte[] imagen = ms.GetBuffer();

                    if (this.IsNuevo)
                    {
                        rpta = NArticulo.Insertar(this.txtCodigo.Text, this.txtNombre.Text.Trim().ToUpper(),
                                                  this.txtDescripcion.Text.Trim(), imagen, Convert.ToInt32(this.txtIdCategoria.Text)
                                                  , Convert.ToInt32(this.cbnIdPresentacion.SelectedValue));
                    }
                    else
                    {
                        rpta = NArticulo.Editar(Convert.ToInt32(this.txtIdarticulo.Text), this.txtCodigo.Text, this.txtNombre.Text.Trim().ToUpper()
                                                ,
                                                this.txtDescripcion.Text.Trim(), imagen, Convert.ToInt32(this.txtIdCategoria.Text)
                                                , Convert.ToInt32(this.cbnIdPresentacion.SelectedValue));
                    }
                    if (rpta.Equals("OK"))
                    {
                        if (this.IsNuevo)
                        {
                            this.MensajeOk("Se inserto correctamente");
                        }
                        else
                        {
                            this.MensajeOk("se actualizo correctamente");
                        }
                    }
                    else
                    {
                        this.MensajeError(rpta);
                    }
                    this.IsNuevo  = false;
                    this.IsEditar = false;
                    this.Botones();
                    this.limpiar();
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Пример #13
0
        private void FrmListarArticulos_Load(object sender, EventArgs e)
        {
            NArticulo negocioArticulo = new NArticulo();

            dgvListarArticulos.DataSource         = negocioArticulo.ListarArticulos();
            dgvListarArticulos.Columns[0].Visible = false;
            dgvListarArticulos.Columns[6].Visible = false;
        }
Пример #14
0
 //-->Método BuscarNombre
 //-----------------------------------------------------------------------------------------------
 private void BuscarNombre()
 {
     //Hace lo mismo que el procedimiento Mostrar pero la diferencia es que aquí si le estamos enviado
     //un valor :   BuscarNombre(this.txtBuscar.Text)     obviamente el nombre que queremos buscar.
     this.dataListado.DataSource = NArticulo.BuscarNombre(this.txtBuscar.Text);
     this.OcultarColumnas();
     lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);
 }
Пример #15
0
 //Método mostrar
 private void Mostrar()
 {
     this.dataListado.DataSource            = NIngreso.Mostrar();
     this.dataListadoArticulos.DataSource   = NArticulo.Mostrar();
     this.dataListadoProveedores.DataSource = NProveedor.Mostrar();
     this.OcultarColumnas();
     lblTotal.Text = "Total de registros: " + Convert.ToString(dataListado.Rows.Count);
 }
Пример #16
0
 //Método mostrar
 private void Mostrar()
 {
     this.dataListado.DataSource           = NArticulo.Mostrar();
     this.dataListadoCategorias.DataSource = NCategoria.Mostrar();
     this.dataListadoFruver.DataSource     = NFruver.Mostrar();
     this.OcultarColumnas();
     lblTotal.Text = "Total de registros: " + Convert.ToString(dataListado.Rows.Count);
 }
Пример #17
0
        //public static Image ByteArrayToImage(byte[] byteArrayIn)
        //{
        //    MemoryStream ms = new MemoryStream(byteArrayIn);
        //    return Image.FromStream(ms);
        //}


        private void dgvArticulo_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex != -1)
            {
                DataTable tabla = new DataTable();


                if (dgvArticulo.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().Equals("Editar"))
                {
                    int idarticulo = Convert.ToInt32(dgvArticulo.Rows[e.RowIndex].Cells[8].Value);
                    tabla = NArticulo.BuscarCodigo(idarticulo);
                    new frmArticulo().Show();
                    int numFilas = tabla.Rows.Count;
                    if (numFilas == 1)
                    {
                        frmArticulo.MyFormArt.txtCodigo.Text                = tabla.Rows[0]["codigo"].ToString();
                        frmArticulo.MyFormArt.txtNombre.Text                = tabla.Rows[0]["nombre"].ToString();
                        frmArticulo.MyFormArt.cboCategoria.SelectedValue    = tabla.Rows[0]["idcategoria"].ToString();
                        frmArticulo.MyFormArt.cboPresentacion.SelectedValue = tabla.Rows[0]["idpresentacion"].ToString();
                        frmArticulo.MyFormArt.txtNeto.Text        = tabla.Rows[0]["neto"].ToString();
                        frmArticulo.MyFormArt.txtDescripcion.Text = tabla.Rows[0]["Descripcion"].ToString();
                        //frmArticulo.MyFormArt.ImageToByteArray(tabla.Rows[0]["imagen"]);
                        byte[] img = (byte[])tabla.Rows[0]["imagen"];
                        var    ms  = new MemoryStream(img);
                        if (ms != null)
                        {
                            frmArticulo.MyFormArt.pbImagen.Image = Image.FromStream(ms);
                        }
                        else
                        {
                            frmArticulo.MyFormArt.pbImagen.Image = null;
                        }
                        frmArticulo.MyFormArt.idArticulo = int.Parse(tabla.Rows[0]["idarticulo"].ToString());
                        frmArticulo.MyFormArt._IsNew     = false;
                    }
                }
                if (dgvArticulo.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().Equals("Eliminar"))
                {
                    int          idarticulo = Convert.ToInt32(dgvArticulo.Rows[e.RowIndex].Cells[8].Value);
                    DialogResult rspta      = MessageBox.Show("Desea Eliminar", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                    if (DialogResult.Yes == rspta)
                    {
                        //var empleado = new Clases.Empleado(id_personal);
                        bool objCat = NArticulo.Eliminar(idarticulo);
                        if (objCat)
                        {
                            dgvArticulo.Rows.RemoveAt(e.RowIndex);
                            MostrarArticulo();
                        }
                        else
                        {
                            MessageBox.Show("Error al eliminar ");
                        }
                    }
                }
            }
            //finish
        }
Пример #18
0
        //guardar
        private void BtnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = "";
                if (this.txtNombre.Text == string.Empty || this.txtIdcategoria.Text == string.Empty || this.txtCodigo.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos,seran remarcados");
                    errorIcono.SetError(txtNombre, "Ingrese un nombre");
                    errorIcono.SetError(txtCodigo, "Ingrese un codigo");
                    errorIcono.SetError(txtCategoria, "Ingrese una categoria");
                }
                else //si no esta vacias las cajas
                {
                    //=======creamos un obj memorystream========
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
                    //guardamos la imagen en un buffer
                    this.pxImagen.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    //envio a imagen lo que tengo almacenado en el buffer
                    byte[] imagen = ms.GetBuffer();
                    //===============FIN IMAGEN============================

                    if (this.isNuevo) //si es nuevo
                    {                 //opcional txtNombre.Text.Trim.Upper
                        rpta = NArticulo.Insertar(this.txtCodigo.Text, this.txtNombre.Text, this.txtDescripcion.Text, imagen, Convert.ToInt32(this.txtIdcategoria.Text), Convert.ToInt32(this.cmbPresentacion.SelectedValue));
                    }
                    else
                    {
                        rpta = NArticulo.Editar(Convert.ToInt32(this.txtIdarticulo.Text), this.txtCodigo.Text, this.txtNombre.Text, this.txtDescripcion.Text, imagen, Convert.ToInt32(this.txtIdcategoria.Text), Convert.ToInt32(this.cmbPresentacion.SelectedValue));
                    }
                    if (rpta.Equals("Ok"))
                    {
                        if (this.isNuevo)
                        {
                            this.MensajeOk("Se inserto de forma correcta el registro");
                        }
                        else
                        {
                            this.MensajeOk("Se actualizo de forma correcta el registro");
                        }
                    }
                    else
                    {
                        this.MensajeError(rpta);
                    }
                    //despues de editar o guardar dejarlos en false
                    this.isNuevo  = false;
                    this.isEditar = false;
                    this.Botones();
                    this.Limpiar();
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Пример #19
0
 private void chkActivar_MouseClick(object sender, MouseEventArgs e)
 {
     if (chkActivar.Value == false)
     {
         try
         {
             DialogResult opcion;
             opcion = MessageBox.Show("deseas desactivar el registro", "Sistema de ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
             if (opcion == DialogResult.OK)
             {
                 int    Codigo;
                 string respuesta = "";
                 foreach (DataGridViewRow fila in DgvListado.Rows)
                 {
                     if (Convert.ToBoolean(fila.Cells[0].Value))
                     {
                         Codigo    = Convert.ToInt32(fila.Cells[1].Value);
                         respuesta = NArticulo.Desactivar(Codigo);
                         this.MensajeOk("Se desactivo el registro : " + Convert.ToString(fila.Cells[5].Value));
                     }
                 }
             }
             this.Listar();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message + ex.StackTrace);
         }
     }
     else
     {
         try
         {
             DialogResult opcion;
             opcion = MessageBox.Show("deseas activar el registro", "Sistema de ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
             if (opcion == DialogResult.OK)
             {
                 int    Codigo;
                 string respuesta = "";
                 foreach (DataGridViewRow fila in DgvListado.Rows)
                 {
                     if (Convert.ToBoolean(fila.Cells[0].Value))
                     {
                         Codigo    = Convert.ToInt32(fila.Cells[1].Value);
                         respuesta = NArticulo.Activar(Codigo);
                         this.MensajeOk("Se activo el registro : " + Convert.ToString(fila.Cells[5].Value));
                     }
                 }
             }
             this.Listar();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message + ex.StackTrace);
         }
     }
 }
Пример #20
0
        private void BtnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                //Creamos un mensaje de dailogo con las opciones necesarias
                DialogResult Opcion;
                //Mostramos el mensaje  y establecemos la opciones OK(para continuar)- Cancel(Para Cancelar), establecemos que es de tipo Cuestion
                Opcion = MessageBox.Show("Realmente deseas eliminar el(los) registro?", "Sistema de Eventos", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                //Si la Opcion es OK
                if (Opcion == DialogResult.OK)
                {
                    int    codigo;
                    string Rpta   = "";
                    string Imagen = "";
                    //Creamos un foreach que va recorrer todas las filas seleccionadas
                    foreach (DataGridViewRow row in DgvListado.Rows)
                    {
                        //Convertimos a Booleanos el valor de la casilla seleccionar
                        if (Convert.ToBoolean(row.Cells[0].Value))
                        {
                            //Tomamos el ID y ese es el parametro que le enviaremos a nuestro metodo Eliminar.
                            codigo = Convert.ToInt32(row.Cells[1].Value);

                            Imagen = Convert.ToString(row.Cells[9].Value);
                            Rpta   = NArticulo.Eliminar(codigo);
                            //Si la respuesta es satisfactora (OK) entonces se mostrara un mensaje de informacion
                            if (Rpta.Equals("OK"))
                            {
                                //this.MensajeOK("Se elimino el Registro" + Convert.ToString(row.Cells[5].Value));
                                //Eliminamos la Imgen de la Carpeta
                                if (Imagen != string.Empty)
                                {
                                    File.Delete(this.Directorio + Imagen);
                                    this.MensajeOK("Se elimino el Registro " + Convert.ToString(row.Cells[5].Value));
                                }
                                else
                                {
                                    this.MensajeOK("Se elimino el Registro " + Convert.ToString(row.Cells[5].Value));
                                }
                            }
                            //En caso de que no mostrar el error.
                            else
                            {
                                this.MensajeError(Rpta);
                            }
                        }
                    }
                    //Volvemos al listado.
                    this.Listar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Пример #21
0
        private void MostrarCategoria()
        {
            DataTable tabla = NArticulo.ListarCategoria();

            if (tabla.Rows.Count > 0)
            {
                cboCategoria.DataSource    = tabla;
                cboCategoria.DisplayMember = "nombre";
                cboCategoria.ValueMember   = "idcategoria";
            }
        }
 private void MostrarDatos()
 {
     try
     {
         dtgvListado.DataSource = NArticulo.Mostar();
         lblTotal.Text          = "Total de Registros: " + Convert.ToString(dtgvListado.RowCount);
     }
     catch (Exception ex)
     {
         MsgError(ex.ToString());
     }
 }
Пример #23
0
        private void btnBorrar_Click(object sender, EventArgs e)
        {
            int          comparar = dtgvListado.RowCount;
            DialogResult Result   = MessageBox.Show("Desea Eliminar los registros seleccionados?", "Sistema Facturacion", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);

            if (Result == DialogResult.Yes)
            {
                N = false;
                E = false;
                HoB_btn();
                limpiar();

                Habilitar(false);
                try
                {
                    string Codigo;
                    string Respuesta = "";
                    foreach (DataGridViewRow row in dtgvListado.Rows)
                    {
                        if (Convert.ToBoolean(row.Cells[0].Value))
                        {
                            Codigo    = Convert.ToString(row.Cells[1].Value);
                            Respuesta = NArticulo.Eliminar(Convert.ToInt32(Codigo));
                            if (Respuesta != ("Ok"))
                            {
                                MsgError(Respuesta);
                            }
                        }
                    }
                    MostrarDatos();
                    if (comparar != dtgvListado.RowCount)
                    {
                        MsgConfirmacion("Se han eliminado los datos correctamente");
                        mtxtbuscar.Text = "";
                    }
                    else
                    {
                        MsgError("Debe seleccionar los campos que desea eliminar");
                        mtxtbuscar.Text = "";
                    }
                    SelectAll.Checked = false;
                    MostrarDatos();

                    {
                    }
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + ex.StackTrace);
                }
            }
        }
 private void BuscarPresentacion()
 {
     try
     {
         dtgvListado.DataSource = NArticulo.BuscarPresentacionArticulo(mtxtbuscar.Text);
         lblTotal.Text          = "Total de Registros: " + Convert.ToString(dtgvListado.RowCount);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Пример #25
0
 //Método Mostrar todos los registros de la tabla articulo:
 private void Mostrar()
 {
     //LLamo a mi clase NArticulo, donde está mi procedimiento: Mostrar, para que me envíe...
     //... ciertos valores.
     this.dataListado.DataSource = NArticulo.Mostrar();
     this.OcultarColumnas();
     //lo concatenamos con el total de registros, llamando a su métodos Rows (de filas)...
     //... y llamamos a su método count, para contar todas las filas.
     //Como: ataListado.Rows.Count, me devuelve un int y lo que queremos es un string...
     //... para eso usamos: Convert.ToString, para convertir todo a un string:
     lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);
 }
Пример #26
0
 private void Buscar()
 {
     try
     {
         DgvListado.DataSource = NArticulo.Buscar(TxtBuscar.Text);
         this.Formato();
         LblTotal.Text = "Total registros: " + Convert.ToString(DgvListado.Rows.Count);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
Пример #27
0
 private void BtnFiltrarArticulos_Click(object sender, EventArgs e)
 {
     try
     {
         DgvArticulos.DataSource = NArticulo.Buscar(txtBuscarArticulo.Text);
         this.FormatoArticulo();
         lblTotalArticulo.Text = "Total Registros: " + Convert.ToString(DgvArticulos.Rows.Count);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #28
0
 private void BtnFiltrarArticulo_Click(object sender, EventArgs e)
 {
     try
     {
         DgvArticulos.DataSource = NArticulo.BuscarVenta(TxtBuscarDetalle.Text.Trim());
         this.FormatoArticulos();
         LblTotalArticulo.Text = "Total registro: " + Convert.ToString(DgvArticulos.Rows.Count);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void botonFiltarArticulos_Click(object sender, EventArgs e)
 {
     try
     {
         dgvArticulos.DataSource = NArticulo.Buscar(textoBuscarArticulo.Text.Trim());
         this.FormatoArticulo();
         labelTotal.Text = "Total Registros" + Convert.ToString(dgvArticulos.Rows.Count);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
Пример #30
0
        private void BtnGuardar_Click(object sender, EventArgs e)
        {
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            this.PximgenCargar.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            byte[] imagen = ms.GetBuffer();

            NArticulo articulo = new NArticulo(TxtCodigoVentas.Text, TxtNombre.Text, TxtDescipcion.Text, imagen, Convert.ToInt32(this.CmbCategoria.SelectedValue), Convert.ToInt32(CmbPresentacion.SelectedValue));

            articulo.insertar_articulo();
            mostrar_articulo();
            limpiar();
            MessageBox.Show("datos guardado en la base de datos");
        }