Exemplo n.º 1
0
        public bool VerificaEsecuzione(string Servizio, out ScheduleDS.MONITOR_SCHEDULERRow schedulazione)
        {
            schedulazione = null;

            using (ScheduleBusiness bSchedule = new ScheduleBusiness())
            {
                _ds.Clear();
                bSchedule.FillSchedule_SCHEDULER(_ds);

                if (!_ds.MONITOR_SCHEDULER.Any(x => x.SERVIZIO.Trim() == Servizio && x.ESEGUITA == "N" && x.DATAESECUZIONE <= DateTime.Today))
                {
                    return(false);
                }

                List <ScheduleDS.MONITOR_SCHEDULERRow> schedulazioni = _ds.MONITOR_SCHEDULER.Where(x => x.SERVIZIO == Servizio && x.ESEGUITA == "N" && x.DATAESECUZIONE <= DateTime.Today).ToList();
                foreach (ScheduleDS.MONITOR_SCHEDULERRow schedulazioneSelezionata in schedulazioni)
                {
                    if (VerificaOraEsecuzione(schedulazioneSelezionata.ORAESECUZIONE))
                    {
                        schedulazione = schedulazioneSelezionata;
                        return(true);
                    }
                }
                return(false);
            }
        }
 public void EstraiSchedule(ScheduleServicesDS ds)
 {
     using (ScheduleBusiness bSchedule = new ScheduleBusiness())
     {
         bSchedule.FillSchedule(_ds, true);
     }
 }
 public void SalvaModificheSchedulazione(ScheduleServicesDS ds)
 {
     using (ScheduleBusiness bSchedule = new ScheduleBusiness())
     {
         bSchedule.UpdateTable(_ds.SCHEDULE.TableName, ds);
     }
 }
Exemplo n.º 4
0
        public CreateScheduleForm(Patient patient)
        {
            InitializeComponent();
            textPhone.Text    = patient.Phone;
            textFullName.Text = patient.FullName;
            memoAddress.Text  = patient.Address;

            scheduleBusiness = new ScheduleBusiness();
        }
        public async Task PostSchedule_ValidFacilityKey_ShouldReturnAcceptedCode()
        {
            //Arrange
            var mockFacilityKey = Guid.Parse("BEC05D78-2F6C-4034-8FB9-ACE3417F83E8");
            var requestData     = FakeDataForPostSchedule();

            _scheduleBusiness = new ScheduleBusiness(_mockScheduleRepository.Object, _mockRoutingRuleScheduleTimingRepository.Object, _unitofwork.Object, _mapper);

            //Act
            await _scheduleBusiness.AddSchedule(mockFacilityKey, requestData);

            //Assert
            _mockScheduleRepository.Verify(mock => mock.AddAsync(It.IsAny <ScheduleTiming>()), Times.Once);
        }
        //public ModifyScheduleViewModel(Schedule schedule) : this()
        //{
        //    id = schedule.Id;
        //    title = schedule.Title;
        //    team = schedule.Team;
        //    startDateTime = schedule.StartDateTime;
        //    endDateTime = schedule.EndDateTime;
        //}

        private void UpdateSchedule()
        {
            var schedule = new Schedule
            {
                Id            = id,
                Title         = Title,
                Team          = Team,
                Type          = Type,
                EndDateTime   = EndDateTime,
                StartDateTime = StartDateTime
            };

            ScheduleBusiness.UpdateSchedule(schedule);
        }
        public void GetSchedule_ValidFacilityKey_ShouldReturnMappedScheduleData()
        {
            //Arrange
            var mockFacilityKey = Guid.Parse("BEC05D78-2F6C-4034-8FB9-ACE3417F83E8");
            var data            = FakeData();

            _mockScheduleRepository.Setup(x => x.GetSchedules(data.FirstOrDefault().FacilityKey)).ReturnsAsync(data);
            _scheduleBusiness = new ScheduleBusiness(_mockScheduleRepository.Object, _mockRoutingRuleScheduleTimingRepository.Object, _unitofwork.Object, _mapper);

            //Act
            var res = _scheduleBusiness.GetSchedules(mockFacilityKey);

            //Assert
            Assert.Equal(data.First().ScheduleTimingName, res.Result.First().Name);
        }
        public async Task UpdateSchedule_ValidFacilityKey_ShouldReturnOkCode()
        {
            //Arrange
            var mockFacilityKey = Guid.Parse("BEC05D78-2F6C-4034-8FB9-ACE3417F83E8");
            var requestData     = FakeDataForPostSchedule();
            var data            = FakeData();

            _mockScheduleRepository.Setup(x => x.GetAsync(It.IsAny <Guid>())).ReturnsAsync(data.FirstOrDefault());
            _scheduleBusiness = new ScheduleBusiness(_mockScheduleRepository.Object, _mockRoutingRuleScheduleTimingRepository.Object, _unitofwork.Object, _mapper);

            //Act
            await _scheduleBusiness.UpdateSchedule(mockFacilityKey, mockFacilityKey, requestData);

            //Assert
            _mockScheduleRepository.Verify(mock => mock.Update(It.IsAny <ScheduleTiming>()), Times.Once);
        }
Exemplo n.º 9
0
        private void CreateSchedule()
        {
            var schedule = new Schedule
            {
                Title         = Title,
                Team          = Team,
                Type          = Type,
                EndDateTime   = EndDateTime,
                StartDateTime = StartDateTime
            };

            ScheduleBusiness.InsertSchedule(schedule);
            ScheduleViewModelBase svmb = ObjectMapper.Map <Schedule, ScheduleViewModelBase>(schedule);

            scheduleListViewModel.ScheduleList.Add(svmb);
        }
        public async Task DeleteSchedule_ValidKey_ShouldReturnOkCode()
        {
            //Arrange
            var mockKey = Guid.Parse("BEC05D78-2F6C-4034-8FB9-ACE3417F83E8");
            var data    = FakeData();

            _mockScheduleRepository.Setup(x => x.Get(It.IsAny <Guid>())).Returns(data.FirstOrDefault);
            _mockRoutingRuleScheduleTimingRepository.Setup(x => x.GetRoutingRuleScheduleTiming(It.IsAny <Guid>()))
            .ReturnsAsync(false);
            _scheduleBusiness = new ScheduleBusiness(_mockScheduleRepository.Object, _mockRoutingRuleScheduleTimingRepository.Object, _unitofwork.Object, _mapper);

            //Act
            await _scheduleBusiness.DeleteSchedule(mockKey);

            //Assert
            _mockScheduleRepository.Verify(mock => mock.Delete(It.IsAny <ScheduleTiming>()), Times.Once);
        }
Exemplo n.º 11
0
        private void buttonFinishExamine_Click(object sender, EventArgs e)
        {
            if (selecteRow == null)
            {
                return;
            }
            bool result = true;

            if (textMedicalRecordID.Text != "")
            {
                result = UpdateMedicalRecord("NotPayment");
            }

            queueBusiness.UpdateStatus((int)selecteRow["QueueID"], "I");
            if (dateReExamineDay.EditValue != null)
            {
                var scheduleBusiness = new ScheduleBusiness();
                var patientBusiness  = new PatientBusiness();
                var patient          = patientBusiness.GetbyId((int)selecteRow["PatientID"]);
                var schedule         = new Schedule
                {
                    DoctorID     = UserBusiness.User.UserID,
                    FullName     = patient.FullName,
                    ScheduleDate = (DateTime)dateReExamineDay.EditValue,
                    ScheduleType = "Tái khám",
                    Phone        = patient.Phone,
                    Address      = patient.Address
                };

                result = result && scheduleBusiness.Insert(schedule) > 0;
            }

            if (!result)
            {
                XtraMessageBox.Show(this, "Có lỗi trong quá trình lưu", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                //Refresh queue
                LoadQueueByDoctor();
                LoadExaminedList();
                ResetAll();
            }
        }
        public async Task DeleteSchedule_NullResult_ShouldReturnInvalidScheduleException()
        {
            //Arrange
            var mockKey = Guid.Parse("BEC05D78-2F6C-4034-8FB9-ACE3417F83E8");

            _scheduleBusiness = new ScheduleBusiness(_mockScheduleRepository.Object, _mockRoutingRuleScheduleTimingRepository.Object, _unitofwork.Object, _mapper);

            Exception expected = new InvalidScheduleException("", 4002);

            try
            {
                //Act
                await _scheduleBusiness.DeleteSchedule(mockKey);
            }
            catch (Exception e)
            {
                Assert.Equal(4002, expected.HResult);
            }
        }
        public async Task UpdateSchedule_ValidFacilityKey_ShouldReturninvalidScheduleException()
        {
            //Arrange
            var mockFacilityKey = Guid.Parse("BEC05D78-2F6C-4034-8FB9-ACE3417F83E8");
            var requestData     = FakeDataForPostSchedule();

            _scheduleBusiness = new ScheduleBusiness(_mockScheduleRepository.Object, _mockRoutingRuleScheduleTimingRepository.Object, _unitofwork.Object, _mapper);
            Exception expected = new InvalidScheduleException("", 4001);

            try
            {
                //Act
                await _scheduleBusiness.UpdateSchedule(mockFacilityKey, mockFacilityKey, requestData);
            }
            catch (Exception actual)
            {
                Assert.Equal(4001, expected.HResult);
            }
        }
        public async Task UpdateSchedule_ValidFacilityKey_ShouldReturninvalidScheduleExceptionforunmatchId()
        {
            //Arrange
            var mockFirstKey  = Guid.Parse("BEC05D78-2F6C-4034-8FB9-ACE3417F83E4");
            var mockSecondKey = Guid.Parse("BEC05D78-2F6C-4034-8FB9-ACE3417F83E9");
            var data          = FakeData();
            var requestData   = FakeDataForPostSchedule();

            _mockScheduleRepository.Setup(x => x.GetAsync(It.IsAny <Guid>())).ReturnsAsync(data.FirstOrDefault());
            _scheduleBusiness = new ScheduleBusiness(_mockScheduleRepository.Object, _mockRoutingRuleScheduleTimingRepository.Object, _unitofwork.Object, _mapper);
            Exception expected = new InvalidScheduleException("", 4003);

            try
            {
                //Act
                await _scheduleBusiness.UpdateSchedule(mockSecondKey, mockFirstKey, requestData);
            }
            catch (Exception actual)
            {
                Assert.Equal(4003, expected.HResult);
            }
        }
Exemplo n.º 15
0
        public void AggiornaSchedulazione(ScheduleDS.MONITOR_SCHEDULERRow schedulazione)
        {
            schedulazione.ESEGUITA = "S";

            ScheduleDS.MONITOR_SCHEDULERRow nuovaSchedulazione = _ds.MONITOR_SCHEDULER.NewMONITOR_SCHEDULERRow();
            nuovaSchedulazione.ESEGUITA      = "N";
            nuovaSchedulazione.SERVIZIO      = schedulazione.SERVIZIO;
            nuovaSchedulazione.FREQUENZA     = schedulazione.FREQUENZA;
            nuovaSchedulazione.ORAESECUZIONE = schedulazione.ORAESECUZIONE;
            switch (nuovaSchedulazione.FREQUENZA)
            {
            case "GIORNALIERA":
                nuovaSchedulazione.DATAESECUZIONE = DateTime.Today.AddDays(1);
                break;
            }
            _ds.MONITOR_SCHEDULER.AddMONITOR_SCHEDULERRow(nuovaSchedulazione);

            using (ScheduleBusiness bSchedule = new ScheduleBusiness())
            {
                bSchedule.UpdateSchedule_SCHEDULER(_ds);
            }
        }
        public async Task DeleteSchedule_ValidKey_ShouldReturnInvalidScheduleException()
        {
            //Arrange
            var mockKey = Guid.Parse("BEC05D78-2F6C-4034-8FB9-ACE3417F83E8");
            var data    = FakeData();

            _mockScheduleRepository.Setup(x => x.Get(It.IsAny <Guid>())).Returns(data.FirstOrDefault);
            _mockRoutingRuleScheduleTimingRepository.Setup(x => x.GetRoutingRuleScheduleTiming(It.IsAny <Guid>()))
            .ReturnsAsync(true);
            _scheduleBusiness = new ScheduleBusiness(_mockScheduleRepository.Object, _mockRoutingRuleScheduleTimingRepository.Object, _unitofwork.Object, _mapper);

            Exception expected = new InvalidScheduleException("", 4004);

            try
            {
                //Act
                await _scheduleBusiness.DeleteSchedule(mockKey);
            }
            catch (Exception e)
            {
                Assert.Equal(4004, expected.HResult);
            }
        }
Exemplo n.º 17
0
 public ScheduleController(ScheduleBusiness scheduleBusiness, ScheduleCompleteBusiness scheduleCompleteBusiness)
 {
     _scheduleBusiness         = scheduleBusiness;
     _scheduleCompleteBusiness = scheduleCompleteBusiness;
 }
Exemplo n.º 18
0
 public ScheduleController(ScheduleBusiness business)
 {
     _business = business;
 }
Exemplo n.º 19
0
 public ScheduleManagerForm()
 {
     InitializeComponent();
     schedulueBusiness = new ScheduleBusiness();
 }
Exemplo n.º 20
0
 // use for invalidvaule (controlname)event
 // private int textFullNameCheck;
 //private int textPhoneCheck;
 public CreateScheduleForm()
 {
     InitializeComponent();
     scheduleBusiness = new ScheduleBusiness();
 }