protected void btnGuardar_Click(object sender, EventArgs e) { //REGISTRAMNIOS EN LA BD Justificacion objJust = new Justificacion(); objJust.Codigo_asistencia = Convert.ToInt32(this.lblCodAsis.Text.ToString()) ; objJust.Codigo_estado = 1; objJust.Codigo_tipo_justificacion = Convert.ToInt32(this.dlTipo.SelectedItem.Value.ToString()); objJust.Motivo = this.txJustificar.Text.ToString().Trim(); objJust.Archivo = ""; objJust.Respuesta = ""; if (Request.QueryString["accion"].ToString().Equals("atender")) { objJust.Respuesta = this.txRespuesta.Text.ToString(); objJust.Codigo_estado = Convert.ToInt32(this.dlEstado.SelectedItem.Value.ToString()); ; } JustificacionBL justificacionBL = new JustificacionBL(); int intGrabar = justificacionBL.Registrar(objJust); if (intGrabar == 0) { this.lblMensaje.Text = "Ocurrio un error al Grabar consulte la Base de Datos"; } else if (intGrabar == 1) { this.lblMensaje.Text = "La justificación se realizó con exito"; Response.Redirect("~/ListarJustificaciones.aspx"); } }
public void Listar() { List<Justificacion> ar = new JustificacionBL().List(); if (ar.ToList().Count() > 0) { gdAsistencia.DataSource = ar.ToList(); gdAsistencia.DataBind(); } else { gdAsistencia.DataSource = null; gdAsistencia.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { this.lblCodAsis.Text = Request.QueryString["coAsis"].ToString(); this.LblMotivo.Text = Request.QueryString["tipo"].ToString(); List<Justificacion> ar = new JustificacionBL().getJustificar(Convert.ToInt32(this.lblCodAsis.Text)); if (Request.QueryString["accion"].ToString().Equals("atender")) { this.txJustificar.Enabled = false; this.dlTipo.Enabled = false; this.lblestado.Visible = true; this.lblRespuesta.Visible = true; this.txRespuesta.Visible = true; this.dlEstado.Visible = true; // List<Justificacion> ar = new JustificacionBL(). getJustificar (Convert.ToInt32 ( this.lblCodAsis.Text) ); /*this.txJustificar.Text = ar[0].Motivo.ToString(); this.dlTipo.SelectedValue = ar[0].Codigo_tipo_justificacion.ToString(); this.dlEstado.SelectedValue = ar[0].Codigo_estado.ToString(); this.txRespuesta.Text = ar[0].Respuesta.ToString();*/ llenarEstadoJustificacion(); } llenarTipoJustificacion(); if (ar.Count > 0) { this.txJustificar.Text = ar[0].Motivo.ToString(); this.dlTipo.SelectedValue = ar[0].Codigo_tipo_justificacion.ToString(); this.dlEstado.SelectedValue = ar[0].Codigo_estado.ToString(); this.txRespuesta.Text = ar[0].Respuesta.ToString(); if (Request.QueryString["accion"].ToString().Equals("nada")) this.btnGuardar.Enabled = false; } } }