コード例 #1
0
        public override async void OnNavigatedTo(INavigationParameters parameters)
        {
            ComplaintImagesDTOs = new ObservableCollection <ComplaintImagesDTO>();


            await _complaintService.GetCities(_settings.UserId);

            await _complaintService.GetAllSpecies(_settings.UserId);

            HasFiles = false;

            if (ComplaintModelObj != null)
            {
                if (!string.IsNullOrWhiteSpace(ComplaintModelObj.ShopName))
                {
                    ShopName.Value = ComplaintModelObj.ShopName;
                }

                if (!string.IsNullOrWhiteSpace(ComplaintModelObj.ShopAddress))
                {
                    ShopAddress.Value = ComplaintModelObj.ShopAddress;
                }
                if (!string.IsNullOrWhiteSpace(ComplaintModelObj.SpeciesName))
                {
                    Species.Value = ComplaintModelObj.SpeciesName;
                }
                if (!string.IsNullOrWhiteSpace(ComplaintModelObj.Comments))
                {
                    Comment.Value = ComplaintModelObj.Comments;
                }

                DateOfInspection.Value = ComplaintModelObj.DateOfInspection ?? DateTime.Now;

                if (!string.IsNullOrEmpty(ComplaintModelObj.Files))
                {
                    List <string> SplitFilePaths = new List <string>();
                    SplitFilePaths = ComplaintModelObj.Files.Split(',')?.ToList();
                    if (SplitFilePaths.AnyExtended())
                    {
                        foreach (var item in SplitFilePaths)
                        {
                            ComplaintImagesDTOs.Add(new ComplaintImagesDTO()
                            {
                                ComplaintId = 0,
                                FileType    = "Image",
                                FileImage   = item
                            });
                        }
                        CheckHashFile();
                    }
                }
            }
        }
 public async Task GetCity()
 {
     CityList = await _complaintService.GetCities("");
 }
コード例 #3
0
        private async Task <bool> ExecuteLoginCommandAsync()
        {
            try
            {
                ValidateFields();
                if (_userName.IsValid && _password.IsValid)
                {
                    _userDialogs.ShowLoading("Loading", null);
                    LoginRequest loginRequest = new LoginRequest();
                    loginRequest.Email    = UserName.Value;
                    loginRequest.Password = Password.Value;
                    _accountService       = new AccountService();
                    _complaintService.DeleteCity();
                    var responce = await _accountService.RequestToken(loginRequest);

                    if (responce == true)
                    {
                        var UserInfo = await _accountService.GetUserInfo();


                        _settings.UserId      = UserInfo.UserId;
                        _settings.UserName    = UserInfo.UserId;
                        _settings.UserCity    = UserInfo.City;
                        _settings.Email       = UserInfo.Email;
                        _settings.PhoneNumber = UserInfo.PhoneNumber;
                        _settings.Name        = UserInfo.Name;
                        _settings.UserRole    = UserInfo.UserRole;
                        _settings.IsLogin     = true;
                        await _complaintService.GetCities("");

                        var CityModel = await _complaintService.GetCityByName(UserInfo.City);

                        if (CityModel == null)
                        {
                            _userDialogs.HideLoading();
                            await PageDialogService.DisplayAlertAsync(null, "Sorry, for your City this APP is not active right now.", "OK");

                            _settings.IsLogin2 = false;

                            return(true);
                        }
                        _settings.UserCityId = CityModel.ExternalId;
                        var Lows = await _complaintService.GetAllLows(_settings.UserId, CityModel.ExternalId);

                        _settings.UserCityId = CityModel.ExternalId;
                        _userDialogs.HideLoading();
                        await NavigationService.NavigateAsync(new System.Uri($"/{AppPages.SSCMaster.SSCMasterPage}/{AppPages.NavigationPage}/{AppPages.DashBoard.HomePage}", System.UriKind.Absolute));
                    }
                    else
                    {
                        _userDialogs.HideLoading();
                        await PageDialogService.DisplayAlertAsync("Login", "Invalid login credentials", "OK");
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                _userDialogs.HideLoading();
                await PageDialogService.DisplayAlertAsync(null, AppAlertMessage.TechnicalError, "OK");

                return(true);
            }
        }