Example #1
0
 private void SignInCommandExecute(object obj)
 {
     try
     {
         string password = (obj as PasswordBox).Password;
         doctor  = dataBaseService.FindDoctorCredentials(UserName, password);
         patient = dataBaseService.FindPatientCredentials(UserName, password);
         if (doctor != null)
         {
             DoctorView doctorView = new DoctorView(doctor);
             login.Close();
             doctorView.Show();
             return;
         }
         else if (patient != null)
         {
             PatientView patientView = new PatientView(patient);
             login.Close();
             patientView.Show();
             return;
         }
         else
         {
             MessageBox.Show("Wrong usename or password");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
        public IActionResult Create(DoctorView doctor)
        {
            CreateDoctorModel create = new CreateDoctorModel(doctor.Name
                                                             , doctor.Specialty
                                                             , doctor.Phone);

            if (create.Invalid)
            {
                ViewData["NameError"] = create.Notifications
                                        .Where(w => w.Property == "Name")?
                                        .FirstOrDefault()?
                                        .Message;
                ViewData["SpecialtyError"] = create.Notifications
                                             .Where(w => w.Property == "Specialty")?
                                             .FirstOrDefault()?
                                             .Message;
                ViewData["PhoneError"] = create.Notifications
                                         .Where(w => w.Property == "Phone")?
                                         .FirstOrDefault()?
                                         .Message;

                ViewData["Doctor"] = doctor ?? new DoctorView();
                return(View("New"));
            }

            ViewData["DoctorView"] = _mapper.Map <DoctorView>(_doctorService.Create(create));
            return(View());
        }
        public IActionResult Alter(DoctorView doctor)
        {
            UpdateDoctorModel update = new UpdateDoctorModel(doctor.Id
                                                             , doctor.Name
                                                             , doctor.Specialty
                                                             , doctor.Phone);

            if (update.Invalid)
            {
                ViewData["IdError"] = update.Notifications
                                      .Where(w => w.Property == "Id")?
                                      .FirstOrDefault()?
                                      .Message;
                ViewData["NameError"] = update.Notifications
                                        .Where(w => w.Property == "Name")?
                                        .FirstOrDefault()?
                                        .Message;
                ViewData["SpecialtyError"] = update.Notifications
                                             .Where(w => w.Property == "Specialty")?
                                             .FirstOrDefault()?
                                             .Message;
                ViewData["PhoneError"] = update.Notifications
                                         .Where(w => w.Property == "Phone")?
                                         .FirstOrDefault()?
                                         .Message;

                ViewData["Doctor"] = doctor ?? new DoctorView();
                return(View("Edit"));
            }

            ViewData["DoctorView"] = _mapper.Map <DoctorView>(_doctorService.Update(update));
            return(View());
        }
        public ActionResult Register(DoctorView newDoctor)
        {
            bool anyUser = _repository.GetDoctors().Any(p => string.Compare(p.Email, newDoctor.Email) == 0);

            if (anyUser)
            {
                ModelState.AddModelError("Email", "Пользователь с таким email уже зарегистрирован");
            }


            if (ModelState.IsValid)
            {
                var currentDoctor = (Doctor)_mapper.Map(newDoctor, typeof(DoctorView), typeof(Doctor));
                currentDoctor.Password = PasswordHasher.GetHashPassword(currentDoctor.Password);
                this.SaveClient(currentDoctor);

                if (!SendEmail(currentDoctor))
                {
                    ModelState.AddModelError("Email", "Введите корректный емейл");
                    DeleteDoctor(currentDoctor.ID);
                    return(View(newDoctor));
                }


                return(RedirectToAction("Confirm", "Doctor"));
            }


            return(View(newDoctor));
        }
        public ResultSchedule(DateTime DatumS, DateTime DatumE, DoctorView Dr, String priority1)
        {
            InitializeComponent();
            this.DataContext = this;
            String priority = priority1;

            Dstart    = DatumS;
            Dend      = DatumE;
            DoctorS   = Dr;
            PriorityS = priority1;
            Dictionary <int, List <Appointment> > availableAppointments = Backend.App.Instance().DoctorWorkDayService.GetAvailableAppointmentsByDateRangeAndDoctorIdIncludingPriority(DatumS, DatumE, Int32.Parse(Dr.IdOfDoctor), priority);
            ObservableCollection <WorkDayView>    SlobodniTermini       = new ObservableCollection <WorkDayView>();

            SlobodniTermini     = new ObservableCollection <WorkDayView>(WorkDayConverter.CreateDoctorWorkDayDtos(Backend.App.Instance().DoctorWorkDayService.GetDoctorWorkDaysByIds(availableAppointments.Keys.ToList()), availableAppointments));
            SlobodniTerminiBind = new ObservableCollection <WorkDayViewView>();
            foreach (WorkDayView w in SlobodniTermini)
            {
                foreach (Appointment a in w.AvailableAppointments)
                {
                    SlobodniTerminiBind.Add(new WorkDayViewView {
                        Id = w.Id, DoctorId = w.DoctorId, RoomId = w.RoomId, IdOfRoom = w.IdOfRoom, Specialization = w.Specialization, DoctorFullName = w.DoctorFullName, Date = w.Date, AvailableAppointment = a
                    });
                }
            }
        }
        private void button_Copy_Click(object sender, RoutedEventArgs e)
        {
            DoctorView lekar = new DoctorView();

            lekar.Name           = this.imeTextBox.Text;
            lekar.Surname        = this.prezimeTextBox.Text;
            lekar.Specialisation = this.specijalizacijaTextBox.Text;


            Regex rgx          = new Regex("[^a-zA-Z0-9 -]");
            var   emailName    = rgx.Replace(lekar.Name, "");
            var   emailSurname = rgx.Replace(lekar.Surname, "");

            lekar.Email = emailName.ToLower() + "." + emailSurname.ToLower() + "@clinic.com";

            if (lekar.Name.Length == 0 || lekar.Surname.Length == 0)
            {
                System.Windows.MessageBox.Show("Niste uneli adekvatno ime lekara.");
                return;
            }

            Doctor doctor = lekar.Convert();

            doctor.Password = Crypt.Encrypt("");
            _controller.Add(doctor);

            lekar.Id = (uint)doctor.Id;
            EmployeesPage.AddDoctor(lekar);
            System.Windows.MessageBox.Show("Uspešno ste sačuvali informacije.");

            NavigationService.Navigate(new Page());
        }
        // GET: Doctors/Create
        public ActionResult Create()
        {
            var doctorView = new DoctorView()
            {
                Facilities      = facilityRepo.GetAll().ToList(),
                Specializations = specializationRepo.GetAll().ToList()
            };

            return(View(doctorView));
        }
        public ActionResult New()
        {
            ViewBag.Message = null;
            ViewBag.Status  = false;
            var department = this._contex.Departments.ToList();
            var doctorview = new DoctorView {
                Doctors = new Doctors(), Departments = department,
            };

            return(this.View(doctorview));
        }
 public DoctorProfilePage(DoctorView doctor)
 {
     _controller = (Application.Current as App).DoctorController;
     InitializeComponent();
     imeTextBox.Text             = doctor.Name;
     prezimeTextBox.Text         = doctor.Surname;
     emailTextBox.Text           = doctor.Email;
     workBeginTextBox.Text       = doctor.StartWorkingHours.ToString();
     workEndTextBox.Text         = doctor.EndWorkingHours.ToString();
     idLabel.Content             = doctor.Id.ToString();
     specijalizacijaTextBox.Text = doctor.Specialisation;
 }
 public void QuitExecute()
 {
     try
     {
         DoctorView doctorView = new DoctorView(UserAdmin);
         doctorView.Show();
         addDoctorView.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Example #11
0
 public void GoToDoctorExecute()
 {
     try
     {
         DoctorView main = new DoctorView(user);
         main.Show();
         administratorView.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
        public ActionResult Doctors()
        {
            var doctors     = this._contex.Doctorses.ToList();
            var departments = this._contex.Departments.ToList();

            var DrView = new DoctorView
            {
                Departments = departments,
                Doctorses   = doctors
            };

            return(PartialView(DrView));
        }
        public ActionResult Edit(int id)
        {
            var     department = this._contex.Departments.ToList();
            Doctors aDoctors   = this._contex.Doctorses.FirstOrDefault(dr => dr.Id == id);

            var DrView = new DoctorView
            {
                Departments = department,
                Doctors     = aDoctors
            };

            return(PartialView(DrView));
        }
Example #14
0
 /// <summary>
 /// This method checks if username and password valid.
 /// </summary>
 /// <param name="password">User input for password.</param>
 public void LogInExecute(object password)
 {
     Password = (password as PasswordBox).Password;
     if (Username == MasterUsername && Password == MasterPassword)
     {
         MasterView masterView = new MasterView(Username, Password);
         masterView.ShowDialog();
     }
     else if (users.FindAdministrator(Username, Password) != null)
     {
         Administrator = users.FindAdministrator(Username, Password);
         if (clinic.CheckIfClinicExists())
         {
             AdministratorView administratorView = new AdministratorView();
             administratorView.ShowDialog();
         }
         else
         {
             CreateClinicView clinicView = new CreateClinicView();
             clinicView.ShowDialog();
         }
     }
     else if (users.FindMaintenance(Username, Password) != null)
     {
         Maintenance = users.FindMaintenance(Username, Password);
         MaintenanceView maintenanceView = new MaintenanceView(Maintenance);
         maintenanceView.ShowDialog();
     }
     else if (users.FindManager(Username, Password) != null)
     {
         Manager = users.FindManager(Username, Password);
         ManagerView managerView = new ManagerView();
         managerView.ShowDialog();
     }
     else if (users.FindDoctor(Username, Password) != null)
     {
         Doctor = users.FindDoctor(Username, Password);
         DoctorView doctorView = new DoctorView();
         doctorView.ShowDialog();
     }
     else if (users.FindPatient(Username, Password) != null)
     {
         Patient = users.FindPatient(Username, Password);
         PatientView patientView = new PatientView();
         patientView.ShowDialog();
     }
     else
     {
         MessageBox.Show("Wrong username or password. Please, try again.", "Notification");
     }
 }
        public ScheduleForPatient(WorkDayViewView selectedAppointment, DateTime DatumS, DateTime DatumE, DoctorView Dr, String priority1)
        {
            InitializeComponent();
            this.DataContext = this;
            Dstart           = DatumS;
            Dend             = DatumE;
            DoctorS          = Dr;
            PriorityS        = priority1;

            AllPatients = new ObservableCollection <PatientView>(PatientConverter.ConvertPatientToPatientViewList(
                                                                     Backend.App.Instance().PatientService.GetAllEntities().ToList()));
            Pacijenti.SelectedIndex = 0;
            SelectedApp             = selectedAppointment;
        }
        private List <DoctorView> GetDoctorsToConfirm()
        {
            List <DoctorView> doctorsToConfirm = new List <DoctorView>();
            List <Doctor>     allDoctors       = _repository.GetDoctors().ToList();

            foreach (Doctor doctor in allDoctors)
            {
                if (((doctor.ConfirmAdmin == null) || (doctor.ConfirmAdmin == false)) && (doctor.ConfirmEmail == true))
                {
                    DoctorView tempDoctor = (DoctorView)_mapper.Map(doctor, typeof(Doctor), typeof(DoctorView));
                    doctorsToConfirm.Add(tempDoctor);
                }
            }
            return(doctorsToConfirm);
        }
        public ActionResult Edit(DoctorView doctorView)
        {
            if (ModelState.IsValid)
            {
                var facilities      = facilityRepo.GetByIds(doctorView.SelectedFacilityIds);
                var specializations = specializationRepo.GetByIds(doctorView.SelectedSpecializationIds);

                doctorRepo.Update(doctorView.Doctor);
                doctorRepo.SetFacilities(doctorView.Doctor, facilities.ToList());
                doctorRepo.SetSpecializations(doctorView.Doctor, specializations.ToList());
                doctorRepo.Save();

                return(RedirectToAction("Index"));
            }
            return(View(doctorView));
        }
Example #18
0
        public ActionResult MakePdf(Prescription prescription)
        {
            DoctorView doctor = new DoctorView();

            //string email = privacy.Encrypt(prescription.PatientEmail);
            using (var db = new MedicalContext())
            {
                var q =
                    (from a in db.Doctors
                     join p in db.Specialist on a.SpecialistId equals p.Id
                     where a.Id == prescription.DocId
                     select new
                {
                    dId = a.Id,
                    dName = a.Name,
                    dQualification = a.Degree,
                    dspecialist = p.Specialist
                });
                foreach (var j in q)
                {
                    doctor.DocName       = privacy.Decrypt(j.dName);
                    doctor.DocSpecialist = j.dspecialist;
                    doctor.DocDegree     = privacy.Decrypt(j.dQualification);
                }
                //var kl = from b in db.Registers
                //         where b.Email == email
                //         select new
                //         {

                //             PatientName = b.Name,

                //             PatientAge = b.Age
                //         };
                //foreach (var k in kl)
                //{

                //    prescription.PatientName = privacy.Decrypt(k.PatientName);
                //    prescription.PatientAge = k.PatientAge;
                //}

                ViewBag.Doctor = doctor;
                return(View(prescription));
            }
        }
        public ActionResult New()
        {
            var doctor = this.GetCurrentDoctor();

            if (doctor == null)
            {
                ViewBag.Message = null;
                ViewBag.Status  = false;

                var department = this._contex.Departments.ToList();
                var doctorview = new DoctorView {
                    Doctors = new Doctors(), Departments = department,
                };
                return(this.View(doctorview));
            }
            else
            {
                return(RedirectToAction("Index", "Doctor"));
            }
        }
Example #20
0
 public ActionResult Edit(DoctorView model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (_doctorBusiness.Edit(model))
             {
                 _doctorBusiness.Save();
                 return(Redirect("/Doctor/List"));
             }
         }
         ViewBag.DepartmentLst = _departmentBusiness.GetAll(true);
         return(View(model));
     }
     catch (Exception)
     {
         ViewBag.DepartmentLst = _departmentBusiness.GetAll(true);
         return(View(model));
     }
 }
        public ActionResult Edit(Doctors doctors)
        {
            var department = this._contex.Departments.ToList();
            var DrView     = new DoctorView
            {
                Departments = department
            };
            var Doctor = this._contex.Doctorses.Single(p => p.Id == doctors.Id);

            ModelState["DoctorPassword"].Errors.Clear();
            ModelState["DoctorConfirmPassword"].Errors.Clear();
            doctors.DoctorPassword        = Doctor.DoctorPassword;
            doctors.DoctorConfirmPassword = Doctor.DoctorPassword;

            if (ModelState.IsValid)
            {
                this._contex.Entry(doctors).State = EntityState.Modified;
                this._contex.SaveChanges();
                return(RedirectToAction("Index", "Admin"));
            }
            return(PartialView(DrView));
        }
        // GET: Doctors/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Doctor doctor = doctorRepo.GetById(id.Value);

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

            var doctorView = new DoctorView()
            {
                Facilities      = db.Facilities.ToList(),
                Specializations = specializationRepo.GetAll().ToList(),
                Doctor          = doctor
            };

            return(View(doctorView));
        }
        public ActionResult New(
            [Bind(Exclude = "IsEmailVerified,ActivationCode")]
            Doctors doctors)
        {
            bool   Status  = false;
            string Message = null;

            var ViewModel = new DoctorView {
                Doctors = new Doctors(), Departments = _contex.Departments.ToList(),
            };

            if (!ModelState.IsValid)
            {
                Message = "Invalid Request";
                return(this.View("New", ViewModel));
            }
            else
            {
                if (doctors.Id == 0)
                {
                    if (this.IsEmailExist(doctors.DoctorEmail))
                    {
                        this.ModelState.AddModelError("EmailExist", "Email is already exist");
                        return(this.View("New", ViewModel));
                    }

                    #region Generate Activation Code

                    doctors.ActivationCode = Guid.NewGuid();

                    #endregion

                    #region Password Hashing

                    doctors.DoctorPassword        = Crypto.Hash(doctors.DoctorPassword);
                    doctors.DoctorConfirmPassword = Crypto.Hash(doctors.DoctorConfirmPassword);

                    #endregion

                    doctors.IsEmailVarified = false;

                    #region Image file upload

                    string fileName = Path.GetFileName(doctors.DoctorImagefile.FileName);
                    doctors.DoctorImagePath = "/Image/doctors/" + fileName;
                    fileName = Path.Combine(Server.MapPath("~/Image/doctors/"), fileName);

                    #endregion

                    #region Save Data

                    doctors.DoctorImagefile.SaveAs(fileName);
                    this._contex.Doctorses.Add(doctors);
                    this._contex.SaveChanges();

                    #endregion

                    #region Send Email

                    var url        = "/Doctor/VarifyAccount/" + doctors.ActivationCode.ToString();
                    var requestUrl = this.Request.Url;
                    if (requestUrl != null)
                    {
                        string link = requestUrl.AbsoluteUri.Replace(requestUrl.PathAndQuery, url);
                        Email.SendVarificationEmail(doctors.DoctorEmail, link);
                    }

                    Message = "Registration successfully done, Check your Email";
                    Status  = true;

                    this.ViewBag.Message = Message;
                    this.ViewBag.Status  = true;

                    #endregion
                }
                else
                {
                    var doctorInDb = this._contex.Doctorses.Single(d => d.Id == doctors.Id);
                    doctorInDb.DoctorName      = doctors.DoctorName;
                    doctorInDb.DoctorBirthDate = doctors.DoctorBirthDate;
                    doctorInDb.DepartmentId    = doctors.DepartmentId;
                    this._contex.SaveChanges();
                }

                return(View("New", ViewModel));
            }

            this.ViewBag.Message = Message;
            this.ViewBag.Status  = Status;

            return(this.View());
        }
        public void DoctorExecute()
        {
            DoctorView doctorView = new DoctorView();

            doctorView.ShowDialog();
        }
Example #25
0
 public bool Add(DoctorView model)
 {
     return(_doctor.Add(model));
 }
 public IActionResult New()
 {
     ViewData["Doctor"] = new DoctorView();
     return(View());
 }
Example #27
0
 public bool Edit(DoctorView model)
 {
     return(_doctor.Edit(model));
 }
 public static void AddDoctor(DoctorView doctor)
 {
     DoctorList.Add(doctor);
 }
Example #29
0
 public DoctorViewModel(DoctorView doctorViewOpen, tblDoctor doctorInstance)
 {
     doctorView = doctorViewOpen;
     Doctor     = doctorInstance;
 }
        public void SaveExecute(object parametar)
        {
            var passwordBox = parametar as PasswordBox;
            var password    = passwordBox.Password;

            User.Password = password;
            User.GenderId = selectedGender.GenderId;
            User.RoleId   = 4;
            try
            {
                if (User.ClinicUserId == 0)
                {
                    bool uniqueNumber      = service.CheckUniqueNumber(UserDoctor.UniqueNumber);
                    bool uniqueBancAccount = service.CheckBancAccount(UserDoctor.BancAccount);
                    if (uniqueNumber && uniqueBancAccount)
                    {
                        int userId = service.AddClinicUser(User);
                        if (userId != 0)
                        {
                            UserDoctor.ClinicUserId    = userId;
                            UserDoctor.DepartmentId    = selectedDepartment.DepartmentId;
                            UserDoctor.WorkShiftId     = selectedWorkShift.WorkShiftId;
                            UserDoctor.ClinicManagerId = selectedManager.ClinicManagerId;

                            if (service.AddNewDoctor(UserDoctor) != 0)
                            {
                                MessageBox.Show("You have successfully added new doctor");
                                Logging.LoggAction("AddDoctorViewModel", "Info", "Succesfull added new doctor");

                                DoctorView doctorView = new DoctorView(UserAdmin);
                                doctorView.Show();
                                addDoctorView.Close();
                            }
                        }
                    }
                }
                else
                {
                    int userId = service.AddClinicUser(User);
                    if (userId != 0)
                    {
                        UserDoctor.ClinicUserId    = userId;
                        UserDoctor.DepartmentId    = selectedDepartment.DepartmentId;
                        UserDoctor.WorkShiftId     = selectedWorkShift.WorkShiftId;
                        UserDoctor.ClinicManagerId = selectedManager.ClinicManagerId;

                        if (service.AddNewDoctor(UserDoctor) != 0)
                        {
                            MessageBox.Show("You have successfully added new doctor");
                            Logging.LoggAction("AddDoctorViewModel", "Info", "Succesfull added new doctor");

                            DoctorView doctorView = new DoctorView(UserAdmin);
                            doctorView.Show();
                            addDoctorView.Close();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                Logging.LoggAction("AddDoctorViewModel", "Error", ex.ToString());
            }
        }