/// <summary>
        /// Add an area to favorite
        /// </summary>
        public async Task <bool> AddFavoriteArea(FavoriteAreaDTO favoriteAreaDTO)
        {
            try
            {
                if (favoriteAreaDTO == null)
                {
                    return(false);
                }

                // add area in database
                favoriteAreaDTO.User_iduser = App.CurrentUserEnvironment.User.IdUser;
                var id = await _dataService.InsertFavoriteArea(favoriteAreaDTO);

                favoriteAreaDTO.DateAddedFavorite = App.CurrentUserEnvironment.ServerCurrentDateTime;
                favoriteAreaDTO.IdfavoriteArea    = id;

                // error handling
                if (id <= 0)
                {
                    var msg   = Resources.UpdateZoneFailed;
                    var title = Resources.UpdateZoneFailedTitle;
                    await _dialogService.ShowMessage(msg, title);

                    return(false);
                }

                // add area to local data
                App.CurrentUserEnvironment.LsFavoriteArea.Add(favoriteAreaDTO);
                SelectedFavoriteArea = favoriteAreaDTO;

                return(true);
            }
            catch (WebException)
            {
                await _dialogService.ShowError(Resources.TimeoutError
                                               , Resources.WebErrorTitle
                                               , Resources.WebErrorButtonText, null);
            }
            catch (TimeoutException e)
            {
                await _dialogService.ShowError(e
                                               , Resources.TimeoutErrorTitle
                                               , Resources.WebErrorButtonText, null);
            }
            return(false);
        }
        /// <summary>
        /// Delete an area from database
        /// </summary>
        public async Task <bool> DeleteFavoriteArea(FavoriteAreaDTO favoriteAreaDTO)
        {
            try
            {
                if (favoriteAreaDTO == null || favoriteAreaDTO.IdfavoriteArea == 0)
                {
                    return(false);
                }

                // delete area from database
                var result = await _dataService.DeleteFavoriteArea(favoriteAreaDTO.IdfavoriteArea);

                // error handling
                if (result <= 0)
                {
                    var msg   = Resources.DeleteZoneFailed;
                    var title = Resources.DeleteZoneFailedTitle;
                    await _dialogService.ShowMessage(msg, title);

                    return(false);
                }

                // suppress local favorite area
                App.CurrentUserEnvironment.LsFavoriteArea.Remove(favoriteAreaDTO);

                return(true);
            }
            catch (WebException)
            {
                await _dialogService.ShowError(Resources.TimeoutError
                                               , Resources.WebErrorTitle
                                               , Resources.WebErrorButtonText, null);
            }
            catch (TimeoutException e)
            {
                await _dialogService.ShowError(e
                                               , Resources.TimeoutErrorTitle
                                               , Resources.WebErrorButtonText, null);
            }
            return(false);
        }
        /// <summary>
        /// Update area in database
        /// </summary>
        public async Task <bool> UpdateFavoriteArea(FavoriteAreaDTO favoriteAreaDTO)
        {
            try
            {
                if (favoriteAreaDTO == null || favoriteAreaDTO.IdfavoriteArea == 0)
                {
                    return(false);
                }

                // update in database
                favoriteAreaDTO.User_iduser = App.CurrentUserEnvironment.User.IdUser;
                var countOfUpdated = await _dataService.UpdateFavoriteArea(favoriteAreaDTO);

                // error handling
                if (countOfUpdated <= 0)
                {
                    var msg   = Resources.UpdateZoneFailed;
                    var title = Resources.UpdateZoneFailedTitle;
                    await _dialogService.ShowMessage(msg, title);

                    return(false);
                }

                return(true);
            }
            catch (WebException)
            {
                await _dialogService.ShowError(Resources.TimeoutError
                                               , Resources.WebErrorTitle
                                               , Resources.WebErrorButtonText, null);
            }
            catch (TimeoutException e)
            {
                await _dialogService.ShowError(e
                                               , Resources.TimeoutErrorTitle
                                               , Resources.WebErrorButtonText, null);
            }
            return(false);
        }