示例#1
0
 public async Task <bool> Delete(SLAEscalationFRTUser SLAEscalationFRTUser)
 {
     if (await ValidateId(SLAEscalationFRTUser))
     {
     }
     return(SLAEscalationFRTUser.IsValidated);
 }
        public async Task <bool> Delete(SLAEscalationFRTUser SLAEscalationFRTUser)
        {
            await DataContext.SLAEscalationFRTUser.Where(x => x.Id == SLAEscalationFRTUser.Id).UpdateFromQueryAsync(x => new SLAEscalationFRTUserDAO {
                DeletedAt = StaticParams.DateTimeNow
            });

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

            if (SLAEscalationFRTUser == null)
            {
                return(null);
            }
            return(SLAEscalationFRTUser);
        }
 public TicketIssueLevel_SLAEscalationFRTUserDTO(SLAEscalationFRTUser SLAEscalationFRTUser)
 {
     this.Id = SLAEscalationFRTUser.Id;
     this.SLAEscalationFRTId = SLAEscalationFRTUser.SLAEscalationFRTId;
     this.AppUserId          = SLAEscalationFRTUser.AppUserId;
     this.AppUser            = SLAEscalationFRTUser.AppUser == null ? null : new TicketIssueLevel_AppUserDTO(SLAEscalationFRTUser.AppUser);
     this.SLAEscalationFRT   = SLAEscalationFRTUser.SLAEscalationFRT == null ? null : new TicketIssueLevel_SLAEscalationFRTDTO(SLAEscalationFRTUser.SLAEscalationFRT);
     this.CreatedAt          = SLAEscalationFRTUser.CreatedAt;
     this.UpdatedAt          = SLAEscalationFRTUser.UpdatedAt;
     this.Errors             = SLAEscalationFRTUser.Errors;
 }
        public async Task <SLAEscalationFRTUser> Get(long Id)
        {
            SLAEscalationFRTUser SLAEscalationFRTUser = await DataContext.SLAEscalationFRTUser.AsNoTracking()
                                                        .Where(x => x.Id == Id).Select(x => new SLAEscalationFRTUser()
            {
                CreatedAt          = x.CreatedAt,
                UpdatedAt          = x.UpdatedAt,
                Id                 = x.Id,
                SLAEscalationFRTId = x.SLAEscalationFRTId,
                AppUserId          = x.AppUserId,
                AppUser            = x.AppUser == null ? null : new AppUser
                {
                    Id             = x.AppUser.Id,
                    Username       = x.AppUser.Username,
                    DisplayName    = x.AppUser.DisplayName,
                    Address        = x.AppUser.Address,
                    Email          = x.AppUser.Email,
                    Phone          = x.AppUser.Phone,
                    SexId          = x.AppUser.SexId,
                    Birthday       = x.AppUser.Birthday,
                    Avatar         = x.AppUser.Avatar,
                    Department     = x.AppUser.Department,
                    OrganizationId = x.AppUser.OrganizationId,
                    Longitude      = x.AppUser.Longitude,
                    Latitude       = x.AppUser.Latitude,
                    StatusId       = x.AppUser.StatusId,
                },
                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 (SLAEscalationFRTUser == null)
            {
                return(null);
            }

            return(SLAEscalationFRTUser);
        }
        public async Task <bool> Create(SLAEscalationFRTUser SLAEscalationFRTUser)
        {
            SLAEscalationFRTUserDAO SLAEscalationFRTUserDAO = new SLAEscalationFRTUserDAO();

            SLAEscalationFRTUserDAO.Id = SLAEscalationFRTUser.Id;
            SLAEscalationFRTUserDAO.SLAEscalationFRTId = SLAEscalationFRTUser.SLAEscalationFRTId;
            SLAEscalationFRTUserDAO.AppUserId          = SLAEscalationFRTUser.AppUserId;
            SLAEscalationFRTUserDAO.CreatedAt          = StaticParams.DateTimeNow;
            SLAEscalationFRTUserDAO.UpdatedAt          = StaticParams.DateTimeNow;
            DataContext.SLAEscalationFRTUser.Add(SLAEscalationFRTUserDAO);
            await DataContext.SaveChangesAsync();

            SLAEscalationFRTUser.Id = SLAEscalationFRTUserDAO.Id;
            await SaveReference(SLAEscalationFRTUser);

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

            if (SLAEscalationFRTUserDAO == null)
            {
                return(false);
            }
            SLAEscalationFRTUserDAO.Id = SLAEscalationFRTUser.Id;
            SLAEscalationFRTUserDAO.SLAEscalationFRTId = SLAEscalationFRTUser.SLAEscalationFRTId;
            SLAEscalationFRTUserDAO.AppUserId          = SLAEscalationFRTUser.AppUserId;
            SLAEscalationFRTUserDAO.UpdatedAt          = StaticParams.DateTimeNow;
            await DataContext.SaveChangesAsync();

            await SaveReference(SLAEscalationFRTUser);

            return(true);
        }
示例#8
0
        public async Task <bool> ValidateId(SLAEscalationFRTUser SLAEscalationFRTUser)
        {
            SLAEscalationFRTUserFilter SLAEscalationFRTUserFilter = new SLAEscalationFRTUserFilter
            {
                Skip = 0,
                Take = 10,
                Id   = new IdFilter {
                    Equal = SLAEscalationFRTUser.Id
                },
                Selects = SLAEscalationFRTUserSelect.Id
            };

            int count = await UOW.SLAEscalationFRTUserRepository.Count(SLAEscalationFRTUserFilter);

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

                await UOW.Begin();

                await UOW.SLAEscalationFRTUserRepository.Update(SLAEscalationFRTUser);

                await UOW.Commit();

                SLAEscalationFRTUser = await UOW.SLAEscalationFRTUserRepository.Get(SLAEscalationFRTUser.Id);

                await Logging.CreateAuditLog(SLAEscalationFRTUser, oldData, nameof(SLAEscalationFRTUserService));

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

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

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

                    throw new MessageException(ex.InnerException);
                }
            }
        }
示例#10
0
 public async Task <bool> Create(SLAEscalationFRTUser SLAEscalationFRTUser)
 {
     return(SLAEscalationFRTUser.IsValidated);
 }
 private async Task SaveReference(SLAEscalationFRTUser SLAEscalationFRTUser)
 {
 }