Ejemplo n.º 1
0
        private void InitializaData()
        {
            _candidateA = new CandidatesModel()
            {
                Id             = 100,
                Name           = "candidateA",
                ConstituencyId = 201
            };

            _candidateB = new CandidatesModel()
            {
                Id             = 101,
                Name           = "candidateB",
                ConstituencyId = 202
            };

            _constituencyA = new ConstituencyModel()
            {
                Id            = 201,
                InvalidVotes  = 2,
                IssuedBallots = 3,
                Name          = "constituencyA",
                Votes         = new Dictionary <CandidatesModel, int>()
            };

            _constituencyB =
                new ConstituencyModel()
            {
                Id            = 202,
                InvalidVotes  = 4,
                IssuedBallots = 5,
                Name          = "constituencyB",
                Votes         = new Dictionary <CandidatesModel, int>()
            };
        }
Ejemplo n.º 2
0
        // GET: Knowledges/Edit/5
        public ActionResult DeveloperEdit(int?id)
        {
            var model = new CandidatesModel();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Candidates      candidates      = db.Candidates.Find(id);
            OccupationArea  occupationArea  = db.OccupationArea.Find(id);
            InformationBank informationBank = db.InformationBank.Find(id);
            Knowledge       knowledge       = db.Knowledge.Find(id);

            model.Candidates      = candidates;
            model.OccupationArea  = occupationArea;
            model.InformationBank = informationBank;
            model.Knowledge       = knowledge;


            if (model == null)
            {
                return(HttpNotFound());
            }

            return(View(model));
        }
Ejemplo n.º 3
0
        public IActionResult UpdateCandidateMaster([FromBody] CandidatesModel model)
        {
            var msg  = new Message <CandidatesModel>();
            var data = DbClientFactory <UserDbClient> .Instance.UpdateCandidatesMaster(model, appSettings.Value.DbConn);

            if (data == "C200")
            {
                msg.IsSuccess = true;
                if (model.CandidateId == 0)
                {
                    msg.ReturnMessage = "Candidate saved successfully";
                }
                else
                {
                    msg.ReturnMessage = "Candidate updated successfully";
                }
            }
            //else if (data == "C201")
            //{
            //    msg.IsSuccess = false;
            //    msg.ReturnMessage = "Email Id already exists";
            //}
            //else if (data == "C202")
            //{
            //    msg.IsSuccess = false;
            //    msg.ReturnMessage = "Mobile Number already exists";
            //}
            return(Ok(msg));
        }
Ejemplo n.º 4
0
        public string addCandidateMaster(CandidatesModel candidateModel)
        {
            try
            {
                var            domainName = API_URL;
                HttpWebRequest request    = (HttpWebRequest)WebRequest.
                                            Create(String.Format("{0}/api/Candidate/SaveCandidateMaster",
                                                                 domainName));
                request.UserAgent   = @"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36";
                request.ContentType = "application/json";
                request.Method      = "POST";



                using (var streamWriter = new StreamWriter(request.GetRequestStream()))
                {
                    var json = JsonConvert.SerializeObject(candidateModel);

                    streamWriter.Write(json);
                }

                var httpResponse = (HttpWebResponse)request.GetResponse();
                var streamReader = new StreamReader(httpResponse.GetResponseStream());
                var result       = streamReader.ReadToEnd();
                return(result);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message.ToString());
                return(ex.Message.ToString());
            }
        }
Ejemplo n.º 5
0
        public ActionResult ListCandidates()
        {
            CandidatesModel canModel = new CandidatesModel();

            canModel.ListCandidates = _canApp.ListCandidates();

            return(View(canModel));
        }
Ejemplo n.º 6
0
        // GET: Candidates
        public ActionResult Candidates()
        {
            CandidatesModel canModel = new CandidatesModel();

            canModel.ListJobs = GetJobs();

            return(View(canModel));
        }
Ejemplo n.º 7
0
        public void AddCandidate(CandidatesModel candidateModel)
        {
            using (ViamericasCareersServices.CareersClient _webClient = new ViamericasCareersServices.CareersClient())
            {
                DcCandidates can = new DcCandidates();

                can.JobId     = candidateModel.JobId;
                can.CardId    = candidateModel.CardId;
                can.City      = candidateModel.City;
                can.FirstName = candidateModel.FirstName;
                can.LastName  = candidateModel.LastName;
                can.RegDate   = DateTime.Now;

                _webClient.AddCandidate(can);
            }
        }
Ejemplo n.º 8
0
        public void SendVotes(VotesReport votesReport)
        {
            var constituency = _repository.GetConstituence(votesReport.ConstituencyId);

            Dictionary <CandidatesModel, int> votesSummary = new Dictionary <CandidatesModel, int>();

            foreach (var candidate in votesReport.Votes)
            {
                CandidatesModel condidate = _repository.GetCandidate(candidate.CandidateId);
                votesSummary[condidate] = candidate.Amount;
            }

            constituency.InvalidVotes  = votesReport.InvalidVotes;
            constituency.IssuedBallots = votesReport.IssuedBallots;
            constituency.Votes         = votesSummary;
        }
Ejemplo n.º 9
0
        public InformationBank InformationBank(CandidatesModel model)
        {
            var information = new InformationBank()
            {
                InformationBankID = model.Candidates.CandidateID,
                Cpf           = model.InformationBank.Cpf,
                BanK          = model.InformationBank.BanK,
                Agency        = model.InformationBank.Agency,
                AccountType   = model.InformationBank.AccountType,
                AccountNumber = model.InformationBank.AccountNumber
            };

            db.InformationBank.Add(information);

            return(information);
        }
Ejemplo n.º 10
0
        public IActionResult SaveCandidateDetails([FromBody] CandidatesModel model)
        {
            var msg  = new Message <CandidatesModel>();
            var data = DbClientFactory <UserDbClient> .Instance.SaveCandidateDetail(model, appSettings.Value.DbConn);

            if (data == null || data == String.Empty)
            {
                msg.IsSuccess     = false;
                msg.ReturnMessage = "User Saving Failed";
            }
            else
            {
                msg.IsSuccess     = true;
                msg.ReturnMessage = "User saved successfully";
            }
            return(Ok(data));
        }
        public ActionResult ScheduleCandidates()
        {
            int    selected       = 1;
            int    pair           = 0;
            var    model          = new CandidatesModel();
            string jsonCandidates = (GetSearchTalent("http://jsonplaceholder.typicode.com/users")).Content;
            var    candidates     = JsonConvert.DeserializeObject <List <CandidatesModel> >(jsonCandidates);

            if (selected == 2 || selected == 4)
            {
                pair = 1;
            }
            var listCandidates = GetListCandidatesSelected(candidates, pair);

            model.ArrayCandidates = listCandidates;
            return(View(model));
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Przesłanie podliczonych wyników wyborów w danym okręgu wyborczym.
        /// </summary>
        /// <param name="votesReport">Protokół komisji wyborczej – podliczone głosy w okręgu</param>
        public void SendVotes(VotesReport votesReport)
        {
            // Defensive Lab: Weryfikacja poprawnośći przesłanych danych

            var constituency = _repository.GetConstituence(votesReport.ConstituencyId);

            Dictionary <CandidatesModel, int> votesSummary = new Dictionary <CandidatesModel, int>();

            foreach (var candidate in votesReport.Votes)
            {
                CandidatesModel condidate = _repository.GetCandidate(candidate.CandidateId);
                votesSummary[condidate] = candidate.Amount;
            }

            constituency.InvalidVotes  = votesReport.InvalidVotes;
            constituency.IssuedBallots = votesReport.IssuedBallots;
            constituency.Votes         = votesSummary;
        }
Ejemplo n.º 13
0
        public ActionResult Developer(CandidatesModel model)
        {
            if (ModelState.IsValid)
            {
                db.Candidates.Add(model.Candidates);
                model.OccupationArea  = OccupationArea(model);
                model.InformationBank = InformationBank(model);
                model.Knowledge       = Knowledge(model);

                db.SaveChanges();

                TempData["Candidates"] = model.Candidates;

                return(RedirectToAction("Edit", "Homeoffice"));
            }

            return(View(model));
        }
        public ActionResult CandidateSelected()
        {
            var    ListSelected   = Session["AbilitiesModel"] as List <AbilitiesModel>;
            int    pair           = 0;
            var    model          = new CandidatesModel();
            string jsonCandidates = (GetSearchTalent("http://jsonplaceholder.typicode.com/users")).Content;
            var    candidates     = JsonConvert.DeserializeObject <List <CandidatesModel> >(jsonCandidates);

            var a = ListSelected[0].IsCheck;

            if (ListSelected[0].IsCheck || ListSelected[2].IsCheck)
            {
                pair = 1;
            }
            var listCandidates = GetListCandidatesSelected(candidates, pair);

            model.ArrayCandidates = listCandidates;
            return(View(model));
        }
Ejemplo n.º 15
0
        public OccupationArea OccupationArea(CandidatesModel model)
        {
            var occupation = new OccupationArea()
            {
                OccupationAreaID = model.Candidates.CandidateID,
                Name             = model.OccupationArea.Name,
                Skype            = model.OccupationArea.Skype,
                Linkedin         = model.OccupationArea.Linkedin,
                Cyte             = model.OccupationArea.Cyte,
                State            = model.OccupationArea.State,
                Portfolio        = model.OccupationArea.Portfolio,
                Willingness      = model.OccupationArea.Willingness,
                Horary           = model.OccupationArea.Horary,
                Salary           = model.OccupationArea.Salary,
            };

            db.OccupationArea.Add(occupation);

            return(occupation);
        }
Ejemplo n.º 16
0
        public ActionResult AddCandidate(CandidatesModel candidateModel)
        {
            try
            {
                CandidatesModel canModel = new CandidatesModel();

                if (ModelState.IsValid)
                {
                    _canApp.AddCandidate(candidateModel);
                    return(RedirectToAction("ListCandidates"));
                }
                else
                {
                    canModel.ListJobs = GetJobs();
                    return(View("Candidates", canModel));
                }
            }
            catch (Exception ex)
            {
                return(View("Error"));
            }
        }
Ejemplo n.º 17
0
        public Knowledge Knowledge(CandidatesModel model)
        {
            var knowledge = new Knowledge()
            {
                KnowledgeID   = model.Candidates.CandidateID,
                Ionic         = model.Knowledge.Ionic,
                Android       = model.Knowledge.Android,
                Ios           = model.Knowledge.Ios,
                Majento       = model.Knowledge.Majento,
                WordPress     = model.Knowledge.WordPress,
                Html          = model.Knowledge.Html,
                Css           = model.Knowledge.Css,
                Bootstrap     = model.Knowledge.Bootstrap,
                Django        = model.Knowledge.Django,
                Jquery        = model.Knowledge.Jquery,
                Angular       = model.Knowledge.Angular,
                Vue           = model.Knowledge.Vue,
                SqlServer     = model.Knowledge.SqlServer,
                MySql         = model.Knowledge.MySql,
                Java          = model.Knowledge.Java,
                Phyton        = model.Knowledge.Phyton,
                Cake          = model.Knowledge.Cake,
                Php           = model.Knowledge.Php,
                AspNetMvc     = model.Knowledge.AspNetMvc,
                Ruby          = model.Knowledge.Ruby,
                C             = model.Knowledge.C,
                C_            = model.Knowledge.C_,
                Photoshop     = model.Knowledge.Photoshop,
                Illustraitor  = model.Knowledge.Illustraitor,
                Salesforce    = model.Knowledge.Salesforce,
                Seo           = model.Knowledge.Seo,
                OtherLanguage = model.Knowledge.OtherLanguage,
                Crud          = model.Knowledge.Crud,
            };

            db.Knowledge.Add(knowledge);

            return(knowledge);
        }
Ejemplo n.º 18
0
        public ActionResult DeveloperEdit(CandidatesModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.Entry(model.Candidates).State      = EntityState.Modified;
                    db.Entry(model.OccupationArea).State  = EntityState.Modified;
                    db.Entry(model.InformationBank).State = EntityState.Modified;
                    db.Entry(model.Knowledge).State       = EntityState.Modified;

                    db.SaveChanges();

                    return(RedirectToAction("Developer", "Homeoffice"));
                }
            }
            catch (DbUpdateConcurrencyException ex)
            {
                // Update the values of the entity that failed to save from the store
                ex.Entries.Single().Reload();
            }

            return(View(model));
        }
Ejemplo n.º 19
0
        public void Test4()
        {
            CandidatesModel candidate = new CandidatesModel();

            candidate.Code = 100000000000;//too long
        }
Ejemplo n.º 20
0
        public void Test3()
        {
            CandidatesModel candidate = new CandidatesModel();

            candidate.Code = 9999999999;//too short
        }
Ejemplo n.º 21
0
        public void Test2()
        {
            CandidatesModel candidate = new CandidatesModel();

            candidate.Code = 77020203557;//wrong checksum
        }
Ejemplo n.º 22
0
        public void Test1()
        {
            CandidatesModel candidate = new CandidatesModel();

            candidate.Code = 77020203551;//PESEL OK
        }
Ejemplo n.º 23
0
        public void Developer()
        {
            HomeofficeController controller = new HomeofficeController();

            CandidatesModel model = new CandidatesModel();

            var candidates = new Candidates()
            {
                CandidateID = 2092,
                Email       = "*****@*****.**"
            };

            var occupation = new OccupationArea()
            {
                OccupationAreaID = 2092,
                Name             = "tes",
                Skype            = "tes",
                Linkedin         = "https://linkedin.com/in/test",
                Cyte             = "Itabuna",
                State            = "Bahia",
                Portfolio        = "https://github.com/test",
                Willingness      = "Morning",
                Horary           = "7-8",
                Salary           = 20,
            };

            var information = new InformationBank()
            {
                InformationBankID = 2092,
                Cpf           = "05453390573",
                BanK          = "Banco do Brasil",
                Agency        = "987898",
                AccountType   = "corrente",
                AccountNumber = "6457"
            };

            var knowledge = new Knowledge()
            {
                KnowledgeID   = 2092,
                Ionic         = 3,
                Android       = 5,
                Ios           = 4,
                Majento       = 2,
                WordPress     = 3,
                Html          = 4,
                Css           = 4,
                Bootstrap     = 4,
                Django        = 3,
                Jquery        = 3,
                Angular       = 4,
                Vue           = 4,
                SqlServer     = 5,
                MySql         = 5,
                Java          = 5,
                Phyton        = 3,
                Cake          = 4,
                Php           = 4,
                AspNetMvc     = 4,
                Ruby          = 4,
                C             = 3,
                C_            = 3,
                Photoshop     = 3,
                Illustraitor  = 4,
                Salesforce    = 4,
                Seo           = 3,
                OtherLanguage = "JS-2",
                Crud          = "https://github.com/test",
            };

            model.Candidates      = candidates;
            model.OccupationArea  = occupation;
            model.InformationBank = information;
            model.Knowledge       = knowledge;

            controller.ModelState.AddModelError("", "error");

            //string expectedView = "Developer";

            var actual = controller.Developer(model) as ViewResult;

            Assert.IsNotNull(actual);
            //Assert.AreEqual(expectedView, actual.ViewName);
            Assert.AreEqual(model, actual.Model);
        }
Ejemplo n.º 24
0
 public void Add(CandidatesModel candidate)
 {
     _candidates.Add(candidate.Id, candidate);
 }