private DateTime?GetMSISDateFromPersonalData()
 {
     if (PersonalData.Validate())
     {
         try
         {
             return(Convert.ToDateTime(PersonalData.Covid19_smitte_start, CultureInfo.InvariantCulture));
         }
         catch (Exception e)
         {
             LogUtils.LogMessage(LogSeverity.ERROR, e.StackTrace, "MSIS data can't be parsed into DateTime");
         }
     }
     return(null);
 }
예제 #2
0
        public void InvokeNextButtonClick(
            Action onSuccess,
            Action onFail,
            Action onValidationFail,
            PlatformDialogServiceArguments platformDialogServiceArguments = null)
        {
            if (Selection == QuestionaireSelection.YesSince)
            {
                if (_selectedDateUTC == DateTime.MinValue)
                {
                    ServiceLocator.Current
                    .GetInstance <IDialogService>()
                    .ShowMessageDialog(
                        null,
                        "REGISTER_QUESTIONAIRE_CHOOSE_DATE_POP_UP".Translate(),
                        "ERROR_OK_BTN".Translate(),
                        platformDialogServiceArguments);

                    onValidationFail?.Invoke();

                    return;
                }
                PersonalData.FinalMiBaDate = _localSelectedDate;
            }
            else if (PersonalData.Validate())
            {
                try
                {
                    PersonalData.FinalMiBaDate = Convert.ToDateTime(PersonalData.Covid19_smitte_start);
                }
                catch
                {
                    onFail?.Invoke();
                    LogUtils.LogMessage(LogSeverity.ERROR, "Miba data can't be parsed into datetime");
                    return;
                }
            }
            else
            {
                onFail?.Invoke();
                LogUtils.LogMessage(LogSeverity.ERROR, "Validation of personaldata failed because of miba data was null or accesstoken expired");
                return;
            }

            onSuccess?.Invoke();
        }
예제 #3
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (Token == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Token");
     }
     if (NotificationsId == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "NotificationsId");
     }
     if (PersonalData == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "PersonalData");
     }
     if (PersonalData != null)
     {
         PersonalData.Validate();
     }
 }