} // end Start ///////////////////////////////////// START OF ORGANIZATIONAL FUNCTIONS /////////////////////////////////////////// /*************************************************************************************************************** ** NOTE: Maybe we should change the layout of the template...like group each interviewee's info together? Rather ** than structure it by the flow of the game. I think this would make it easier to parse through, especially ** if there are more than 3 questions. ** The next 3 functions are pretty hard-coded. If more content is added, the 3 organize functions need to be ** changed. ***************************************************************************************************************/ void OrganizeInterviewees(string[] fileInfo) { // Get greg's info string[] gregAnswers = { fileInfo[3], fileInfo[13], fileInfo[23] }; string[] gregFeedback = { fileInfo[6], fileInfo[16], fileInfo[26] }; int[] gregScores = { Int32.Parse(fileInfo[7]), Int32.Parse(fileInfo[17]), Int32.Parse(fileInfo[27]) }; string gregPros = fileInfo[32]; string gregCons = fileInfo[33]; // Get lisa's info string[] lisaAnswers = { fileInfo[4], fileInfo[14], fileInfo[24] }; string[] lisaFeedback = { fileInfo[8], fileInfo[18], fileInfo[28] }; int[] lisaScores = { Int32.Parse(fileInfo[9]), Int32.Parse(fileInfo[19]), Int32.Parse(fileInfo[29]) }; string lisaPros = fileInfo[34]; string lisaCons = fileInfo[35]; // Get tyrone's info string[] tyAnswers = { fileInfo[5], fileInfo[15], fileInfo[25] }; string[] tyFeedback = { fileInfo[10], fileInfo[20], fileInfo[30] }; int[] tyScores = { Int32.Parse(fileInfo[11]), Int32.Parse(fileInfo[21]), Int32.Parse(fileInfo[31]) }; string tyPros = fileInfo[36]; string tyCons = fileInfo[37]; // Save all interviewee info Interviewee greg = new Interviewee(gregAnswers, gregFeedback, gregScores, gregPros, gregCons); Interviewee lisa = new Interviewee(lisaAnswers, lisaFeedback, lisaScores, lisaPros, lisaCons); Interviewee tyrone = new Interviewee(tyAnswers, tyFeedback, tyScores, tyPros, tyCons); interviewees = new Interviewee[3] { greg, lisa, tyrone }; } // end OrganizeInterviewees.
public Interviewee Create(Interviewee entity) { context.Interviewees.Add(entity); context.SaveChanges(); return(entity); }
public virtual ActionResult IntervieweeInfo(IntervieweeViewModel model) { if (ModelState.IsValid) { var interviewee = new Interviewee() { InterviewDate = DateTime.Now, PlaceOfResidenceId = model.PlaceOfResidenceId, SeniorityId = model.SeniorityId, SexId = model.SexId, EducationId = model.EducationId, Age = model.Age, MartialStatusId = model.MartialStatusId, MaterialStatusId = model.MaterialStatusId, AgeId = model.AgeId, WorkplaceId = model.WorkplaceId }; Session[_intervieweeSessionKey] = interviewee; Session[_resultsSessionKey] = new List <Result>(); return(RedirectToAction(MVC.Application.Survey.SOC29())); } model.SetDictionaries(_dictionariesRepository.GetList()); return(View(model)); }
public IActionResult Index(Interviewee interviewee) { if (interviewee.FirstInterview >= interviewee.SecondInterview) { ModelState.AddModelError("", ("The first interview must come before the second")); } return(View(interviewee)); }
public ActionResult CreateInterview(Interviewee interviewee) { if (!ModelState.IsValid) { return(View()); } return(View("Completed", interviewee)); }
public ActionResult DeleteConfirmed(int id) { Interviewee interviewee = db.Interviewees.Find(id); db.Interviewees.Remove(interviewee); db.SaveChanges(); return(RedirectToAction("Index")); }
public static IntervieweeDto ToIntervieweeDto(this Interviewee interviewee) { return(new IntervieweeDto() { Name = interviewee.Name, Surname = interviewee.Surname, Interviews = interviewee.Interviews.Select(i => i.ToInterviewDto()).ToList() }); }
public Interviewee Update(int id, Interviewee objectToUpdate) { Interviewee existingInterviewee = context.Interviewees.Where(i => i.Id == id).FirstOrDefault(); existingInterviewee.Name = objectToUpdate.Name; existingInterviewee.Description = objectToUpdate.Description; context.SaveChanges(); return(objectToUpdate); }
public ActionResult Create(Interviewee model) { if (!ModelState.IsValid) { return(View(model)); } model.ChangedBy = User.Identity.GetUserId(); model.CreatedBy = User.Identity.GetUserId(); _service.Create(model); return(RedirectToAction("Interviewees")); }
public ActionResult Edit([Bind(Include = "IdCandidate,IdInterview")] Interviewee interviewee) { if (ModelState.IsValid) { db.Entry(interviewee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IdCandidate = new SelectList(db.Candidates, "IdCandidate", "FirstName", interviewee.IdCandidate); ViewBag.IdInterview = new SelectList(db.Interviews, "IdInterview", "Name", interviewee.IdInterview); return(View(interviewee)); }
public ActionResult Create(Interviewee i) { { if (ModelState.IsValid) { return(View("RegisterInterviewCompleted", i)); } else { return(View(i)); } } }
private void AddInterviews(Interviewee interviewee, IEnumerable <Interview> interviews) { foreach (var interview in interviews) { if (interview is null) { throw new ArgumentException("Interview cannot be null"); } interview.ID = GenerateId(); _interviews[interview.ID] = interview; interviewee.Interviews.Add(interview); } }
public async Task <ApiResponse> UpdateAsync([FromBody] Interviewee model) { try { var result = await _intervieweeService.CrudService.UpdateAsync(model); return(HttpResponse(200, "", result)); } catch (Exception e) { _logger.Log(LogType.Error, () => e.Message, e); return(HttpResponse(500, e.Message)); } }
// GET: Interviewees/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Interviewee interviewee = db.Interviewees.Find(id); if (interviewee == null) { return(HttpNotFound()); } return(View(interviewee)); }
public async Task <ApiResponse> CreateAsync([FromBody] Interviewee model) { try { Console.WriteLine(model.ContactNumber); var result = await _intervieweeService.CrudService.InsertAsync(model); return(HttpResponse(200, "", result.Value)); } catch (Exception e) { _logger.Log(LogType.Error, () => e.Message, e); return(HttpResponse(500, e.Message)); } }
// GET: Interviewees/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Interviewee interviewee = db.Interviewees.Find(id); if (interviewee == null) { return(HttpNotFound()); } ViewBag.IdCandidate = new SelectList(db.Candidates, "IdCandidate", "FirstName", interviewee.IdCandidate); ViewBag.IdInterview = new SelectList(db.Interviews, "IdInterview", "Name", interviewee.IdInterview); return(View(interviewee)); }
private static void Check(Interviewee interviewee) { if (interviewee is null) { throw new ArgumentException("Interviewee cannot be null or empty."); } if (string.IsNullOrEmpty(interviewee.Name)) { throw new ArgumentException("Name cannot be null or empty."); } if (string.IsNullOrEmpty(interviewee.Surname)) { throw new ArgumentException("Surname cannot be null or empty."); } }
public void EditInterviewee(Interviewee interviewee, int id) { try { using (var connection = new MySqlConnection(connectionString)) { connection.Open(); using (var cmd = new MySqlCommand()) { cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = "update interviewee set " + "firstname = @firstname ," + "lastname = @lastname ," + "email = @email ," + "university = @university ," + "githublink = @githublink ," + "bamboolink = @bamboolink ," + "backend = @backend ," + "frontend = @frontend ," + "algorithms = @algorithms ," + "specialnote = @specialnote " + "where id = " + id; cmd.Connection = connection; cmd.Parameters.AddWithValue("@firstname", interviewee.firstname); cmd.Parameters.AddWithValue("@lastname", interviewee.lastname); cmd.Parameters.AddWithValue("@email", interviewee.email); cmd.Parameters.AddWithValue("@university", interviewee.university); cmd.Parameters.AddWithValue("@githublink", interviewee.githublink); cmd.Parameters.AddWithValue("@bamboolink", interviewee.bamboolink); cmd.Parameters.AddWithValue("@backend", interviewee.backendnote); cmd.Parameters.AddWithValue("@frontend", interviewee.frontend); cmd.Parameters.AddWithValue("@algorithms", interviewee.algorithms); cmd.Parameters.AddWithValue("@specialnote", interviewee.specialnote); cmd.ExecuteNonQuery(); } } } catch (MySqlException ex) { Debug.WriteLine(ex.Message); } }
public void Add(Interviewee interviewee, IEnumerable <Interview> interviews) { if (interviewee is null) { throw new ArgumentException("Interviewee cannot be null"); } if (!IntervieweeExists(interviewee)) { _interviewees.Add(interviewee.GetHashCode(), interviewee); } else { interviewee = _interviewees[interviewee.GetHashCode()]; } AddInterviews(interviewee, interviews); }
/// <summary> /// Sync Interviewees /// </summary> private static void SyncInterviewees() { var webApiClient = DiContainers.Global.Resolve <IWebApiClient>(); var apiInterviewees = webApiClient.GetInterviewees(); if (apiInterviewees == null || apiInterviewees.Count == 0) { return; } using (var dbContext = new AARPDbContext()) { try { foreach (var apiInterviewee in apiInterviewees) { var currentInterview = dbContext.Interviewees.FirstOrDefault(x => x.Id.ToString() == apiInterviewee.Id); if (currentInterview != null) { continue; } var interviewee = new Interviewee { Id = int.Parse(apiInterviewee.Id), Name = apiInterviewee.GetFullName(), Email = apiInterviewee.Email, OpeningID = apiInterviewee.OpeningID, StageID = apiInterviewee.StageID }; dbContext.Interviewees.Add(interviewee); dbContext.SaveChanges(); } } catch (Exception e) { Logger.Error(e.Message, e); } } }
public void AddInterviewee(Interviewee interviewee) { try { using (var connection = new MySqlConnection(connectionString)) { connection.Open(); using (var cmd = new MySqlCommand()) { cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = "insert into interviewee (firstname, lastname, email, university" + ", githublink, bamboolink, backend, frontend, algorithms, specialnote) " + "values (@firstname, @lastname, @email, @university" + ", @githublink, @bamboolink, @backend, @frontend, @algorithms, @specialnote)"; Debug.WriteLine(cmd.CommandText); cmd.Connection = connection; cmd.Parameters.AddWithValue("@firstname", interviewee.firstname); cmd.Parameters.AddWithValue("@lastname", interviewee.lastname); cmd.Parameters.AddWithValue("@email", interviewee.email); cmd.Parameters.AddWithValue("@university", interviewee.university); cmd.Parameters.AddWithValue("@githublink", interviewee.githublink); cmd.Parameters.AddWithValue("@bamboolink", interviewee.bamboolink); cmd.Parameters.AddWithValue("@backend", interviewee.backendnote); cmd.Parameters.AddWithValue("@frontend", interviewee.frontend); cmd.Parameters.AddWithValue("@algorithms", interviewee.algorithms); cmd.Parameters.AddWithValue("@specialnote", interviewee.specialnote); cmd.ExecuteNonQuery(); } } } catch (MySqlException ex) { Debug.WriteLine(ex.Message); } }
public ActionResult Update(Interviewee model) { string msg; try { if (ModelState.IsValid) { model.ChangedBy = User.Identity.GetUserId(); _service.Update(model); msg = "Saved Successfully"; } else { return(View(model)); } } catch (Exception ex) { msg = "Error occured:" + ex.Message; } return(RedirectToAction("Interviewees")); }
public void Update(Interviewee entity) { _repository.Update(entity); }
public ActionResult Update(Int32 id) { Interviewee model = _service.GetById(id); return(View(model)); }
private bool IntervieweeExists(Interviewee interviewee) { return(_interviewees.ContainsKey(interviewee.GetHashCode())); }
public void SaveIntervieweeWithInterviews(Interviewee interviewee, IEnumerable <Interview> interviews) { Check(interviewee); _memory.Add(interviewee, interviews); }
public List <Interviewee> GetInterviewees() { List <Interviewee> listOfInterviewee = new List <Interviewee>(); Debug.WriteLine("get interviewee"); try { using (var connection = new MySqlConnection(connectionString)) { connection.Open(); Debug.WriteLine("connection is opened"); using (var cmd = new MySqlCommand()) { cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = "Select * from interviewee"; cmd.Connection = connection; MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Interviewee interviewee = new Interviewee(); interviewee.extranotes = new List <ExtraNote>(); interviewee.id = Convert.ToInt32(reader.GetValue(0)); interviewee.firstname = reader.GetValue(1).ToString(); interviewee.lastname = reader.GetValue(2).ToString(); interviewee.email = reader.GetValue(3).ToString(); interviewee.university = reader.GetValue(4).ToString(); interviewee.githublink = reader.GetValue(5).ToString(); interviewee.bamboolink = reader.GetValue(6).ToString(); interviewee.backendnote = Convert.ToInt32(reader.GetValue(7)); interviewee.frontend = Convert.ToInt32(reader.GetValue(8)); interviewee.algorithms = Convert.ToInt32(reader.GetValue(9)); interviewee.specialnote = reader.GetValue(10).ToString(); // the notes for this interviewee using (var connectionNote = new MySqlConnection(connectionString)) { connectionNote.Open(); using (var cmdNote = new MySqlCommand()) { cmdNote.CommandType = System.Data.CommandType.Text; cmdNote.CommandText = "Select * from extranotes"; cmdNote.Connection = connectionNote; MySqlDataReader readerNote = cmdNote.ExecuteReader(); while (readerNote.Read()) { ExtraNote extraNote = new ExtraNote(); extraNote.id = Convert.ToInt32(readerNote.GetValue(0)); extraNote.intervieweeid = Convert.ToInt32(readerNote.GetValue(1)); extraNote.columnname = readerNote.GetValue(2).ToString(); extraNote.note = readerNote.GetValue(3).ToString(); // here we check whether the extra note is for this interviewee or not if (interviewee.id == extraNote.intervieweeid) { interviewee.extranotes.Add(extraNote); } } readerNote.Close(); } } Debug.WriteLine(interviewee.firstname + " is added"); listOfInterviewee.Add(interviewee); } reader.Close(); } } } catch (MySqlException ex) { Debug.WriteLine(ex); } return(listOfInterviewee); }
}// end OrganizeJobInfo // Further organizes all of the candidate's information. This includes candidate answers, feedback, // scores, pros, and cons. void OrganizeCandidates(string[] fileInfo, int startIndex, int endIndex) { int answersStart = 0, feedbackStart = 0, scoresStart = 0, prosStart = 0, consStart = 0; int answersEnd = 0, feedbackEnd = 0, scoresEnd = 0, prosEnd = 0, consEnd = 0; // Check for markers in the file, and save the start & end spots of each section. for (int i = 0; i < fileInfo.Length; i++) { if (fileInfo[i].Equals("ANSWERS")) { answersStart = i + 1; } if (fileInfo[i].Equals("ANSWERS_END")) { answersEnd = i - 1; } if (fileInfo[i].Equals("FEEDBACK")) { feedbackStart = i + 1; } if (fileInfo[i].Equals("FEEDBACK_END")) { feedbackEnd = i - 1; } if (fileInfo[i].Equals("SCORES")) { scoresStart = i + 1; } if (fileInfo[i].Equals("SCORES_END")) { scoresEnd = i - 1; } if (fileInfo[i].Equals("PROS")) { prosStart = i + 1; } /*if (fileInfo[i].Equals("PROS_END")) * { * prosEnd = i-1; * }*/ if (fileInfo[i].Equals("CONS")) { consStart = i + 1; break; } /*if (fileInfo[i].Equals("CONS_END")) * { * consEnd = i-1; * break; * }*/ }// end for int questionsLen = jobInfoNode.GetQuestions().Length; /*Debug.Log("Answers start at index " + answersStart); * Debug.Log("Feedback end at index " + feedbackStart); * Debug.Log("Scores start at index " + scoresStart); * Debug.Log("Pros start at index " + prosStart); * Debug.Log("Cons start at index " + consStart); */ int currentCandidate = 1; // Goes through each candidate for (int i = 0; i < 3; i++) { Interviewee candidate; string[] answers = new string[questionsLen]; string[] feedback = new string[questionsLen]; int[] scores = new int[questionsLen]; string pros, cons; int index = 0; // Save each answers from candidate i for (int j = answersStart; j < answersStart + questionsLen; j++) { answers[index] = fileInfo[j]; index++; } index = 0; // Save each feedback sentence from candidate i for (int j = feedbackStart; j < feedbackStart + questionsLen; j++) { feedback[index] = fileInfo[j]; index++; } index = 0; // Save each score for candidate i. for (int j = scoresStart; j < scoresStart + questionsLen; j++) { scores[index] = Int32.Parse(fileInfo[j]); index++; } pros = fileInfo[prosStart + i]; cons = fileInfo[consStart + i]; candidate = new Interviewee(questionsLen, answers, feedback, scores, pros, cons); candidates[i] = candidate; // Go to next candidate's answer, feedback, and scores list. answersStart += questionsLen; feedbackStart += questionsLen; scoresStart += questionsLen; } // end for loop } // end OrganizeCandidates
public void Given_Interviewee_When_ConvertedToIntervieweeDto_Then_IntervieweeDtoIsIdentical(Interviewee interviewee) { var intervieweeDto = interviewee.ToIntervieweeDto(); Assert.Multiple(() => { Assert.AreEqual(interviewee.Name, intervieweeDto.Name); Assert.AreEqual(interviewee.Surname, intervieweeDto.Surname); Assert.AreEqual(interviewee.Interviews.First().Result, intervieweeDto.Interviews.First().Result); Assert.AreEqual(interviewee.Interviews.First().Date, intervieweeDto.Interviews.First().Date); }); }
public void Delete(Interviewee entity) { _repository.Delete(entity); }