예제 #1
0
        public void UpdateReportValidationAlertingConflictsWithPreviousData(List <WorkScheduleUnitModel> unitForceMapList, List <WorkShiftModel> availableWorkShiftList, ref ReportValidationModel reportValidation)
        {
            foreach (WorkScheduleUnitModel oldUnitForceMap in unitForceMapList)
            {
                ImportableWorkScheduleUnitModel workScheduleForUnit = WorkScheduleForUnitList
                                                                      .Where(ws => ws.ShiftDate.HasValue &&
                                                                             ws.ShiftDate.Value.Date.CompareTo(oldUnitForceMap.ShiftDate.Date) == 0 &&
                                                                             ws.WorkshiftLabel == oldUnitForceMap.CurrentWorkShift.Label &&
                                                                             ws.UnitId == oldUnitForceMap.UnitId
                                                                             ).FirstOrDefault();

                if (workScheduleForUnit == null)
                {
                    continue;
                }

                WorkScheduleUnitModel newUnitForceMap = workScheduleForUnit.ToWorkScheduleUnitModel(availableWorkShiftList);

                // necessary condition because the old cell phone takes the number registered in the Active Unit

                /*if(!String.IsNullOrEmpty(newUnitForceMap.CellPhone))
                 *  UpdateReportValidationWithReplacingData(oldUnitForceMap.CellPhone, newUnitForceMap.CellPhone, workScheduleForUnit,
                 *                                            WorkScheduleForUnitModel.colNames[WorkScheduleForUnitModel.CELL_PHONE_COL_NUM], ref reportValidation);
                 *
                 * UpdateReportValidationWithReplacingData(oldUnitForceMap.Remarks, newUnitForceMap.Remarks, workScheduleForUnit,
                 *                                            WorkScheduleForUnitModel.colNames[WorkScheduleForUnitModel.REMARK_COL_NUM], ref reportValidation);
                 */
                UpdateReportValidationWithReplacingData(oldUnitForceMap.Station == null ? null : oldUnitForceMap.Station.StationId,
                                                        newUnitForceMap.Station == null ? null : newUnitForceMap.Station.StationId, workScheduleForUnit,
                                                        ImportableWorkScheduleUnitModel.colNames[ImportableWorkScheduleUnitModel.STATION_NAME_COL_NUM], ref reportValidation);

                UpdateReportValidationWithReplacingData(oldUnitForceMap.Doctor, newUnitForceMap.Doctor, workScheduleForUnit,
                                                        ImportableWorkScheduleUnitModel.colNames[ImportableWorkScheduleUnitModel.DOCTOR_COL_NUM], ref reportValidation);

                UpdateReportValidationWithReplacingData(oldUnitForceMap.Driver, newUnitForceMap.Driver, workScheduleForUnit,
                                                        ImportableWorkScheduleUnitModel.colNames[ImportableWorkScheduleUnitModel.DRIVER_COL_NUM], ref reportValidation);

                UpdateReportValidationWithReplacingData(oldUnitForceMap.Nurse, newUnitForceMap.Nurse, workScheduleForUnit,
                                                        ImportableWorkScheduleUnitModel.colNames[ImportableWorkScheduleUnitModel.NURSE_COL_NUM], ref reportValidation);

                UpdateReportValidationWithReplacingData(oldUnitForceMap.FirstAuxiliar, newUnitForceMap.FirstAuxiliar, workScheduleForUnit,
                                                        ImportableWorkScheduleUnitModel.colNames[ImportableWorkScheduleUnitModel.FIRST_AUXILIAR_COL_NUM], ref reportValidation);

                UpdateReportValidationWithReplacingData(oldUnitForceMap.SecondAuxiliar, newUnitForceMap.SecondAuxiliar, workScheduleForUnit,
                                                        ImportableWorkScheduleUnitModel.colNames[ImportableWorkScheduleUnitModel.SECOND_AUXILIAR_COL_NUM], ref reportValidation);

                UpdateReportValidationWithReplacingData(oldUnitForceMap.ThirdAuxiliar, newUnitForceMap.ThirdAuxiliar, workScheduleForUnit,
                                                        ImportableWorkScheduleUnitModel.colNames[ImportableWorkScheduleUnitModel.THIRD_AUXILIAR_COL_NUM], ref reportValidation);

                //TODO: UpdateReportValidationWithReplacingData (isURAM)
            }
        }
예제 #2
0
        public WorkScheduleUnitModel ToWorkScheduleUnitModel(List <WorkShiftModel> availableWorkShiftList) //, Dictionary<string, string> unitTypeByUnitId
        {
            WorkScheduleUnitModel newUnit = new WorkScheduleUnitModel();

            if (this.ShiftDate.HasValue)
            {
                newUnit.ShiftDate = this.ShiftDate.Value;
            }

            if (availableWorkShiftList != null)
            {
                newUnit.CurrentWorkShift = availableWorkShiftList.Where(ws => ws.Label == this.WorkshiftLabel).FirstOrDefault();
            }

            CadStationModel newCadStation = new CadStationModel();

            newCadStation.StationId = this.StationId;
            newUnit.Station         = newCadStation;

            newUnit.Remarks   = this.Remark;
            newUnit.CellPhone = this.CellPhone;
            newUnit.UnitId    = this.UnitId;

            newUnit.Doctor         = GetUnitCrewMember(this.Doctor);
            newUnit.Nurse          = GetUnitCrewMember(this.Nurse);
            newUnit.FirstAuxiliar  = GetUnitCrewMember(this.FirstAuxiliar);
            newUnit.SecondAuxiliar = GetUnitCrewMember(this.SecondAuxiliar);
            newUnit.ThirdAuxiliar  = GetUnitCrewMember(this.ThirdAuxiliar);
            newUnit.Driver         = GetUnitCrewMember(this.Driver);

            if (this.UnitType == WorkScheduleUnitModel.CATEGORY_URAM_NAME)
            {
                newUnit.Category = WorkScheduleUnitModel.CATEGORY_URAM_NAME;
            }
            else
            {
                newUnit.Category = newUnit.GenerateUnitType();
            }

            return(newUnit);
        }
예제 #3
0
        public bool IsRightCrewCategory()
        {
            WorkScheduleUnitModel workScheduleUnit = this.ToWorkScheduleUnitModel(null);

            return(String.IsNullOrEmpty(this._unitType) || (workScheduleUnit.Category ?? String.Empty) == this._unitType);
        }