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 PostShift(Shift shift)
        {
            //Due to c# having no interoperability between DateTime or plugin class Localdate and java Date
            //and localDate we decided to just skip deserialization in the c# client
            socketHandler.SendToDatabase("PostShift", shift);
            string result = socketHandler.GetResponse();

            if (result.Equals("OK"))
            {
                //If ok it post and returns if post was succesful
                socketHandler.SendToDatabase("PostShift;Confirmed", shift);
                result = socketHandler.GetResponse();
                if (result.Equals("OK"))
                {
                    return("Success");
                }
                else
                {
                    return("Failed");
                }
            }
            else
            {
                return("Database already has this shift in it");
            }
        }
Esempio n. 3
0
        public string PostShift(Shift shift)
        {
            socketHandler.SendToDatabase("PostShift", shift);
            string result = socketHandler.GetResponse();

            if (result.Equals("OK"))
            {
                socketHandler.SendToDatabase("PostShift;Confirmed", shift);
                result = socketHandler.GetResponse();
                if (result.Equals("OK"))
                {
                    return("Success");
                }
                else
                {
                    return("Failed");
                }
            }
            else
            {
                return("Employee already has a shift on that day...");
            }
        }
Esempio n. 4
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");
            }
        }
        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");
            }
        }