private void Fill()
        {
            switch (type)
            {
            case Enums.CommonOperationType.ODoctor:
                pnlNurse.Visible  = false;
                pnlDoctor.Visible = true;
                using (var uow = (AdoNetUnitOfWork)UnitOfWorkFactory.Create(UnitOfWorkFactory.ConnectionType.SQL, Connection.connectionString))
                {
                    var docRepos = new DoctorRepository(uow);
                    cmbDoc.ValueMember   = "ID";
                    cmbDoc.DisplayMember = "FullName";
                    cmbDoc.DataSource    = docRepos.GetAllDoctorsL();
                    cmbDoc.Text          = "Choose A Doctor...";
                }
                break;

            case Enums.CommonOperationType.ONurse:
                pnlDoctor.Visible = false;
                pnlNurse.Visible  = true;
                using (var uow = (AdoNetUnitOfWork)UnitOfWorkFactory.Create(UnitOfWorkFactory.ConnectionType.SQL, Connection.connectionString))
                {
                    var nurseRepos = new NurseRepository(uow);
                    cmbNurse.ValueMember   = "ID";
                    cmbNurse.DisplayMember = "FullName";
                    cmbNurse.DataSource    = nurseRepos.GetAllNursesL();
                    cmbNurse.Text          = "Choose A Nurse...";
                }
                break;
            }
        }
        private void btnDocLeave_Click(object sender, EventArgs e)
        {
            int  data   = 0;
            bool _excep = false;

            using (var uow = (AdoNetUnitOfWork)UnitOfWorkFactory.Create(UnitOfWorkFactory.ConnectionType.SQL, Connection.connectionString))
            {
                try
                {
                    Models.AnnualLeave annualLeave = new Models.AnnualLeave()
                    {
                        WorkerID   = (int)cmbDoc.SelectedValue,
                        WorkerType = (int)type,
                        Duration   = Convert.ToInt32(txtLeaveDuration.Text),
                        LeaveType  = chkDHasReport.Checked ? 2 : 1,
                        DocID      = (int)cmbExtraDoctor.SelectedValue
                    };
                    var dRepos = new DoctorRepository(uow);
                    data = dRepos.InsertAnnual(annualLeave);
                    uow.SaveChanges();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    _excep = true;
                }
                if (data == 3 && _excep == false)
                {
                    MessageBox.Show("The operation is successfull");
                }
            }
        }
Example #3
0
        protected void CreateUser_Click(object sender, EventArgs e)
        {
            var manager = new UserManager();
            var user    = new ApplicationUser()
            {
                UserName = UserName.Text
            };
            var identiyRole = new IdentityUserRole();

            identiyRole.RoleId = cbRoles.SelectedItem.Value.ToString();
            identiyRole.UserId = user.Id;
            user.Roles.Add(identiyRole);
            IdentityResult result = manager.Create(user, Password.Text);

            if (result.Succeeded)
            {
                var doc = new Doctor()
                {
                    DoctorID = int.Parse(ViewState["DoctorID"].ToString()), UserID = identiyRole.UserId
                };
                DoctorRepository doctorRepository = new DoctorRepository();
                doctorRepository.updateDoctorUserID(doc);


                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Saved sucessfully');window.location ='Doctors.aspx';", true);
            }
            else
            {
                ErrorMessage.Text = result.Errors.FirstOrDefault();
            }
        }
Example #4
0
        // GET: Doctor Timings
        public JsonResult GetDoctorTimings()
        {
            if (SessionHandler.IsExpired)
            {
                return(Json(new
                {
                    redirectUrl = Url.Action("DoctorLogin", "Account"),
                    isRedirect = true
                }));
            }
            else
            {
                try
                {
                    var Model   = new DoctorTimingsViewModel();
                    var objRepo = new DoctorRepository();
                    Model.DoctorId          = SessionHandler.UserInfo.Id;
                    Model.DoctorTimingsList = objTimingRepo.GetListByDoctorId(Model.DoctorId).ToList();

                    Model.DayWiseTimings = GetList(Model.DoctorTimingsList);



                    Model.DoctorTiming                 = new DoctorTimingsModel();
                    Model.DoctorTiming.doctorID        = Model.DoctorId;
                    Model.DoctorTiming.doctorTimingsID = 0;
                    return(Json(Model, JsonRequestBehavior.AllowGet));
                }
                catch (System.Web.Http.HttpResponseException ex)
                {
                    return(Json(new { Message = ex.Response.ReasonPhrase.ToString() }));
                }
            }
        }
Example #5
0
        public ActionResult Index(IndexVM model)
        {
            model.Pager              = model.Pager ?? new PagerVM();
            model.Pager.Page         = model.Pager.Page <= 0 ? 1 : model.Pager.Page;
            model.Pager.ItemsPerPage = model.Pager.ItemsPerPage <= 0 ? 10 : model.Pager.ItemsPerPage;

            model.Filter                 = model.Filter ?? new FilterVM();
            model.Filter.PatientId       = model.PatientId;
            model.Filter.DoctorId        = model.DoctorId;
            model.Filter.AppointmentDate = model.AppointmentDate;

            Expression <Func <Appointment, bool> > filter = model.Filter.GenerateFilter();

            AppointmentRepository repo = new AppointmentRepository();

            model.items            = repo.GetAll(filter, model.Pager.Page, model.Pager.ItemsPerPage);
            model.Pager.PagesCount = (int)Math.Ceiling(repo.Count(filter) / (double)(model.Pager.ItemsPerPage));

            PatientRepository patientsRepo = new PatientRepository();

            //model.PatientOne = patientsRepo.GetById(model.PatientId);
            model.PatientList = patientRepo.GetAll();
            DoctorRepository doctorsRepo = new DoctorRepository();

            //model.DoctorOne = doctorsRepo.GetById(model.DoctorId);
            model.DoctorList = doctorRepo.GetAll();
            return(View(model));
        }
Example #6
0
 public DirectorReportGenerator(string path, DoctorRepository doctorRepository, MedicalAppointmentRepository medicalAppointmentRepository)
 {
     app                           = App.Current as App;
     _path                         = path;
     _doctorRepository             = doctorRepository;
     _medicalAppointmentRepository = medicalAppointmentRepository;
 }
Example #7
0
 public DoctorService(DoctorRepository doctorRepository, UserRepository userRepository, AppointmentService appointmentService)
 {
     _doctorRepository   = doctorRepository;
     _appointmentService = appointmentService;
     _userValidation     = new UserValidation();
     _userRepository     = userRepository;
 }
        public ActionResult Login(LoginVM model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            if (model.AccountType.ToString() == "Doctor")
            {
                DoctorRepository repo = new DoctorRepository();
                AuthenticationManager.AuthenticateDoctor(model.Username, model.Password);
            }
            else
            {
                PatientRepository repo = new PatientRepository();
                AuthenticationManager.AuthenticatePatient(model.Username, model.Password);
            }

            if (AuthenticationManager.LoggedDoctor == null && AuthenticationManager.LoggedPatient == null)
            {
                ModelState.AddModelError("AuthenticationFailed", "Authentication failed!");
            }

            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            return(RedirectToAction("Index", "Home"));
        }
        public void DoctorRepositoryConstructor()
        {
            EmptyLists();
            doctorRepository = new DoctorRepository(context);

            Assert.NotNull(doctorRepository);
        }
 public ScheduleController()
 {
     dbContext    = new CaremeDBContext();
     scheduleRepo = new ScheduleDataRepository(dbContext);
     // scheduleRepo = new ScheduleRepository(dbContext);
     doctorRepo = new DoctorRepository(dbContext);
 }
        public void DoctorRepositoryConstructorFalseInput()
        {
            EmptyLists();
            Exception ex = Assert.Throws <NullReferenceException>(() => doctorRepository = new DoctorRepository(null));

            Assert.Equal("De dokterContext is leeg.", ex.Message);
        }
        public IEnumerable <Doctor> GetAllDoctors()
        {
            DoctorRepository     _doctorservice = new DoctorRepository(System.Configuration.ConfigurationManager.ConnectionStrings["DbConnection"].ConnectionString);
            IEnumerable <Doctor> _doctor        = _doctorservice.GetAll();

            return(_doctor);
        }
Example #13
0
        public async void UpdateAsync_WhenEntityExists_ShouldUpdateEntity_Test()
        {
            // Arrange
            var sut = new DoctorRepository(this.GetDatabaseConnection(), this.converter, this.logger.Object);
            await sut.InsertAsync(this.testEntity, "TestUser");

            this.testEntity.FirstName = "Valentino";
            this.testEntity.LastName  = "Rossi";

            // Act
            await sut.UpdateAsync(this.testEntity, "TestUserForUpdate");

            // Assert
            var entities      = sut.GetAllAsync().Result.ToList();
            var updatedResult = entities.First(a => a.Id == this.testEntity.Id);

            Assert.Equal("Valentino", updatedResult.FirstName);
            Assert.Equal("Rossi", updatedResult.LastName);

            Assert.NotEqual(DateTime.MinValue, this.testEntity.Created);
            Assert.NotEqual(DateTime.MinValue, this.testEntity.Updated);
            Assert.True(this.testEntity.Updated > this.testEntity.Created);
            Assert.Equal("TestUser", this.testEntity.CreatedBy);
            Assert.Equal("TestUserForUpdate", this.testEntity.UpdatedBy);
        }
Example #14
0
 public UnitOfWork(bbuContext context)
 {
     _context             = context;
     Addresses            = new AddressRepository(_context);
     AppUsers             = new AppUserRepository(_context);
     Banks                = new BankRepository(_context);
     BankAccounts         = new BankAccountRepository(_context);
     Cemeteries           = new CemeteryRepository(_context);
     Credentials          = new CredentialsRepository(_context);
     Deceaseds            = new DeceasedRepository(_context);
     Doctors              = new DoctorRepository(_context);
     Employees            = new EmployeeRepository(_context);
     Files                = new FileRepository(_context);
     Funerals             = new FuneralRepository(_context);
     FuneralDocuments     = new FuneralDocumentRepository(_context);
     Genders              = new GenderRepository(_context);
     HomeAffairsOffices   = new HomeAffairsOfficeRepository(_context);
     HomeAffairsOfficers  = new HomeAffairsOfficerRepository(_context);
     Hospitals            = new HospitalRepository(_context);
     Informants           = new InformantRepository(_context);
     Members              = new MemberRepository(_context);
     Months               = new MonthRepository(_context);
     Mortuaries           = new MortuaryRepository(_context);
     NextOfKins           = new NextOfKinRepository(_context);
     NumberConfigurations = new NumberConfigurationRepository(_context);
     Payments             = new PaymentRepository(_context);
     PaymentPeriods       = new PaymentPeriodRepository(_context);
     People               = new PersonRepository(_context);
     PurchaseItems        = new PurchaseItemRepository(_context);
     Settings             = new SettingRepository(_context);
     States               = new StateRepository(_context);
     Suppliers            = new SupplierRepository(_context);
     Tasks                = new TaskRepository(_context);
     Years                = new YearRepository(_context);
 }
Example #15
0
        public FormAdminWindow(IMainController inController, DoctorRepository inDoctorRepository, NurseRepository inNurseRepository)
        {
            _controller       = inController;
            _doctorRepository = inDoctorRepository;
            _nurseRepository  = inNurseRepository;

            InitializeComponent();
        }
 public AppointmentController(AppointmentRepository appointmentRepository, DoctorRepository doctorRepository,
                              UserManager <ApplicationUser> userManager, ApplicationDbContext context)
 {
     _appointmentRepository = appointmentRepository;
     _doctorRepository      = doctorRepository;
     this.userManager       = userManager;
     this.context           = context;
 }
Example #17
0
 public DoctorController(DoctorRepository doctorRepository, IHostingEnvironment hostingEnvironment,
                         UserManager <ApplicationUser> userManager, ApplicationDbContext context)
 {
     _doctorRepository       = doctorRepository;
     this.hostingEnvironment = hostingEnvironment;
     this.userManager        = userManager;
     _context = context;
 }
Example #18
0
        public EmployeeService()
        {
            doctorRepositoryFactory = new DoctorFileRepositoryFactory();
            doctorRepository        = doctorRepositoryFactory.CreateDoctorRepository();

            secretaryRepositoryFactory = new SecretaryFileRepositoryFactory();
            secretaryRepository        = secretaryRepositoryFactory.CreateSecretaryRepository();
        }
        public void UpdateFalseInput()
        {
            EmptyLists();
            doctorRepository = new DoctorRepository(context);
            Exception ex = Assert.Throws <NullReferenceException>(() => doctorRepository.Update(null));

            Assert.Equal("De dokter is leeg.", ex.Message);
        }
        public void Update()
        {
            EmptyLists();
            Doctor doctor = new Doctor(12, "een", "*****@*****.**", "eend");

            doctorRepository = new DoctorRepository(context);
            Assert.True(doctorRepository.Update(doctor));
        }
        public void Add()
        {
            EmptyLists();
            Doctor doctor = new Doctor(0, "een", "*****@*****.**", "eend");

            doctorRepository = new DoctorRepository(context);
            Assert.Equal(14, doctorRepository.Insert(doctor));
        }
        public void GetByDepartmentFalseInput()
        {
            EmptyLists();
            doctorRepository = new DoctorRepository(context);
            Exception ex = Assert.Throws <NullReferenceException>(() => doctorRepository.GetByDoctorWithDepartment(-1));

            Assert.Equal("Het afdelingId is leeg.", ex.Message);
        }
        public void GetByIdFalseInput()
        {
            EmptyLists();
            doctorRepository = new DoctorRepository(context);
            Exception ex = Assert.Throws <NullReferenceException>(() => doctorRepository.GetById(-1));

            Assert.Equal("Het dokterId is leeg.", ex.Message);
        }
 public AlarmService(AlarmRepository repository, DoctorRepository doctorRepository, MessageRepository messageRepository, IUnitWork unitWork, IOptions <MyOptions> optionsAccessor)
 {
     _repository        = repository;
     _unitWork          = unitWork;
     _doctorRepository  = doctorRepository;
     _messageRepository = messageRepository;
     _optionsAccessor   = optionsAccessor.Value;
 }
Example #25
0
 public BookingController()
 {
     dbContext       = new CaremeDBContext();
     scheduleRepo    = new ScheduleRepository(dbContext);
     hospitalRepo    = new HospitalRepository(dbContext);
     doctorRepo      = new DoctorRepository(dbContext);
     appointmentRepo = new AppointmentRepository(dbContext);
 }
Example #26
0
 public DoctorService()
 {
     doctorRepository            = new DoctorRepository(path);
     patientsRepository          = new PatientsRepository(path2);
     operationRepository         = new OperationRepository(path3);
     appointmentRepository       = new AppointmentRepository(path4);
     employeesScheduleRepository = new EmployeesScheduleRepository(path5);
 }
 public DoctorController(DoctorRepository repository, EspecialidadRepository repositoryEspecialidad, DoctorEspecialidadRepository repositoryDoctorEspecialidad, IHostingEnvironment hostingEnvironment, IMapper mapper, UserManager <IdentityUser> userManager)
 {
     _repository                   = repository;
     _repositoryEspecialidad       = repositoryEspecialidad;
     _repositoryDoctorEspecialidad = repositoryDoctorEspecialidad;
     _hostingEnvironment           = hostingEnvironment;
     _mapper      = mapper;
     _userManager = userManager;
 }
    public override void DataBind()
    {
        base.DataBind();
        PatientRepository patient = new PatientRepository();
        DoctorRepository  doctor  = new DoctorRepository();

        lblPatientName.Text = patient.getPatientNameByID(int.Parse(Container.AppointmentViewInfo.Appointment.CustomFields["PatientID"].ToString()));
        lblDoctorName.Text  = doctor.getDoctorNameByID(int.Parse(Container.AppointmentViewInfo.Appointment.CustomFields["DoctorID"].ToString()));
    }
Example #29
0
        public FormNurseWindow(IMainController inController, DoctorRepository inDoctorRepository, PatientRepository inPacientRepository, Nurse nurse)
        {
            _controller        = inController;
            _doctorRepository  = inDoctorRepository;
            _pacientRepository = inPacientRepository;
            _nurse             = nurse;

            InitializeComponent();
        }
Example #30
0
 public DoctorService(DoctorRepository doctorRepository, UserRepository userRepository, AddressRepository addressRepository, ScheduleRepository scheduleRepository, AppointmentRepository appointmentRepository, WaitingRepository waitingRepository)
 {
     _doctorRepository = doctorRepository;
     _userRepository = userRepository;
     _addressRepository = addressRepository;
     _scheduleRepository = scheduleRepository;
     _appointmentRepository = appointmentRepository;
     _waitingRepository = waitingRepository;
 }
Example #31
0
        public ActionResult Index()
        {
            IDoctorRepository doctorRepository = new DoctorRepository();
            DoctorViewModel   currentUser      = new DoctorViewModel();

            currentUser = doctorRepository.GetByIdentityId(User.Identity.GetUserId()).ToViewModel();

            return(View(currentUser));
        }