示例#1
0
        public async Task <bool> RemoveItemByIdentityAsync(int id)
        {
            VoiceMailData origData = Auditing.Active ? await GetItemByIdentityAsync(id) : null;

            if (!await DataProvider.RemoveByIdentityAsync(id))
            {
                return(false);
            }

            await SetupClient();

            try {
                if (YetaWFManager.IsSync())
                {
                    RecordingResource.Delete(pathSid: origData.RecordingSid);
                }
                else
                {
                    await RecordingResource.DeleteAsync(pathSid : origData.RecordingSid);
                }
            } catch (Exception) { }

            await Auditing.AddAuditAsync($"{nameof(VoiceMailDataProvider)}.{nameof(RemoveItemByIdentityAsync)}", Dataset, Guid.Empty,
                                         $"Remove Voice Mail Entry {id}",
                                         DataBefore : origData,
                                         DataAfter : null
                                         );

            return(true);
        }
示例#2
0
        public async Task <bool> AddItemAsync(VoiceMailData data)
        {
            data.Created = DateTime.UtcNow;
            if (!await DataProvider.AddAsync(data))
            {
                return(false);
            }
            await Auditing.AddAuditAsync($"{nameof(VoiceMailDataProvider)}.{nameof(AddItemAsync)}", Dataset, Guid.Empty,
                                         $"Add Voice Mail Entry {data.Id}",
                                         DataBefore : null,
                                         DataAfter : data
                                         );

            return(true);
        }
示例#3
0
        public async Task UpdateItemAsync(VoiceMailData data)
        {
            VoiceMailData origEmail = Auditing.Active ? await GetItemAsync(data.CallSid) : null;

            UpdateStatusEnum status = await DataProvider.UpdateByIdentityAsync(data.Id, data);

            if (status != UpdateStatusEnum.OK)
            {
                throw new InternalError("Unexpected error {0} updating item", status);
            }
            await Auditing.AddAuditAsync($"{nameof(VoiceMailDataProvider)}.{nameof(UpdateItemAsync)}", Dataset, Guid.Empty,
                                         $"Update Voice Mail Entry {data.Id}",
                                         DataBefore : origEmail,
                                         DataAfter : data
                                         );
        }