Beispiel #1
0
 //METODO DOBLE CLICK EN CELDA
 private void DobleClickDgvCell()
 {
     try
     {
         frmIngresarCliente formIngresarCliente = new frmIngresarCliente();
         formIngresarCliente.ctrlSeleccionado = 2;
         formIngresarCliente.IdCliente        = Convert.ToString(dgvListado.CurrentRow.Cells["IdCliente"].Value).Trim();
         Convert.ToString(dgvListado.CurrentRow.Cells["Apellidos"].Value).Trim().ToUpper();
         formIngresarCliente.Nombres   = Convert.ToString(dgvListado.CurrentRow.Cells["Nombres"].Value).Trim().ToUpper();
         formIngresarCliente.Apellidos = Convert.ToString(dgvListado.CurrentRow.Cells["Apellidos"].Value).Trim().ToUpper();
         if (formIngresarCliente.Apellidos == string.Empty)
         {
             formIngresarCliente.chkPersonaFisica.Checked = false;
         }
         else
         {
             formIngresarCliente.chkPersonaFisica.Checked = true;
         }
         formIngresarCliente.Sexo               = Convert.ToString(dgvListado.CurrentRow.Cells["sexo"].Value).Trim();
         formIngresarCliente.FechaNacimiento    = Convert.ToDateTime(dgvListado.CurrentRow.Cells["FechaNacimiento"].Value);
         formIngresarCliente.TipoDocumento      = Convert.ToString(dgvListado.CurrentRow.Cells["TipoDocumento"].Value).Trim().ToUpper();
         formIngresarCliente.NumeroDocumento    = Convert.ToString(dgvListado.CurrentRow.Cells["NumeroDocumento"].Value).Trim();
         formIngresarCliente.Domicilio          = Convert.ToString(dgvListado.CurrentRow.Cells["Domicilio"].Value).Trim();
         formIngresarCliente.TelefonoFijo       = Convert.ToString(dgvListado.CurrentRow.Cells["TelefonoFijo"].Value).Trim();
         formIngresarCliente.TelefonoCelular    = Convert.ToString(dgvListado.CurrentRow.Cells["TelefonoCelular"].Value).Trim();
         formIngresarCliente.Email              = Convert.ToString(dgvListado.CurrentRow.Cells["Email"].Value).Trim();
         formIngresarCliente.btnInsertar.Click += new EventHandler(formIngresarCliente_btnInsertarClick);
         formIngresarCliente.ShowDialog();
     }
     catch
     {
     }
 }
Beispiel #2
0
        //BOTON INGRESAR NUEVO PROVEEDOR
        private void btnIngresar_Click(object sender, EventArgs e)
        {
            frmIngresarCliente formIngresarCliente = new frmIngresarCliente();

            formIngresarCliente.ctrlSeleccionado = 0;
            //CAPTURADOR DE EVENTO CLICK EN BOTON INSERTAR
            formIngresarCliente.btnInsertar.Click += new EventHandler(formIngresarCliente_btnInsertarClick);
            formIngresarCliente.ShowDialog();
        }
Beispiel #3
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            int                idCliente;
            string             Respuesta = "";
            DialogResult       Opcion;
            frmIngresarCliente formIngresarCliente = new frmIngresarCliente();

            try
            {
                //SELECCION DE VARIOS REGISTROS
                if (chkEliminarVarios.Checked)
                {
                    Opcion = MessageBox.Show(
                        "¿Realmente desea eliminar los registros seleccionados?",
                        "Eliminando registro", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (Opcion == DialogResult.Yes)
                    {
                        foreach (DataGridViewRow row in dgvListado.Rows)
                        {
                            if (Convert.ToBoolean(row.Cells[0].Value))
                            {
                                idCliente = Convert.ToInt32(row.Cells["IdCliente"].Value);
                                if (idCliente > 1)
                                {
                                    Respuesta = NegocioCliente.Eliminar(idCliente);
                                }
                                else if (idCliente <= 0)
                                {
                                    MessageBox.Show("Seleccione un cliente.", "Acción no permitida", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                                else
                                {
                                    MessageBox.Show("No puede eliminar a este cliente.", "Acción no permitida.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                            }
                        }
                        if (Respuesta.Equals("OK"))
                        {
                            formIngresarCliente.NotificacionOk("Los registros se eliminaron correctamente.", "Eliminando");
                        }
                        else
                        {
                            formIngresarCliente.NotificacionError("Los registros no se eliminaron.", "Error");
                        }
                        Mostrar();
                    }
                }
                else
                {
                    //SELECCION DE UN REGISTRO
                    Opcion = MessageBox.Show(
                        "¿Realmente desea eliminar el registro seleccionado?",
                        "Eliminando registro", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (Opcion == DialogResult.Yes)
                    {
                        idCliente = Convert.ToInt32(dgvListado.CurrentRow.Cells["IdCliente"].Value);
                        if (idCliente > 1)
                        {
                            Respuesta = NegocioCliente.Eliminar(idCliente);
                        }
                        else if (idCliente <= 0)
                        {
                            MessageBox.Show("Seleccione un cliente.", "Acción no permitida", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("No puede eliminar a este cliente.", "Acción no permitida.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        if (Respuesta.Equals("OK"))
                        {
                            formIngresarCliente.NotificacionOk("El registro se eliminó correctamente", "Eliminando");
                        }
                        else
                        {
                            formIngresarCliente.NotificacionError("El registro no se eliminó", "Error");
                        }
                    }
                }
                chkEliminarVarios.Checked = false;
                Mostrar();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Beispiel #4
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            int                idIngreso;
            string             respuesta = "";
            DialogResult       Opcion;
            frmIngresarCliente formIngresarCliente = new frmIngresarCliente();

            try
            {
                //SELECCION DE VARIOS REGISTROS
                if (chkEliminarVarios.Checked)
                {
                    Opcion = MessageBox.Show(
                        "¿Realmente desea anular los registros seleccionados?. Tenga en cuenta que al anular este ingreso el stock actual de los productos relacionados se restará",
                        "Anulando registro. ¡Advertencia!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (Opcion == DialogResult.Yes)
                    {
                        foreach (DataGridViewRow row in dgvListado.Rows)
                        {
                            if (Convert.ToBoolean(row.Cells[0].Value))
                            {
                                idIngreso = Convert.ToInt32(row.Cells[1].Value);
                                respuesta = NegocioIngreso.Anular(idIngreso);
                                //DataTable Detalle = new DataTable();
                                DataTable Detalle = NegocioIngreso.Mostrar(idIngreso);
                                foreach (DataRow det in Detalle.Rows)
                                {
                                    int     idArticulo = Convert.ToInt32(det["IdArticulo"]);
                                    decimal cantidad   = Convert.ToDecimal(det["Cantidad"]);
                                    respuesta = NegocioArticulo.DisminuirStock(idArticulo, cantidad);
                                }
                            }
                        }
                        if (respuesta.Equals("OK"))
                        {
                            formIngresarCliente.NotificacionOk("Los registros se anularon correctamente.", "Anulando");
                        }
                        else
                        {
                            formIngresarCliente.NotificacionError("Los registros no se anularon.", "Error");
                        }
                        Mostrar();
                    }
                }
                else
                {
                    //SELECCION DE UN REGISTRO
                    Opcion = MessageBox.Show(
                        "¿Realmente desea anular los registros seleccionados?. Tenga en cuenta que al anular este ingreso el stock actual de los productos relacionados se restará",
                        "Anulando registro. ¡Advertencia!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (Opcion == DialogResult.Yes)
                    {
                        idIngreso = Convert.ToInt32(dgvListado.CurrentRow.Cells[1].Value);
                        respuesta = NegocioIngreso.Anular(Convert.ToInt32(idIngreso));
                        DataTable Detalle = NegocioIngreso.Mostrar(idIngreso);
                        foreach (DataRow det in Detalle.Rows)
                        {
                            int     idArticulo = Convert.ToInt32(det["IdArticulo"]);
                            decimal cantidad   = Convert.ToDecimal(det["Cantidad"]);
                            respuesta = NegocioArticulo.DisminuirStock(idArticulo, cantidad);
                        }
                        if (respuesta.Equals("OK"))
                        {
                            formIngresarCliente.NotificacionOk("El registro se anuló correctamente", "Anulando");
                        }
                        else
                        {
                            formIngresarCliente.NotificacionError("El registro no se anuló", "Error");
                        }
                        Mostrar();
                    }
                }
                chkEliminarVarios.Checked = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }