public Task <ReminderHistory> AddAsync(ReminderHistory ReminderHistory, CancellationToken token = default(CancellationToken)) { var query = $@" INSERT INTO ReminderHistory ( ReminderId , StatusId , Memo , OutputFlag , InputType , ReminderAmount , CreateBy , CreateAt ) OUTPUT inserted.* VALUES ( @ReminderId , @StatusId , @Memo , @OutputFlag , @InputType , @ReminderAmount , @CreateBy , GETDATE() ) "; return(dbHelper.ExecuteAsync <ReminderHistory>(query, ReminderHistory, token)); }
public async Task <int> UpdateStatusAsync(int loginUserId, Reminder[] Reminder, CancellationToken token = default(CancellationToken)) { using (var scope = transactionScopeBuilder.Create()) { var count = 0; foreach (var r in Reminder) { var result = await updateReminderQueryProcessor.UpdateStatusAsync(r, token); var history = new ReminderHistory() { ReminderId = result.Id, StatusId = result.StatusId, Memo = result.Memo, OutputFlag = result.OutputAt != null ? 1 : 0, InputType = (int)ReminderHistory.ReminderHistoryInputType.StatusChange, ReminderAmount = r.ReminderAmount, CreateBy = loginUserId, }; var historyResult = await addReminderHistoryQueryProcessor.AddAsync(history, token); if (historyResult == null) { return(-1); } else { count++; } } scope.Complete(); return(count); } }
public void InitializeUserComponent(int precision, ReminderHistory reminderHistory) { FormWidth = 490; FormHeight = 400; ReminderHistory = reminderHistory; nmbReminderAmount.Fields.DecimalPart.MaxDigits = precision; nmbReminderAmount.Fields.DecimalPart.MinDigits = precision; SetFunctionKeys(); }
public Task <ReminderHistory> UpdateReminderHistoryAsync(ReminderHistory reminderHistory, CancellationToken token = default(CancellationToken)) { var query = @" UPDATE ReminderHistory SET StatusId = @StatusId , Memo = @Memo OUTPUT inserted.* WHERE Id = @Id "; return(dbHelper.ExecuteAsync <ReminderHistory>(query, reminderHistory, token)); }
public async Task <CountResult> DeleteHistoryAsync(string SessionKey, ReminderHistory reminderHistory) { return(await authorizationProcessor.DoAuthorizeAsync(SessionKey, async token => { var result = await reminderHistoryProcessor.DeleteHistoryAsync(reminderHistory, token); return new CountResult { ProcessResult = new ProcessResult { Result = true }, Count = result, }; }, logger)); }
private void RecordSendSMSHistory(Reminder reminder, Contact contact, Profile profile, DateTime serverCurrentDateTime) { var reminderHistory = new ReminderHistory(); reminderHistory.ContactId = contact.Id; reminderHistory.Message = reminder.Message; reminderHistory.ProfileId = profile.Id; reminderHistory.ReminderDateTime = reminder.ReminderDateTime; reminderHistory.ReminderId = reminder.Id; reminderHistory.EmailSent = false; reminderHistory.SMSSent = true; reminderHistory.MessageSentDateTime = serverCurrentDateTime; _db.ReminderHistories.Add(reminderHistory); _db.Save(); }
public async Task <ReminderHistory> UpdateReminderHistoryAsync(ReminderHistory reminderHistory, CancellationToken token = default(CancellationToken)) { using (var scope = transactionScopeBuilder.Create()) { var result = await updateReminderHistoryQueryProcessor.UpdateReminderHistoryAsync(reminderHistory, token); if (reminderHistory.IsUpdateStatusMemo) { var reminder = new Reminder() { Id = reminderHistory.ReminderId, StatusId = reminderHistory.StatusId, Memo = reminderHistory.Memo, }; var reminderSummaryResult = await updateReminderQueryProcessor.UpdateStatusAsync(reminder); } scope.Complete(); return(result); } }
public async Task <int> DeleteHistoryAsync(ReminderHistory reminderHistory, CancellationToken token = default(CancellationToken)) { using (var scope = transactionScopeBuilder.Create()) { var result = await deleteReminderHistoryQueryProcessor.DeleteAsync(reminderHistory.Id, token); if (reminderHistory.IsUpdateStatusMemo) { var item = (await reminderHistoryQueryProcessor.GetItemsByReminderIdAsync(reminderHistory.ReminderId, token)).FirstOrDefault(); var reminder = new Reminder() { Id = reminderHistory.ReminderId, StatusId = item?.StatusId ?? reminderHistory.StatusId, Memo = item?.Memo ?? string.Empty, }; await updateReminderQueryProcessor.UpdateStatusAsync(reminder, token); } scope.Complete(); return(result); } }
public async Task <int> DeleteHistory(ReminderHistory reminderHistory, CancellationToken token) => await reminderHistoryProcessor.DeleteHistoryAsync(reminderHistory, token);
public async Task <ReminderHistory> UpdateReminderHistory(ReminderHistory reminderHistory, CancellationToken token) => await reminderHistoryProcessor.UpdateReminderHistoryAsync(reminderHistory, token);