public string PostUser(User user)
        {
            //Check if there is one in database
            socketHandler.SendToDatabase("PostUser", user);
            string result = socketHandler.GetResponse();

            if (result.Equals("OK"))
            {
                //If ok it post and returns if post was succesful
                socketHandler.SendToDatabase("PostUser;Confirmed", user);
                result = socketHandler.GetResponse();
                if (result.Equals("OK"))
                {
                    return("Success");
                }
                else
                {
                    return("User already exists");
                }
            }
            else
            {
                return("Database already has this user in it");
            }
        }
        public string ValidateLogin(User user)
        {
            socketHandler.SendToDatabase("Login", user);
            string result = socketHandler.GetResponse();

            string[] resultSlpit = result.Split(";");
            if (resultSlpit[0].Equals("OK"))
            {
                return("Login successful;" + resultSlpit[1]);
            }
            else
            {
                return("Wrong username or password");
            }
        }
Example #3
0
        public string PostUser(User user)
        {
            socketHandler.SendToDatabase("PostUser", user);
            string result = socketHandler.GetResponse();

            if (result.Equals("OK"))
            {
                socketHandler.SendToDatabase("PostUser;Confirmed", user);
                result = socketHandler.GetResponse();
                if (result.Equals("OK"))
                {
                    return("Success");
                }
                else
                {
                    return("User already exists");
                }
            }
            else
            {
                return("Database already has this user in it");
            }
        }
Example #4
0
 public string GetShift(int id)
 {
     socketHandler.SendToDatabaseStringOnly("GetShift;" + id);
     return(socketHandler.GetResponse());
 }