public async Task <SLAAlertFRTPhone> Get(long Id)
        {
            SLAAlertFRTPhone SLAAlertFRTPhone = await DataContext.SLAAlertFRTPhone.AsNoTracking()
                                                .Where(x => x.Id == Id).Select(x => new SLAAlertFRTPhone()
            {
                CreatedAt     = x.CreatedAt,
                UpdatedAt     = x.UpdatedAt,
                Id            = x.Id,
                SLAAlertFRTId = x.SLAAlertFRTId,
                Phone         = x.Phone,
                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 (SLAAlertFRTPhone == null)
            {
                return(null);
            }

            return(SLAAlertFRTPhone);
        }
 public async Task <bool> Delete(SLAAlertFRTPhone SLAAlertFRTPhone)
 {
     if (await ValidateId(SLAAlertFRTPhone))
     {
     }
     return(SLAAlertFRTPhone.IsValidated);
 }
        public async Task <bool> Delete(SLAAlertFRTPhone SLAAlertFRTPhone)
        {
            await DataContext.SLAAlertFRTPhone.Where(x => x.Id == SLAAlertFRTPhone.Id).UpdateFromQueryAsync(x => new SLAAlertFRTPhoneDAO {
                DeletedAt = StaticParams.DateTimeNow
            });

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

            if (SLAAlertFRTPhone == null)
            {
                return(null);
            }
            return(SLAAlertFRTPhone);
        }
Beispiel #5
0
 public TicketIssueLevel_SLAAlertFRTPhoneDTO(SLAAlertFRTPhone SLAAlertFRTPhone)
 {
     this.Id            = SLAAlertFRTPhone.Id;
     this.SLAAlertFRTId = SLAAlertFRTPhone.SLAAlertFRTId;
     this.Phone         = SLAAlertFRTPhone.Phone;
     this.SLAAlertFRT   = SLAAlertFRTPhone.SLAAlertFRT == null ? null : new TicketIssueLevel_SLAAlertFRTDTO(SLAAlertFRTPhone.SLAAlertFRT);
     this.CreatedAt     = SLAAlertFRTPhone.CreatedAt;
     this.UpdatedAt     = SLAAlertFRTPhone.UpdatedAt;
     this.Errors        = SLAAlertFRTPhone.Errors;
 }
        public async Task <bool> Create(SLAAlertFRTPhone SLAAlertFRTPhone)
        {
            SLAAlertFRTPhoneDAO SLAAlertFRTPhoneDAO = new SLAAlertFRTPhoneDAO();

            SLAAlertFRTPhoneDAO.Id            = SLAAlertFRTPhone.Id;
            SLAAlertFRTPhoneDAO.SLAAlertFRTId = SLAAlertFRTPhone.SLAAlertFRTId;
            SLAAlertFRTPhoneDAO.Phone         = SLAAlertFRTPhone.Phone;
            SLAAlertFRTPhoneDAO.CreatedAt     = StaticParams.DateTimeNow;
            SLAAlertFRTPhoneDAO.UpdatedAt     = StaticParams.DateTimeNow;
            DataContext.SLAAlertFRTPhone.Add(SLAAlertFRTPhoneDAO);
            await DataContext.SaveChangesAsync();

            SLAAlertFRTPhone.Id = SLAAlertFRTPhoneDAO.Id;
            await SaveReference(SLAAlertFRTPhone);

            return(true);
        }
        public async Task <bool> Update(SLAAlertFRTPhone SLAAlertFRTPhone)
        {
            SLAAlertFRTPhoneDAO SLAAlertFRTPhoneDAO = DataContext.SLAAlertFRTPhone.Where(x => x.Id == SLAAlertFRTPhone.Id).FirstOrDefault();

            if (SLAAlertFRTPhoneDAO == null)
            {
                return(false);
            }
            SLAAlertFRTPhoneDAO.Id            = SLAAlertFRTPhone.Id;
            SLAAlertFRTPhoneDAO.SLAAlertFRTId = SLAAlertFRTPhone.SLAAlertFRTId;
            SLAAlertFRTPhoneDAO.Phone         = SLAAlertFRTPhone.Phone;
            SLAAlertFRTPhoneDAO.UpdatedAt     = StaticParams.DateTimeNow;
            await DataContext.SaveChangesAsync();

            await SaveReference(SLAAlertFRTPhone);

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

            int count = await UOW.SLAAlertFRTPhoneRepository.Count(SLAAlertFRTPhoneFilter);

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

                await UOW.Begin();

                await UOW.SLAAlertFRTPhoneRepository.Update(SLAAlertFRTPhone);

                await UOW.Commit();

                SLAAlertFRTPhone = await UOW.SLAAlertFRTPhoneRepository.Get(SLAAlertFRTPhone.Id);

                await Logging.CreateAuditLog(SLAAlertFRTPhone, oldData, nameof(SLAAlertFRTPhoneService));

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

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

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

                    throw new MessageException(ex.InnerException);
                }
            }
        }
 private async Task SaveReference(SLAAlertFRTPhone SLAAlertFRTPhone)
 {
 }
 public async Task <bool> Create(SLAAlertFRTPhone SLAAlertFRTPhone)
 {
     return(SLAAlertFRTPhone.IsValidated);
 }