コード例 #1
0
        private void btnImpresion_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.dgvTransferencia.SelectedRows.Count == 1)
                {
                    this.Visible = false;
                    TransferenciaMaterialesGeneral       Datos      = this.ObtenerDatosReporte();
                    frmVerReporteTransferenciaMateriales VerReporte = new frmVerReporteTransferenciaMateriales(Datos.IDTransferencia);
                    VerReporte.ShowDialog();
                    VerReporte.Dispose();

                    this.Visible = true;
                }
                else
                {
                    MessageBox.Show("Seleccione una fila.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                LogError.AddExcFileTxt(ex, "frmTransferenciaMateriales ~ btnImpresion_Click");
                MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                this.txtMensajeError.Visible = false;
                List <Error> Errores = this.ValidarDatos();
                if (Errores.Count == 0)
                {
                    this.Visible = false;
                    TransferenciaMateriales         Datos = this.ObtenerDatos();
                    TransferenciaMateriales_Negocio Neg   = new TransferenciaMateriales_Negocio();

                    int IDTransferencia = Neg.GenerarTransferencia(Comun.Conexion, Datos.IDEmpleado, Datos.IDEmpleadoDestino, Datos.Observaciones, Comun.IDUsuario);
                    if (IDTransferencia > 0)
                    {
                        //Generar el reporte
                        frmVerReporteTransferenciaMateriales VerReporte = new frmVerReporteTransferenciaMateriales(IDTransferencia);
                        VerReporte.ShowDialog();
                        VerReporte.Dispose();
                        this.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        MessageBox.Show("Ocurrió un error al generar el reporte.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    this.Visible = true;
                }
                else
                {
                    this.MostrarMensajeError(Errores);
                }
            }
            catch (Exception ex)
            {
                LogError.AddExcFileTxt(ex, "frmNuevaTransferenciaMateriales ~ btnGuardar_Click");
                MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }