Exemplo n.º 1
0
        public bool AddLandlord(string email, string password, bool confirmed, DateTime dateOfCreation,
            string name, string surname, string address, string postCode, string city, string country, string phone)
        {
            ServerModel.MdlLandlord mdlLandlordObj = new ServerModel.MdlLandlord(0, email, password, confirmed,
                dateOfCreation, name, surname, address, postCode, city, country, phone);

            ServerDatabase.DbLandlord dbLandlordObj = new ServerDatabase.DbLandlord();
            ServerDatabase.DbCheckEmailExists dbCheckEmailObj = new ServerDatabase.DbCheckEmailExists();

            //if email does not exist register
            if (!dbCheckEmailObj.checkEmailExists(mdlLandlordObj.Email))
                return dbLandlordObj.AddLandlord(mdlLandlordObj);

            Console.WriteLine("Registration has failed due to the existing email");
            Console.WriteLine("Thread: " + Thread.CurrentThread.ManagedThreadId.ToString() + " Time: " + DateTime.Now.ToString());
            return false;
        }
Exemplo n.º 2
0
        public ArrayList GetUserData(string email)
        {
            ServerModel.MdlStudent mdlStudentObj = new ServerModel.MdlStudent(email, null);
            ServerModel.MdlLandlord mdlLandlordObj = new ServerModel.MdlLandlord(email, null);

            if (GetUserType(email).Equals("student"))
            {
                Console.WriteLine("User is of type: Student.");
                mdlStudentObj = ServerDatabase.DbGetData.GetStudentData(mdlStudentObj);
                return FillArrayListStudent(mdlStudentObj);
            }
            else if (GetUserType(email).Equals("landlord"))
            {
                Console.WriteLine("User is of type: Landlord.");
                mdlLandlordObj = ServerDatabase.DbGetData.GetLandlordData(mdlLandlordObj);
                return FillArrayListLandlord(mdlLandlordObj);
            }
            else
            {
                ArrayList array = new ArrayList();
                Console.WriteLine("Unable to get Users information.");
                return array;
            }
        }