public void CargarListadoInasistencias(int anho, int mes, int idSala) { try { var lstUiInasistencias = new LN.Inasistencia().Listar(anho, mes, idSala); var sorted = new SortableBindingList <BE.UI.Inasistencia>(lstUiInasistencias); this.dgvInasistencias.DataSource = sorted; this.FormatoListadoInasistencias(); } catch (Exception ex) { throw ex; } }
private void btnGuardar_Click(object sender, EventArgs e) { try { #region Validaciones if (this.cboEmpleado.SelectedIndex == 0) { this.cboEmpleado.Focus(); throw new Exception("Seleccione un empleado"); } if (this.cboTipos.SelectedIndex == 0) { this.cboTipos.Focus(); throw new Exception("Seleccione un tipo de inasistencia"); } if (this.txtAsunto.Text.Trim().Length == 0) { this.txtAsunto.Focus(); throw new Exception("Ingrese el asunto de la inasistencia"); } if (this.txtDetalle.Text.Trim().Length == 0) { this.txtDetalle.Focus(); throw new Exception("Ingrese el detalle de la inasistencia"); } #endregion #region Guardar this.beInasistencia.Fecha = this.dtpFecha.Value; this.beInasistencia.EmpleadoCodigo = this.cboEmpleado.SelectedValue.ToString(); this.beInasistencia.TipoCodigo = this.cboTipos.SelectedValue.ToString(); this.beInasistencia.Asunto = this.txtAsunto.Text; this.beInasistencia.Detalle = this.txtDetalle.Text; this.beInasistencia.Certificado = this.txtCertificado.Text; int idUsuarioSesion = ((MdiMain)this.MdiParent).uiUsuario.ID; bool rpta = false; string msg = ""; var lnInasistencia = new LN.Inasistencia(); if (this.beInasistencia.Id == 0) //Nuevo { rpta = lnInasistencia.Insertar(ref this.beInasistencia, idUsuarioSesion); if (true) { msg = "Se registro el nuevo adelanto"; } } else //Actualizar { rpta = lnInasistencia.Actualizar(this.beInasistencia, idUsuarioSesion); if (true) { msg = "Se actualizo el adelanto"; } } if (rpta == true) { Util.InformationMessage(msg); this.frmList.CargarListadoInasistencias(); this.Close(); } #endregion } catch (Exception ex) { Util.ErrorMessage(ex.Message); } }