public async Task <bool> Delete(SLAAlertFRTMail SLAAlertFRTMail) { if (await ValidateId(SLAAlertFRTMail)) { } return(SLAAlertFRTMail.IsValidated); }
public async Task <SLAAlertFRTMail> Get(long Id) { SLAAlertFRTMail SLAAlertFRTMail = await DataContext.SLAAlertFRTMail.AsNoTracking() .Where(x => x.Id == Id).Select(x => new SLAAlertFRTMail() { CreatedAt = x.CreatedAt, UpdatedAt = x.UpdatedAt, Id = x.Id, SLAAlertFRTId = x.SLAAlertFRTId, Mail = x.Mail, SLAAlertFRT = x.SLAAlertFRT == null ? null : new SLAAlertFRT { Id = x.SLAAlertFRT.Id, TicketIssueLevelId = x.SLAAlertFRT.TicketIssueLevelId, IsNotification = x.SLAAlertFRT.IsNotification, IsMail = x.SLAAlertFRT.IsMail, IsSMS = x.SLAAlertFRT.IsSMS, Time = x.SLAAlertFRT.Time, TimeUnitId = x.SLAAlertFRT.TimeUnitId, IsAssignedToUser = x.SLAAlertFRT.IsAssignedToUser, IsAssignedToGroup = x.SLAAlertFRT.IsAssignedToGroup, SmsTemplateId = x.SLAAlertFRT.SmsTemplateId, MailTemplateId = x.SLAAlertFRT.MailTemplateId, }, }).FirstOrDefaultAsync(); if (SLAAlertFRTMail == null) { return(null); } return(SLAAlertFRTMail); }
public async Task <bool> Delete(SLAAlertFRTMail SLAAlertFRTMail) { await DataContext.SLAAlertFRTMail.Where(x => x.Id == SLAAlertFRTMail.Id).UpdateFromQueryAsync(x => new SLAAlertFRTMailDAO { DeletedAt = StaticParams.DateTimeNow }); return(true); }
public async Task <SLAAlertFRTMail> Get(long Id) { SLAAlertFRTMail SLAAlertFRTMail = await UOW.SLAAlertFRTMailRepository.Get(Id); if (SLAAlertFRTMail == null) { return(null); } return(SLAAlertFRTMail); }
public TicketIssueLevel_SLAAlertFRTMailDTO(SLAAlertFRTMail SLAAlertFRTMail) { this.Id = SLAAlertFRTMail.Id; this.SLAAlertFRTId = SLAAlertFRTMail.SLAAlertFRTId; this.Mail = SLAAlertFRTMail.Mail; this.SLAAlertFRT = SLAAlertFRTMail.SLAAlertFRT == null ? null : new TicketIssueLevel_SLAAlertFRTDTO(SLAAlertFRTMail.SLAAlertFRT); this.CreatedAt = SLAAlertFRTMail.CreatedAt; this.UpdatedAt = SLAAlertFRTMail.UpdatedAt; this.Errors = SLAAlertFRTMail.Errors; }
public async Task <bool> Create(SLAAlertFRTMail SLAAlertFRTMail) { SLAAlertFRTMailDAO SLAAlertFRTMailDAO = new SLAAlertFRTMailDAO(); SLAAlertFRTMailDAO.Id = SLAAlertFRTMail.Id; SLAAlertFRTMailDAO.SLAAlertFRTId = SLAAlertFRTMail.SLAAlertFRTId; SLAAlertFRTMailDAO.Mail = SLAAlertFRTMail.Mail; SLAAlertFRTMailDAO.CreatedAt = StaticParams.DateTimeNow; SLAAlertFRTMailDAO.UpdatedAt = StaticParams.DateTimeNow; DataContext.SLAAlertFRTMail.Add(SLAAlertFRTMailDAO); await DataContext.SaveChangesAsync(); SLAAlertFRTMail.Id = SLAAlertFRTMailDAO.Id; await SaveReference(SLAAlertFRTMail); return(true); }
public async Task <bool> Update(SLAAlertFRTMail SLAAlertFRTMail) { SLAAlertFRTMailDAO SLAAlertFRTMailDAO = DataContext.SLAAlertFRTMail.Where(x => x.Id == SLAAlertFRTMail.Id).FirstOrDefault(); if (SLAAlertFRTMailDAO == null) { return(false); } SLAAlertFRTMailDAO.Id = SLAAlertFRTMail.Id; SLAAlertFRTMailDAO.SLAAlertFRTId = SLAAlertFRTMail.SLAAlertFRTId; SLAAlertFRTMailDAO.Mail = SLAAlertFRTMail.Mail; SLAAlertFRTMailDAO.UpdatedAt = StaticParams.DateTimeNow; await DataContext.SaveChangesAsync(); await SaveReference(SLAAlertFRTMail); return(true); }
public async Task <bool> ValidateId(SLAAlertFRTMail SLAAlertFRTMail) { SLAAlertFRTMailFilter SLAAlertFRTMailFilter = new SLAAlertFRTMailFilter { Skip = 0, Take = 10, Id = new IdFilter { Equal = SLAAlertFRTMail.Id }, Selects = SLAAlertFRTMailSelect.Id }; int count = await UOW.SLAAlertFRTMailRepository.Count(SLAAlertFRTMailFilter); if (count == 0) { SLAAlertFRTMail.AddError(nameof(SLAAlertFRTMailValidator), nameof(SLAAlertFRTMail.Id), ErrorCode.IdNotExisted); } return(count == 1); }
public async Task <SLAAlertFRTMail> Update(SLAAlertFRTMail SLAAlertFRTMail) { if (!await SLAAlertFRTMailValidator.Update(SLAAlertFRTMail)) { return(SLAAlertFRTMail); } try { var oldData = await UOW.SLAAlertFRTMailRepository.Get(SLAAlertFRTMail.Id); await UOW.Begin(); await UOW.SLAAlertFRTMailRepository.Update(SLAAlertFRTMail); await UOW.Commit(); SLAAlertFRTMail = await UOW.SLAAlertFRTMailRepository.Get(SLAAlertFRTMail.Id); await Logging.CreateAuditLog(SLAAlertFRTMail, oldData, nameof(SLAAlertFRTMailService)); return(SLAAlertFRTMail); } catch (Exception ex) { await UOW.Rollback(); if (ex.InnerException == null) { await Logging.CreateSystemLog(ex, nameof(SLAAlertFRTMailService)); throw new MessageException(ex); } else { await Logging.CreateSystemLog(ex.InnerException, nameof(SLAAlertFRTMailService)); throw new MessageException(ex.InnerException); } } }
public async Task <bool> Create(SLAAlertFRTMail SLAAlertFRTMail) { return(SLAAlertFRTMail.IsValidated); }
private async Task SaveReference(SLAAlertFRTMail SLAAlertFRTMail) { }