Ejemplo n.º 1
0
        public string UserLogin(LoginProperties data)
        {
            if (data == null)
            {
                return(MISSING);
            }

            try
            {
                JavaScriptSerializer json = new JavaScriptSerializer();
                UserEntity           auth = new UserEntity();

                auth.UserName = data.UserName;
                auth.Password = GetHashPassword(data.Password);

                if (!string.IsNullOrEmpty(auth.UserName))
                {
                    TableManager tblMgr = new TableManager();
                    UserEntity   user   = tblMgr.GetUserByName(auth.UserName);

                    if (user != null && user.UserName == auth.UserName && user.Password == auth.Password)
                    {
                        return(Login(user.UserId, user.UserType, user.FirstName, user.LastName, user.Email, user.Mobile, user.DateOfBirth, user.Gender, user.City, user.Favorite));
                    }
                    else
                    {
                        return(INVALID);
                    }
                }
                else
                {
                    return(MISSING);
                }
            }
            catch (Exception)
            {
                return(ERROR);
            }
        }
Ejemplo n.º 2
0
        public string UserLogin(LoginProperties data)
        {
            if (data == null)
            {
                return MISSING;
            }

            try
            {
                JavaScriptSerializer json = new JavaScriptSerializer();
                UserEntity auth = new UserEntity();

                auth.UserName = data.UserName;
                auth.Password = GetHashPassword(data.Password);

                if (!string.IsNullOrEmpty(auth.UserName))
                {
                    TableManager tblMgr = new TableManager();
                    UserEntity user = tblMgr.GetUserByName(auth.UserName);

                    if (user != null && user.UserName == auth.UserName && user.Password == auth.Password)
                    {
                        return Login(user.UserId, user.UserType, user.FirstName, user.LastName, user.Email, user.Mobile, user.DateOfBirth, user.Gender, user.City, user.Favorite);
                    }
                    else
                    {
                        return INVALID;
                    }
                }
                else
                {
                    return MISSING;
                }
            }
            catch (Exception)
            {
                return ERROR;
            }
        }