/// <summary> /// Initializes a new instance of the <see cref="UserProfileService"/> class. /// </summary> /// <param name="logger">Injected Logger Provider.</param> /// <param name="userProfileDelegate">The profile delegate to interact with the DB.</param> /// <param name="userPreferenceDelegate">The preference delegate to interact with the DB.</param> /// <param name="emailDelegate">The email delegate to interact with the DB.</param> /// <param name="emailInviteDelegate">The email invite delegate to interact with the DB.</param> /// <param name="configuration">The configuration service.</param> /// <param name="emailQueueService">The email service to queue emails.</param> /// <param name="legalAgreementDelegate">The terms of service delegate.</param> /// <param name="cryptoDelegate">Injected Crypto delegate.</param> /// <param name="notificationSettingsService">Notification settings delegate.</param> /// <param name="messageVerificationDelegate">The message verification delegate to interact with the DB.</param> /// <param name="patientService">The patient service.</param> public UserProfileService( ILogger <UserProfileService> logger, IUserProfileDelegate userProfileDelegate, IUserPreferenceDelegate userPreferenceDelegate, IEmailDelegate emailDelegate, IMessagingVerificationDelegate emailInviteDelegate, IConfigurationService configuration, IEmailQueueService emailQueueService, ILegalAgreementDelegate legalAgreementDelegate, ICryptoDelegate cryptoDelegate, INotificationSettingsService notificationSettingsService, IMessagingVerificationDelegate messageVerificationDelegate, IPatientService patientService) { this.logger = logger; this.userProfileDelegate = userProfileDelegate; this.userPreferenceDelegate = userPreferenceDelegate; this.emailDelegate = emailDelegate; this.emailInviteDelegate = emailInviteDelegate; this.configurationService = configuration; this.emailQueueService = emailQueueService; this.legalAgreementDelegate = legalAgreementDelegate; this.cryptoDelegate = cryptoDelegate; this.notificationSettingsService = notificationSettingsService; this.messageVerificationDelegate = messageVerificationDelegate; this.patientService = patientService; }
/// <summary> /// Initializes a new instance of the <see cref="UserProfileService"/> class. /// </summary> /// <param name="logger">Injected Logger Provider.</param> /// <param name="patientService">The patient service.</param> /// <param name="userEmailService">The User Email service.</param> /// <param name="userSMSService">The User SMS service.</param> /// <param name="configurationService">The configuration service.</param> /// <param name="emailQueueService">The email service to queue emails.</param> /// <param name="notificationSettingsService">The Notifications Settings service.</param> /// <param name="userProfileDelegate">The profile delegate to interact with the DB.</param> /// <param name="userPreferenceDelegate">The preference delegate to interact with the DB.</param> /// <param name="legalAgreementDelegate">The terms of service delegate.</param> /// <param name="messageVerificationDelegate">The message verification delegate.</param> /// <param name="cryptoDelegate">Injected Crypto delegate.</param> /// <param name="httpContextAccessor">The injected http context accessor provider.</param> public UserProfileService( ILogger <UserProfileService> logger, IPatientService patientService, IUserEmailService userEmailService, IUserSMSService userSMSService, IConfigurationService configurationService, IEmailQueueService emailQueueService, INotificationSettingsService notificationSettingsService, IUserProfileDelegate userProfileDelegate, IUserPreferenceDelegate userPreferenceDelegate, ILegalAgreementDelegate legalAgreementDelegate, IMessagingVerificationDelegate messageVerificationDelegate, ICryptoDelegate cryptoDelegate, IHttpContextAccessor httpContextAccessor) { this.logger = logger; this.patientService = patientService; this.userEmailService = userEmailService; this.userSMSService = userSMSService; this.configurationService = configurationService; this.emailQueueService = emailQueueService; this.notificationSettingsService = notificationSettingsService; this.userProfileDelegate = userProfileDelegate; this.userPreferenceDelegate = userPreferenceDelegate; this.legalAgreementDelegate = legalAgreementDelegate; this.messageVerificationDelegate = messageVerificationDelegate; this.cryptoDelegate = cryptoDelegate; this.httpContextAccessor = httpContextAccessor; }
/// <summary> /// Initializes a new instance of the <see cref="CommentService"/> class. /// </summary> /// <param name="logger">Injected Logger Provider.</param> /// <param name="commentDelegate">Injected Comment delegate.</param> /// <param name="profileDelegate">Injected Profile delegate.</param> /// <param name="cryptoDelegate">Injected Crypto delegate.</param> public CommentService(ILogger <CommentService> logger, ICommentDelegate commentDelegate, IUserProfileDelegate profileDelegate, ICryptoDelegate cryptoDelegate) { this.logger = logger; this.commentDelegate = commentDelegate; this.profileDelegate = profileDelegate; this.cryptoDelegate = cryptoDelegate; }
/// <summary> /// Initializes a new instance of the <see cref="NoteService"/> class. /// </summary> /// <param name="logger">Injected Logger Provider.</param> /// <param name="noteDelegate">Injected Note delegate.</param> /// <param name="profileDelegate">Injected Profile delegate.</param> /// <param name="cryptoDelegate">Injected Crypto delegate.</param> public NoteService(ILogger <NoteService> logger, INoteDelegate noteDelegate, IUserProfileDelegate profileDelegate, ICryptoDelegate cryptoDelegate) { this.logger = logger; this.noteDelegate = noteDelegate; this.profileDelegate = profileDelegate; this.cryptoDelegate = cryptoDelegate; }
/// <summary> /// Constructs a database Note model from a user Node model. /// </summary> /// <param name="cryptoDelegate">Crypto delegate to decrypt note.</param> /// <param name="key">The security key.</param> /// <returns>The database user note model.</returns> public Database.Models.Note ToDbModel(ICryptoDelegate cryptoDelegate, string key) { return(new Database.Models.Note() { Id = this.Id, HdId = this.HdId, JournalDateTime = this.JournalDateTime, Version = this.Version, CreatedDateTime = this.CreatedDateTime, CreatedBy = this.CreatedBy, UpdatedDateTime = this.UpdatedDateTime, UpdatedBy = this.UpdatedBy, Title = cryptoDelegate.Encrypt(key, this.Title), Text = cryptoDelegate.Encrypt(key, this.Text), }); }
/// <summary> /// Constructs a UserNote model from a Node database model. /// </summary> /// <param name="model">The note database model.</param> /// <param name="cryptoDelegate">Crypto delegate to decrypt note.</param> /// <param name="key">The security key.</param> /// <returns>The user note model.</returns> public static UserNote CreateFromDbModel(Database.Models.Note model, ICryptoDelegate cryptoDelegate, string key) { return(new UserNote() { Id = model.Id, HdId = model.HdId, JournalDateTime = model.JournalDateTime, Version = model.Version, CreatedDateTime = model.CreatedDateTime, CreatedBy = model.CreatedBy, UpdatedDateTime = model.UpdatedDateTime, UpdatedBy = model.UpdatedBy, Title = model.Title != null?cryptoDelegate.Decrypt(key, model.Title) : string.Empty, Text = model.Text != null?cryptoDelegate.Decrypt(key, model.Text) : string.Empty, }); }
/// <summary> /// Constructs a database comment model from a user Node model. /// </summary> /// <param name="cryptoDelegate">Crypto delegate to decrypt comment.</param> /// <param name="key">The security key.</param> /// <returns>The database user comment model.</returns> public Database.Models.Comment ToDbModel(ICryptoDelegate cryptoDelegate, string key) { return(new Database.Models.Comment() { Id = this.Id, UserProfileId = this.UserProfileId, EntryTypeCode = this.EntryTypeCode, ParentEntryId = this.ParentEntryId, Version = this.Version, CreatedDateTime = this.CreatedDateTime, CreatedBy = this.CreatedBy, UpdatedDateTime = this.UpdatedDateTime, UpdatedBy = this.UpdatedBy, Text = cryptoDelegate.Encrypt(key, this.Text), }); }
/// <summary> /// Constructs a UserComment model from a Node database model. /// </summary> /// <param name="model">The comment database model.</param> /// <param name="cryptoDelegate">Crypto delegate to decrypt comment.</param> /// <param name="key">The security key.</param> /// <returns>The user comment model.</returns> public static UserComment CreateFromDbModel(Database.Models.Comment model, ICryptoDelegate cryptoDelegate, string key) { return(new UserComment() { Id = model.Id, UserProfileId = model.UserProfileId, EntryTypeCode = model.EntryTypeCode, ParentEntryId = model.ParentEntryId, Version = model.Version, CreatedDateTime = model.CreatedDateTime, CreatedBy = model.CreatedBy, UpdatedDateTime = model.UpdatedDateTime, UpdatedBy = model.UpdatedBy, Text = model.Text != null?cryptoDelegate.Decrypt(key, model.Text) : string.Empty, }); }
public async override void OnReceive(Context context, Intent intent) { try { var setupSingleton = MvxAndroidSetupSingleton.EnsureSingletonAvailable(context); setupSingleton.EnsureInitialized(); RealmService = new CryptoRealmService(); CryptoDelegate = new CryptoDelegate(); var cryptoCurrencies = await CryptoDelegate.GetCryptoCurrencyList(); if (cryptoCurrencies != null && cryptoCurrencies.Count > 0) { var searchDto = new ReminderSearchDto { Type = SearchType.AllReminders }; var reminders = RealmService.GetReminder(searchDto); string message = ""; foreach (var reminder in reminders) { var cryptoCurrency = cryptoCurrencies.FirstOrDefault(x => x.MarketName == reminder.MarketName); if (cryptoCurrency == null) { continue; } if (reminder.IsExactValueSet && cryptoCurrency.Last == reminder.ExactValue) { message += reminder.MarketName + " has reached " + reminder.ExactValue.ConvertExpo() + ". \n"; } if (reminder.IsLowerLimitSet && cryptoCurrency.Last < reminder.LowerLimit) { message += reminder.MarketName + " has gone below " + reminder.LowerLimit.ConvertExpo() + ". It's current value is " + cryptoCurrency.Last.ConvertExpo() + ". \n"; } if (reminder.IsUpperLimitSet && cryptoCurrency.Last > reminder.UpperLimit) { message += reminder.MarketName + " has gone above " + reminder.UpperLimit.ConvertExpo() + ". It's current value is " + cryptoCurrency.Last.ConvertExpo() + ". \n"; } } message.TrimEnd('\r', '\n'); if (string.IsNullOrEmpty(message)) { return; } Notification.BigTextStyle textStyle = new Notification.BigTextStyle(); textStyle.BigText(message); Notification.Builder builder = new Notification.Builder(context) .SetSound(RingtoneManager.GetDefaultUri(RingtoneType.Notification)) .SetContentTitle("Crypto Reminder.") .SetSmallIcon(Resource.Drawable.notification_bg) .SetStyle(textStyle); // Build the notification: Notification notification = builder.Build(); // Get the notification manager: NotificationManager notificationManager = context.GetSystemService(Context.NotificationService) as NotificationManager; // Publish the notification: const int notificationId = 0; notificationManager.Notify(notificationId, notification); } } catch (Exception ex) { } }
public RemindersListViewModel(IDialogService dialogService, ICryptoDelegate cryptoDelegate) { CryptoDelegate = cryptoDelegate; DialogService = dialogService; }
public CryptoCurrencyListViewModel(IDialogService dialogService, ICryptoDelegate cryptoDelegate) { CryptoDelegate = cryptoDelegate; DialogService = dialogService; }
/// <summary> /// Constructs a List of UserNote models from a List of Node database models. /// </summary> /// <param name="models">The list of note database model.</param> /// <param name="cryptoDelegate">Crypto delegate to decrypt note.</param> /// <param name="key">The security key.</param> /// <returns>A list of use notes.</returns> public static IEnumerable <UserNote> CreateListFromDbModel(IEnumerable <Database.Models.Note> models, ICryptoDelegate cryptoDelegate, string key) { List <UserNote> newList = new List <UserNote>(); foreach (Database.Models.Note model in models) { newList.Add(UserNote.CreateFromDbModel(model, cryptoDelegate, key)); } return(newList); }