Ejemplo n.º 1
0
        public static user createUser(user userObj)
        {
            GeoStoreDBEntities db = new GeoStoreDBEntities();

            db.users.AddObject(userObj);
            db.SaveChanges();
            return(getUserByName(userObj.name));
        }
Ejemplo n.º 2
0
        public static user getUserByOpenID(string openid)
        {
            GeoStoreDBEntities db = new GeoStoreDBEntities();
            var userQuery         = from userObj in db.users
                                    where userObj.open_id == openid
                                    select userObj;
            var users = userQuery.ToList();

            if (users.Count > 0)
            {
                return(users.Single());
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
        public static user getUserByEmail(string email)
        {
            GeoStoreDBEntities db = new GeoStoreDBEntities();
            var userQuery         = from userObj in db.users
                                    where userObj.email == email
                                    select userObj;
            var users = userQuery.ToList();

            if (users.Count > 0)
            {
                return(users.Single());
            }
            else
            {
                return(null);
            }
        }
        //check if open id exists in our system.
        private VerificationResponse VerifyOpenId(string openid)
        {
            VerificationResponse verificationResponse = new VerificationResponse();
            GeoStoreDBEntities   db = new GeoStoreDBEntities();
            user userObj            = user.getUserByOpenID(openid);

            if (userObj != null)
            {
                verificationResponse.status  = 0;
                verificationResponse.message = "This openid is already registered. You might have already registered with us.";
            }
            else
            {
                verificationResponse.status  = 1;
                verificationResponse.message = "The openid is successfully authenticated.";
            }
            return(verificationResponse);
        }
        public string VerifyEmailAddress(string email)
        {
            VerificationResponse verificationResponse = new VerificationResponse();
            GeoStoreDBEntities   db = new GeoStoreDBEntities();
            var userObj             = user.getUserByEmail(email);

            if (userObj != null)
            {
                verificationResponse.status  = 0;
                verificationResponse.message = "This email is already registered. You might have already registered with us.";
            }
            else
            {
                verificationResponse.status  = 1;
                verificationResponse.message = "";
            }
            return(JsonConvert.SerializeObject(verificationResponse));
        }
        public string VerifyUser(string userName)
        {
            VerificationResponse verificationResponse = new VerificationResponse();
            GeoStoreDBEntities   db = new GeoStoreDBEntities();
            user userObj            = user.getUserByName(userName);

            if (userObj != null)
            {
                verificationResponse.status  = 0;
                verificationResponse.message = "This user name is not available. Please choose another name.";
            }
            else
            {
                verificationResponse.status  = 1;
                verificationResponse.message = "This User name is available.";
            }
            return(JsonConvert.SerializeObject(verificationResponse));
        }