Ejemplo n.º 1
0
 public async Task <bool> Delete(SLAEscalationPhone SLAEscalationPhone)
 {
     if (await ValidateId(SLAEscalationPhone))
     {
     }
     return(SLAEscalationPhone.IsValidated);
 }
        public async Task <bool> Delete(SLAEscalationPhone SLAEscalationPhone)
        {
            await DataContext.SLAEscalationPhone.Where(x => x.Id == SLAEscalationPhone.Id).UpdateFromQueryAsync(x => new SLAEscalationPhoneDAO {
                DeletedAt = StaticParams.DateTimeNow
            });

            return(true);
        }
 public TicketIssueLevel_SLAEscalationPhoneDTO(SLAEscalationPhone SLAEscalationPhone)
 {
     this.Id = SLAEscalationPhone.Id;
     this.SLAEscalationId = SLAEscalationPhone.SLAEscalationId;
     this.Phone           = SLAEscalationPhone.Phone;
     this.CreatedAt       = SLAEscalationPhone.CreatedAt;
     this.UpdatedAt       = SLAEscalationPhone.UpdatedAt;
     this.Errors          = SLAEscalationPhone.Errors;
 }
Ejemplo n.º 4
0
        public async Task <SLAEscalationPhone> Get(long Id)
        {
            SLAEscalationPhone SLAEscalationPhone = await UOW.SLAEscalationPhoneRepository.Get(Id);

            if (SLAEscalationPhone == null)
            {
                return(null);
            }
            return(SLAEscalationPhone);
        }
        public async Task <bool> Create(SLAEscalationPhone SLAEscalationPhone)
        {
            SLAEscalationPhoneDAO SLAEscalationPhoneDAO = new SLAEscalationPhoneDAO();

            SLAEscalationPhoneDAO.Id = SLAEscalationPhone.Id;
            SLAEscalationPhoneDAO.SLAEscalationId = SLAEscalationPhone.SLAEscalationId;
            SLAEscalationPhoneDAO.Phone           = SLAEscalationPhone.Phone;
            SLAEscalationPhoneDAO.CreatedAt       = StaticParams.DateTimeNow;
            SLAEscalationPhoneDAO.UpdatedAt       = StaticParams.DateTimeNow;
            DataContext.SLAEscalationPhone.Add(SLAEscalationPhoneDAO);
            await DataContext.SaveChangesAsync();

            SLAEscalationPhone.Id = SLAEscalationPhoneDAO.Id;
            await SaveReference(SLAEscalationPhone);

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

            if (SLAEscalationPhoneDAO == null)
            {
                return(false);
            }
            SLAEscalationPhoneDAO.Id = SLAEscalationPhone.Id;
            SLAEscalationPhoneDAO.SLAEscalationId = SLAEscalationPhone.SLAEscalationId;
            SLAEscalationPhoneDAO.Phone           = SLAEscalationPhone.Phone;
            SLAEscalationPhoneDAO.UpdatedAt       = StaticParams.DateTimeNow;
            await DataContext.SaveChangesAsync();

            await SaveReference(SLAEscalationPhone);

            return(true);
        }
        public async Task <SLAEscalationPhone> Get(long Id)
        {
            SLAEscalationPhone SLAEscalationPhone = await DataContext.SLAEscalationPhone.AsNoTracking()
                                                    .Where(x => x.Id == Id).Select(x => new SLAEscalationPhone()
            {
                CreatedAt       = x.CreatedAt,
                UpdatedAt       = x.UpdatedAt,
                Id              = x.Id,
                SLAEscalationId = x.SLAEscalationId,
                Phone           = x.Phone,
            }).FirstOrDefaultAsync();

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

            return(SLAEscalationPhone);
        }
Ejemplo n.º 8
0
        public async Task <bool> ValidateId(SLAEscalationPhone SLAEscalationPhone)
        {
            SLAEscalationPhoneFilter SLAEscalationPhoneFilter = new SLAEscalationPhoneFilter
            {
                Skip = 0,
                Take = 10,
                Id   = new IdFilter {
                    Equal = SLAEscalationPhone.Id
                },
                Selects = SLAEscalationPhoneSelect.Id
            };

            int count = await UOW.SLAEscalationPhoneRepository.Count(SLAEscalationPhoneFilter);

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

                await UOW.Begin();

                await UOW.SLAEscalationPhoneRepository.Update(SLAEscalationPhone);

                await UOW.Commit();

                SLAEscalationPhone = await UOW.SLAEscalationPhoneRepository.Get(SLAEscalationPhone.Id);

                await Logging.CreateAuditLog(SLAEscalationPhone, oldData, nameof(SLAEscalationPhoneService));

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

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

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

                    throw new MessageException(ex.InnerException);
                }
            }
        }
Ejemplo n.º 10
0
 public async Task <bool> Create(SLAEscalationPhone SLAEscalationPhone)
 {
     return(SLAEscalationPhone.IsValidated);
 }
Ejemplo n.º 11
0
 private async Task SaveReference(SLAEscalationPhone SLAEscalationPhone)
 {
 }