public IActionResult Delete(int?id, DoctorsViewModel doctorsView)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var instance = _context.Doctors.SingleOrDefault(m => m.DoctorsId == id);

            doctorsView.Doctor = instance;
            doctorsView.doctorsOperationFlag = "Delete";
            //doctorsView.doctorsOperationFlag = "Delete";
            if ((instance == null) || (!instance.DoctorsExistedFlag))
            {
                return(NotFound());
            }
            // В случае вызова формы создания профиля модальным окном возвращать частичное представление.
            if (Request.Headers["X-Requested-With"] == "XMLHttpRequest")
            {
                return(PartialView("Details", doctorsView));
            }
            // В случае вызова формы создания профиля отдельным окном (отдельной вкладкой) возвращать полное представление.
            else
            {
                return(View("Details", doctorsView));
            }
        }
示例#2
0
        public ActionResult addOrUpdate(DoctorsViewModel model)
        {
            if (model.Id == 0)
            {
                doctorRepository.InsertDoctor(model);
            }
            else
            {
                var doctor = db.Doctors.Where(x => x.Id == model.Id).FirstOrDefault();

                if (doctor != null)
                {
                    doctor.FirstName    = model.FirstName;
                    doctor.LastName     = model.LastName;
                    doctor.BirthDate    = model.BirthDate;
                    doctor.Address      = model.Address;
                    doctor.Email        = model.Email;
                    doctor.PhoneNumber  = model.PhoneNumber;
                    doctor.City         = model.City;
                    doctor.DoctorGender = model.DoctorGender;
                    doctorRepository.UpdateDoctor(doctor);
                }
            }
            doctorRepository.Save();
            return(RedirectToAction("Index"));
        }
示例#3
0
        public DoctorsView(DoctorsViewModel doctorsViewModel)
        {
            InitializeComponent();
            _viewModel = doctorsViewModel;

            //DGV
            _dataGridViewDoctors.AutoGenerateColumns = false;
            _dataGridViewDoctors.DataSource          = _viewModel.Doctors;
            _columnOrderNumber.DataPropertyName      = nameof(Doctor.OrderNumber);
            _columnFirstName.DataPropertyName        = nameof(Doctor.FirstName);
            _columnLastName.DataPropertyName         = nameof(Doctor.LastName);
            _columnMiddleName.DataPropertyName       = nameof(Doctor.MiddleName);
            _columnSpec.DataPropertyName             = nameof(Doctor.SpecializationName);

            //привязка текстбоксов
            _textBoxLastName.DataBindings.Add("Text", _viewModel,
                                              nameof(_viewModel.LastName), true, DataSourceUpdateMode.OnPropertyChanged);
            _textBoxFirstName.DataBindings.Add("Text", _viewModel,
                                               nameof(_viewModel.FirstName), true, DataSourceUpdateMode.OnPropertyChanged);
            _textBoxMiddleName.DataBindings.Add("Text", _viewModel,
                                                nameof(_viewModel.MiddleName), true, DataSourceUpdateMode.OnPropertyChanged);

            //привязка комбобокса
            _comboBoxSpecialization.DataSource    = _viewModel.Specializations;
            _comboBoxSpecialization.DisplayMember = nameof(Specialization.Name);

            _buttonSave.Click += ButtonSave_Click;
            this.Load         += DoctorsView_Load;
        }
        public IActionResult CreateDoctorsAppointment(int id, string date)
        {
            var doctor = _context.Doctors.Include(d => d.ClinicalDepartment).Include(d => d.DoctorsAppointments).Where(s => s.DoctorsExistedFlag).SingleOrDefault(m => m.DoctorsId == id);
            DoctorsViewModel instance = new DoctorsViewModel();

            instance.DoctorsAppointment = new DoctorsAppointments();
            instance.Doctor             = doctor;
            if (date != null)
            {
                instance.DoctorsAppointment.DoctorAppointmentsDate = date;
                instance.DoctorsAppointmentss = _context.DoctorsAppointments.Where(d => d.DoctorAppointmentsExistedFlag && d.DoctorsId == id && d.DoctorAppointmentsDate == date && d.CustomerId == null).OrderBy(d => d.DoctorAppointmentsTime).ToList();
            }
            int    loggedInUserId;
            Claim  user      = User.FindFirst(c => c.Type == ClaimTypes.SerialNumber);
            string userValue = user.Value;

            Int32.TryParse(userValue, out loggedInUserId);
            Customer currentCustomer = _context.Customer.FirstOrDefault(c => c.CustomerExistedFlag && c.UsersId == loggedInUserId);

            instance.Customers = currentCustomer;
            // В случае вызова формы создания профиля модальным окном возвращать частичное представление.
            if (Request.Headers["X-Requested-With"] == "XMLHttpRequest")
            {
                return(PartialView(instance));
            }
            // В случае вызова формы создания профиля отдельным окном (отдельной вкладкой) возвращать полное представление.
            else
            {
                return(View(instance));
            }
        }
        public MainViewModel()
        {
            DoctorsVM     = new DoctorsViewModel();
            SpecialtyesVM = new SpecialtyesViewModel();
            PatientsVM    = new PatientsViewModel();
            ReceptionsVM  = new ReceptionsViewModel();

            CurrentView = ReceptionsVM;

            DoctorsViewCommand = new RelayCommand(o =>
            {
                CurrentView = DoctorsVM;
            });

            SpecialtyesViewCommand = new RelayCommand(o =>
            {
                CurrentView = SpecialtyesVM;
            });

            PatientsViewCommand = new RelayCommand(o =>
            {
                CurrentView = PatientsVM;
            });

            ReceptionsViewCommand = new RelayCommand(o =>
            {
                CurrentView = ReceptionsVM;
            });
        }
        public IActionResult CreateDoctorsAppointment(DoctorsViewModel doctorAppointment, int id)
        {
            // Если id не соответствуют, то, значит, такого нет, и возвращется HTTP-ответ с кодом 404 ("Не найдено").
            if (id != doctorAppointment.Doctor.DoctorsId)
            {
                return(NotFound());
            }

            // Проверка модели на правильность.
            try
            {
                // Отметка о том, что профиль активный (не удалённый).
                doctorAppointment.DoctorsAppointment.DoctorAppointmentsExistedFlag = true;
                doctorAppointment.DoctorsAppointment.DoctorAppointmentsId          = _context.DoctorsAppointments.AsNoTracking().FirstOrDefault(d => d.DoctorAppointmentsExistedFlag && d.DoctorsId == id && d.DoctorAppointmentsDate == doctorAppointment.DoctorsAppointment.DoctorAppointmentsDate && d.DoctorAppointmentsTime == doctorAppointment.DoctorsAppointment.DoctorAppointmentsTime && d.CustomerId == null).DoctorAppointmentsId;
                doctorAppointment.DoctorsAppointment.DoctorsId = id;
                // Занесение сделанных правок в базу данных.
                _context.Update(doctorAppointment.DoctorsAppointment);
                // Сохранение изменений в базе данных.
                _context.SaveChanges();
            }
            // Проверка на конкурирующие запросы к базе данных.
            catch (DbUpdateConcurrencyException)
            {
                // Если такого профиля нет, то возвращется HTTP-ответ с кодом 404 ("Не найдено").
                if ((!InstanceExists(doctorAppointment.DoctorsAppointment.DoctorAppointmentsId)) || (!doctorAppointment.DoctorsAppointment.DoctorAppointmentsExistedFlag))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            return(new EmptyResult());
        }
        public IActionResult Index(int id)
        {
            DoctorsViewModel model = new DoctorsViewModel
            {
                Doctors            = _context.Doctors.Include(d => d.DoctorTeamLinks).Take(6).ToList(),
                DoctorTeamLinks    = _context.DoctorTeamLinks.Include(d => d.Doctor).ToList(),
                PatientSay         = _context.PatientSays.Take(3).ToList(),
                Randevu            = _context.Randevu.ToList(),
                Randevus           = _context.Randevu.FirstOrDefault(),
                AppointmentKind    = _context.AppointmentKind.ToList(),
                ClinicOpeningHours = _context.ClinicOpeningHours.ToList(),
                AppointmentTimes   = _context.AppointmentTimes.ToList(),

                Clients    = _context.Clients.ToList(),
                BreadCrumb = new BreadCrumbViewModel
                {
                    Title = "Həkimlərimiz",
                    Links = new List <string>
                    {
                        "Ana Səhifə",
                        "Həkimlərimiz"
                    }
                }
            };

            return(View(model));
        }
示例#8
0
        public async Task <ActionResult> Index(DoctorsViewModel model)
        {
            try
            {
                string response = await APICallerExtensions.APICallAsync("Doctors/UpdateStatus", model, false, HttpContext.Session.GetObject(StorageType.Token).ToString());

                if (response.ToLower().Contains("exception:"))
                {
                    ModelState.AddModelError(string.Empty, response);
                    return(RedirectToAction(nameof(Index)));
                }
                var content = JsonConvert.DeserializeObject <SingleResponse <DoctorsViewModel> >(response);
                if (!content.DidError)
                {
                    return(RedirectToAction(nameof(Index)));
                }
                else
                {
                    ModelState.AddModelError(string.Empty, content.Message);
                    return(RedirectToAction(nameof(Index)));
                }
            }
            catch
            {
                return(RedirectToAction(nameof(Index)));
            }
        }
        public async Task <object> UpdateStatus([FromBody] DoctorsViewModel model)
        {
            try
            {
                var user = new ApplicationUser();
                user = await _userManager.FindByEmailAsync(model.Email);

                user.IsApproved = model.Status;
                var result = await _userManager.UpdateAsync(user);

                return(new SingleResponse <object>
                {
                    Message = "Status Updated",
                    DidError = false,
                    ErrorMessage = string.Empty,
                    Token = string.Empty,
                    Model = null
                });
                //return RedirectToAction(nameof(Index));
            }
            catch (Exception ex)
            {
                //return View();
                return(new SingleResponse <object>
                {
                    Message = "Status Update Failed",
                    DidError = true,
                    ErrorMessage = ex.Message,
                    Token = string.Empty,
                    Model = null
                });
            }
        }
示例#10
0
        public void ShowDoctorsView()
        {
            var vm   = new DoctorsViewModel(this);
            var from = new DoctorsView(vm);

            from.Owner = _mainfrom;
            from.ShowDialog();
        }
示例#11
0
        public DoctorsPage()
        {
            InitializeComponent();

            _doctorsViewModel            = new DoctorsViewModel();
            Doctors_DataGrid.ItemsSource = _doctorsViewModel.Doctors;
            _doctorsViewModel.UpdateDoctorsAsync().ConfigureAwait(false);
        }
示例#12
0
 public SampleAddViewModel(PatientViewModel patient)
 {
     this._patient    = patient;
     _patientName     = patient.Name + " " + patient.Surname;
     this._doctorsVM  = new DoctorsViewModel();
     this._allDoctors = _doctorsVM.AllDoctors;
     _labWorker       = new LabWorker();
 }
示例#13
0
        public ActionResult Doctors(int hospitalId)
        {
            var model = new DoctorsViewModel
            {
                Hospital = _hospitalRepo.Get(hospitalId),
                Doctors  = _doctorRepo.GetDoctors().Where(d => d.HospitalID == hospitalId).ToList()
            };

            return(View(model));
        }
示例#14
0
        public ActionResult New()
        {
            var doctor             = new Doctor();
            DoctorsViewModel model = new DoctorsViewModel
            {
                Doctor           = doctor,
                DoctorCategories = _categories.Get()
            };

            return(View("DoctorsForm", model));
        }
 public DoctorsController(ApplicationDbContext db, HostingEnvironment hostingEnvironment)
 {
     _db = db;
     _hostingEnvironment = hostingEnvironment;
     DoctorsVM           = new DoctorsViewModel()
     {
         Specialties    = _db.Specialties.ToList(),
         SubSpecialties = _db.SubSpecialties.ToList(),
         Doctors        = new Models.Doctors()
     };
 }
示例#16
0
 public void Setup()
 {
     unitOfWork        = new UnitOfWork();
     appViewModel      = new Mock <IApplicationViewModel <Administrator> >();
     dispatcherWrapper = new DispatcherWrapper();
     parentPage        = new ParentPage();
     security          = new Security();
     viewModel         = new DoctorsViewModel(unitOfWork, appViewModel.Object, dispatcherWrapper, security)
     {
         ParentPage = parentPage
     };
 }
        public ScheduleAppointmentWindowViewModel(CaseViewModel caseVM)
        {
            this._caseViewModel = caseVM;
            this._database      = new Database();
            this._doctorsVM     = new DoctorsViewModel();
            this._allDoctors    = _doctorsVM.AllDoctors;
            _patientName        = caseVM.PatientName + " " + caseVM.PatientSurname;
            _receptionist       = new Receptionist();
            List <String> appointmentTimes = this.getListOfAppointmentTimes();

            _appointmentTimes = this.createObservableCollectionOfAppointmentTimes(appointmentTimes);
        }
        public async Task <IActionResult> DoctorsInCategory(string categoryName)
        {
            var viewModel = new DoctorsViewModel();
            var doctors   = await this.doctorsService.GetDoctorsByCategoryNameAsync <IndexDoctorViewModel>(categoryName);

            var categoriesNames = await this.categoriesService.GetCategoriesNames();

            viewModel.CategoryName   = categoryName;
            viewModel.Doctors        = doctors;
            viewModel.CategoiesNames = categoriesNames;

            return(this.View(viewModel));
        }
        public IActionResult DoctorInfo([FromQuery] int doctorId)
        {
            DoctorAdmin doctors = new ServiceNode <object, DoctorAdmin>(_fc).GetClient($"/api/doctors/get/{doctorId}").Data;
            QueryCount  count   = new ServiceNode <object, QueryCount>(_fc).GetClient($"/api/online_query/query/count/{doctorId}").Data;
            List <Lang> langs   = new ServiceNode <object, List <Lang> >(_fc).GetClient("/api/lang/all").Data;
            var         model   = new DoctorsViewModel();

            model.QCount         = count.QCount;
            model.Doctor         = doctors;
            model.Languages      = langs;
            ViewData["DoctorId"] = doctorId;
            return(View(model));
        }
 public void InsertDoctor(DoctorsViewModel model)
 {
     context.Doctors.Add(new Doctors
     {
         BirthDate    = model.BirthDate,
         LastName     = model.LastName,
         FirstName    = model.FirstName,
         Address      = model.Address,
         City         = model.City,
         Email        = model.Email,
         PhoneNumber  = model.PhoneNumber,
         DoctorGender = model.DoctorGender
     });
 }
示例#21
0
        public DoctorsViewModel UpdateDoctors(int _id_doctor, DoctorsViewModel _doctor)
        {
            DoctorsEntity upd_doctor = new DoctorsEntity();

            upd_doctor.Person.Name     = _doctor.Name;
            upd_doctor.Person.Surname  = _doctor.Surname;
            upd_doctor.Person.Address  = _doctor.Address;
            upd_doctor.Person.Phone    = _doctor.Phone;
            upd_doctor.Department.Name = _doctor.Department;

            new DoctorsRepository().Update(_id_doctor, upd_doctor);

            return(this.ReadOneDoctor(_id_doctor));
        }
 public async Task <object> Index(UserModel userModel)
 {
     try
     {
         var list = new List <ApplicationUserListViewModel>();
         foreach (var user in _userManager.Users.ToList())
         {
             list.Add(new ApplicationUserListViewModel()
             {
                 UserEmail  = user.Email,
                 Roles      = await _userManager.GetRolesAsync(user),
                 IsApproved = user.IsApproved
             });
         }
         DoctorsViewModel model = new DoctorsViewModel();
         model.UserList = new List <ApplicationUserListViewModel>();
         foreach (var user in list)
         {
             foreach (var role in user.Roles)
             {
                 if (role == "Doctor")
                 {
                     model.UserList.Add(user);
                 }
             }
         }
         //return View(model);
         return(new SingleResponse <DoctorsViewModel>
         {
             Message = "User info fetched into model",
             DidError = false,
             ErrorMessage = string.Empty,
             Token = string.Empty,
             Model = model
         });
     }
     catch (Exception ex)
     {
         return(new SingleResponse <DoctorsViewModel>
         {
             Message = ex.Message,
             DidError = true,
             ErrorMessage = ex.InnerException.ToString(),
             Token = string.Empty,
             Model = new DoctorsViewModel()
         });
     }
 }
示例#23
0
        public DoctorsViewModel InsertDoctors(DoctorsViewModel _doctor)
        {
            DoctorsEntity new_doctor = new DoctorsEntity();

            new_doctor.Person          = new PersonsEntity();
            new_doctor.Person.Name     = _doctor.Name;
            new_doctor.Person.Surname  = _doctor.Surname;
            new_doctor.Person.Address  = _doctor.Address;
            new_doctor.Person.Phone    = _doctor.Phone;
            new_doctor.Department      = new DepartmentsEntity();
            new_doctor.Department.Name = _doctor.Department;

            new DoctorsRepository().Insert(new_doctor);

            return(this.ReadOneDoctor(0));
        }
示例#24
0
        public ActionResult Edit(int id)
        {
            var doctor = _repository.Get(id);

            if (doctor == null)
            {
                return(NotFound());
            }

            DoctorsViewModel model = new DoctorsViewModel
            {
                Doctor           = doctor,
                DoctorCategories = _categories.Get()
            };

            return(View("DoctorsForm", model));
        }
 public IActionResult Create(int?id)
 {
     if (id != null)
     {
         var doctor = _context.Doctors.Include(d => d.ClinicalDepartment).Include(d => d.DoctorsAppointments).Where(s => s.DoctorsExistedFlag).SingleOrDefault(m => m.DoctorsId == id);
         DoctorsViewModel instance = new DoctorsViewModel();
         instance.Doctor = doctor;
         instance.ClinicalDepartments  = _context.ClinicalDepartment.Where(c => c.ClinicalDepartmentExistedFlag).ToList();
         instance.DoctorsAppointmentss = _context.DoctorsAppointments.Where(d => d.DoctorAppointmentsExistedFlag && d.DoctorsId == id).ToList();
         if (instance.DoctorsAppointmentss.Any())
         {
             instance.doctorsStartDate = (Convert.ToDateTime(instance.DoctorsAppointmentss.First().DoctorAppointmentsDate)).Date.ToShortDateString();
             instance.doctorsStopDate  = (Convert.ToDateTime(instance.DoctorsAppointmentss.Last().DoctorAppointmentsDate)).Date.ToShortDateString();
         }
         // В случае вызова формы создания профиля модальным окном возвращать частичное представление.
         if (Request.Headers["X-Requested-With"] == "XMLHttpRequest")
         {
             return(PartialView(instance));
         }
         // В случае вызова формы создания профиля отдельным окном (отдельной вкладкой) возвращать полное представление.
         else
         {
             return(View(instance));
         }
     }
     else
     {
         // В случае вызова формы создания профиля модальным окном возвращать частичное представление.
         if (Request.Headers["X-Requested-With"] == "XMLHttpRequest")
         {
             DoctorsViewModel returnView = new DoctorsViewModel();
             returnView.Doctor = new Doctors();
             returnView.ClinicalDepartments = _context.ClinicalDepartment.Where(c => c.ClinicalDepartmentExistedFlag).ToList();
             return(PartialView(returnView));
         }
         // В случае вызова формы создания профиля отдельным окном (отдельной вкладкой) возвращать полное представление.
         else
         {
             DoctorsViewModel returnView = new DoctorsViewModel();
             returnView.Doctor = new Doctors();
             returnView.ClinicalDepartments = _context.ClinicalDepartment.Where(c => c.ClinicalDepartmentExistedFlag).ToList();
             return(View(returnView));
         }
     }
 }
示例#26
0
        public DoctorsViewModel ReadOneDoctor(int _id)
        {
            DoctorsEntity    _doctor   = new DoctorsRepository().ReadOne(_id);
            DoctorsViewModel doctor_vm = new DoctorsViewModel();

            doctor_vm = new DoctorsViewModel
            {
                Id          = _doctor.Id,
                DoctorNS    = _doctor.Person.Name + ' ' + _doctor.Person.Surname,
                Address     = _doctor.Person.Address,
                Phone       = _doctor.Person.Phone,
                Department  = _doctor.Department.Name,
                Specialties = string.Join(", ", _doctor.Specialties.Select(i => i.Name)),
                Removed     = _doctor.Removed
            };

            return(doctor_vm);
        }
示例#27
0
        public async Task <IActionResult> Index()
        {
            var docName = _userManager.GetUserName(User);

            var docViewModel = new DoctorsViewModel
            {
                Appointments = await _appointmentsRepository.GetByDoctorName(docName)
            };


            if (docViewModel.Appointments.Count != 0)
            {
                foreach (var appointment in docViewModel.Appointments)
                {
                    appointment.Patient = await _patientsRepository.Get(appointment.PatientId);
                }
            }

            return(View(docViewModel));
        }
示例#28
0
        public async Task <IActionResult> Index()
        {
            var user = await _doctorsRepository.GetDoctorByName(User.Identity.Name);

            var doctorsViewModel = new DoctorsViewModel
            {
                Appointments        = _appointmentsRepository.GetTodaysAppointmentByDoctorName(user.Name),
                NextDoctorsAbsences = _absenceRepository.GetNextDoctorAbsences(user.DoctorId)
            };

            if (doctorsViewModel.NextDoctorsAbsences.Count != 0)
            {
                foreach (var appointment in doctorsViewModel.Appointments)
                {
                    appointment.Patient = await _patientsRepository.GetPatientById(appointment.PatientId);
                }
            }

            return(View(doctorsViewModel));
        }
示例#29
0
        public async Task <ActionResult> Save(DoctorsViewModel model, IFormFile file)
        {
            if (!ModelState.IsValid)
            {
                model.DoctorCategories = _categories.Get();
                return(View("DoctorsForm", model));
            }

            if (file != null && !string.IsNullOrWhiteSpace(file.FileName))
            {
                model.Doctor.ImagePath = await ServerFiles.SaveImageToLocalFiles(_environment, file, ServerFiles.doctors);
            }

            if (model.Doctor.Id == 0)
            {
                _repository.Create(model.Doctor);
            }
            else
            {
                _repository.Update(model.Doctor);
            }

            return(RedirectToAction("Index", "Doctors"));
        }
示例#30
0
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     this.MyViewModel = (DoctorsViewModel)this.DataContext;
     this.MyViewModel.loadData();
     this.DocList.ItemsSource = this.MyViewModel.DoctorList;
 }