コード例 #1
0
ファイル: CtrStudent.cs プロジェクト: HappyBox/EFlats
        public int CalculateProfileScore(int id)
        {
            ServerDatabase.DbStudent dbStudentObj = new ServerDatabase.DbStudent();
            ServerDatabase.DbCheckEmailExists dbCheckEmailObj = new ServerDatabase.DbCheckEmailExists();
            object[] queueBasedArray = new object[3];

            dbStudentObj.GetQueueBasedData(id).CopyTo(queueBasedArray);
            //update score to the table and return it ONLY if update was successfult
            return dbStudentObj.UpdateScore(id, CalculateProfileScoreResult(queueBasedArray));
        }
コード例 #2
0
ファイル: CtrStudent.cs プロジェクト: HappyBox/EFlats
        public bool AddToWishlist(int studentId, int flatId, int score, int queueNumber)
        {
            ServerDatabase.DbStudent dbStudentObj = new ServerDatabase.DbStudent();
            //check if application exists
            if(!dbStudentObj.checkApplicationExists(studentId, flatId))
                return dbStudentObj.AddToWishlist(studentId, flatId, score, queueNumber);

            Console.WriteLine("Add to wishlist() has failed due to the existing application");
            Console.WriteLine("Thread: " + Thread.CurrentThread.ManagedThreadId.ToString() + " Time: " + DateTime.Now.ToString());
            return false;
        }
コード例 #3
0
ファイル: CtrStudent.cs プロジェクト: HappyBox/EFlats
        public int GetLastQueueNumber(int flatId)
        {
            ServerDatabase.DbStudent dbStudentObj = new ServerDatabase.DbStudent();
            ServerDatabase.DbFlat dbFlatObj = new ServerDatabase.DbFlat();
            //check if FlatId exists
            if(dbFlatObj.CheckFlatExists(flatId))
                //return biggest queue number
                return dbStudentObj.GetLastQueueNumber(flatId);

            Console.WriteLine("Add to wishlist() has failed due to the non existing flat");
            Console.WriteLine("Thread: " + Thread.CurrentThread.ManagedThreadId.ToString() + " Time: " + DateTime.Now.ToString());
            return -2;
        }
コード例 #4
0
ファイル: CtrStudent.cs プロジェクト: MiroPakanec/EFlats
        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;
        }
コード例 #5
0
ファイル: CtrStudent.cs プロジェクト: HappyBox/EFlats
        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;
        }
コード例 #6
0
ファイル: CtrEmail.cs プロジェクト: MiroPakanec/EFlats
        public bool checkCodeExist(string code)
        {
            //DB find, student update confirmed
            MdlStudent studentObj = new MdlStudent();
            studentObj.ConfirmationCode = code;
            DbStudent dbStudent = new DbStudent();
            using (TransactionScope scope = new TransactionScope())
            {
                //get student by confirmation code
                studentObj = dbStudent.GetStudentData(studentObj.ConfirmationCode, "code");

                scope.Complete();
            }

            if (studentObj != null)
                return confirm(studentObj);
            else
                return false;
        }
コード例 #7
0
ファイル: CtrEmail.cs プロジェクト: MiroPakanec/EFlats
 private bool confirm(MdlStudent student)
 {
     student.Confirmed = true;
     DbStudent dbStudentObj = new DbStudent();
     return dbStudentObj.UpdateProfile(student);
 }
コード例 #8
0
ファイル: CtrStudent.cs プロジェクト: MiroPakanec/EFlats
 public DataSet GetWishlist(string studentEmail)
 {
     DbStudent dbStudentObj = new DbStudent();
     return dbStudentObj.GetWishlistData(studentEmail);
 }
コード例 #9
0
ファイル: CtrStudent.cs プロジェクト: MiroPakanec/EFlats
 public MdlStudent GetStudentData(string email)
 {
     DbStudent dbStudentObj = new DbStudent();
     return dbStudentObj.GetStudentData(email);
 }
コード例 #10
0
ファイル: CtrStudent.cs プロジェクト: MiroPakanec/EFlats
        public bool UpdateProfile(string email, int numberOfChildren, bool pet, int numberOfCohabitors, bool disabled,
            string name, string surname, string address, string postCode, string city, string country, string phone)
        {
            DbStudent dbStudentObj = new DbStudent();
            MdlStudent mdlStudentObj = GetStudent(email, numberOfChildren, pet, numberOfCohabitors,
                disabled, name, surname, address, postCode, city, country, phone);

            mdlStudentObj = CalculateProfileScore(mdlStudentObj);
            return dbStudentObj.UpdateProfile(mdlStudentObj);
        }
コード例 #11
0
ファイル: CtrStudent.cs プロジェクト: HappyBox/EFlats
 public bool RemoveFromWishlist(int studentId, int flatId)
 {
     ServerDatabase.DbStudent DbStudentObj = new ServerDatabase.DbStudent();
     return DbStudentObj.RemoveFromWishlist(studentId, flatId);
 }
コード例 #12
0
ファイル: CtrStudent.cs プロジェクト: HappyBox/EFlats
 public static int GetScore(int studentId)
 {
     ServerDatabase.DbStudent dbStudentObj = new ServerDatabase.DbStudent();
     return dbStudentObj.GetScore(studentId);
 }