Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        public void UpdateUnitInForceMap(string unitId)
        {
            UnitVM selectedUnit = this.UnitList.Where(uvm => uvm.UnitModel.UnitId == unitId)
                                  .FirstOrDefault();

            if (selectedUnit != null)
            {
                selectedUnit.UnitModel = UnitForceMapBusiness.GetCurrentUnitForceMap(unitId);
                UnitForceMapBusiness.UpdateUnitForceMap(selectedUnit.UnitModel);
            }
        }