public void CanGetEmployerWithoutDescriptionByIdTest()
        {
            IEmployerDAO <Employer> employerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();

            testEmployer.FirstName = "Ema";
            testEmployer.LastName  = "Coelho";
            testEmployer.UserName  = "******";
            testEmployer.Password  = "******";
            testEmployer.Email     = "*****@*****.**";
            testEmployer.Address   = "Lousada";

            Employer returnedEmployer = employerDAO.Create(testEmployer);

            Employer e = employerDAO.FindEmployerById(returnedEmployer.Id);

            Assert.Equal(returnedEmployer.Id, e.Id);
            Assert.Equal(returnedEmployer.UserName, e.UserName);
            Assert.Equal(returnedEmployer.FirstName, e.FirstName);
            Assert.Equal(returnedEmployer.LastName, e.LastName);
            Assert.Equal(returnedEmployer.Email, e.Email);
            Assert.Equal(returnedEmployer.Address, e.Address);

            _fixture.Dispose();
        }
예제 #2
0
        public void CanFindJobPostByIdOrReturnNullWhenNotFoundTest()
        {
            IEmployerDAO <Employer> EmployerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();

            testEmployer.FirstName   = "Marcelo";
            testEmployer.LastName    = "Carvalho";
            testEmployer.UserName    = "******";
            testEmployer.Password    = "******";
            testEmployer.Email       = "*****@*****.**";
            testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testEmployer.Address     = "Lixa";

            Employer returned = EmployerDAO.Create(testEmployer);

            IJobDAO jobPostDAO = new JobDAO(_connection);
            JobPost testPost   = new JobPost();

            testPost.Title         = "Canalização Estourada";
            testPost.Category      = Categories.PLUMBING;
            testPost.Description   = "Grande estouro nos canos da sanita";
            testPost.Tradable      = true;
            testPost.InitialPrice  = 60.6;
            testPost.Address       = "Rua sem fim";
            testPost.PaymentMethod = new[] { Payment.PAYPAL, Payment.MONEY };

            JobPost returnedPost = jobPostDAO.Create(returned.Id, testPost);

            Assert.Equal(returnedPost.Id, jobPostDAO.FindById(returnedPost.Id).Id);

            //when not found
            Assert.Null(jobPostDAO.FindById(200));

            _fixture.Dispose();
        }
예제 #3
0
        public ActionResult <List <FavoriteModel> > FavoritesList()
        {
            try
            {
                int?id = ClaimHelper.GetIdFromClaimIdentity((ClaimsIdentity)this.ControllerContext.HttpContext.User.Identity);

                if (id == null)
                {
                    return(Unauthorized(new ErrorMessageModel("Sem Autorização ou sem sessão inciada")));
                }

                EmployerDAO employerDAO = new EmployerDAO(_connection);

                List <FavoriteModel> favorites = employerDAO.FavoritesList((int)id).ToList();

                if (favorites == null)
                {
                    return(NotFound(new ErrorMessageModel("Lista de favoritos Inexistente!")));
                }

                return(favorites);
            }
            catch (Exception ex)
            {
                return(BadRequest(new ErrorMessageModel(ex.Message)));
            }
        }
        public void CanRegisterEmployerTest()
        {
            IEmployerDAO <Employer> EmployerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();

            testEmployer.FirstName   = "Marcelo";
            testEmployer.LastName    = "Carvalho";
            testEmployer.UserName    = "******";
            testEmployer.Password    = "******";
            testEmployer.Email       = "*****@*****.**";
            testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testEmployer.Address     = "Lixa";

            Employer returned = EmployerDAO.Create(testEmployer);

            Assert.Equal(testEmployer.FirstName, returned.FirstName);
            Assert.Equal(testEmployer.LastName, returned.LastName);
            Assert.Equal(testEmployer.UserName, returned.UserName);
            Assert.Equal(testEmployer.Password, returned.Password);
            Assert.Equal(testEmployer.Email, returned.Email);
            Assert.Equal(testEmployer.Description, returned.Description);
            Assert.Equal(testEmployer.Address, returned.Address);

            _fixture.Dispose();
        }
        public void CanEmployerUpdateProfileTest()
        {
            IEmployerDAO <Employer> EmployerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();

            testEmployer.FirstName   = "Jessica";
            testEmployer.LastName    = "Coelho";
            testEmployer.UserName    = "******";
            testEmployer.Password    = "******";
            testEmployer.Email       = "*****@*****.**";
            testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testEmployer.Address     = "Ordem";

            Employer returned = EmployerDAO.Create(testEmployer);

            returned.FirstName   = "Ema";
            returned.LastName    = "Coelho";
            returned.UserName    = "******";
            returned.Description = "Sou um empregador!";
            returned.Address     = "Lousada";

            Employer updated = EmployerDAO.Update(returned, returned.Id);

            Assert.Equal(returned.FirstName, updated.FirstName);
            Assert.Equal(returned.LastName, updated.LastName);
            Assert.Equal(returned.UserName, updated.UserName);
            Assert.Equal(returned.Description, updated.Description);
            Assert.Equal(returned.Address, updated.Address);

            _fixture.Dispose();
        }
예제 #6
0
        public void CanGetEmployerWithDescriptionByIdTest()
        {
            IEmployerDAO <Employer> employerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();

            testEmployer.FirstName   = "Ema";
            testEmployer.LastName    = "Coelho";
            testEmployer.UserName    = "******";
            testEmployer.Password    = "******";
            testEmployer.Email       = "*****@*****.**";
            testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testEmployer.Address     = "Lousada";

            Employer returnedEmployer = employerDAO.Create(testEmployer);

            Employer e = employerDAO.FindEmployerById(returnedEmployer.Id);

            Assert.Equal(returnedEmployer.Id, e.Id);
            Assert.Equal(returnedEmployer.UserName, e.UserName);
            Assert.Equal(returnedEmployer.FirstName, e.FirstName);
            Assert.Equal(returnedEmployer.LastName, e.LastName);
            Assert.Equal(returnedEmployer.Email, e.Email);
            Assert.Equal(returnedEmployer.Address, e.Address);
            Assert.Equal(returnedEmployer.Description, e.Description);

            _fixture.Dispose();
        }
예제 #7
0
        public void CanMateAddRatingTest()
        {
            IEmployerDAO <Employer> EmployerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();

            testEmployer.FirstName   = "Marcelo";
            testEmployer.LastName    = "Carvalho";
            testEmployer.UserName    = "******";
            testEmployer.Password    = "******";
            testEmployer.Email       = "*****@*****.**";
            testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testEmployer.Address     = "Lixa";

            Employer returned = EmployerDAO.Create(testEmployer);

            IReviewEmployerDAO ReviewEmployerDAO = new ReviewEmployerDAO(_connection);
            Review             reviewsTest       = new Review();

            reviewsTest.Id     = 5;
            reviewsTest.Rating = 4;

            Review revReturned = ReviewEmployerDAO.ReviewEmployer(returned.Id, reviewsTest);

            Assert.Equal(reviewsTest.Id, revReturned.Id);
            Assert.Equal(reviewsTest.Rating, revReturned.Rating);

            _fixture.Dispose();
        }
예제 #8
0
        public void CanSearchJobPostWithTwoCategoryTest()
        {
            IEmployerDAO <Employer> EmployerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();

            testEmployer.FirstName   = "Marcelo";
            testEmployer.LastName    = "Carvalho";
            testEmployer.UserName    = "******";
            testEmployer.Password    = "******";
            testEmployer.Email       = "*****@*****.**";
            testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testEmployer.Address     = "Lixa";

            Employer returned = EmployerDAO.Create(testEmployer);

            IJobDAO jobPostDAO = new JobDAO(_connection);
            JobPost testPost   = new JobPost();

            testPost.Title         = "Canalização Estourada";
            testPost.Category      = Categories.PLUMBING;
            testPost.Description   = "Grande estouro nos canos da sanita";
            testPost.Tradable      = true;
            testPost.InitialPrice  = 60.6;
            testPost.Address       = "Rua sem fim";
            testPost.PaymentMethod = new[] { Payment.PAYPAL, Payment.MONEY };

            JobPost testPost2 = new JobPost();

            testPost2.Title         = "Cortar Relva";
            testPost2.Category      = Categories.GARDENING;
            testPost2.Description   = "Isto parece a amazonia!";
            testPost2.Tradable      = true;
            testPost2.InitialPrice  = 60.6;
            testPost2.Address       = "Rua sem fim";
            testPost2.PaymentMethod = new[] { Payment.PAYPAL, Payment.MONEY };

            jobPostDAO.Create(returned.Id, testPost);
            jobPostDAO.Create(returned.Id, testPost2);

            Categories[] categories = { Categories.PLUMBING, Categories.GARDENING };
            List <JobPostReturnedModel> jobPosts = jobPostDAO.GetJobs(categories, "", null, null, 1);

            JobPostReturnedModel[] jobPostsArray = jobPosts.ToArray();

            Assert.Equal("Canalização Estourada", jobPostsArray[0].Title);
            Assert.Equal(Categories.PLUMBING, jobPostsArray[0].Category);
            Assert.Equal("Grande estouro nos canos da sanita", jobPostsArray[0].Description);
            Assert.True(jobPostsArray[0].Tradable);
            Assert.Equal(60.6, jobPostsArray[0].InitialPrice);
            Assert.Equal("Rua sem fim", jobPostsArray[0].Address);

            Assert.Equal("Cortar Relva", jobPostsArray[1].Title);
            Assert.Equal(Categories.GARDENING, jobPostsArray[1].Category);
            Assert.Equal("Isto parece a amazonia!", jobPostsArray[1].Description);
            Assert.True(jobPostsArray[1].Tradable);
            Assert.Equal(60.6, jobPostsArray[1].InitialPrice);
            Assert.Equal("Rua sem fim", jobPostsArray[1].Address);

            _fixture.Dispose();
        }
예제 #9
0
        public Administrateur(int usercon)
        {
            InitializeComponent();
            user = usercon;
            EmployerDAO T = new EmployerDAO();

            i = T.lastVal();
            txtIdUtil.Text = (i + 1).ToString();
        }
        public void CanMakeOfferOnJobWithoutPriceTest()
        {
            IEmployerDAO <Employer> EmployerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();

            testEmployer.FirstName   = "Marcelo";
            testEmployer.LastName    = "Carvalho";
            testEmployer.UserName    = "******";
            testEmployer.Password    = "******";
            testEmployer.Email       = "*****@*****.**";
            testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testEmployer.Address     = "Lixa";

            Employer returned = EmployerDAO.Create(testEmployer);

            IJobDAO jobPostDAO = new JobDAO(_connection);
            JobPost testPost   = new JobPost();

            testPost.Title         = "Canalização Estourada";
            testPost.Category      = Categories.PLUMBING;
            testPost.Description   = "Grande estouro nos canos da sanita";
            testPost.Tradable      = true;
            testPost.InitialPrice  = 60.6;
            testPost.Address       = "Rua sem fim";
            testPost.PaymentMethod = new[] { Payment.PAYPAL, Payment.MONEY };

            JobPost jobReturned = jobPostDAO.Create(returned.Id, testPost);

            IMateDAO <Mate> MateDAO  = new MateDAO(_connection);
            Mate            testMate = new Mate();

            testMate.FirstName   = "Miguel";
            testMate.LastName    = "Dev";
            testMate.UserName    = "******";
            testMate.Password    = "******";
            testMate.Email       = "*****@*****.**";
            testMate.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testMate.Address     = "Figueiró";
            testMate.Categories  = new[] { Categories.CLEANING, Categories.PLUMBING };
            testMate.Rank        = Ranks.SUPER_MATE;
            testMate.Range       = 20;

            Mate returnedMate = MateDAO.Create(testMate);

            Offer mateOffer = new Offer();

            mateOffer.Price   = 0;
            mateOffer.JobPost = jobReturned;
            Offer offer = jobPostDAO.makeOfferOnJob(mateOffer, returnedMate.Id);

            //Verificar que o preço foi estabelicido com o default
            Assert.Equal(testPost.InitialPrice, offer.Price);
            Assert.Equal(mateOffer.JobPost.Id, offer.JobPost.Id);
            Assert.False(offer.Approved);

            _fixture.Dispose();
        }
예제 #11
0
        public void ReturnEmptyWhenSearchJobWithWrongLocationTest()
        {
            IEmployerDAO <Employer> EmployerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();

            testEmployer.FirstName   = "Marcelo";
            testEmployer.LastName    = "Carvalho";
            testEmployer.UserName    = "******";
            testEmployer.Password    = "******";
            testEmployer.Email       = "*****@*****.**";
            testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testEmployer.Address     = "Rua Eng. Luís Carneiro Leão, Figueiró";

            Employer returned = EmployerDAO.Create(testEmployer);

            IJobDAO jobPostDAO = new JobDAO(_connection);
            JobPost testPost   = new JobPost();

            testPost.Title         = "Canalização Estourada";
            testPost.Category      = Categories.PLUMBING;
            testPost.Description   = "Grande estouro nos canos da sanita";
            testPost.Tradable      = true;
            testPost.InitialPrice  = 60.6;
            testPost.Address       = "Rua sem fim";
            testPost.PaymentMethod = new[] { Payment.PAYPAL, Payment.MONEY };

            JobPost jobReturned = jobPostDAO.Create(returned.Id, testPost);

            IMateDAO <Mate> MateDAO  = new MateDAO(_connection);
            Mate            testMate = new Mate();

            testMate.FirstName   = "Miguel";
            testMate.LastName    = "Dev";
            testMate.UserName    = "******";
            testMate.Password    = "******";
            testMate.Email       = "*****@*****.**";
            testMate.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testMate.Address     = "Random City";
            testMate.Categories  = new[] { Categories.CLEANING, Categories.PLUMBING };
            testMate.Rank        = Ranks.SUPER_MATE;
            testMate.Range       = 20;

            Mate returnedMate = MateDAO.Create(testMate);

            Offer mateOffer = new Offer();

            mateOffer.Price    = 20;
            mateOffer.Approved = false;
            mateOffer.JobPost  = jobReturned;
            Offer offer = jobPostDAO.makeOfferOnJob(mateOffer, returnedMate.Id);

            Categories[] categories = { Categories.PLUMBING };
            Assert.Empty(jobPostDAO.GetJobs(categories, testMate.Address, 400, null, returnedMate.Id));

            _fixture.Dispose();
        }
예제 #12
0
        public void CanSearchJobPostWithOneCategoryWithDistanceAndAddressTest()
        {
            IEmployerDAO <Employer> EmployerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();

            testEmployer.FirstName   = "Marcelo";
            testEmployer.LastName    = "Carvalho";
            testEmployer.UserName    = "******";
            testEmployer.Password    = "******";
            testEmployer.Email       = "*****@*****.**";
            testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testEmployer.Address     = "Rua Eng. Luís Carneiro Leão, Figueiró";

            Employer returned = EmployerDAO.Create(testEmployer);

            IJobDAO jobPostDAO = new JobDAO(_connection);
            JobPost testPost   = new JobPost();

            testPost.Title         = "Canalização Estourada";
            testPost.Category      = Categories.PLUMBING;
            testPost.Description   = "Grande estouro nos canos da sanita";
            testPost.Tradable      = true;
            testPost.InitialPrice  = 60.6;
            testPost.Address       = "Rua de Salgueiros, Penafiel";
            testPost.PaymentMethod = new[] { Payment.PAYPAL, Payment.MONEY };

            JobPost testPost2 = new JobPost();

            testPost2.Title         = "Canalização Estourada";
            testPost2.Category      = Categories.PLUMBING;
            testPost2.Description   = "Grande estouro nos canos da sanita";
            testPost2.Tradable      = true;
            testPost2.InitialPrice  = 60.6;
            testPost2.Address       = "London";
            testPost2.PaymentMethod = new[] { Payment.PAYPAL, Payment.MONEY };

            jobPostDAO.Create(returned.Id, testPost);
            jobPostDAO.Create(returned.Id, testPost2);

            Categories[] categories = { Categories.PLUMBING };

            List <JobPostReturnedModel> jobPosts = jobPostDAO.GetJobs(categories, testEmployer.Address, 400, null, 1);

            JobPostReturnedModel[] jobPostsArray = jobPosts.ToArray();

            Assert.Equal("Canalização Estourada", jobPostsArray[0].Title);
            Assert.Equal(Categories.PLUMBING, jobPostsArray[0].Category);
            Assert.Equal("Grande estouro nos canos da sanita", jobPostsArray[0].Description);
            Assert.True(jobPostsArray[0].Tradable);
            Assert.Equal(60.6, jobPostsArray[0].InitialPrice);
            Assert.Equal("Rua de Salgueiros, Penafiel", jobPostsArray[0].Address);
            Assert.Single(jobPostsArray);

            _fixture.Dispose();
        }
예제 #13
0
        public void CanIgnoreValidJobTest()
        {
            IEmployerDAO <Employer> EmployerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();

            testEmployer.FirstName   = "Marcelo";
            testEmployer.LastName    = "Carvalho";
            testEmployer.UserName    = "******";
            testEmployer.Password    = "******";
            testEmployer.Email       = "*****@*****.**";
            testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testEmployer.Address     = "Rua Eng. Luís Carneiro Leão, Nº 54 4590-244 Porto, Portugal";

            Employer returned = EmployerDAO.Create(testEmployer);

            IJobDAO jobPostDAO = new JobDAO(_connection);
            JobPost testPost   = new JobPost();

            testPost.Title         = "Canalização Estourada";
            testPost.Category      = Categories.PLUMBING;
            testPost.Description   = "Grande estouro nos canos da sanita";
            testPost.Tradable      = true;
            testPost.InitialPrice  = 60.6;
            testPost.Address       = "Rua de Salgueiros, Penafiel";
            testPost.PaymentMethod = new[] { Payment.PAYPAL, Payment.MONEY };

            JobPost jobReturned = jobPostDAO.Create(returned.Id, testPost);

            IMateDAO <Mate> MateDAO  = new MateDAO(_connection);
            Mate            testMate = new Mate();

            testMate.FirstName   = "Miguel";
            testMate.LastName    = "Dev";
            testMate.UserName    = "******";
            testMate.Password    = "******";
            testMate.Email       = "*****@*****.**";
            testMate.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testMate.Address     = "Rua de Salgueiros, Penafiel";
            testMate.Categories  = new[] { Categories.CLEANING, Categories.PLUMBING };
            testMate.Rank        = Ranks.SUPER_MATE;
            testMate.Range       = 20;

            Mate returnedMate = MateDAO.Create(testMate);

            IgnoredJobModel job = new IgnoredJobModel();

            job.Id = jobReturned.Id;

            Assert.True(MateDAO.IgnoreJobPost(returnedMate.Id, job));

            Categories[] categories = { Categories.PLUMBING };
            Assert.Empty(jobPostDAO.GetJobs(categories, testMate.Address, 400, null, returnedMate.Id));

            _fixture.Dispose();
        }
        public void CanUpdatePostDetailsTest()
        {
            IEmployerDAO <Employer> EmployerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();

            testEmployer.FirstName   = "Marcelo";
            testEmployer.LastName    = "Carvalho";
            testEmployer.UserName    = "******";
            testEmployer.Password    = "******";
            testEmployer.Email       = "*****@*****.**";
            testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testEmployer.Address     = "Lixa";

            Employer returned = EmployerDAO.Create(testEmployer);

            IJobDAO jobPostDAO = new JobDAO(_connection);
            JobPost testPost   = new JobPost();

            testPost.Title         = "Canalização Estourada";
            testPost.Category      = Categories.PLUMBING;
            testPost.ImagePath     = "path/image";
            testPost.Description   = "Grande estouro nos canos da sanita";
            testPost.Tradable      = true;
            testPost.InitialPrice  = 60.6;
            testPost.Address       = "Rua sem fim";
            testPost.PaymentMethod = new[] { Payment.PAYPAL, Payment.MONEY };

            JobPost jobReturned = jobPostDAO.Create(returned.Id, testPost);

            //Change variables from old post to new ones
            JobPost OldPost = jobReturned;

            OldPost.Id            = jobReturned.Id;
            OldPost.Title         = "Cadeira dificil de Montar";
            OldPost.Category      = Categories.FURNITURE_ASSEMBLE;
            OldPost.ImagePath     = "";
            OldPost.Description   = "Cadeira super complicada";
            OldPost.Tradable      = true;
            OldPost.InitialPrice  = 63.6;
            OldPost.Address       = "Rua com fim";
            OldPost.PaymentMethod = new[] { Payment.PAYPAL, Payment.MONEY };

            JobPost newPost = jobPostDAO.UpdatePostDetails(OldPost);


            Assert.Equal(OldPost.Title, newPost.Title);
            Assert.Equal(OldPost.Category, newPost.Category);
            Assert.Equal(OldPost.ImagePath, newPost.ImagePath);
            Assert.Equal(OldPost.Description, newPost.Description);
            Assert.Equal(OldPost.Tradable, newPost.Tradable);
            Assert.Equal(OldPost.InitialPrice, newPost.InitialPrice);
            Assert.Equal(OldPost.Address, newPost.Address);

            _fixture.Dispose();
        }
예제 #15
0
        private void btnSupprimer_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are You Sure You Want to Delete this Product\nfrom Database", "Warning", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                int ProductID = Convert.ToInt32(txtmodIdEmp.Text);

                EmployerDAO pdo = new EmployerDAO();
                pdo.RemoveEmpbyId(ProductID);
                Administrateur_Load(sender, e);
            }
        }
예제 #16
0
        private void btnConfirme_Click(object sender, EventArgs e)
        {
            EmployerDAO empd = new EmployerDAO();
            Employer    emp2 = empd.Find(user);
            DateTime    auj  = DateTime.Now.Date;
            string      d    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            DateTime    auj2 = DateTime.Parse(d);


            // Employer emp = new Employer(0,"","","","","","","","","", auj,auj,null);
            decimal total, don, ret;

            total = Convert.ToDecimal(txtTotal.Text);
            don   = Convert.ToDecimal(txtmtdonne.Text);
            ret   = Convert.ToDecimal(txtmtretourne.Text);
            metiers.Ticket m = new metiers.Ticket(idTick, emp2, total, don, ret, auj2);
            //metiers.Ticket m2 = new metiers.Ticket(emp2, total, don, ret, auj);

            TicketDAO bd = new TicketDAO();

            bd.Add(m);
            //  bd.Add2(m2);

            metiers.Ticket m2 = bd.Find(Convert.ToInt32(txtnumtick.Text));
            foreach (DataGridViewRow Row in dgvProd.Rows)
            {
                try
                {
                    LigneTicketDAO ltb             = new LigneTicketDAO();
                    int            ProductId       = Convert.ToInt32(Row.Cells["id"].Value);
                    string         ProductName     = Row.Cells["Nomproduit"].Value.ToString();
                    decimal        ProductPrice    = Convert.ToDecimal(Row.Cells["prix"].Value);
                    int            ProductQuantity = Convert.ToInt32(Row.Cells["qte"].Value);
                    decimal        ProductTotal    = Convert.ToDecimal(Row.Cells["totalProduit"].Value);
                    ProduitDAO     pb = new ProduitDAO();
                    Produit        p  = pb.Find(ProductId);
                    LigneTicket    l  = new LigneTicket(0, p, m2, ProductName, ProductQuantity, ProductPrice, ProductTotal);
                    ltb.Add(l);
                }
                catch
                {
                    //means Rows are ended
                }
            }



            new Ticket(txtTotal.Text, txtmtdonne.Text, txtmtretourne.Text).ShowDialog();
            this.Hide();
            UIEmployer f1 = new UIEmployer(user);

            f1.Show();
        }
예제 #17
0
        public void CanVerifyIfUserIsNotFromChatTest()
        {
            IEmployerDAO <Employer> EmployerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();

            testEmployer.FirstName   = "Marcelo";
            testEmployer.LastName    = "Carvalho";
            testEmployer.UserName    = "******";
            testEmployer.Password    = "******";
            testEmployer.Email       = "*****@*****.**";
            testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testEmployer.Address     = "Lixa";

            Employer returned = EmployerDAO.Create(testEmployer);

            IMateDAO <Mate> MateDAO  = new MateDAO(_connection);
            Mate            testMate = new Mate();

            testMate.FirstName   = "Miguel";
            testMate.LastName    = "Dev";
            testMate.UserName    = "******";
            testMate.Password    = "******";
            testMate.Email       = "*****@*****.**";
            testMate.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testMate.Address     = "Figueiró";
            testMate.Categories  = new[] { Categories.CLEANING, Categories.PLUMBING };
            testMate.Rank        = Ranks.SUPER_MATE;
            testMate.Range       = 20;

            Mate returnedMate = MateDAO.Create(testMate);

            ChatDAO chatDao = new ChatDAO(_connection);

            int chatId = chatDao.CreateChatId();

            Chat chat = new Chat();

            chat.UserId = returned.Id;
            chat.ChatId = chatId;

            chatDao.CreateChat(chat);
            chat.UserId = returnedMate.Id;
            chatDao.CreateChat(chat);

            bool user1IsFromChat = chatDao.IsUserFromChat(999999999, returned.Id);
            bool user2IsFromChat = chatDao.IsUserFromChat(999999999, returnedMate.Id);

            Assert.False(user1IsFromChat);
            Assert.False(user2IsFromChat);

            _fixture.Dispose();
        }
예제 #18
0
 public ActionResult <EmployerModel> Create(EmployerRegister regEmployer)
 {
     try
     {
         Employer employer = _mapper.Map <Employer>(regEmployer);
         IEmployerDAO <Employer> EmployerDAO   = new EmployerDAO(_connection);
         EmployerModel           employerModel = _mapper.Map <EmployerModel>(EmployerDAO.Create(employer));
         return(Ok(employerModel));
     }
     catch (Exception ex)
     {
         return(BadRequest(new ErrorMessageModel(ex.Message)));
     }
 }
예제 #19
0
        public bool PostEmployer(EmployerDAO emp)
        {
            EmployerServiceClient client = new EmployerServiceClient();

            try
            {
                bool result = client.CreateEmployer(emp);
                return result;
            }
            catch (FaultException<KaskServiceException> e)
            {
                throw new HttpException(e.Message);
            }
        }
        public void CanUserAddReportTest()
        {
            IMateDAO <Mate> MateDAO  = new MateDAO(_connection);
            Mate            testMate = new Mate();

            testMate.FirstName   = "Miguel";
            testMate.LastName    = "Dev";
            testMate.UserName    = "******";
            testMate.Password    = "******";
            testMate.Email       = "*****@*****.**";
            testMate.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testMate.Address     = "Figueir";
            testMate.Categories  = new[] { Categories.CLEANING, Categories.PLUMBING };
            testMate.Rank        = Ranks.SUPER_MATE;
            testMate.Range       = 20;

            Mate returnedMate = MateDAO.Create(testMate);

            IEmployerDAO <Employer> EmployerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();

            testEmployer.FirstName   = "Marcelo";
            testEmployer.LastName    = "Carvalho";
            testEmployer.UserName    = "******";
            testEmployer.Password    = "******";
            testEmployer.Email       = "*****@*****.**";
            testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testEmployer.Address     = "Lixa";

            Employer returnedEmployer = EmployerDAO.Create(testEmployer);

            IReportDAO ReportDAO  = new ReportDAO(_connection);
            Report     reportTest = new Report();

            reportTest.Id         = 1;
            reportTest.Reason     = Reasons.INADEQUATE_BEHAVIOUR;
            reportTest.ReportedId = 35;
            reportTest.ReporterId = 34;
            reportTest.Comment    = "O trabalho que fez nao presta";

            Report repReturned = ReportDAO.ReportUser(returnedEmployer.Id, returnedMate.Id, reportTest);

            Assert.Equal(reportTest.Id, repReturned.Id);
            Assert.Equal(reportTest.Reason, repReturned.Reason);
            Assert.Equal(reportTest.ReportedId, repReturned.ReportedId);
            Assert.Equal(reportTest.ReporterId, repReturned.ReporterId);
            Assert.Equal(reportTest.Comment, repReturned.Comment);

            _fixture.Dispose();
        }
예제 #21
0
        public ActionResult <EmployerProfileModel> GetEmployerById(int id)
        {
            try
            {
                EmployerDAO          employerDAO = new EmployerDAO(_connection);
                EmployerProfileModel returned    = _mapper.Map <EmployerProfileModel>(employerDAO.FindEmployerById(id));

                return(Ok(returned));
            }
            catch (Exception ex)
            {
                return(BadRequest(new ErrorMessageModel(ex.Message)));
            }
        }
예제 #22
0
        public ActionResult <List <PendingJobModel> > PendingJobsList()
        {
            int?employerID = ClaimHelper.GetIdFromClaimIdentity((ClaimsIdentity)this.ControllerContext.HttpContext.User.Identity);

            if (employerID == null)
            {
                return(Unauthorized(new ErrorMessageModel("Utilizador não existe!")));
            }

            EmployerDAO            employerDAO = new EmployerDAO(_connection);
            List <PendingJobModel> pendingJobs = employerDAO.PendingJobsList((int)employerID).ToList();

            return(Ok(pendingJobs));
        }
예제 #23
0
        public UIEmployer(int user)
        {
            InitializeComponent();
            this.user = user;
            EmployerDAO edao = new EmployerDAO();

            nomUtilisateur = edao.FindNameByid(user);
            // label4.Text = user.ToString();
            label4.Text = nomUtilisateur;
            TicketDAO T = new TicketDAO();

            i = T.lastVal();
            txtnumtick.Text = (i + 1).ToString();
        }
        public void CanUpdateChatHubConnectionTest()
        {
            IEmployerDAO <Employer> EmployerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();

            testEmployer.FirstName   = "Marcelo";
            testEmployer.LastName    = "Carvalho";
            testEmployer.UserName    = "******";
            testEmployer.Password    = "******";
            testEmployer.Email       = "*****@*****.**";
            testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testEmployer.Address     = "Lixa";

            Employer returned = EmployerDAO.Create(testEmployer);

            IMateDAO <Mate> MateDAO  = new MateDAO(_connection);
            Mate            testMate = new Mate();

            testMate.FirstName   = "Miguel";
            testMate.LastName    = "Dev";
            testMate.UserName    = "******";
            testMate.Password    = "******";
            testMate.Email       = "*****@*****.**";
            testMate.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testMate.Address     = "Figueiró";
            testMate.Categories  = new[] { Categories.CLEANING, Categories.PLUMBING };
            testMate.Rank        = Ranks.SUPER_MATE;
            testMate.Range       = 20;

            Mate returnedMate = MateDAO.Create(testMate);

            ChatDAO chatDao = new ChatDAO(_connection);

            chatDao.AddChatHubConnection(returned.Id, "connection1");
            chatDao.AddChatHubConnection(returnedMate.Id, "connection2");

            chatDao.UpdateChatHubConnection(returned.Id, "connection1Replaced");
            chatDao.UpdateChatHubConnection(returnedMate.Id, "connection2Replaced");

            ChatConnection connection1 = chatDao.GetChatConnectionFromUserId(returned.Id);
            ChatConnection connection2 = chatDao.GetChatConnectionFromUserId(returnedMate.Id);

            Assert.Equal("connection1Replaced", connection1.Connection);
            Assert.Equal(returned.Id, connection1.UserId);
            Assert.Equal("connection2Replaced", connection2.Connection);
            Assert.Equal(returnedMate.Id, connection2.UserId);

            _fixture.Dispose();
        }
예제 #25
0
        public void CanReturnJobPostsFromEmployerTest()
        {
            IEmployerDAO <Employer> EmployerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();

            testEmployer.FirstName   = "Marcelo";
            testEmployer.LastName    = "Carvalho";
            testEmployer.UserName    = "******";
            testEmployer.Password    = "******";
            testEmployer.Email       = "*****@*****.**";
            testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testEmployer.Address     = "Lixa";

            Employer returned = EmployerDAO.Create(testEmployer);

            IJobDAO jobPostDAO = new JobDAO(_connection);
            JobPost testPost   = new JobPost();

            testPost.Title         = "Canalização Estourada";
            testPost.Category      = Categories.PLUMBING;
            testPost.Description   = "Grande estouro nos canos da sanita";
            testPost.Tradable      = true;
            testPost.InitialPrice  = 60.6;
            testPost.Address       = "Rua sem fim";
            testPost.PaymentMethod = new[] { Payment.PAYPAL, Payment.MONEY };

            JobPost testPost2 = new JobPost();

            testPost2.Title         = "Cortar Relva";
            testPost2.Category      = Categories.GARDENING;
            testPost2.Description   = "Isto parece a amazonia!";
            testPost2.Tradable      = true;
            testPost2.InitialPrice  = 60.6;
            testPost2.Address       = "Rua sem fim";
            testPost2.PaymentMethod = new[] { Payment.PAYPAL, Payment.MONEY };

            jobPostDAO.Create(returned.Id, testPost);
            jobPostDAO.Create(returned.Id, testPost2);

            List <JobPost> returnedList = jobPostDAO.GetEmployerPosts(returned.Id);

            Assert.Equal(2, returnedList.Count);
            Assert.Equal(testPost.Id, returnedList.Find(a => a.Id == testPost.Id).Id);
            Assert.Equal(testPost2.Id, returnedList.Find(a => a.Id == testPost2.Id).Id);

            _fixture.Dispose();
        }
        public void CanEmployerAddReviewTest()
        {
            IEmployerDAO <Employer> EmployerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();

            testEmployer.FirstName   = "Marcelo";
            testEmployer.LastName    = "Carvalho";
            testEmployer.UserName    = "******";
            testEmployer.Password    = "******";
            testEmployer.Email       = "*****@*****.**";
            testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testEmployer.Address     = "Lixa";

            Employer returnedEmp = EmployerDAO.Create(testEmployer);

            IMateDAO <Mate> MateDAO  = new MateDAO(_connection);
            Mate            testMate = new Mate();

            testMate.FirstName   = "Miguel";
            testMate.LastName    = "Dev";
            testMate.UserName    = "******";
            testMate.Password    = "******";
            testMate.Email       = "*****@*****.**";
            testMate.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testMate.Address     = "Figueir";
            testMate.Categories  = new[] { Categories.CLEANING, Categories.PLUMBING };
            testMate.Rank        = Ranks.SUPER_MATE;
            testMate.Range       = 20;

            Mate returned = MateDAO.Create(testMate);

            IReviewMateDAO ReviewMateDAO = new ReviewMateDAO(_connection);
            MateReview     reviewsTest   = new MateReview();

            reviewsTest.Id      = 5;
            reviewsTest.Rating  = 4;
            reviewsTest.Comment = "O trolha fez um trabalho excelente!";

            MateReview revReturned = ReviewMateDAO.ReviewMate(returnedEmp.Id, returned.Id, reviewsTest);

            Assert.Equal(reviewsTest.Id, revReturned.Id);
            Assert.Equal(reviewsTest.Rating, revReturned.Rating);
            Assert.Equal(reviewsTest.Comment, revReturned.Comment);

            _fixture.Dispose();
        }
예제 #27
0
        private void btnModifier_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are You Sure You Want to Update this Emp\n", "Warning", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                int          ProductID = Convert.ToInt32(txtmodIdEmp.Text);
                MemoryStream ms        = new MemoryStream();
                pbmodImg.Image.Save(ms, pbmodImg.Image.RawFormat);
                byte[] img = ms.ToArray();

                DateTime dtinsc = DateTime.Now;
                string   d      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                DateTime auj2   = DateTime.Parse(d);

                EmployerDAO pdo = new EmployerDAO();
                pdo.Update(ProductID, txtmodNom.Text, txtmodPrenom.Text, txtmodsexe.Text, dtmodDN.Value, txtmodTel.Text, txtModEmail.Text, txtmodtype.Text, txtmodUtilisateur.Text, txtmodMp.Text, txtmodAdresse.Text, img, auj2);
                Administrateur_Load(sender, e);
            }
        }
        public void ReturnExceptionCreatingChatWithUserId0Test()
        {
            IEmployerDAO <Employer> EmployerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();

            testEmployer.FirstName   = "Marcelo";
            testEmployer.LastName    = "Carvalho";
            testEmployer.UserName    = "******";
            testEmployer.Password    = "******";
            testEmployer.Email       = "*****@*****.**";
            testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testEmployer.Address     = "Lixa";

            Employer returned = EmployerDAO.Create(testEmployer);

            IMateDAO <Mate> MateDAO  = new MateDAO(_connection);
            Mate            testMate = new Mate();

            testMate.FirstName   = "Miguel";
            testMate.LastName    = "Dev";
            testMate.UserName    = "******";
            testMate.Password    = "******";
            testMate.Email       = "*****@*****.**";
            testMate.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testMate.Address     = "Figueiró";
            testMate.Categories  = new[] { Categories.CLEANING, Categories.PLUMBING };
            testMate.Rank        = Ranks.SUPER_MATE;
            testMate.Range       = 20;

            Mate returnedMate = MateDAO.Create(testMate);

            ChatDAO chatDao = new ChatDAO(_connection);

            int chatId = chatDao.CreateChatId();

            Chat chat = new Chat();

            chat.UserId = 0;
            chat.ChatId = chatId;

            Assert.Throws <Exception>(() => chatDao.CreateChat(chat));

            _fixture.Dispose();
        }
예제 #29
0
        public void CanRegisterEmployerTest()
        {
            IEmployerDAO <Employer> EmployerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();
            string   password     = testEmployer.Password;

            testEmployer.FirstName   = "Samuel";
            testEmployer.LastName    = "Cunha";
            testEmployer.UserName    = "******";
            testEmployer.Password    = "******";
            testEmployer.Email       = "*****@*****.**";
            testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testEmployer.Address     = "Aparecida";

            Employer returned = EmployerDAO.Create(testEmployer);

            Assert.True(PasswordOperations.VerifyHash("samuel123", returned.Password, returned.PasswordSalt));
            _fixture.Dispose();
        }
예제 #30
0
        private void btnEnrUtil_Click(object sender, EventArgs e)
        {
            DateTime     dtinsc = DateTime.Now;
            string       d      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            DateTime     auj2   = DateTime.Parse(d);
            MemoryStream ms     = new MemoryStream();

            pictureBoxUtilisateur.Image.Save(ms, pictureBoxUtilisateur.Image.RawFormat);
            byte[] img = ms.ToArray();



            Employer emp = new Employer(0, txtNomUtil.Text, txtPrenomutil.Text, cbxSexe.Text, txtTel.Text
                                        , txtEmail.Text, txtadresse.Text, cbxType.Text, txtusername.Text, Eramake.eCryptography.Encrypt(txtpssword.Text), dtNaiss.Value, auj2, img);

            EmployerDAO bd = new EmployerDAO();

            bd.Add(emp);
            Administrateur_Load(sender, e);
        }
예제 #31
0
        private void Administrateur_Load(object sender, EventArgs e)
        {
            dgvEmp.Rows.Clear();
            EmployerDAO edao = new EmployerDAO();

            nomUtilisateur = edao.FindNameByid(user);
            //label2.Text = user.ToString();
            label2.Text = nomUtilisateur;

            timer1.Start();
            lblauj.Text   = Convert.ToString(DateTime.Now.ToLongDateString());
            lbltemps.Text = Convert.ToString(DateTime.Now.ToLongTimeString());
            EmployerDAO pd = new EmployerDAO();

            employes = pd.FindAll();
            foreach (Employer mm in employes)
            {
                dgvEmp.Rows.Add(mm.Id, mm.Nom, mm.Prenom, mm.Sexe, mm.DateNaiss.ToShortDateString(), mm.Tel, mm.Email, mm.Type, mm.NomUtilisateur, mm.Password, mm.Adresse, mm.Img, mm.DateInscription);
            }
        }
예제 #32
0
        public async Task<ActionResult> Create(FormCollection collection)
        {
            try
            {
                if (!string.IsNullOrEmpty(Request.Form["FirstName"]) && !string.IsNullOrEmpty(Request.Form["LastName"]) && !string.IsNullOrEmpty(Request.Form["SSN"]) && Request.Form["acknowledgeAccurateDataCheckbox"] != null)
                {
                    // save application form data back to database through service
                    using (HttpClient httpClient = new HttpClient())
                    {
                        httpClient.BaseAddress = new Uri("http://localhost:51309");
                        httpClient.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                        HttpResponseMessage result = new HttpResponseMessage();
                        string resultContent = "";

                        // gather Applicant form data
                        ApplicantDAO applicant = new ApplicantDAO();
                        applicant.FirstName = Request.Form["FirstName"];
                        applicant.MiddleName = Request.Form["MiddleName"];
                        applicant.LastName = Request.Form["LastName"];
                        applicant.SSN = Request.Form["SSN"];
                        applicant.ApplicantAddress = Request.Form["ApplicantAddress"];
                        applicant.Phone = Request.Form["ApplicantPhone"];
                        applicant.NameAlias = Request.Form["NameAlias"];

                        // post (save) applicant data
                        result = httpClient.PostAsJsonAsync(ServiceURIs.ServiceApplicantUri, applicant).Result;
                        resultContent = result.Content.ReadAsStringAsync().Result;

                        // gather Application form data
                        ApplicationDAO application = new ApplicationDAO();
                        application.ApplicationStatus = "Submitted";
                        application.SalaryExpectation = Request.Form["SalaryExpectation"];
                        application.FullTime = Convert.ToByte(Request.Form["FullTime"]);
                        application.AvailableForDays = Convert.ToByte(Request.Form["AvailableForDays"]);
                        application.AvailableForEvenings = Convert.ToByte(Request.Form["AvailableForEvenings"]);
                        application.AvailableForWeekends = Convert.ToByte(Request.Form["AvailableForWeekends"]);
                        application.MondayFrom = System.TimeSpan.FromHours(Convert.ToDouble(Request.Form["MondayFrom"]));
                        application.TuesdayFrom = System.TimeSpan.FromHours(Convert.ToDouble(Request.Form["TuesdayFrom"]));
                        application.WednesdayFrom = System.TimeSpan.FromHours(Convert.ToDouble(Request.Form["WednesdayFrom"]));
                        application.ThursdayFrom = System.TimeSpan.FromHours(Convert.ToDouble(Request.Form["ThursdayFrom"]));
                        application.FridayFrom = System.TimeSpan.FromHours(Convert.ToDouble(Request.Form["FridayFrom"]));
                        application.SaturdayFrom = System.TimeSpan.FromHours(Convert.ToDouble(Request.Form["SaturdayFrom"]));
                        application.SundayFrom = System.TimeSpan.FromHours(Convert.ToDouble(Request.Form["SundayFrom"]));
                        application.MondayTo = System.TimeSpan.FromHours(Convert.ToDouble(Request.Form["MondayTo"]));
                        application.TuesdayTo = System.TimeSpan.FromHours(Convert.ToDouble(Request.Form["TuesdayTo"]));
                        application.WednesdayTo = System.TimeSpan.FromHours(Convert.ToDouble(Request.Form["WednesdayTo"]));
                        application.ThursdayTo = System.TimeSpan.FromHours(Convert.ToDouble(Request.Form["ThursdayTo"]));
                        application.FridayTo = System.TimeSpan.FromHours(Convert.ToDouble(Request.Form["FridayTo"]));
                        application.SaturdayTo = System.TimeSpan.FromHours(Convert.ToDouble(Request.Form["SaturdayTo"]));
                        application.SundayTo = System.TimeSpan.FromHours(Convert.ToDouble(Request.Form["SundayTo"]));

                        // post (save) application data
                        result = httpClient.PostAsJsonAsync(ServiceURIs.ServiceApplicationUri, application).Result;
                        resultContent = result.Content.ReadAsStringAsync().Result;

                        // get correct applicant id
                        // TODO: there is still something we might need to change about this...
                        // ***** We don't, it's safe to assume that id would be the last item on the list
                        // since we're using auto incremented id. *****
                        var applicants = await ServerResponse<List<ApplicantDAO>>.GetResponseAsync(ServiceURIs.ServiceApplicantUri); ;
                        applicant.ApplicantID = applicants.Last().ApplicantID;

                        // get correct application id
                        // TODO: there is still something we might need to change about this...
                        var applications = await ServerResponse<List<ApplicationDAO>>.GetResponseAsync(ServiceURIs.ServiceApplicationUri);
                        application.ApplicationID = applications.Last().ApplicationID;

                        // Create Applied DAO;
                        AppliedDAO applied = new AppliedDAO();
                        applied.ApplicantID = applicant.ApplicantID;
                        applied.ApplicationID = application.ApplicationID;
                        applied.JobOpeningID = Convert.ToInt32(Request.Form["JobOpeningIDReferenceNumber"]);
                        applied.DateApplied = DateTime.Now;

                        // post (save) applied data
                        result = httpClient.PostAsJsonAsync(ServiceURIs.ServiceAppliedUri, applied).Result;
                        resultContent = result.Content.ReadAsStringAsync().Result;

                        // gather Employer data
                        EmployerDAO employer = new EmployerDAO();
                        var employers = await ServerResponse<List<EmployerDAO>>.GetResponseAsync(ServiceURIs.ServiceEmployerUri);
                        EmploymentDAO employment = new EmploymentDAO();

                        for (int i = 1; i < 4; i++)
                        {
                            // make sure this form item is filled in...
                            if ((!string.IsNullOrWhiteSpace(Request.Form["EmployerName_" + i]) &&
                                  !string.IsNullOrWhiteSpace(Request.Form["EmployerAddress_" + i])))
                            {
                                employer.Name = Request.Form["EmployerName_" + i];
                                employer.EmployerAddress = Request.Form["EmployerAddress_" + i];
                                if (!string.IsNullOrWhiteSpace(Request.Form["EmployerPhone_" + i]))
                                    employer.PhoneNumber = Request.Form["EmployerPhone_" + i];

                                //if (!string.IsNullOrWhiteSpace(employer.Name))
                                //{
                                // TODO: check if employer already exists in database
                                // TODO: if employer exists in database: don't insert data
                                // if employer !exists in database: insert data

                                // post (save) employer data
                                result = httpClient.PostAsJsonAsync(ServiceURIs.ServiceEmployerUri, employer).Result;
                                resultContent = result.Content.ReadAsStringAsync().Result;
                                //}

                                // get correct employer id
                                // TODO: there is still something we might need to change about this...
                                employers = await ServerResponse<List<EmployerDAO>>.GetResponseAsync(ServiceURIs.ServiceEmployerUri); ;
                                employer.EmployerID = employers.Last().EmployerID;


                                // gather Employment data
                                employment = new EmploymentDAO();
                                employment.ApplicantID = applicant.ApplicantID;
                                employment.EmployerID = employer.EmployerID;
                                if (!string.IsNullOrWhiteSpace(Request.Form["MayWeContactCurrentEmployer_" + i]))
                                    employment.MayWeContactCurrentEmployer = Convert.ToByte(Request.Form["MayWeContactCurrentEmployer_" + i]);
                                if (!string.IsNullOrWhiteSpace(Request.Form["EmployedFrom_" + i]))
                                    employment.EmployedFrom = Convert.ToDateTime(Request.Form["EmployedFrom_" + i]);
                                if (!string.IsNullOrWhiteSpace(Request.Form["EmployedTo_" + i]))
                                    employment.EmployedTo = Convert.ToDateTime(Request.Form["EmployedTo_" + i]);
                                if (!string.IsNullOrWhiteSpace(Request.Form["EmployerSupervisor_" + i]))
                                    employment.Supervisor = Request.Form["EmployerSupervisor_" + i];
                                if (!string.IsNullOrWhiteSpace(Request.Form["EmployedPosition_" + i]))
                                    employment.Position = Request.Form["EmployedPosition_" + i];
                                if (!string.IsNullOrWhiteSpace(Request.Form["EmployedStartingSalary_" + i]))
                                    employment.StartingSalary = Request.Form["EmployedStartingSalary_" + i];
                                if (!string.IsNullOrWhiteSpace(Request.Form["EmployedEndingSalary_" + i]))
                                    employment.EndingSalary = Request.Form["EmployedEndingSalary_" + i];
                                if (!string.IsNullOrWhiteSpace(Request.Form["EmployedReasonForLeaving_" + i]))
                                    employment.ReasonForLeaving = Request.Form["EmployedReasonForLeaving_" + i];
                                if (!string.IsNullOrWhiteSpace(Request.Form["EmployedResponsibilities_" + i]))
                                    employment.Responsibilities = Request.Form["EmployedResponsibilities_" + i];

                                // post (save) employment data
                                result = httpClient.PostAsJsonAsync(ServiceURIs.ServiceEmploymentUri, employment).Result;
                                resultContent = result.Content.ReadAsStringAsync().Result;
                            }
                        }

                        // gather School and Education data
                        SchoolDAO school = new SchoolDAO();
                        var schools = await ServerResponse<List<SchoolDAO>>.GetResponseAsync(ServiceURIs.ServiceSchoolUri);
                        EducationDAO education = new EducationDAO();

                        for (int i = 1; i < 4; i++)
                        {
                            // make sure this form item is filled in...
                            if ((!string.IsNullOrWhiteSpace(Request.Form["SchoolName_" + i]) &&
                                  !string.IsNullOrWhiteSpace(Request.Form["SchoolAddress_" + i])))
                            {
                                school = new SchoolDAO();
                                school.SchoolName = Request.Form["SchoolName_" + i];
                                school.SchoolAddress = Request.Form["SchoolAddress_" + i];

                                //if (!string.IsNullOrWhiteSpace(school.SchoolName))
                                //{
                                // TODO: check if school already exists in database
                                // TODO: if school exists in database: don't insert data
                                // if school !exists in database: insert data

                                // post (save) school data
                                result = httpClient.PostAsJsonAsync(ServiceURIs.ServiceSchoolUri, school).Result;
                                resultContent = result.Content.ReadAsStringAsync().Result;
                                //}

                                // get correct school id
                                // TODO: there is still something we might need to change about this...
                                schools = await ServerResponse<List<SchoolDAO>>.GetResponseAsync(ServiceURIs.ServiceSchoolUri);
                                school.SchoolID = schools.Last().SchoolID;

                                // gather Education data
                                education = new EducationDAO();
                                education.ApplicantID = applicant.ApplicantID;
                                education.SchoolID = school.SchoolID;
                                if (!string.IsNullOrWhiteSpace(Request.Form["YearsAttendedFrom_" + i]))
                                    education.YearsAttendedFrom = Convert.ToDateTime(Request.Form["YearsAttendedFrom_" + i]);
                                if (!string.IsNullOrWhiteSpace(Request.Form["YearsAttendedTo_" + i]))
                                    education.YearsAttendedTo = Convert.ToDateTime(Request.Form["YearsAttendedTo_" + i]);
                                if (!string.IsNullOrWhiteSpace(Request.Form["Graduated_" + i]))
                                    education.Graduated = Convert.ToByte(Request.Form["Graduated_" + i]);
                                if (!string.IsNullOrWhiteSpace(Request.Form["DegreeAndMajor_" + i]))
                                    education.DegreeAndMajor = Request.Form["DegreeAndMajor_" + i];

                                // post (save) education data
                                result = httpClient.PostAsJsonAsync(ServiceURIs.ServiceEducationUri, education).Result;
                                resultContent = result.Content.ReadAsStringAsync().Result;
                            }
                        }
                    }

                    try
                    {
                        // redirect to assessment questions, if possible
                        return RedirectToAction("Create", "Assessments", new { ID = Convert.ToInt32(Request.Form["JobOpeningIDReferenceNumber"]) });
                    }
                    catch
                    {
                        return RedirectToAction("Welcome", "Home");
                    }
                }
                else
                {
                    // TODO: validation later on...
                    return RedirectToAction("Create");
                }
            }
            catch
            {
                // TODO: validation later on...
                return RedirectToAction("Create");
            }
        }