Пример #1
0
 public ActionResult PatientStatusEdit(AppointmentStatusViewModel appointmentStatusViewModel)
 {
     if (!ModelState.IsValid)
     {
         AppointmentStatusViewModel vm = appointmentRepository.getPatientStatus(appointmentStatusViewModel.id);
         return(View(vm));
     }
     appointmentRepository.updatePatientStatus(appointmentStatusViewModel);
     return(RedirectToAction("PatientStatusList"));
 }
Пример #2
0
        public IActionResult Index(int?id)
        {
            if (id == 0)
            {
                id = 0;
            }
            ViewBag.Status = id;
            string userid = HttpContext.Session.GetString("User_Id");

            if (string.IsNullOrWhiteSpace(userid))
            {
                return(NotFound());
            }
            short userId = Convert.ToInt16(userid);
            AppointmentStatusViewModel appointmentStatusViewModel = new AppointmentStatusViewModel();

            appointmentStatusViewModel = visitorRepository.GetVisitorAppointment(id, userId);
            return(View(appointmentStatusViewModel));
        }
Пример #3
0
        public bool updatePatientStatus(AppointmentStatusViewModel appointmentStatusViewModel)
        {
            int count = 0;

            using (Entities.Entities ctx = new Entities.Entities())
            {
                Appointment appointmentEntity = ctx.Appointments.Find(appointmentStatusViewModel.id);

                if (appointmentEntity == null)
                {
                    return(false);
                }

                appointmentEntity.Status = appointmentStatusViewModel.Status;

                ctx.Entry(appointmentEntity).State = System.Data.Entity.EntityState.Modified;
                count = ctx.SaveChanges();
            }
            return(count > 0 ? true : false);
        }
Пример #4
0
        public ActionResult PatientStatusEdit(int AppointmentID = 0)
        {
            AppointmentStatusViewModel vm = appointmentRepository.getPatientStatus(AppointmentID);

            return(View(vm));
        }
Пример #5
0
        public AppointmentStatusViewModel GetVisitorAppointment(int?id, short userid)
        {
            if (id == 0)
            {
                id = 1;
            }
            List <Appointment>         appointments = new List <Appointment>();
            AppointmentStatusViewModel appointmentStatusViewModel = new AppointmentStatusViewModel();

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                using (SqlCommand cmd = new SqlCommand("sp_getmeetingfromstatus", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@visitorId", userid);
                    cmd.Parameters.AddWithValue("@status", id);
                    con.Open();
                    using (SqlDataReader dr = cmd.ExecuteReader())
                    {
                        for (int i = 1; i <= 5; i++)
                        {
                            while (dr.Read())
                            {
                                switch (i)
                                {
                                case 1:
                                    appointmentStatusViewModel.Pending = Convert.ToInt16(dr["meeting_count"]);

                                    break;

                                case 2:
                                    appointmentStatusViewModel.Approved = Convert.ToInt16(dr["meeting_count"]);

                                    break;

                                case 3:
                                    appointmentStatusViewModel.Rejected = Convert.ToInt16(dr["meeting_count"]);

                                    break;

                                case 4:
                                    appointmentStatusViewModel.Completed = Convert.ToInt16(dr["meeting_count"]);

                                    break;

                                case 5:
                                    appointmentStatusViewModel.Total = Convert.ToInt16(dr["meeting_count"]);
                                    break;
                                }
                            }
                            dr.NextResult();
                        }

                        while (dr.Read())
                        {
                            Appointment app = new Appointment();
                            app.Extra   = Convert.ToString(dr["FirstName"]);
                            app.Extra  += ' ';
                            app.Extra  += (string)dr["LastName"];
                            app.From    = (DateTime)dr["_From"];
                            app.To      = (DateTime)dr["_To"];
                            app.Purpose = Convert.ToString(dr["Purpose"]);
                            appointments.Add(app);
                        }
                        appointmentStatusViewModel.appointments = appointments;
                    }
                }
            }
            return(appointmentStatusViewModel);
        }
Пример #6
0
 public AppointmentStatysWindow(AppointmentsList app1)
 {
     InitializeComponent();
     DataContext = new AppointmentStatusViewModel(app1);
 }