Ejemplo n.º 1
0
        async public Task GetLows()
        {
            try
            {
                IsBusy = true;
                var listLows = await _complaintService.GetAllLows(_settings.UserId, _settings.UserCityId);

                if (listLows.AnyExtended())
                {
                    IsEmpty = false;
                    IsBusy  = false;
                    int i = 1;
                    foreach (var item in listLows)
                    {
                        item.LowsTitile       = item.LowsTitile;
                        item.NumberText       = Convert.ToString(i);
                        item.LowsDescriptions = item.LowsDescriptions;
                        LowsList.Add(item);
                        i++;
                    }
                    IsBusy = false;
                }
                else
                {
                    IsEmpty = true;
                    IsBusy  = false;
                }
            }
            catch (Exception ex)
            {
                IsEmpty = true;
                IsBusy  = false;
            }
        }
Ejemplo n.º 2
0
        private async Task GetLows()
        {
            List <LowsModel> listLows       = new List <LowsModel>();
            List <LowsModel> UpdateLowModel = new List <LowsModel>();

            listLows = await _complaintService.GetAllLows(_settings.UserId, _settings.UserCityId);

            if (listLows.Count > 0)
            {
                SaveLowList = new List <int>();
                if (!string.IsNullOrEmpty(ComplaintModelObj.LowsId))
                {
                    List <int> SplitLows = new List <int>();
                    SplitLows = ComplaintModelObj.LowsId.Split(',')?.Select(Int32.Parse).ToList();
                    foreach (var item in listLows)
                    {
                        if (SplitLows.AnyExtended())
                        {
                            if (SplitLows.Contains(item.ExternalId))
                            {
                                item.IsCheck = true;
                            }
                            else
                            {
                                item.IsCheck = false;
                            }
                            UpdateLowModel.Add(item);
                        }
                        else
                        {
                            UpdateLowModel.Add(item);
                        }
                    }
                    LowsList = UpdateLowModel;
                }
                else
                {
                    LowsList = listLows;
                }
            }
            else
            {
                IsBusy  = false;
                IsEmpty = true;
            }
            IsBusy = false;
        }
        public async Task SetComplaintOverviewData()
        {
            try
            {
                List <LowsModel> listLows = new List <LowsModel>();
                listLows = await _complaintService.GetAllLows(_settings.UserId, _settings.UserCityId);

                RejectTextArea    = ComplaintModelObj.CommentForRejection;
                Complaint         = _complaintService.GetNonComplaint();
                IsBusy            = true;
                ComplaintModelObj = await _complaintService.GetNonComplaintModel();

                var Controller = EnumExtensionMethods.GetEnumDescription(UserRole.Controller);
                var Admin      = EnumExtensionMethods.GetEnumDescription(UserRole.Admin);

                if (ComplaintModelObj != null)
                {
                    if (!string.IsNullOrEmpty(ComplaintModelObj.LowsId))
                    {
                        List <int> SplitLows = new List <int>();
                        SplitLows = ComplaintModelObj.LowsId.Split(',')?.Select(Int32.Parse).ToList();
                        int i = 1;
                        foreach (var item in listLows)
                        {
                            if (SplitLows.AnyExtended())
                            {
                                if (SplitLows.Contains(item.ExternalId))
                                {
                                    item.LowsTitile = item.LowsTitile;
                                    item.NumberText = Convert.ToString(i);
                                    LowsList.Add(item);
                                    i++;
                                }
                            }
                        }
                    }

                    ComplaintImagesDTOs = new ObservableCollection <ComplaintImagesDTO>();
                    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();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
        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);
            }
        }