protected void ASPxFormLayout1_E8_Click(object sender, EventArgs e) { try { using (ICCEntities lObjEntidad = new ICCEntities()) { TRX_Solicitud lObjSolicitud = new TRX_Solicitud(); lObjSolicitud = (from p in lObjEntidad.TRX_Solicitud where p.CorreoElectronico == ASPxFormLayout1_E6.Text select p).FirstOrDefault(); if (lObjSolicitud != null) { throw new Exception("Correo electrónico ya ha realizado solicitud anteriormente."); } if (ASPxFormLayout1_E4.Text != ASPxFormLayout1_E9.Text) { throw new Exception("La contraseña no coindice, ingrese nuevamente la contraseña."); } if (ASPxFormLayout1_E6.Text.Trim().Length == 0) { throw new Exception("Es necesario ingresar un correo electrónico valido."); } if (ASPxFormLayout1_E4.Text.Trim().Length == 0) { throw new Exception("Es necesario ingresar una contraseña valida."); } if (ASPxFormLayout1_E9.Text.Trim().Length == 0) { throw new Exception("Es necesario ingresar una re-contraseña valida."); } if (ASPxFormLayout1_E2.Text.Trim().Length == 0) { throw new Exception("Es necesario ingresar nombre y apellidos."); } lObjSolicitud = new TRX_Solicitud(); lObjSolicitud.Contrasena = ASPxFormLayout1_E4.Text; lObjSolicitud.CorreoElectronico = ASPxFormLayout1_E6.Text; lObjSolicitud.Estado_ID = 1; lObjSolicitud.NombresApellidos = ASPxFormLayout1_E2.Text; lObjSolicitud.Organizacion_ID = Convert.ToInt32(ASPxFormLayout1_E3.SelectedItem.Value); lObjSolicitud.Departamento_ID = Convert.ToInt32(ASPxFormLayout1_E1.SelectedItem.Value); lObjSolicitud.Municipio_ID = Convert.ToInt32(ASPxFormLayout1_E5.SelectedItem.Value); lObjEntidad.TRX_Solicitud.Add(lObjSolicitud); lObjEntidad.SaveChanges(); Response.Redirect("~/"); } } catch (Exception ex) { Response.Write("<script>alert('" + ex.Message + "');</script>"); } }
protected void ASPxFormLayout1_E8_Click(object sender, EventArgs e) { using (ICCEntities lObjEntidad = new ICCEntities()) { TRX_Solicitud lObjSolicitud = new TRX_Solicitud(); lObjSolicitud = (from p in lObjEntidad.TRX_Solicitud where p.CorreoElectronico == ASPxFormLayout1_E2.Text && p.Contrasena == ASPxFormLayout1_E4.Text select p).FirstOrDefault(); if (lObjSolicitud != null) { FormsAuthentication.SetAuthCookie(ASPxFormLayout1_E2.Text, true); SubCrearCookiePermisos(ASPxFormLayout1_E2.Text); Response.Redirect("~/Contenido/index.html"); } } }