public void GetUnitList() { try { string returnMessage; UnitList = new ObservableCollection <UnitVM>(); _currentFilteredDate = SelectedDate; _currentFilteredWorkShift = SelectedWorkShift; _currentFilterTime = VerifyShiftTime(); List <UnitForceMapModel> unitList = UnitForceMapBusiness.GetUnitForceMapList(SelectedRegion, SelectedDate, SelectedWorkShift, CurrentFilterTime, (int)SelectedFilterType, out returnMessage); foreach (var u in unitList) { var unitVM = new UnitVM(u, "Red"); UnitList.Add(unitVM); } SelectedUnit = null; FilterUnitCount = unitList.Count.ToString(); CurrentActiveFilter = SelectedDate.ToString("dd/MM/yyyy") + " das " + SelectedWorkShift.InicialTime.Hours.ToString().PadLeft(2, '0') + " às " + SelectedWorkShift.FinalTime.Hours.ToString().PadLeft(2, '0') + " (" + (SelectedFilterType == FilterTypeEnum.ALL ? "Todas AMs" : string.Empty) + (SelectedFilterType == FilterTypeEnum.OUT_SERVICE ? "AMs fora de serviço" : string.Empty) + (SelectedFilterType == FilterTypeEnum.IN_SERVICE ? "AMs em serviço" : string.Empty) + (string.IsNullOrEmpty(SelectedRegion) ? string.Empty : " da região " + SelectedRegion) + ")"; } catch (Exception ex) { ShowMessage(ex.Message); } }
public UnitCrewMemberVM(CrewMemberTypeEnum crewMemberType, UnitForceMapModel currentUnit, WorkShiftModel.ShiftTime currentShiftTime) { this._crewMemberType = crewMemberType; this._currentUnitId = currentUnit.UnitId; this._shiftTime = currentShiftTime; this._shiftDate = currentUnit.ShiftDate; this._workShift = currentUnit.CurrentWorkShift; }
public void VerifyShiftChange() { WorkShiftModel VerifyWorkShift = UnitForceMapBusiness.GetCurrentWorkShift(WorkShiftList); if (VerifyWorkShift.ToString() != CurrentWorkShift.ToString()) { CurrentWorkShift = VerifyWorkShift; } _currentFilterTime = VerifyShiftTime(); }
public EditUnitVM(UnitForceMapModel unit, WorkShiftModel.ShiftTime currentShiftTime) { //UnitForceMapModel currentUnit = UnitForceMapBusiness.GetCurrentUnitForceMap(unit.UnitId); BackupUnit = CopyUnit(unit);// (UnitForceMapModel)unit.Clone(); _currentShiftTime = currentShiftTime; HeaderText = new string[3]; HeaderText[0] = "Você está editando as informações de uma AM em seu"; HeaderText[1] = "TURNO " + (_currentShiftTime == WorkShiftModel.ShiftTime.Actual ? "ATUAL" : "FUTURO"); HeaderText[2] = unit.ShiftDate.ToString("dd/MM/yyyy") + " das " + unit.CurrentWorkShift.ToString(); LoadData(); }