public FormBuscarNotaSalida(FormRemisionNew formRemisionNew)
 {
     InitializeComponent();
     this.nuevo           = true;
     formato              = "{0:n" + nroDecimales + "}";
     this.formRemisionNew = formRemisionNew;
 }
Beispiel #2
0
        private void executeModificar()
        {
            // Verificando la existencia de datos en el datagridview
            if (dataGridView.Rows.Count == 0)
            {
                MessageBox.Show("No hay un registro seleccionado", "Eliminar", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            int index          = dataGridView.CurrentRow.Index;                                 // Identificando la fila actual del datagridview
            int idGuiaRemision = Convert.ToInt32(dataGridView.Rows[index].Cells[0].Value);      // obteniedo el idRegistro del datagridview

            currentGuiaRemision = guiaRemisiones.Find(x => x.idGuiaRemision == idGuiaRemision); // Buscando la registro especifico en la lista de registros

            //Mostrando el formulario de modificacion
            FormRemisionNew formGuiaRemision = new FormRemisionNew(currentGuiaRemision);

            formGuiaRemision.ShowDialog();
            this.reLoad(); // Recargando los registros
        }
        private async void btnGuiaRemision_Click(object sender, EventArgs e)
        {
            // Verificando la existencia de datos en el datagridview
            if (dataGridView.Rows.Count == 0)
            {
                MessageBox.Show("No hay un registro seleccionado", "Desactivar o anular", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            try
            {
                loadState(true);
                int index = dataGridView.CurrentRow.Index;                                                 // Identificando la fila actual del datagridview
                currentNotaSalida = new NotaSalida();                                                      //creando una instancia del objeto correspondiente
                currentNotaSalida.idNotaSalida = Convert.ToInt32(dataGridView.Rows[index].Cells[0].Value); // obteniedo el idRegistro del datagridview

                // Comprobando si el registro ya esta desactivado
                if (notaSalidas.Find(x => x.idNotaSalida == currentNotaSalida.idNotaSalida).estado == 0)
                {
                    MessageBox.Show("Este registro ya esta desactivado", "Desactivar", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }


                currentNotaSalida = notaSalidas.Find(x => x.idNotaSalida == currentNotaSalida.idNotaSalida);
                // Procediendo con las desactivacion
                FormRemisionNew form = new FormRemisionNew(currentNotaSalida);
                form.ShowDialog();
                cargarRegistros(); // recargando los registros en el datagridview
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "Eliminar", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            finally
            {
                loadState(false);
            }
        }
        private void entrarGuiaremision()
        {
            if (dgvNotaSalida.Rows.Count == 0)
            {
                MessageBox.Show("No hay un registro seleccionado", "nota salida", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            int index        = dgvNotaSalida.CurrentRow.Index;                            // Identificando la fila actual del datagridview
            int idNotaSalida = Convert.ToInt32(dgvNotaSalida.Rows[index].Cells[2].Value); // obteniedo el idRegistro del datagridview

            currentNotaSalida = listNotasalida.Find(x => x.idNotaSalida == idNotaSalida);
            if (formRemisionNew == null)
            {
                FormRemisionNew formRemisionNew = new FormRemisionNew(currentNotaSalida);
                formRemisionNew.ShowDialog();
                this.Close();
                this.FindForm();
            }
            else
            {
                this.Close();
            }
        }