Ejemplo n.º 1
0
 /// <summary>
 /// Checks business rules for deleting a range
 /// </summary>
 /// <param name="p">parameters</param>
 public void DeleteRange(DoctorScheduleDeleteRangeSP p)
 {
     if (p.EndUnixEpoch < p.StartUnixEpoch)
     {
         throw new BRException(BusinessErrorStrings.DoctorSchedule.DeleteRangeEndDateShouldBeGreaterStartDate);
     }
 }
        /// <summary>
        /// Delets a slots by a defined range
        /// </summary>
        /// <param name="p"></param>
        public void DeleteRange(DoctorScheduleDeleteRangeSP p)
        {
            ((DoctorScheduleBR)this.BusinessLogicObject).DeleteRange(p);

            var filter = GetByRangeFilter(new DoctorScheduleGetByRangeSP()
            {
                DoctorID       = p.DoctorID,
                StartUnixEpoch = p.StartUnixEpoch,
                EndUnixEpoch   = p.EndUnixEpoch
            });

            GetByFilterParameters getParams = new GetByFilterParameters(filter, new SortExpression(), 0, 1000, null, GetSourceTypeEnum.Table);

            var list = GetByFilterT(getParams);

            foreach (var item in list)
            {
                try
                {
                    Delete(item);
                }
                catch (BRException) // we ignore business exceptions
                {
                    // ignore
                }
            }
        }