Esempio n. 1
0
        public static bool Login(string userId, string password)
        {
            //clear current principal
            Thread.CurrentPrincipal = null;

            AppPrincipal prin         = new AppPrincipal();
            AppIdentity  appIdentity  = prin.AppIdentity;
            UserLoginDAL userLoginDal = new UserLoginDAL();

            userLoginDal.FillUserLoginByUserId(userId, appIdentity);

            if (appIdentity.IsNew)
            {
                return(false);
            }

            if (appIdentity.Disabled != 0)
            {
                return(false);
            }

            if (appIdentity.Password == password)
            {
                Thread.CurrentPrincipal = prin;
                return(true);
            }

            return(false);
        }
Esempio n. 2
0
        public static bool LoginForService(string userId)
        {
            Thread.CurrentPrincipal = null;
            AppPrincipal appPrincipal = new AppPrincipal();
            AppIdentity  appIdentity  = appPrincipal.AppIdentity;
            UserLoginDAL userLoginDal = new UserLoginDAL();

            userLoginDal.FillUserLoginByUserId(userId, appIdentity);
            if (appIdentity.IsNew)
            {
                return(false);
            }
            Thread.CurrentPrincipal = appPrincipal;
            return(true);
        }