private void btnDialogOk_Click(object sender, RoutedEventArgs e) { if (tbEndTime.Text == "" || tbStartTime.Text == "" || cbPatient.Text == "" || cbPatient.Text == null || cbRoom.Text == "" || cbRoom.Text == null || DatePick.Text == "Select a date") { MessageBox.Show("Niste popunili sva polja!", "Upozorenje!", MessageBoxButton.OK, MessageBoxImage.Warning); } else { Model.Examination ex = new Model.Examination(DoctorHome.ExaminationControl.examinationService.examinationRepository.next_id++, Convert.ToDateTime(DatePick.Text + " " + tbStartTime.Text), Convert.ToDateTime(DatePick.Text + " " + tbEndTime.Text), "Milana123", cbPatient.Text, int.Parse(cbRoom.Text), GetExaminationType()); DoctorHome.ExaminationControl.examinationService.examinationRepository.next_id++; Boolean b = DoctorHome.ExaminationControl.CreateExamination(ex); if (b == true) { DoctorHome.LoadAll(); MessageBox.Show("Uspešno ste dodali resurs!", "Uspešno izvršeno!", MessageBoxButton.OK, MessageBoxImage.Information); this.Close(); } else { MessageBox.Show("Izabrani termin je zauzet", "Upozorenje", MessageBoxButton.OK, MessageBoxImage.Information); } } }
public bool Create(Model.Examination newExamination) { List <Model.Examination> examinations = GetAll(); if (IsRoomFree(newExamination.StartTime, newExamination.EndTime, newExamination.ExaminationId, newExamination.room.RoomId)) { examinations.Add(newExamination); examinationRepository.SaveExamination(examinations); return(true); } return(false); }
protected Model.Examination Add() { var ex = new Model.Examination { Name = "test", QuestionCount = 20, Date = DateTime.Now, Description = "description" }; var error = _manager.Create(ex); Assert.IsTrue(string.IsNullOrEmpty(error)); return ex; }
private void Button_Click_Update(object sender, RoutedEventArgs e) { ExaminationUpdate = new ExaminationUpdate(this); ExaminationUpdate.Show(); Model.Examination selected = (Model.Examination)lvDataBinding.SelectedItems[0]; ExaminationUpdate.lbuID.Content = (selected.ExaminationId.ToString()); ExaminationUpdate.lbuPatient.Content = (selected.patient.User.Username); String[] StartDateTime = selected.StartTime.ToString().Split(' '); String[] EndDateTime = selected.EndTime.ToString().Split(' '); ExaminationUpdate.tbuStartTime.Text = StartDateTime[1]; ExaminationUpdate.tbuEndTime.Text = EndDateTime[1]; ExaminationUpdate.DatePick.Text = StartDateTime[0]; ExaminationUpdate.cbRoom.Items.Add(selected.room.RoomId); ExaminationUpdate.cbRoom.SelectedItem = selected.room.RoomId; }
protected Model.Examination AddExaminationAndGenerate() { var manager = new ExaminationManager(); var ex = new Model.Examination { Name = "test", QuestionCount = 20, Date = DateTime.Now, Description = "description" }; var error = manager.Create(ex); Assert.IsTrue(string.IsNullOrEmpty(error)); GenerateQuestions(30); error = manager.GenerateExamination(ex); return ex; }
private void Button_Click_Delete(object sender, RoutedEventArgs e) { if (lvDataBinding.SelectedIndex > -1) { MessageBoxResult result = MessageBox.Show("Da li ste sigurni da želite da izbrišete termin?", "Zdravo", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); if (result == MessageBoxResult.Yes) { Model.Examination selected = (Model.Examination)lvDataBinding.SelectedItems[0]; ExaminationControl.DeleteExamination(selected.ExaminationId); LoadAll(); MessageBox.Show("Uspešno ste izbrisali termin", "Uspešno!"); } } else { MessageBox.Show("Niste selektovali željeni termin!", "Upozorenje", MessageBoxButton.OK, MessageBoxImage.Warning); } return; }
public IActionResult AddExamApply([FromBody] dynamic examApply) { try { dynamic examApplyObject = Newtonsoft.Json.JsonConvert.DeserializeObject <dynamic>(examApply.ToString()); int teacherId = examApplyObject.teacherId; int examId = examApplyObject.examination.Id; int courseId = examApplyObject.examination.CourseId; DateTime time = examApplyObject.examination.Time; int duration = examApplyObject.examination.Duration; string name = examApplyObject.examination.Name; Model.Examination examination = new Model.Examination(examId, courseId, time, name, duration); bool result = examinationBll.AddExamApply(examination, teacherId); return(Ok(result)); } catch (Exception e) { return(NotFound(e.Message)); } }
public List <Model.Examination> LoadExamination() { List <Model.Examination> examinations = new List <Model.Examination>(); examinations.Clear(); try { String line; StreamReader sr = new StreamReader(FileLocation); while ((line = sr.ReadLine()) != null) { Console.WriteLine(line); string[] words = line.Split(','); Console.WriteLine(words[5]); Console.WriteLine(words[4]); Model.Examination exam = new Model.Examination(int.Parse(words[0]), Convert.ToDateTime(words[1]), Convert.ToDateTime(words[2]), words[3], words[4], int.Parse(words[5]), (Model.ExaminationType)Enum.Parse(typeof(Model.ExaminationType), words[6])); Console.WriteLine("NO"); examinations.Add(exam); next_id = exam.ExaminationId; } next_id++; sr.Close(); } catch (Exception e) { Console.WriteLine("Exception: " + e.Message); } finally { Console.WriteLine("Executing finally block."); } return(examinations); }
public void Load() { Controller.PatientController PatientController = new Controller.PatientController(); Model.Examination selectedExamination = (Model.Examination)dh.lvDataBinding.SelectedItems[0]; Model.Patient selectedPatient = PatientController.GetOnePatient(selectedExamination.patient.User.Username); lbAddressPatient.Content = selectedPatient.User.Address; lbuUsernamePatient.Content = selectedPatient.User.Username; lbuJMBG.Content = selectedPatient.User.Jmbg; lbNamePatient.Content = selectedPatient.User.Name; lbGender.Content = selectedPatient.User.Gender; lbDateOfBirthPatient.Content = selectedPatient.User.DateOfBirth; lbSurnamePatient.Content = selectedPatient.User.Surname; lbNumberPatient.Content = selectedPatient.User.PhoneNumber; List <Model.Anamnesis> anamneses = anamControl.GetAllAnamnesisPatient(selectedPatient.User.Username); lvDataBinding.Items.Clear(); foreach (Model.Anamnesis an in anamneses) { lvDataBinding.Items.Add(an); Console.WriteLine(an.DescriptionAnamnesis); } }
public Boolean CreateExamination(Model.Examination NewExamination) { return(examinationService.Create(NewExamination)); }