Example #1
0
        private bool _esUsuarioOASis()
        {
            bool ban = false;

            try{
                SitioWebOasis.ProxySeguro.Seguridad seg = new ProxySeguro.Seguridad();
                ProxySeguro.DatosUsuario            du  = new ProxySeguro.DatosUsuario();
                string periodoVigente = this._getPeriodoVigente();

                //  GESTIONA EL ROL DE UN USUARIO REGISTRADO
                bool blnUsuarioValido = seg.AutenticarUsuario(this._addGuionCedula(this.per_numCedula),
                                                              "e",
                                                              periodoVigente,
                                                              out this._dsUsuarioOASis);

                ban = (this._dsUsuarioOASis.Carreras.Rows.Count > 0)? true
                                                                    : false;
            }
            catch (Exception ex) {
                ban = false;
                Errores err = new Errores();
                err.SetError(ex, "_registrarDireccionEstudiante");
            }

            return(ban);
        }
Example #2
0
        public List <System.Web.Mvc.SelectListItem> getLstCarrerasPA()
        {
            List <System.Web.Mvc.SelectListItem> lstCarerrasPA = new List <System.Web.Mvc.SelectListItem>();

            System.Web.Mvc.SelectListItem carrera = new System.Web.Mvc.SelectListItem();
            try
            {
                if (this.UsuarioActual != null)
                {
                    ProxySeguro.Seguridad seg = new ProxySeguro.Seguridad();
                    dsCDPA = seg.carrerasDocentesPeriodosAnteriores(this.UsuarioActual.Cedula.ToString());
                    string[]  lstCarreras = { "strCodCarrera", "strCarrera" };
                    DataTable dtSelect    = dsCDPA.Tables[0].DefaultView.ToTable(true, lstCarreras);//Realiza un select de las carreras usando el distinc
                    if (dtSelect != null && dtSelect.Rows.Count > 0)
                    {
                        foreach (DataRow item in dtSelect.Rows)
                        {
                            carrera       = new System.Web.Mvc.SelectListItem();
                            carrera.Value = item["strCodCarrera"].ToString();
                            carrera.Text  = item["strCarrera"].ToString();
                            lstCarerrasPA.Add(carrera);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                lstCarerrasPA = new List <System.Web.Mvc.SelectListItem>();
                Errores err = new Errores();
                err.SetError(ex, "getCarrerasPeriodosAnteriores");
            }
            return(lstCarerrasPA);
        }
Example #3
0
 public void getCarrerasPeriodosAnteriores()
 {
     try
     {
         ProxySeguro.Seguridad seg = new ProxySeguro.Seguridad();
         dsCDPA = seg.carrerasDocentesPeriodosAnteriores(this.UsuarioActual.Cedula.ToString());
     }
     catch (Exception ex)
     {
         Errores err = new Errores();
         err.SetError(ex, "getCarrerasPeriodosAnteriores");
     }
 }
        private string strGetUltimoPeriodoRegistrado()
        {
            string ultimoPeriodoRegistrado = string.Empty;
            string numIdentificacion       = string.Empty;

            try {
                numIdentificacion = this._getNumeroIdentificacion();
                if (!string.IsNullOrEmpty(numIdentificacion))
                {
                    ProxySeguro.Seguridad seg = new ProxySeguro.Seguridad();
                    ultimoPeriodoRegistrado = seg.getUltimoPeriodoRegistrado(numIdentificacion);

                    seg.Dispose();
                }
            }
            catch (Exception ex) {
                Errores err = new Errores();
                err.SetError(ex, "strGetUltimoPeriodoRegistrado");
                err.setInfo("HomeController", ex.Message);
            }

            return(ultimoPeriodoRegistrado);
        }
Example #5
0
        private bool _existeRolUsuario()
        {
            bool blnUsuarioValido = false;

            try
            {
                WSSeguridad.dtstUsuario dsUsuario = new WSSeguridad.dtstUsuario();
                string numIdentificacionUsr       = this._getNumeroIdentificacion();

                if (!string.IsNullOrEmpty(numIdentificacionUsr))
                {
                    string periodoVigente = this._getPeriodoVigente();
                    SitioWebOasis.ProxySeguro.Seguridad seg = new ProxySeguro.Seguridad();

                    //  GESTIONA EL ROL DE UN USUARIO REGISTRADO
                    blnUsuarioValido = seg.AutenticarUsuario(numIdentificacionUsr,
                                                             "e",
                                                             periodoVigente,
                                                             out dsUsuario);

                    //  Verificar si el usuario es válido
                    if (blnUsuarioValido)
                    {
                        //  Add objeto seguridad a la cache del usuario
                        this._addObjetoSeguridad();

                        // registrar datos del usuario en la sesión para futuras referencias
                        Usuario usr = this.RegistrarUsuarioEnSesion(dsUsuario);

                        // crear un ticket de autenticación
                        FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                                                                                         usr.Login,
                                                                                         DateTime.Now,
                                                                                         DateTime.Now.AddMinutes(20),
                                                                                         false,
                                                                                         usr.RolActual.ID.ToString());

                        //  Encriptar el ticket
                        string encTicket = FormsAuthentication.Encrypt(ticket);

                        //  Crear una cookie y añadir el ticket encriptado como datos
                        HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);

                        //  Añadir la cookie a la respuesta
                        Response.Cookies.Add(cookie);

                        //  Seteo el tiempo de session en "20" minutos
                        Session.Timeout = 20;
                    }
                    else
                    {
                        this.Session["UsuarioActual"] = new Usuario();
                    }
                }
            }catch (Exception ex) {
                blnUsuarioValido = false;

                Errores err = new Errores();
                err.SetError(ex, "_existeRolUsuario");
            }

            return(blnUsuarioValido);
        }