예제 #1
0
        public string AddStudent(MdlStudent mdlStudentObj)
        {
            DbStudent dbStudentObj = new DbStudent();
            CtrEmail ctrEmailObj = new CtrEmail();

            mdlStudentObj.Salt = CreateSalt(10);
            mdlStudentObj.Password = CreateHash(mdlStudentObj.Password, mdlStudentObj.Salt);

            //mdlStudentObj.ConfirmationCode = ctrEmailObj.getCode();
            mdlStudentObj.ConfirmationCode = "none";
            string Feedback = dbStudentObj.AddStudent(mdlStudentObj);
            if (Feedback == "Error")
                return Feedback;

            //ctrEmailObj.send();
            return Feedback;
        }
예제 #2
0
        public bool AddStudent(string email, string password, bool confirmed, bool student,
            int score, int numberOfChildren, bool pet, int numberOfCohabiters, bool disabled, DateTime dateOfCreation,
            string name, string surname, string address, string postCode, string city, string country, string phone)
        {
            ServerModel.MdlStudent mdlStudentObj = new ServerModel.MdlStudent(0, email, password, confirmed, student,
                score, numberOfChildren, pet, numberOfCohabiters, disabled, dateOfCreation, name, surname, address, postCode, city, country, phone);

            ServerDatabase.DbStudent dbStudentObj = new ServerDatabase.DbStudent();
            ServerDatabase.DbCheckEmailExists dbCheckEmailObj = new ServerDatabase.DbCheckEmailExists();

            if (!dbCheckEmailObj.checkEmailExists(mdlStudentObj.Email))
                return dbStudentObj.AddStudent(mdlStudentObj);

            Console.WriteLine("Registration has failed due to the existing email");
            Console.WriteLine("Thread: " + Thread.CurrentThread.ManagedThreadId.ToString() + " Time: " + DateTime.Now.ToString());
            return false;
        }