Пример #1
0
        protected void grvCategorias_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "select")
            {
                int i = int.Parse(e.CommandArgument.ToString());
                try
                {
                    DataSet ds = new Database().getData("SELECCIONA_REGISTRO_ESPECIFICO", new SqlParameter[] { new SqlParameter("@tabla", "tb_categoria"),
                        new SqlParameter("@columna", "id_categoria"), new SqlParameter("@dato", int.Parse(grvCategorias.Rows[i].Cells[1].Text))});
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        txtID.Text = ds.Tables[0].Rows[0]["id_categoria"].ToString();
                        txtDescripcion.Text = ds.Tables[0].Rows[0]["descripcion"].ToString();
                        rblEstado.SelectedValue = bool.Parse((ds.Tables[0].Rows[0]["estado"].ToString()))? "1":"0";
                        txtID.Enabled = true;
                        txtDescripcion.Enabled = true;
                        rblEstado.Enabled = true;
                        btnAgregar.Enabled = false;
                        btnAceptar.Enabled = true;
                        btnCancelar.Enabled = true;
                    }
                }
                catch (Exception ex)
                {

                }
            }
        }
Пример #2
0
 protected void btnAceptar_Click(object sender, EventArgs e)
 {
     try
     {
         int id = (txtID.Text == string.Empty) ? 0 : int.Parse(txtID.Text);
         DataSet ds = new Database().getData("INSERTA_MODIFICA_EVENTO", new SqlParameter[] {
         new SqlParameter("@id_evento", id),
         new SqlParameter("@titulo", txtTitulo.Text),
         new SqlParameter("@descripcion", txtDescripcion.Text),
         new SqlParameter("@url_imagen","~\\Uploads\\" + fulImagen.FileName),
         new SqlParameter("@fecha_evento", calEventos.SelectedDate.ToShortDateString()),
         new SqlParameter("@hora_inicio", txtHoraInicio.Text),
         new SqlParameter("@hora_fin", txtHoraFin.Text),
         new SqlParameter("@estado", rblEstado.SelectedValue)
         });
         if (ds.Tables[0].Rows.Count > 0)
         {
             txtID.Text = ds.Tables[0].Rows[0]["id_evento"].ToString();
             fulImagen.SaveAs(Server.MapPath("~/Uploads/" + fulImagen.FileName));
             lblInformacion.Text = "Los datos fueron almacenados con éxito.";
             LoadGRV();
         }
     }
     catch (Exception ex)
     {
         lblInformacion.Text = ex.Message;
     }
 }
Пример #3
0
 protected void btnAcceder_Click(object sender, EventArgs e)
 {
     try
     {
         DataSet ds = new Database().getData("SELECCIONA_USUARIO", new SqlParameter[] {
             new SqlParameter("@nombre_usuario", txtUsuario.Value),
             new SqlParameter("@contraseña", new General().GetHash(txtPassword.Value))
         });
         if (ds.Tables.Count > 0)
         {
             if (ds.Tables[0].Rows.Count > 0)
             {
                 DataRow row = ds.Tables[0].Rows[0];
                 Session["id_usuario"] = row["id_usuario"];
                 Session["nombre_usuario"] = row["nombre_usuario"];
                 FormsAuthentication.SetAuthCookie(txtUsuario.Value, chkRecordar.Checked);
                 Response.Redirect("~/Default.aspx");
             }
             else
             {
                 lblInformacion.Text = "Credenciales inválidas";
             }
         }
     }
     catch (Exception ex)
     {
         lblInformacion.Text = ex.Message;
     }
 }
Пример #4
0
 protected void Unnamed1_Click(object sender, EventArgs e)
 {
     try
     {
         Database ds = new Database();
         DataSet data = ds.getData("INSERTA_MODIFICA_USUARIO", new SqlParameter[] {
         new SqlParameter("@id_usuario", int.Parse("0")), new SqlParameter("@id_tipo_identificacion", cmbTipoIdentificacion.SelectedValue),
         new SqlParameter("@identificacion", txtIdentificacion.Value), new SqlParameter("@nombre_razon_social", txtNombre.Value),
         new SqlParameter("@correo_electronico", txtCorreoElectronico.Value), new SqlParameter("@nombre_usuario", txtUsuario.Value),
         new SqlParameter("@contraseña", new General().GetHash(txtContraseña.Value)), new SqlParameter("@id_pregunta_secreta", cmbPreguntaSecreta.SelectedValue),
         new SqlParameter("@respuesta_secreta", txtRespuestaSecreta.Value), new SqlParameter("@sexo", rblSexo.SelectedValue),
         new SqlParameter("@direccion", txtDireccion.Value), new SqlParameter("@telefono", txtTelefono.Value),
         new SqlParameter("@celular", txtCelular.Value), new SqlParameter("@pagina_web", txtPaginaWeb.Value),
         new SqlParameter("@id_ocupacion", cmbOcupacion.SelectedValue), new SqlParameter("@id_universidad", cmbUniversidad.SelectedValue),
         new SqlParameter("@id_carrera", cmbCarrera.SelectedValue), new SqlParameter("@fecha_nacimiento", txtFechaNacimiento.Value)
     });
         if (data.Tables.Count > 0)
         {
             Mail correo = new Mail(MailCredentials.hostname, MailCredentials.port, MailCredentials.user, MailCredentials.token, "*****@*****.**");
             correo.SendMail(txtCorreoElectronico.Value, "Confirmación de cuenta",
                 "Bienvenido, estás a sólo un paso de lograr tu registro.\nConfirma tu cuenta a través de este enlace: http://" + Request.Url.Host + ":" + Request.Url.Port + "/Account/Verify.aspx?id=" + data.Tables[0].Rows[0]["id_usuario"].ToString());
             Response.Redirect("~/Account/Congratulations.aspx");
         }
     }
     catch (Exception ex)
     {
         lblInformacion.Text = ex.Message;
     }
 }
Пример #5
0
 protected void btnAceptar_Click(object sender, EventArgs e)
 {
     try
     {
         fulImagen.SaveAs(Server.MapPath("~/Uploads/Cursos/" + fulImagen.FileName));
         int id = (txtID.Text == String.Empty) ? 0 : int.Parse(txtID.Text);
         Database db = new Database();
         DataSet row = db.getData("INSERTA_MODIFICA_CURSO", new SqlParameter[] {
             new SqlParameter("@id_curso", id),
             new SqlParameter("@nombre", txtNombre.Text),
             new SqlParameter("@descripcion", txtDescripcion.Text),
             new SqlParameter("@id_categoria", cmbCategoria.SelectedValue),
             new SqlParameter("@objetivo", txtObjetivo.Text),
             new SqlParameter("@dirigido_a", txtDirigidoA.Text),
             new SqlParameter("@pre_requisitos", txtPrerequisitos.Value),
             new SqlParameter("@aprendizaje", txtAprendizaje.Text),
             new SqlParameter("@precio_ucsg", txtPrecioUCSG.Text),
             new SqlParameter("@precio_publico", txtPrecioPublico.Text),
             new SqlParameter("@maximo_estudiantes", txtMaximoEstudiantes.Text),
             new SqlParameter("@minimo_estudiantes", txtMinimoEstudiantes.Text),
             new SqlParameter("@id_docente", cmbDocente.SelectedValue),
             new SqlParameter("@certificacion", rblCertificacion.SelectedValue),
             new SqlParameter("@horas", txtHoras.Text),
             new SqlParameter("@fecha_inicio", calFechaInicio.SelectedDate.ToShortDateString()),
             new SqlParameter("@url_imagen", "~\\Uploads\\Cursos\\" + fulImagen.FileName),
             new SqlParameter("@estado", cmbEstado.SelectedValue)
         });
         if (row.Tables[0].Rows.Count > 0)
         {
             txtID.Text = row.Tables[0].Rows[0]["id_curso"].ToString();
             foreach (GridViewRow r in grvHorario.Rows)
             {
                 DropDownList ddl = (DropDownList)r.FindControl("id_dia");
                 TextBox desde = (TextBox)r.FindControl("desde");
                 TextBox hasta = (TextBox)r.FindControl("hasta");
                 int ans = db.ExecuteSQL("INSERTA_HORARIO_CURSO", new SqlParameter[] {
                     new SqlParameter("@id_curso", txtID.Text),
                     new SqlParameter("@id_dia", ddl.SelectedValue),
                     new SqlParameter("@desde", desde.Text),
                     new SqlParameter("@hasta", hasta.Text)
                 });
                 if (ans > 0)
                 {
                     LoadCursos();
                     Clear();
                 }
             }
         }
         lblInformacion.Text = "Se ha guardado correctamente los datos";
     }
     catch(Exception ex)
     {
         lblInformacion.Text = ex.Message;
     }
 }
Пример #6
0
 protected void btnAceptar_Click(object sender, EventArgs e)
 {
     try
     {
         Database db = new Database();
         int id = (txtID.Text == string.Empty) ? int.Parse("0") : int.Parse(txtID.Text);
         DataSet row = db.getData("INSERTA_MODIFICA_DOCENTE", new SqlParameter[] {
             new SqlParameter("@id_docente", id),
             new SqlParameter("@cedula", txtCedula.Text),
             new SqlParameter("@nombre", txtNombre.Text),
             new SqlParameter("@direccion", txtDireccion.Text),
             new SqlParameter("@telefono_casa", txtTelefonoCasa.Text),
             new SqlParameter("@telefono_trabajo", txtTelefonoTrabajo.Text),
             new SqlParameter("@celular", txtCelular.Text),
             new SqlParameter("@correo_electronico", txtCorreoElectronico.Text),
             new SqlParameter("@id_profesion", cmbProfesion.SelectedValue),
             new SqlParameter("@id_universidad", cmbUniversidad.SelectedValue),
             new SqlParameter("@experiencia", txtExperiencia.Value),
             new SqlParameter("@estado", rblEstado.SelectedValue)
         });
         if (row.Tables[0].Rows.Count > 0)
         {
             txtID.Text = row.Tables[0].Rows[0]["id_docente"].ToString();
             foreach(GridViewRow r in grvHorario.Rows)
             {
                 DropDownList ddl = (DropDownList)r.FindControl("id_dia");
                 TextBox desde = (TextBox)r.FindControl("desde");
                 TextBox hasta = (TextBox)r.FindControl("hasta");
                 int ans = db.ExecuteSQL("INSERTA_HORARIO_DOCENTE", new SqlParameter[] {
                     new SqlParameter("@id_docente", txtID.Text),
                     new SqlParameter("@id_dia", ddl.SelectedValue),
                     new SqlParameter("@desde", desde.Text),
                     new SqlParameter("@hasta", hasta.Text)
                 });
             }
             for (int i = 0; i<chlCertificados.Items.Count -1; i++)
             {
                 if (chlCertificados.Items[i].Selected)
                 {
                     int r = db.ExecuteSQL("INSERTA_CERTIFICACION_DOCENTE", new SqlParameter[] { new SqlParameter("@id_docente", txtID.Text),
                          new SqlParameter("@id_certificacion", chlCertificados.Items[i].Value )});
                 }
             }
             LoadDocentes();
             Clear();
         }
     }
     catch (Exception ex)
     {
         lblMensaje.Text = ex.Message;
     }
 }
Пример #7
0
 protected void btnCambiar_Click(object sender, EventArgs e)
 {
     try
     {
         int rows = new Database().ExecuteSQL("CAMBIA_CONTRASEÑA_USUARIO", new SqlParameter[] {
             new SqlParameter("@nombre_usuario", txtNombreUsuario.Text), new SqlParameter("@contraseña_nueva", new General().GetHash(txtContrasena.Text)) });
         if (rows <= 0)
             lblInformacion4.Text = "Error, no se produjo ningún cambio, intente nuevamente";
         else
             Response.Redirect("Login.aspx");
     }
     catch(Exception ex)
     {
         lblInformacion4.Text = ex.Message;
     }
 }
Пример #8
0
 protected void dlEventos_ItemCommand(object source, DataListCommandEventArgs e)
 {
     if (HttpContext.Current.User.Identity.IsAuthenticated)
     {
         if (e.CommandName == "Inscribir")
         {
             try
             {
                 DataSet ds = new Database().getData("SELECCIONA_REGISTRO_ESPECIFICO_TEXTO", new SqlParameter[] {
                 new SqlParameter("@tabla", "tb_usuario"), new SqlParameter("@columna", "nombre_usuario"),
                 new SqlParameter("@dato", HttpContext.Current.User.Identity.Name)
             });
                 Session["id_usuario"] = ds.Tables[0].Rows[0]["id_usuario"];
                 Session["nombre"] = ds.Tables[0].Rows[0]["nombre_razon_social"];
                 Session["correo_electronico"] = ds.Tables[0].Rows[0]["correo_electronico"];
                 Session["nombre_usuario"] = ds.Tables[0].Rows[0]["nombre_usuario"];
             }
             catch (Exception ex)
             {
                 Response.Write("Error: " + ex.Message);
             }
             try
             {
                 int index = e.Item.ItemIndex;
                 Label lbl = (Label)dlEventos.Items[index].FindControl("lblID");
                 Button btn = (Button)dlEventos.Items[index].FindControl("btnInscribirme");
                 DataSet ds = new Database().getData("INSCRIBIR_USUARIO_CURSO", new SqlParameter[] {
             new SqlParameter("@id_curso", lbl.Text),
             new SqlParameter("@id_usuario", Session["id_usuario"])
         });
                 if (ds.Tables[0].Rows.Count > 0)
                 {
                     btn.Text = ds.Tables[0].Rows[0]["mensaje"].ToString();
                     btn.Enabled = false;
                 }
             }
             catch (Exception ex)
             {
                 Response.Write("Error: " + ex.Message);
             }
         }
     }
     else
         Response.Redirect("~/Account/Login.aspx");
 }
Пример #9
0
 protected void grvCursos_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         int index = int.Parse(e.CommandArgument.ToString());
         try
         {
             int rows = new Database().ExecuteSQL("ELIMINA_USUARIO_INSCRIPCION", new SqlParameter[] {
                 new SqlParameter("@id_usuario", Session["id_usuario"]),
                 new SqlParameter("@id_curso", grvCursos.Rows[index].Cells[0].Text)
             });
             if (rows > 0)
             {
                 LoadGrv();
             }
         }
         catch (Exception ex)
         {
             Response.Write("Error: " + ex.Message);
         }
     }
 }
Пример #10
0
 protected void btnSolicitar_Click(object sender, EventArgs e)
 {
     try
     {
         DataSet ds = new Database().getData("SELECCIONA_REGISTRO_ESPECIFICO_TEXTO", new SqlParameter[] {
             new SqlParameter("@tabla", "tb_usuario"), new SqlParameter("@columna", "nombre_usuario"), new SqlParameter("@dato", txtNombreUsuario.Text)
         });
         if (ds.Tables[0].Rows.Count > 0)
         {
             txtNombreUsuario.Enabled = false;
             btnSolicitar.Enabled = false;
             divPregunta.Visible = true;
             cmbPregunta.SelectedValue = ds.Tables[0].Rows[0]["id_pregunta_secreta"].ToString();
             rfvRespuesta.Enabled = true;
         }
         else
             lblInformacion.Text = "El usuario no existe.";
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
Пример #11
0
 protected void btnValidar_Click(object sender, EventArgs e)
 {
     try
     {
         DataSet ds = new Database().getData("RESPONDE_PREGUNTA_SECRETA", new SqlParameter[] { new SqlParameter("@nombre_usuario",
             txtNombreUsuario.Text), new SqlParameter("@respuesta", txtRespuesta.Text)});
         if (ds.Tables[0].Rows.Count > 0)
         {
             lblInformacion2.Text = string.Empty;
             divContrasena.Visible = true;
             txtRespuesta.Enabled = false;
             btnSolicitar.Enabled = false;
             btnValidar.Enabled = false;
             rfvContrasena.Enabled = true;
             cmbPregunta.SelectedValue = ds.Tables[0].Rows[0]["id_pregunta_secreta"].ToString();
         }
         else
             lblInformacion2.Text = "Respuesta incorrecta.";
     }
     catch(Exception ex)
     {
         lblInformacion2.Text = ex.Message;
     }
 }
Пример #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             DataSet ds = new Database().getData("SELECCIONA_REGISTRO_ESPECIFICO_TEXTO", new SqlParameter[] {
                 new SqlParameter("@tabla", "tb_usuario"), new SqlParameter("@columna", "nombre_usuario"),
                 new SqlParameter("@dato", HttpContext.Current.User.Identity.Name)
             });
             Session["id_usuario"] = ds.Tables[0].Rows[0]["id_usuario"];
             Session["nombre"] = ds.Tables[0].Rows[0]["nombre_razon_social"];
             Session["correo_electronico"] = ds.Tables[0].Rows[0]["correo_electronico"];
             Session["nombre_usuario"] = ds.Tables[0].Rows[0]["nombre_usuario"];
             lblNombre.Text = Session["nombre"].ToString();
             lblCorreo.Text = Session["correo_electronico"].ToString();
             lblUsuario.Text = Session["nombre_usuario"].ToString();
         }
         catch(Exception ex)
         {
             Response.Write("Error: " + ex.Message);
         }
     }
 }
Пример #13
0
 protected void grvDocentes_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Select")
     {
         try
         {
             int index = int.Parse(e.CommandArgument.ToString());
             DataSet ds = new Database().getData("SELECCIONA_REGISTRO_ESPECIFICO", new SqlParameter[] {
             new SqlParameter("@tabla", "tb_docente"),
             new SqlParameter("@columna", "id_docente"),
             new SqlParameter("@dato", grvDocentes.Rows[index].Cells[1].Text)
             });
             if (ds.Tables[0].Rows.Count > 0)
             {
                 DataRow row = ds.Tables[0].Rows[0];
                 txtID.Text = row["id_docente"].ToString();
                 txtNombre.Text = row["nombre"].ToString();
                 txtDireccion.Text = row["direccion"].ToString();
                 txtCedula.Text = row["cedula"].ToString();
                 txtCelular.Text = row["celular"].ToString();
                 txtCorreoElectronico.Text = row["correo_electronico"].ToString();
                 txtTelefonoCasa.Text = row["telefono_casa"].ToString();
                 txtTelefonoTrabajo.Text = row["telefono_trabajo"].ToString();
                 cmbProfesion.SelectedValue = row["id_profesion"].ToString();
                 cmbUniversidad.SelectedValue = row["id_universidad"].ToString();
                 rblEstado.SelectedValue = (bool.Parse(row["estado"].ToString())) ? "1" : "0";
                 txtExperiencia.Value = row["experiencia"].ToString();
                 Enable();
                 ViewState["GridView"] = new Database().getData("SELECCIONA_REGISTRO_ESPECIFICO", new SqlParameter[] {
                     new SqlParameter("@tabla", "tb_profesor_dia"), new SqlParameter("@columna", "id_docente"),
                     new SqlParameter("@dato", txtID.Text)
                 }).Tables[0];
                 grvHorario.DataSource = (DataTable)ViewState["GridView"];
                 grvHorario.DataBind();
                 DataTable dt = new Database().getData("SELECCIONA_REGISTRO_ESPECIFICO", new SqlParameter[] {
                     new SqlParameter("@tabla", "tb_docente_certificacion"), new SqlParameter("@columna", "id_docente"),
                     new SqlParameter("@dato", txtID.Text)
                 }).Tables[0];
                 for (int i = 0; i< chlCertificados.Items.Count - 1; i++)
                 {
                     foreach(DataRow r in dt.Rows)
                         if (int.Parse(chlCertificados.Items[i].Value) == int.Parse(r["id_certificacion"].ToString()))
                             chlCertificados.Items[i].Selected = true;
                 }
             }
         }
         catch (Exception ex)
         {
             lblMensaje.Text = ex.Message;
         }
     }
 }
Пример #14
0
 protected void LoadIntereses()
 {
     Database ds = new Database();
     ds.setCheckBoxList(chlIntereses, ds.getData("SELECCIONA_TABLA_GENERAL_POR_ESTADO", new SqlParameter[] { new SqlParameter("@tabla", "tb_interes") }), "descripcion", "id_interes");
 }
Пример #15
0
 protected void LoadPreguntaSecreta()
 {
     Database ds = new Database();
     ds.setDropdownList(cmbPreguntaSecreta, ds.getData("SELECCIONA_TABLA_GENERAL_POR_ESTADO", new SqlParameter[] { new SqlParameter("@tabla", "tb_pregunta_secreta") }), "descripcion", "id_pregunta_secreta");
 }
Пример #16
0
 protected void LoadTipoIdentificacion()
 {
     Database ds = new Database();
     ds.setDropdownList(cmbTipoIdentificacion, ds.getData("SELECCIONA_TABLA_GENERAL_POR_ESTADO", new SqlParameter[] { new SqlParameter("@tabla", "tb_tipo_identificacion") }), "descripcion", "id_tipo_identificacion");
 }
Пример #17
0
 protected void grvHorario_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     try
     {
         DropDownList ddl = (DropDownList)e.Row.FindControl("id_dia");
         Database db = new Database();
         ddl.DataSource = db.getData("SELECCIONA_TABLA_GENERAL_POR_ESTADO", new SqlParameter[] { new SqlParameter("@tabla", "tb_dia") });
         ddl.DataTextField = "descripcion";
         ddl.DataValueField = "id_dia";
         ddl.DataBind();
     }
     catch (Exception ex)
     {
         lblInformacion.Text = ex.Message;
     }
 }
Пример #18
0
        protected void grvCursos_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Select")
            {
                try
                {
                    int index = int.Parse(e.CommandArgument.ToString());
                    DataSet ds = new Database().getData("SELECCIONA_REGISTRO_ESPECIFICO", new SqlParameter[] {
                    new SqlParameter("@tabla", "tb_curso"),
                    new SqlParameter("@columna", "id_curso"),
                    new SqlParameter("@dato", grvCursos.Rows[index].Cells[1].Text)
                });
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        DataRow row = ds.Tables[0].Rows[0];
                        txtAprendizaje.Text = row["aprendizaje"].ToString();
                        txtDescripcion.Text = row["descripcion"].ToString();
                        txtDirigidoA.Text = row["dirigido_a"].ToString();
                        txtHoras.Text = row["horas"].ToString();
                        txtID.Text = row["id_curso"].ToString();
                        txtMaximoEstudiantes.Text = row["maximo_estudiantes"].ToString();
                        txtMinimoEstudiantes.Text = row["minimo_estudiantes"].ToString();
                        txtNombre.Text = row["nombre"].ToString();
                        txtObjetivo.Text = row["objetivo"].ToString();
                        txtPrecioPublico.Text = row["precio_publico"].ToString();
                        txtPrecioUCSG.Text = row["precio_ucsg"].ToString();
                        txtPrerequisitos.Value = row["pre_requisitos"].ToString();
                        cmbCategoria.SelectedValue = row["id_categoria"].ToString();
                        cmbDocente.SelectedValue = row["id_docente"].ToString();
                        cmbEstado.SelectedValue = (bool.Parse(row["estado"].ToString())) ? "1" : "0";
                        calFechaInicio.SelectedDate = DateTime.Parse(row["fecha_inicio"].ToString());
                        Enable();
                    }
                    ds = new Database().getData("SELECCIONA_REGISTRO_ESPECIFICO", new SqlParameter[] {
                    new SqlParameter("@tabla", "tb_curso_dia"), new SqlParameter("@columna", "id_curso"),
                    new SqlParameter("@dato", txtID.Text)
                });
                    grvHorario.DataSource = ds.Tables[0];
                    grvHorario.DataBind();
                    ViewState["GridView"] = ds.Tables[0];

                }
                catch(Exception ex)
                {
                    lblInformacion.Text = ex.Message;
                }
            }
        }
Пример #19
0
 protected void LoadUniversidad()
 {
     Database ds = new Database();
     ds.setDropdownList(cmbUniversidad, ds.getData("SELECCIONA_TABLA_GENERAL_POR_ESTADO", new SqlParameter[] { new SqlParameter("@tabla", "tb_universidad") }), "descripcion", "id_universidad");
 }
Пример #20
0
 protected void grvEventos_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "select")
     {
         int i = int.Parse(e.CommandArgument.ToString());
         try
         {
             DataSet ds = new Database().getData("SELECCIONA_REGISTRO_ESPECIFICO", new SqlParameter[] {
                 new SqlParameter("@tabla", "tb_evento"), new SqlParameter("@columna", "id_evento"),
                 new SqlParameter("@dato", grvEventos.Rows[i].Cells[1].Text)
             });
             if (ds.Tables[0].Rows.Count > 0)
             {
                 DataRow row = ds.Tables[0].Rows[0];
                 txtID.Text = row["id_evento"].ToString();
                 txtTitulo.Text = row["titulo"].ToString();
                 txtDescripcion.Text = row["descripcion"].ToString();
                 txtHoraInicio.Text = row["hora_inicio"].ToString();
                 txtHoraFin.Text = row["hora_fin"].ToString();
                 calEventos.SelectedDate = DateTime.Parse(row["fecha_evento"].ToString());
                 rblEstado.SelectedValue = (bool.Parse(row["estado"].ToString())) ? "1" : "0";
                 lblImagen.Text = row["url_imagen"].ToString();
                 Enable();
             }
             else
                 lblInformacion.Text = "No se encontró el registro o no se realizó corréctamente la consulta.";
         }
         catch (Exception ex)
         {
             lblInformacion.Text = "Hubo un error al momento de cargar los datos: " + ex.Message;
         }
     }
 }
Пример #21
0
 protected void Unnamed2_Click(object sender, EventArgs e)
 {
     int id = (txtID.Text == String.Empty) ? 0 : int.Parse(txtID.Text);
     try
     {
         DataSet ds = new Database().getData("INSERTA_MODIFICA_CATEGORIA", new SqlParameter[] {
         new SqlParameter("@id_categoria", id),
         new SqlParameter("@descripcion", txtDescripcion.Text),
         new SqlParameter("@estado", rblEstado.SelectedValue)});
         if (ds.Tables[0].Rows.Count > 0)
         {
             txtID.Text = ds.Tables[0].Rows[0]["id_categoria"].ToString();
             lblEstado.Text = "Los datos fueron almacenados con éxito";
             Clear();
             LoadGRV();
         }
         else
             lblEstado.Text = "Hubo un error, intente nuevamente";
     }
     catch (Exception ex)
     {
         lblEstado.Text = "Error: " + ex.Message;
     }
 }
Пример #22
0
 protected void LoadCarrera()
 {
     Database ds = new Database();
     ds.setDropdownList(cmbCarrera, ds.getData("SELECCIONA_TABLA_GENERAL_POR_ESTADO", new SqlParameter[] { new SqlParameter("@tabla", "tb_carrera") }), "descripcion", "id_carrera");
 }