Exemplo n.º 1
0
 // Edit Question
 private void btnEditQuestion_Click(object sender, EventArgs e)
 {
     if (lvOpenQuestions.SelectedItems.Count == 1)
     {
         int selectedRow = lvOpenQuestions.SelectedItems[0].Index;
         int selectedId  = Convert.ToInt32(lvOpenQuestions.Items[selectedRow].SubItems[5].Text);
         ((MainForm)this.Parent.Parent).ReplaceForm(new EditQuestion(ql.GetSingleQuestion(selectedId)));
     }
     else
     {
         MessageBox.Show("Error");
     }
 }
        public ActionResult AppointmentOverview()
        {
            List <AppointmentViewModel> appointmentViews = new List <AppointmentViewModel>();

            foreach (Appointment appointment in _appointmentLogic.GetAllAppointmentsFromUser(Convert.ToInt32(Request.Cookies["id"])))
            {
                appointmentViews.Add(new AppointmentViewModel(appointment, _questionLogic.GetSingleQuestion(appointment.QuestionId), _userLogic.GetUserById(appointment.CareRecipientId)));
            }

            return(View("Appointment/Overview", appointmentViews));
        }
Exemplo n.º 3
0
        public ActionResult AppointmentOverview()
        {
            int userId = int.Parse(User.Claims.FirstOrDefault(c => c.Type == System.Security.Claims.ClaimTypes.Sid).Value);

            List <AppointmentViewModel> appointmentViews = new List <AppointmentViewModel>();

            foreach (Appointment appointment in _appointmentLogic.GetAllAppointmentsFromUser(userId))
            {
                appointmentViews.Add(new AppointmentViewModel(appointment, _questionLogic.GetSingleQuestion(appointment.QuestionId), _userLogic.GetUserById(appointment.CareRecipientId)));
            }

            return(View("Appointment/Overview", appointmentViews));
        }
Exemplo n.º 4
0
        public void GetSingleQuestion_IsValid()
        {
            Mock <IQuestionContext> mockContext = new Mock <IQuestionContext>();
            Mock <Category>         category    = new Mock <Category>("Medisch");
            Mock <Question>         question    = new Mock <Question>(1, "foo", "baa", Question.QuestionStatus.Open, DateTime.Today, true, category.Object, 12);

            mockContext.Setup(x => x.GetSingleQuestion(question.Object.QuestionId))
            .Returns(question.Object);

            QuestionLogic questionLogic = new QuestionLogic(mockContext.Object);
            Question      result        = questionLogic.GetSingleQuestion(question.Object.QuestionId);

            Assert.IsInstanceOfType(result, typeof(Question));
        }
        public ActionResult OverviewAppointment()
        {
            List <AppointmentViewModel> appointments = new List <AppointmentViewModel>();

            int userId = 0;

            try
            {
                userId = Convert.ToInt32(Request.Cookies["id"]);
            }
            catch (Exception)
            {
                ViewBag.Message = "U moet zich eerst inloggen";
                return(View("Login"));
            }


            foreach (Appointment appointment in _appointmentLogic.GetAllAppointmentsFromUser(userId))
            {
                appointments.Add(new AppointmentViewModel(appointment, _questionLogic.GetSingleQuestion(appointment.QuestionId), _userLogic.GetUserById(userId)));
            }

            return(View("Appointment/Overview", appointments));
        }
        //React to Question
        private void btnReactToQuestion_Click(object sender, EventArgs e)
        {
            if (lvOpenQuestions.SelectedItems.Count == 0)
            {
                MessageBox.Show("Selecteer eerst een vraag uit de lijst.");
            }
            else
            {
                int selectedRow = lvOpenQuestions.SelectedItems[0].Index;
                int selectedId  = Convert.ToInt32(lvOpenQuestions.Items[selectedRow].SubItems[5].Text);


                Form questionReaction = new FormVolQuestionReaction(QuestionLogic.GetSingleQuestion(selectedId));
                questionReaction.Show();
            }
        }
Exemplo n.º 7
0
 public ActionResult Edit(int id)
 {
     ViewData["Categories"] = _categoryLogic.GetAllCategories();
     return(View("../CareRecipient/Question/Edit", new QuestionViewModel(_questionLogic.GetSingleQuestion(id))));
 }