Example #1
0
        //Please write your properties and functions here. This part will not be replaced.


        protected override bool onBeforeInsert(object entitySet, InsertParameters parameters)
        {
            Visit           visit = (Visit)entitySet;
            var             doctorScheduleService = DoctorScheduleEN.GetService("");
            vDoctorSchedule doctorScheduleV       = doctorScheduleService.GetByIDV(visit.DoctorScheduleID, new GetByIDParameters());

            ((VisitBR)BusinessLogicObject).CheckInsert(visit, doctorScheduleV);

            visit.VisitStatusID  = (int)EntityEnums.VisitStatusEnum.Scheduled;
            visit.DoctorReport   = null;
            visit.ChiefComplaint = null;
            visit.Description    = null;

            // updating doctor schedule number of registered patients
            DoctorSchedule doctorSchedule = doctorScheduleService.GetByIDT(visit.DoctorScheduleID, new GetByIDParameters());

            doctorSchedule.NumberOfRegisteredPatients++;

            parameters.DetailEntityObjects.Add(new DetailObjectInfo()
            {
                EntityName = vDoctorSchedule.EntityName,
                FnName     = RuleFunctionSEnum.Update,
                EntitySet  = doctorSchedule
            });

            return(true);
        }
Example #2
0
        protected override bool onBeforeDelete(object entitySet, DeleteParameters parameters)
        {
            Visit           visit = (Visit)entitySet;
            var             doctorScheduleService = DoctorScheduleEN.GetService("");
            vDoctorSchedule doctorSchedule        = doctorScheduleService.GetByIDV(visit.DoctorScheduleID, new GetByIDParameters());

            doctorSchedule.NumberOfRegisteredPatients--;
            parameters.DetailEntityObjects.Add(new DetailObjectInfo()
            {
                EntityName = vDoctorSchedule.EntityName,
                FnName     = RuleFunctionSEnum.Update,
                EntitySet  = doctorSchedule
            });

            return(true);
        }
Example #3
0
        public void CheckInsert(Visit visit, vDoctorSchedule doctorSchedule)
        {
            if (doctorSchedule.IsDisabled == true)
            {
                throw new BRException(BusinessErrorStrings.Visit.Insert_ScheduleIsDisabled);
            }

            if (doctorSchedule.SlotUnixEpoch < DateTimeEpoch.GetUtcNowEpoch())
            {
                throw new BRException(BusinessErrorStrings.Visit.Insert_TheTimeForThisScheduleHasPassed);
            }

            if (doctorSchedule.NumberOfAllowedPatients < doctorSchedule.NumberOfRegisteredPatients + 1)
            {
                throw new BRException(BusinessErrorStrings.Visit.TimeSlotIsFull);
            }
        }