public spGetUser_Result GetUser(string username)
        {
            spGetUser_Result returnUser;

            try
            {
                using (NorthwindEntities context = new NorthwindEntities())
                {
                    IEnumerable <spGetUser_Result> user = context.spGetUser(username);
                    returnUser = user.First();
                }
            }
            catch (Exception ex) {
                returnUser          = new spGetUser_Result();
                returnUser.username = "******";
            }

            return(returnUser);
        }
Exemple #2
0
        public bool Authorize(string user, string password)
        {
            bool   auth       = false;
            string publicuser = WebConfigurationManager.AppSettings["PFUserName"];
            string publicpass = WebConfigurationManager.AppSettings["PFPassWord"];

            if (user.Equals(publicuser) && password.Equals(publicpass))
            {
                auth = true;
            }
            else
            {
                GetUsers         BLLUserCall = new GetUsers();
                spGetUser_Result Check       = BLLUserCall.GetUser(user);// ifuser exists
                if (!Check.username.Equals("invalid"))
                {
                    if (Check.Password.Equals(password))
                    {
                        auth = true;
                    }
                }
            }
            return(auth);
        }