private async Task ValidateDataResponse(ResponseBase response)
        {
            if (response.Success && response.StatusCode == 0)
            {
                if (CodeService == CodeResponse.UserDisableAccount)
                {
                    await dialogService.AlertIcon(response.Title, $"Te hemos enviado un correo de reactivación a: {UserAccount}");

                    return;
                }

                await dialogService.AlertIcon(response.Title, response.Message);

                return;
            }

            await dialogService.ShowMessage(response.Title, response.Message);
        }
        private async void Send()
        {
            try
            {
                if (ValidateData())
                {
                    dialogService.ShowProgress();
                    var request = new RequestRegisterMinor
                    {
                        Action                     = "GetRegistrationResponsible",
                        Controller                 = "Family",
                        Document                   = loginViewModel.User.Document,
                        DocumentType               = loginViewModel.User.DocumentType,
                        StringMinorDocument        = IdentityFile.File,
                        StringCivilRegistration    = RegisterFile.File,
                        MinorDocumentType          = MemberSelected.DocumentType,
                        MinorDocument              = MemberSelected.Document,
                        MinorFullName              = MemberSelected.FullNames,
                        ExtentionCivilRegistration = RegisterFile.Extension.ToUpper().Replace(".", ""),
                        ExtentionDocument          = IdentityFile.Extension.ToUpper().Replace(".", ""),
                        MailResponsible            = loginViewModel.User.UserName
                    };
                    var response = await apiService.RegisterMinor(request);

                    dialogService.HideProgress();
                    if (response.Success && response.StatusCode != -1)
                    {
                        await dialogService.AlertIcon("Tu solicitud fue recibida", $"Tu solicitud ha sido registrada exitosamente bajo el radicado Nº: {response.NumFnc}. En un plazo máximo de dos (2) días hábiles daremos respuesta a tu requerimiento a través del correo {loginViewModel.User.UserName}");

                        await navigationService.Back();
                    }
                    else
                    {
                        await dialogService.ShowMessage(response.Title, response.Message);
                    }
                }
                else
                {
                    await dialogService.ShowMessage("", "Todos los campos marcados con (*) son obligatorios");
                }
            }
            catch (Exception e)
            {
                dialogService.HideProgress();
                ServiceLocator.Current.GetInstance <IExceptionService>().RegisterException(e);
            }
        }
Example #3
0
        private async void LoadCards()
        {
            try
            {
                CertificateCards = new ObservableCollection <CertificateCardViewModel>();

                dialogService.ShowProgress();
                var loginUser = BeneficiarySelected.Document.Equals(loginViewModel.User.Document);
                IsVisibleGroup = BeneficiarySelected.FullNames.Equals("Grupo Familiar");
                RequestCertificates request = new RequestCertificates
                {
                    Controller             = "Affiliate",
                    Action                 = "GetCertificates",
                    LoginUser              = loginUser,
                    Document               = BeneficiarySelected.Document,
                    DocumentType           = BeneficiarySelected.DocumentType,
                    GroupCode              = GroupCertificateSelected != null ? GroupCertificateSelected.GroupCode : string.Empty,
                    TypeCertificate        = BeneficiarySelected.TypeCertificate,
                    RequestGroup           = BeneficiarySelected.FullNames.Equals("Grupo Familiar"),
                    LoggedUserDocument     = loginViewModel.User.Document,
                    LoggedUserDocumentType = loginViewModel.User.DocumentType
                };

                var response = await apiService.GetCertificates(request);

                if (response.Success)
                {
                    if (response.Groups != null && GroupCertificates.Count == 0)
                    {
                        GroupCertificates = new ObservableCollection <GroupCertificate>(response.Groups);
                    }
                    if (response.Certificates != null)
                    {
                        CertificateCards = new ObservableCollection <CertificateCardViewModel>();
                        foreach (var a in response.Certificates)
                        {
                            CertificateCards.Add
                            (
                                new CertificateCardViewModel
                            {
                                CertificateName   = a.CertificateName,
                                CertificateCode   = a.CertificateCode,
                                FileName          = a.FileName,
                                TypeCertificate   = a.TypeCertificate,
                                Document          = beneficiarySelected.Document,
                                DocumentType      = beneficiarySelected.DocumentType,
                                Name              = beneficiarySelected.FullNames,
                                IsVisibleGenerate = a.CertificateCode.Equals("5"),
                                HasDebt           = !response.PeaceSafe,
                                GroupCode         = GroupCode
                            }
                            );
                        }
                    }
                }
                else
                {
                    await dialogService.ShowMessage(response.Title, response.Message);
                }
                dialogService.HideProgress();
                if (BeneficiarySelected.FullNames.Equals("Grupo Familiar") && !string.IsNullOrWhiteSpace(GroupNames))
                {
                    await dialogService.AlertIcon($"Estos son tus familiares en {GroupCertificateSelected.GroupName}", GroupNames);
                }
            }
            catch (Exception e)
            {
                ServiceLocator.Current.GetInstance <IExceptionService>().RegisterException(e);
            }
            finally
            {
                dialogService.HideProgress();
            }
        }