Exemple #1
0
        public async Task <SLAEscalationFRTMail> Get(long Id)
        {
            SLAEscalationFRTMail SLAEscalationFRTMail = await DataContext.SLAEscalationFRTMail.AsNoTracking()
                                                        .Where(x => x.Id == Id).Select(x => new SLAEscalationFRTMail()
            {
                CreatedAt          = x.CreatedAt,
                UpdatedAt          = x.UpdatedAt,
                Id                 = x.Id,
                SLAEscalationFRTId = x.SLAEscalationFRTId,
                Mail               = x.Mail,
                SLAEscalationFRT   = x.SLAEscalationFRT == null ? null : new SLAEscalationFRT
                {
                    Id = x.SLAEscalationFRT.Id,
                    TicketIssueLevelId = x.SLAEscalationFRT.TicketIssueLevelId,
                    IsNotification     = x.SLAEscalationFRT.IsNotification,
                    IsMail             = x.SLAEscalationFRT.IsMail,
                    IsSMS             = x.SLAEscalationFRT.IsSMS,
                    Time              = x.SLAEscalationFRT.Time,
                    TimeUnitId        = x.SLAEscalationFRT.TimeUnitId,
                    IsAssignedToUser  = x.SLAEscalationFRT.IsAssignedToUser,
                    IsAssignedToGroup = x.SLAEscalationFRT.IsAssignedToGroup,
                    SmsTemplateId     = x.SLAEscalationFRT.SmsTemplateId,
                    MailTemplateId    = x.SLAEscalationFRT.MailTemplateId,
                },
            }).FirstOrDefaultAsync();

            if (SLAEscalationFRTMail == null)
            {
                return(null);
            }

            return(SLAEscalationFRTMail);
        }
 public async Task <bool> Delete(SLAEscalationFRTMail SLAEscalationFRTMail)
 {
     if (await ValidateId(SLAEscalationFRTMail))
     {
     }
     return(SLAEscalationFRTMail.IsValidated);
 }
Exemple #3
0
        public async Task <bool> Delete(SLAEscalationFRTMail SLAEscalationFRTMail)
        {
            await DataContext.SLAEscalationFRTMail.Where(x => x.Id == SLAEscalationFRTMail.Id).UpdateFromQueryAsync(x => new SLAEscalationFRTMailDAO {
                DeletedAt = StaticParams.DateTimeNow
            });

            return(true);
        }
        public async Task <SLAEscalationFRTMail> Get(long Id)
        {
            SLAEscalationFRTMail SLAEscalationFRTMail = await UOW.SLAEscalationFRTMailRepository.Get(Id);

            if (SLAEscalationFRTMail == null)
            {
                return(null);
            }
            return(SLAEscalationFRTMail);
        }
Exemple #5
0
 public TicketIssueLevel_SLAEscalationFRTMailDTO(SLAEscalationFRTMail SLAEscalationFRTMail)
 {
     this.Id = SLAEscalationFRTMail.Id;
     this.SLAEscalationFRTId = SLAEscalationFRTMail.SLAEscalationFRTId;
     this.Mail             = SLAEscalationFRTMail.Mail;
     this.SLAEscalationFRT = SLAEscalationFRTMail.SLAEscalationFRT == null ? null : new TicketIssueLevel_SLAEscalationFRTDTO(SLAEscalationFRTMail.SLAEscalationFRT);
     this.CreatedAt        = SLAEscalationFRTMail.CreatedAt;
     this.UpdatedAt        = SLAEscalationFRTMail.UpdatedAt;
     this.Errors           = SLAEscalationFRTMail.Errors;
 }
Exemple #6
0
        public async Task <bool> Create(SLAEscalationFRTMail SLAEscalationFRTMail)
        {
            SLAEscalationFRTMailDAO SLAEscalationFRTMailDAO = new SLAEscalationFRTMailDAO();

            SLAEscalationFRTMailDAO.Id = SLAEscalationFRTMail.Id;
            SLAEscalationFRTMailDAO.SLAEscalationFRTId = SLAEscalationFRTMail.SLAEscalationFRTId;
            SLAEscalationFRTMailDAO.Mail      = SLAEscalationFRTMail.Mail;
            SLAEscalationFRTMailDAO.CreatedAt = StaticParams.DateTimeNow;
            SLAEscalationFRTMailDAO.UpdatedAt = StaticParams.DateTimeNow;
            DataContext.SLAEscalationFRTMail.Add(SLAEscalationFRTMailDAO);
            await DataContext.SaveChangesAsync();

            SLAEscalationFRTMail.Id = SLAEscalationFRTMailDAO.Id;
            await SaveReference(SLAEscalationFRTMail);

            return(true);
        }
Exemple #7
0
        public async Task <bool> Update(SLAEscalationFRTMail SLAEscalationFRTMail)
        {
            SLAEscalationFRTMailDAO SLAEscalationFRTMailDAO = DataContext.SLAEscalationFRTMail.Where(x => x.Id == SLAEscalationFRTMail.Id).FirstOrDefault();

            if (SLAEscalationFRTMailDAO == null)
            {
                return(false);
            }
            SLAEscalationFRTMailDAO.Id = SLAEscalationFRTMail.Id;
            SLAEscalationFRTMailDAO.SLAEscalationFRTId = SLAEscalationFRTMail.SLAEscalationFRTId;
            SLAEscalationFRTMailDAO.Mail      = SLAEscalationFRTMail.Mail;
            SLAEscalationFRTMailDAO.UpdatedAt = StaticParams.DateTimeNow;
            await DataContext.SaveChangesAsync();

            await SaveReference(SLAEscalationFRTMail);

            return(true);
        }
        public async Task <bool> ValidateId(SLAEscalationFRTMail SLAEscalationFRTMail)
        {
            SLAEscalationFRTMailFilter SLAEscalationFRTMailFilter = new SLAEscalationFRTMailFilter
            {
                Skip = 0,
                Take = 10,
                Id   = new IdFilter {
                    Equal = SLAEscalationFRTMail.Id
                },
                Selects = SLAEscalationFRTMailSelect.Id
            };

            int count = await UOW.SLAEscalationFRTMailRepository.Count(SLAEscalationFRTMailFilter);

            if (count == 0)
            {
                SLAEscalationFRTMail.AddError(nameof(SLAEscalationFRTMailValidator), nameof(SLAEscalationFRTMail.Id), ErrorCode.IdNotExisted);
            }
            return(count == 1);
        }
        public async Task <SLAEscalationFRTMail> Update(SLAEscalationFRTMail SLAEscalationFRTMail)
        {
            if (!await SLAEscalationFRTMailValidator.Update(SLAEscalationFRTMail))
            {
                return(SLAEscalationFRTMail);
            }
            try
            {
                var oldData = await UOW.SLAEscalationFRTMailRepository.Get(SLAEscalationFRTMail.Id);

                await UOW.Begin();

                await UOW.SLAEscalationFRTMailRepository.Update(SLAEscalationFRTMail);

                await UOW.Commit();

                SLAEscalationFRTMail = await UOW.SLAEscalationFRTMailRepository.Get(SLAEscalationFRTMail.Id);

                await Logging.CreateAuditLog(SLAEscalationFRTMail, oldData, nameof(SLAEscalationFRTMailService));

                return(SLAEscalationFRTMail);
            }
            catch (Exception ex)
            {
                await UOW.Rollback();

                if (ex.InnerException == null)
                {
                    await Logging.CreateSystemLog(ex, nameof(SLAEscalationFRTMailService));

                    throw new MessageException(ex);
                }
                else
                {
                    await Logging.CreateSystemLog(ex.InnerException, nameof(SLAEscalationFRTMailService));

                    throw new MessageException(ex.InnerException);
                }
            }
        }
 public async Task <bool> Create(SLAEscalationFRTMail SLAEscalationFRTMail)
 {
     return(SLAEscalationFRTMail.IsValidated);
 }
Exemple #11
0
 private async Task SaveReference(SLAEscalationFRTMail SLAEscalationFRTMail)
 {
 }