Пример #1
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;
     }
 }
Пример #2
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;
     }
 }
Пример #3
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;
     }
 }
Пример #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 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");
 }
Пример #6
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");
 }
Пример #7
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");
 }
Пример #8
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");
 }
Пример #9
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");
 }