Пример #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);
        }
Пример #2
0
 public BL()
 {
     loginDAL     = new LoginDAL();
     orderDAL     = new OrderDAL();
     productDAL   = new ProductDAL();
     historyDAL   = new SaleHistoryDAL();
     userDAL      = new UserDAL();
     userLoginDAL = new UserLoginDAL();
 }
Пример #3
0
        public bool ChangePassword(User user)
        {
            if (string.IsNullOrWhiteSpace(user.UserName) || string.IsNullOrWhiteSpace(user.Password))
            {
                return(false);
            }

            var login = new UserLoginDAL();

            return(login.ChangePassword(user));
        }
Пример #4
0
        public bool VerifyLoginCredentials(User user)
        {
            if (string.IsNullOrWhiteSpace(user.UserName) || string.IsNullOrWhiteSpace(user.Password))
            {
                return(false);
            }

            var login = new UserLoginDAL();

            return(login.VerifyCredentials(user.UserName, user.Password, user.UserType));
        }
Пример #5
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);
        }
Пример #6
0
 public bool LoginUser(Property objProp)
 {
     try
     {
         UserLoginDAL userLog = new UserLoginDAL();
         if (userLog.getUser(objProp) == 1)
         {
             flag = true;
         }
         else
         {
             flag = false;
         }
     }
     catch (Exception ex)
     {
         objNLog.Error("Exception : " + ex.Message);
     }
     return flag;
 }