public async Task <bool> Delete(SLAEscalationFRTPhone SLAEscalationFRTPhone)
 {
     if (await ValidateId(SLAEscalationFRTPhone))
     {
     }
     return(SLAEscalationFRTPhone.IsValidated);
 }
        public async Task <SLAEscalationFRTPhone> Get(long Id)
        {
            SLAEscalationFRTPhone SLAEscalationFRTPhone = await DataContext.SLAEscalationFRTPhone.AsNoTracking()
                                                          .Where(x => x.Id == Id).Select(x => new SLAEscalationFRTPhone()
            {
                CreatedAt          = x.CreatedAt,
                UpdatedAt          = x.UpdatedAt,
                Id                 = x.Id,
                SLAEscalationFRTId = x.SLAEscalationFRTId,
                Phone              = x.Phone,
                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 (SLAEscalationFRTPhone == null)
            {
                return(null);
            }

            return(SLAEscalationFRTPhone);
        }
        public async Task <bool> Delete(SLAEscalationFRTPhone SLAEscalationFRTPhone)
        {
            await DataContext.SLAEscalationFRTPhone.Where(x => x.Id == SLAEscalationFRTPhone.Id).UpdateFromQueryAsync(x => new SLAEscalationFRTPhoneDAO {
                DeletedAt = StaticParams.DateTimeNow
            });

            return(true);
        }
Ejemplo n.º 4
0
        public async Task <SLAEscalationFRTPhone> Get(long Id)
        {
            SLAEscalationFRTPhone SLAEscalationFRTPhone = await UOW.SLAEscalationFRTPhoneRepository.Get(Id);

            if (SLAEscalationFRTPhone == null)
            {
                return(null);
            }
            return(SLAEscalationFRTPhone);
        }
Ejemplo n.º 5
0
 public TicketIssueLevel_SLAEscalationFRTPhoneDTO(SLAEscalationFRTPhone SLAEscalationFRTPhone)
 {
     this.Id = SLAEscalationFRTPhone.Id;
     this.SLAEscalationFRTId = SLAEscalationFRTPhone.SLAEscalationFRTId;
     this.Phone            = SLAEscalationFRTPhone.Phone;
     this.SLAEscalationFRT = SLAEscalationFRTPhone.SLAEscalationFRT == null ? null : new TicketIssueLevel_SLAEscalationFRTDTO(SLAEscalationFRTPhone.SLAEscalationFRT);
     this.CreatedAt        = SLAEscalationFRTPhone.CreatedAt;
     this.UpdatedAt        = SLAEscalationFRTPhone.UpdatedAt;
     this.Errors           = SLAEscalationFRTPhone.Errors;
 }
        public async Task <bool> Create(SLAEscalationFRTPhone SLAEscalationFRTPhone)
        {
            SLAEscalationFRTPhoneDAO SLAEscalationFRTPhoneDAO = new SLAEscalationFRTPhoneDAO();

            SLAEscalationFRTPhoneDAO.Id = SLAEscalationFRTPhone.Id;
            SLAEscalationFRTPhoneDAO.SLAEscalationFRTId = SLAEscalationFRTPhone.SLAEscalationFRTId;
            SLAEscalationFRTPhoneDAO.Phone     = SLAEscalationFRTPhone.Phone;
            SLAEscalationFRTPhoneDAO.CreatedAt = StaticParams.DateTimeNow;
            SLAEscalationFRTPhoneDAO.UpdatedAt = StaticParams.DateTimeNow;
            DataContext.SLAEscalationFRTPhone.Add(SLAEscalationFRTPhoneDAO);
            await DataContext.SaveChangesAsync();

            SLAEscalationFRTPhone.Id = SLAEscalationFRTPhoneDAO.Id;
            await SaveReference(SLAEscalationFRTPhone);

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

            if (SLAEscalationFRTPhoneDAO == null)
            {
                return(false);
            }
            SLAEscalationFRTPhoneDAO.Id = SLAEscalationFRTPhone.Id;
            SLAEscalationFRTPhoneDAO.SLAEscalationFRTId = SLAEscalationFRTPhone.SLAEscalationFRTId;
            SLAEscalationFRTPhoneDAO.Phone     = SLAEscalationFRTPhone.Phone;
            SLAEscalationFRTPhoneDAO.UpdatedAt = StaticParams.DateTimeNow;
            await DataContext.SaveChangesAsync();

            await SaveReference(SLAEscalationFRTPhone);

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

            int count = await UOW.SLAEscalationFRTPhoneRepository.Count(SLAEscalationFRTPhoneFilter);

            if (count == 0)
            {
                SLAEscalationFRTPhone.AddError(nameof(SLAEscalationFRTPhoneValidator), nameof(SLAEscalationFRTPhone.Id), ErrorCode.IdNotExisted);
            }
            return(count == 1);
        }
Ejemplo n.º 9
0
        public async Task <SLAEscalationFRTPhone> Update(SLAEscalationFRTPhone SLAEscalationFRTPhone)
        {
            if (!await SLAEscalationFRTPhoneValidator.Update(SLAEscalationFRTPhone))
            {
                return(SLAEscalationFRTPhone);
            }
            try
            {
                var oldData = await UOW.SLAEscalationFRTPhoneRepository.Get(SLAEscalationFRTPhone.Id);

                await UOW.Begin();

                await UOW.SLAEscalationFRTPhoneRepository.Update(SLAEscalationFRTPhone);

                await UOW.Commit();

                SLAEscalationFRTPhone = await UOW.SLAEscalationFRTPhoneRepository.Get(SLAEscalationFRTPhone.Id);

                await Logging.CreateAuditLog(SLAEscalationFRTPhone, oldData, nameof(SLAEscalationFRTPhoneService));

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

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

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

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