Example #1
0
        public static IEnumerable <ImportableWorkScheduleUnitModel> ToUnitWorkScheduleModelList(this DataTable dt)
        {
            List <ImportableWorkScheduleUnitModel> workkShiftModelList = new List <ImportableWorkScheduleUnitModel>();
            int row = 2;

            foreach (DataRow dr in dt.Rows)
            {
                ImportableWorkScheduleUnitModel workSchedule = new ImportableWorkScheduleUnitModel();

                workSchedule.ShiftDateCellValue = GetCellValue(dr, ImportableWorkScheduleUnitModel.SHIFT_DATE_COL_NUM);
                if (String.IsNullOrEmpty(workSchedule.ShiftDateCellValue))
                {
                    break;
                }

                workSchedule.WorkshiftLabel = GetCellValue(dr, ImportableWorkScheduleUnitModel.WORKSHIF_LABEL_COL_NUM);
                workSchedule.UnitId         = GetCellValue(dr, ImportableWorkScheduleUnitModel.UNIT_ID_COL_NUM);
                workSchedule.CellPhone      = GetCellValue(dr, ImportableWorkScheduleUnitModel.CELL_PHONE_COL_NUM);
                workSchedule.StationName    = GetCellValue(dr, ImportableWorkScheduleUnitModel.STATION_NAME_COL_NUM);
                workSchedule.StationId      = GetCellValue(dr, ImportableWorkScheduleUnitModel.STATION_ID_COL_NUM);
                workSchedule.Remark         = GetCellValue(dr, ImportableWorkScheduleUnitModel.REMARK_COL_NUM);
                workSchedule.Doctor         = GetCellValue(dr, ImportableWorkScheduleUnitModel.DOCTOR_COL_NUM);
                workSchedule.Nurse          = GetCellValue(dr, ImportableWorkScheduleUnitModel.NURSE_COL_NUM);
                workSchedule.FirstAuxiliar  = GetCellValue(dr, ImportableWorkScheduleUnitModel.FIRST_AUXILIAR_COL_NUM);
                workSchedule.SecondAuxiliar = GetCellValue(dr, ImportableWorkScheduleUnitModel.SECOND_AUXILIAR_COL_NUM);
                workSchedule.ThirdAuxiliar  = GetCellValue(dr, ImportableWorkScheduleUnitModel.THIRD_AUXILIAR_COL_NUM);
                workSchedule.Driver         = GetCellValue(dr, ImportableWorkScheduleUnitModel.DRIVER_COL_NUM);
                workSchedule.IsURAM         = GetCellValue(dr, ImportableWorkScheduleUnitModel.IS_URAM_COL_NUM);
                workSchedule.DateFrequence  = GetCellValue(dr, ImportableWorkScheduleUnitModel.DATE_FREQUENCE_COL_NUM);
                workSchedule.Row            = row++;

                workkShiftModelList.Add(workSchedule);
            }
            return(workkShiftModelList);
        }
Example #2
0
        protected override bool IsWorkScheduleMatchingTheDate(ImportableWorkScheduleUnitModel workSchedule, DateTime date)
        {
            int  diffDays        = Math.Abs((int)workSchedule.ShiftDate.Value.Subtract(date).TotalDays);
            bool isTheSameParity = (diffDays % 2) == 0;

            return(isTheSameParity);
        }
Example #3
0
 protected override bool IsWorkScheduleMatchingTheDate(ImportableWorkScheduleUnitModel workSchedule, DateTime date)
 {
     return
         ((date.DayOfWeek != DayOfWeek.Saturday) &&
          (date.DayOfWeek != DayOfWeek.Sunday) &&
          !_holidayList.Contains(date));
 }
Example #4
0
        public virtual List <ImportableWorkScheduleUnitModel> GetWorkScheduleInsidePeriod(List <ImportableWorkScheduleUnitModel> workScheduleList)
        {
            List <ImportableWorkScheduleUnitModel> workScheduleListModified = new List <ImportableWorkScheduleUnitModel>();

            foreach (WorkShiftPeriodModel workShift in
                     this.WorkShiftPeriodList.Where(w => w.WorkShiftDate.Value.CompareTo(DateTime.Now.Date) >= 0))
            {
                foreach (ImportableWorkScheduleUnitModel workSchedule in workScheduleList.Where(ws => IsWorkScheduleFollowingTheRule(ws)))
                {
                    if (IsWorkScheduleMatchingTheDate(workSchedule, workShift.WorkShiftDate.Value))
                    {
                        ImportableWorkScheduleUnitModel newWorkSchedule = (ImportableWorkScheduleUnitModel)workSchedule.Clone();
                        newWorkSchedule.ShiftDate = workShift.WorkShiftDate;

                        workScheduleListModified.Add(newWorkSchedule);
                    }
                }
            }

            return(workScheduleListModified);
        }
Example #5
0
 protected override bool IsWorkScheduleFollowingTheRule(ImportableWorkScheduleUnitModel workSchedule)
 {
     return(workSchedule.DateFrequence == Properties.Resources.FREQUENCE_TYPE_ALTERNABLE_DAY_DESCRIPTION);
 }
Example #6
0
 protected override bool IsWorkScheduleMatchingTheDate(ImportableWorkScheduleUnitModel workSchedule, DateTime date)
 {
     return(true);
 }
Example #7
0
 protected override bool IsWorkScheduleMatchingTheDate(ImportableWorkScheduleUnitModel workSchedule, DateTime date)
 {
     return(workSchedule.ShiftDate.Value.CompareTo(date) == 0);
 }
Example #8
0
 protected override bool IsWorkScheduleMatchingTheDate(ImportableWorkScheduleUnitModel workSchedule, DateTime date)
 {
     throw new NotImplementedException();
 }
Example #9
0
 protected override bool IsWorkScheduleFollowingTheRule(ImportableWorkScheduleUnitModel workSchedule)
 {
     throw new NotImplementedException();
 }
Example #10
0
 protected abstract bool IsWorkScheduleMatchingTheDate(ImportableWorkScheduleUnitModel workSchedule, DateTime date);
Example #11
0
 protected abstract bool IsWorkScheduleFollowingTheRule(ImportableWorkScheduleUnitModel workSchedule);