Ejemplo n.º 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);
            }
        }