Exemple #1
0
        async Task ExecuteLoadItemsCommand(bool syncItems = true)
        {
            if (IsBusy)
            {
                IsBusy = false;
                return;
            }

            IsBusy = true;
            try
            {
                Items.Clear();
                networkAccess = Connectivity.NetworkAccess;
                syncItems     = (networkAccess == NetworkAccess.Internet && syncItems ? true : false);
                if (_sort == null)
                {
                    _sort = new SortingModel()
                    {
                        id = 0, SortingText = "PostCode Asc"
                    }
                }
                ;
                var items = await manager.GetPropertyItemsAsync(_searchText, _IsInProgress, _IsPriority, _sort.id, syncItems);

                //Check Permissions 401 && 403
                IsCheckPermissions();
                foreach (var item in items)
                {
                    Items.Add(new PropertyModel()
                    {
                        FirstRow = item.BuildingNumber + (item.BuildingNumber.Length == 0 ? "" : (item.BuildingName.Length == 0 ? "" : ", ")) + item.BuildingName, SecoundRow = item.PrincipalStreet + (item.PrincipalStreet.Length == 0 ? "" : (Convert.ToString(item.Postcode).Length == 0 ? "" : ", ")) + item.Postcode, Id = item.Id, Postcode = item.Postcode, BuildingName = item.BuildingName, BuildingNumber = item.BuildingNumber, Cell = item.Cell, CellManagerId = item.CellManagerId, Country = item.Country, DependentLocality = item.DependentLocality, DependentStreet = item.DependentStreet, IncidentId = item.IncidentId, LocalityName = item.LocalityName, MCBuildingName = item.MCBuildingName, MCSubBuildingName = item.MCSubBuildingName, MPRN = item.MPRN, ConcatStatus = (string.IsNullOrEmpty(item.LatestStatus) ? "" : item.LatestStatus + (string.IsNullOrEmpty(item.LatestSubStatus) ? "" : ", " + item.LatestSubStatus)), Status = item.Status, PostTown = item.PostTown, PrincipalStreet = item.PrincipalStreet, PriorityCustomer = item.PriorityCustomer, SubBuildingName = item.SubBuildingName, Zone = item.Zone, ZoneManagerId = item.ZoneManagerId, Latitude = item.Latitude, Longitude = item.Longitude, LatestStatus = item.LatestStatus, LatestSubStatus = item.LatestSubStatus, AssignedResourceCount = item.AssignedResourceCount, IncidentName = item.IncidentName, IsStatusUpdated = item.IsStatusUpdated, Notes = (string.IsNullOrEmpty(item.Notes) ? "" : item.Notes), StatusChangedOn = item.StatusChangedOn, PropertyId = item.PropertyId, CreatedAt = item.CreatedAt, CreatedBy = item.CreatedBy, Deleted = item.Deleted, IsIsolated = item.IsIsolated, IsLastStatusUpdate = item.IsLastStatusUpdate, IsMPRNAssigned = item.IsMPRNAssigned, IsUnassigned = item.IsUnassigned, ModifiedBy = item.ModifiedBy, NotesCount = item.NotesCount, UpdatedAt = item.UpdatedAt, Version = item.Version
                    });
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }