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