示例#1
0
        private bool ValidateFields()
        {
            try
            {
                bool result = true;
                if (AreaSelected == null)
                {
                    ErrorArea = "Es requerido seleccionar el area médica";
                    result    = false;
                }
                if (!string.IsNullOrWhiteSpace(NameOfficial))
                {
                    if (!ValidatorHelper.IsValidName(NameOfficial))
                    {
                        ErrorOfficial = "Ingrese un nombre válido";
                        result        = false;
                    }
                }
                if (Comment.Length < 40)
                {
                    ErrorComment = "Mínimo 40 caracteres";
                    result       = false;
                }
                if (RefundMotiveSelected == null && IsVisibleRefundMotive)
                {
                    ErrorRefundMotive = "El motivo del reembolso es requerido.";
                    result            = false;
                }
                if (documentsRequired != null)
                {
                    foreach (var doc in DocumentsRequired)
                    {
                        doc.IsVisibleError = doc.IsRequired && string.IsNullOrWhiteSpace(doc.NameDocument);
                    }
                }

                var asd = DocumentsRequired.Any(x => x.IsVisibleError == true);
                if (asd)
                {
                    result = false;
                }

                if (!result)
                {
                    dialogService.ShowMessage("", "Por favor diligencia correctamente todos los campos");
                }

                return(result);
            }
            catch (Exception e)
            {
                ServiceLocator.Current.GetInstance <IExceptionService>().RegisterException(e);
                return(false);
            }
        }
示例#2
0
        public List <FileSelected> GetFile(int code)
        {
            var file = DocumentsRequired.Where(x => x.Code == code).FirstOrDefault();

            List <FileSelected> fileReady = new List <FileSelected>();

            if (file != null)
            {
                fileReady.Add(new FileSelected
                {
                    File      = file.Base64,
                    Name      = file.NameDocument,
                    Extension = file.Extension
                });
            }

            return(fileReady);
        }
示例#3
0
        public async void SavePQRS()
        {
            try
            {
                dialogService.ShowProgress();
                string documentType        = WhoSelected.Equals("A un tercero") ? DocumentSelected.Code : loginViewModel.User.DocumentType;
                string applicantDocument   = WhoSelected.Equals("A un tercero") ? Document : loginViewModel.User.Document;
                int    subject             = whoSelected.Equals("A un tercero") ? 02 : 01;
                List <FileSelected> thanks = new List <FileSelected>();

                if (DocumentsRequired.First() != null && EventTypeSelected.EventTypesId.Equals("4"))
                {
                    if (!string.IsNullOrWhiteSpace(DocumentsRequired.First().FilesSelected.First().NameDocument))
                    {
                        thanks.Add(new FileSelected
                        {
                            File      = DocumentsRequired.First().FilesSelected.First().Base64,
                            Extension = DocumentsRequired.First().FilesSelected.First().Extension,
                            Name      = DocumentsRequired.First().FilesSelected.First().NameDocument
                        });
                    }
                }


                List <FileSelected> complains = new List <FileSelected>();
                if (EventTypeSelected.EventTypesId.Equals("1"))
                {
                    foreach (var doc in DocumentsRequired.First().FilesSelected)
                    {
                        complains.Add(new FileSelected
                        {
                            Extension = doc.Extension,
                            Name      = doc.NameDocument,
                            File      = doc.Base64
                        });
                    }
                }

                List <FileSelected> titularDeath = GetFile(1);
                List <FileSelected> civilRegistrationMarriage = GetFile(2);
                List <FileSelected> birthCertificate          = GetFile(3);
                List <FileSelected> spouseDeath            = GetFile(4);
                List <FileSelected> extraJudgement         = GetFile(5);
                List <FileSelected> bankAccountCertificate = GetFile(6);
                List <FileSelected> beneficiaryDeath       = GetFile(7);
                List <FileSelected> payroll     = GetFile(8);
                List <FileSelected> bankAccount = GetFile(9);

                var request = new RequestCreatePQRS
                {
                    EventType                               = EventTypeSelected.EventTypesId,
                    SubjectOfTheEvent                       = subject.ToString(),
                    ApplicantDocumentType                   = loginViewModel.User.DocumentType,
                    ApplicantDocument                       = loginViewModel.User.Document,
                    ThirdDocument                           = applicantDocument,
                    ThirdDocumentType                       = documentType,
                    BankAccountUser                         = HasBankAccount,
                    RelatedArea                             = areaSelected.Code.ToString(),
                    NamesOfficial                           = NameOfficial ?? String.Empty,
                    EventDate                               = EventDate.ToString("dd/MM/yyyy"),
                    EventComment                            = Comment,
                    AcceptTermsAndConditions                = true,
                    ReasonsForReimbursement                 = RefundMotiveSelected?.Code.ToString() ?? string.Empty,
                    SendFileThanksAndCongratulations        = thanks ?? new List <FileSelected>(),
                    SendFilesComplaintsAndClaims            = complains ?? new List <FileSelected>(),
                    SendBeneficiaryDeathCertificate         = beneficiaryDeath ?? new List <FileSelected>(),
                    SendFileBankAccountCertificate          = bankAccountCertificate ?? new List <FileSelected>(),
                    SendFileTitularDeathCertificate         = titularDeath ?? new List <FileSelected>(),
                    SendFilesCivilRegistrationMarriage      = civilRegistrationMarriage ?? new List <FileSelected>(),
                    SendFileBirthCertificateSon             = birthCertificate ?? new List <FileSelected>(),
                    SendFileSpouseDeathCertificate          = spouseDeath ?? new List <FileSelected>(),
                    SendFileExtraJudgmentStatement          = extraJudgement ?? new List <FileSelected>(),
                    SendFileBankAccount                     = bankAccount ?? new List <FileSelected>(),
                    SendFileBankStatementOrRemovablePayroll = payroll ?? new List <FileSelected>(),
                    EventCodeDepartment                     = PQRSUser.ResponseUser.CodeState,
                    EventCodeCity                           = PQRSUser.ResponseUser.CodeCity,
                    Action     = "PostCreatePqrs",
                    Controller = "pqrs"
                };



                //var request = new RequestCreatePQRS();
                dialogService.ShowProgress();
                var response = await apiService.PostPQRS(request);

                dialogService.HideProgress();
                if (response.Success)
                {
                    await dialogService.ShowMessage("", response.Message + " " + response.SettledNumber);

                    await navigationService.BackToRoot();
                }
                else
                {
                    await dialogService.ShowMessage(response.Title, response.Message);
                }
            }
            catch (Exception e)
            {
                ServiceLocator.Current.GetInstance <IExceptionService>().RegisterException(e);
            }
            finally
            {
                dialogService.HideProgress();
            }
        }