Example #1
0
 public List <EPersona> GetAllPersonas()
 {
     return(iPersona.getAllPersona());
 }
Example #2
0
        public EPersona iniciarSesion(string email, string password, string rol)
        {
            EPersona res = new EPersona();

            res.pNombre = "Error";

            EPersona ep = new EPersona();

            foreach (var item in iPersona.getAllPersona())
            {
                if (item.Correo == email && item.Password == password)
                {
                    ep = item;
                    break;
                }
            }
            if (rol == "Usuario")
            {
                EUsuario eu = null;
                try
                {
                    eu = iUsuario.getUsuario(ep.id);
                }
                catch (Exception)
                {
                }
                if (eu != null)
                {
                    return(ep);
                }
                else
                {
                    ep.pNombre = "ErrorRol";
                    return(ep);
                }
            }

            if (rol == "Conductor")
            {
                EConductor eu = null;
                try
                {
                    eu = iConductor.getConductor(ep.id);
                }
                catch (Exception)
                {
                }
                if (eu != null)
                {
                    return(ep);
                }
                else
                {
                    ep.pNombre = "ErrorRol";
                    return(ep);
                }
            }
            if (rol == "Admin")
            {
                EAdmin eu = null;
                try
                {
                    eu = iAdmin.getAdmin(ep.id);
                }
                catch (Exception)
                {
                }
                if (eu != null)
                {
                    return(ep);
                }
                else
                {
                    ep.pNombre = "ErrorRol";
                    return(ep);
                }
            }

            if (rol == "SuperAdmin")
            {
                ESuperAdmin eu = null;
                try
                {
                    eu = iSuperAd.getSuperAdmin(ep.id);
                }
                catch (Exception)
                {
                }
                if (eu != null)
                {
                    return(ep);
                }
                else
                {
                    ep.pNombre = "ErrorRol";
                    return(ep);
                }
            }

            return(res);
        }