//
 // GET: /TalonOrder/
 public ActionResult Index(int policlinicId)
 {
     var repository = new Repository();
     ViewBag.PoliclinicId = policlinicId;
     ViewBag.Specializations = repository.GetAllSpecializations();
     return View();
 }
 //
 // GET: /Policlinic/
 public ActionResult Index(int policlinicId)
 {
     ViewBag.PoliclinicId = policlinicId;
     var repository = new Repository();
     ViewBag.Policlinic = repository.GetPoliclinicById(policlinicId);
     return View();
 }
Beispiel #3
0
 public ActionResult Index(int regionId)
 {
     ViewBag.RegionId = regionId;
     var repository = new Repository();
     ViewBag.Region = repository.GetRegionById(regionId);
     ViewBag.Policlinics = repository.GetPoliclinicsByRegionId(regionId);
     return View();
 }
Beispiel #4
0
 public ActionResult CancelOrder(int policlinicId, int patientId, int visitHistoryId)
 {
     var repository = new Repository();
     var history = repository.GetVisitHistoryById(visitHistoryId);
     repository.SetUnusedAvailableTimeById(history.AvailableTime.AvailableTimeId);
     repository.DeleteVisitHistory(visitHistoryId);
     return RedirectToAction("History", new {policlinicId = policlinicId, patientId = patientId});
 }
 public ActionResult OrderStep1(int policlinicId, int specializationId)
 {
     var repository = new Repository();
     ViewBag.PoliclinicId = policlinicId;
     ViewBag.SpecializationId = specializationId;
     var avalibleDoctors = repository.GetDoctorsBySpecializationId(specializationId);
     ViewBag.Doctors = avalibleDoctors;
     return View();
 }
Beispiel #6
0
 public ActionResult HomeVisitHistory(int policlinicId, int patientId)
 {
     var repository = new Repository();
     var homeVisitHistories = repository.GetHomeVisitHistoriesByPatientIdAndPoliclinicId(policlinicId, patientId);
     ViewBag.PoliclinicId = policlinicId;
     ViewBag.PatientId = patientId;
     ViewBag.Histories = homeVisitHistories;
     return View();
 }
 public ActionResult OrderStep2(int specializationId, int doctorId = -1, int policlinicId = -1)
 {
     var repository = new Repository();
     var avaliableDates = repository.GetAvailableTimesByDoctorId(doctorId).Where(t => t.Time > DateTime.Now).Select(t => t.Time);
     ViewBag.PoliclinicId = policlinicId;
     ViewBag.SpecializationId = specializationId;
     ViewBag.DoctorId = doctorId;
     ViewBag.Dates = avaliableDates.DistinctBy(t => t.Date).ToList();
     return View();
 }
Beispiel #8
0
 public int ValidateOrder(Patient patient, int doctorId, string date, string time)
 {
     var repository = new Repository();
     var result = repository.IsPatientExists(patient);
     if (result == -1)
     {
         return -1;
     }
     if (!repository.SetUsedAvailableTimeByTime(DateTime.Parse(date + " " + time), result))
     {
         return -1;
     }
     var availableTime = repository.GetAvailableTimeByTime(DateTime.Parse(date + " " + time));
     return availableTime != null ? repository.AddOrder(result, doctorId, availableTime.AvailableTimeId) : -1;
 }
Beispiel #9
0
 public int ValidateHomeOrder(Patient patient, string date, int policlinicId)
 {
     var repository = new Repository();
     var result = repository.IsPatientExists(patient);
     if (result == -1)
     {
         return -1;
     }
     return repository.AddHomeVisitHistory(new HomeVisitHistory()
     {
         Date = DateTime.Parse(date),
         Policlinic = repository.GetPoliclinicById(policlinicId),
         Patient = patient
     });
 }
 public ActionResult OrderStep3(string date, int specializationId, int doctorId = -1, int policlinicId = -1)
 {
     var repository = new Repository();
     var availableTimes = repository.GetAvailableTimesByDoctorId(doctorId).Where(t => t.Time > DateTime.Now).Select(t => t.Time);
     var toView = new Dictionary<int, List<DateTime>>();
     var res = availableTimes.GroupBy(t => t.Hour);
     foreach (var re in res)
     {
         var minutes = new List<DateTime>();
         foreach (var minute in re)
         {
             minutes.Add(minute);
         }
         toView.Add(re.Key, minutes);
     }
     ViewBag.PoliclinicId = policlinicId;
     ViewBag.SpecializationId = specializationId;
     ViewBag.DoctorId = doctorId;
     ViewBag.Date = date;
     ViewBag.Times = toView;
     return View();
 }
Beispiel #11
0
 public int ValidateUser(Patient patient)
 {
     var repository = new Repository();
     return repository.IsPatientExists(patient);
 }
 public ActionResult OrderStep5(int orderId)
 {
     var repository = new Repository();
     var order = repository.GetVisitHistoryById(orderId);
     ViewBag.Order = order;
     return View();
 }
Beispiel #13
0
 public ActionResult CancelHomeOrder(int policlinicId, int patientId, int homeVisitHistoryId)
 {
     var repository = new Repository();
     repository.DeleteHomeVisitHistory(homeVisitHistoryId);
     return RedirectToAction("HomeVisitHistory", new {policlinicId = policlinicId, patientId = patientId});
 }