public async Task <bool> Delete(SLAEscalationUser SLAEscalationUser) { if (await ValidateId(SLAEscalationUser)) { } return(SLAEscalationUser.IsValidated); }
public async Task <bool> Delete(SLAEscalationUser SLAEscalationUser) { await DataContext.SLAEscalationUser.Where(x => x.Id == SLAEscalationUser.Id).UpdateFromQueryAsync(x => new SLAEscalationUserDAO { DeletedAt = StaticParams.DateTimeNow }); return(true); }
public async Task <SLAEscalationUser> Get(long Id) { SLAEscalationUser SLAEscalationUser = await UOW.SLAEscalationUserRepository.Get(Id); if (SLAEscalationUser == null) { return(null); } return(SLAEscalationUser); }
public TicketIssueLevel_SLAEscalationUserDTO(SLAEscalationUser SLAEscalationUser) { this.Id = SLAEscalationUser.Id; this.SLAEscalationId = SLAEscalationUser.SLAEscalationId; this.AppUserId = SLAEscalationUser.AppUserId; this.AppUser = SLAEscalationUser.AppUser == null ? null : new TicketIssueLevel_AppUserDTO(SLAEscalationUser.AppUser); this.SLAEscalation = SLAEscalationUser.SLAEscalation == null ? null : new TicketIssueLevel_SLAEscalationDTO(SLAEscalationUser.SLAEscalation); this.CreatedAt = SLAEscalationUser.CreatedAt; this.UpdatedAt = SLAEscalationUser.UpdatedAt; this.Errors = SLAEscalationUser.Errors; }
public async Task <SLAEscalationUser> Get(long Id) { SLAEscalationUser SLAEscalationUser = await DataContext.SLAEscalationUser.AsNoTracking() .Where(x => x.Id == Id).Select(x => new SLAEscalationUser() { CreatedAt = x.CreatedAt, UpdatedAt = x.UpdatedAt, Id = x.Id, SLAEscalationId = x.SLAEscalationId, 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, }, SLAEscalation = x.SLAEscalation == null ? null : new SLAEscalation { Id = x.SLAEscalation.Id, TicketIssueLevelId = x.SLAEscalation.TicketIssueLevelId, IsNotification = x.SLAEscalation.IsNotification, IsMail = x.SLAEscalation.IsMail, IsSMS = x.SLAEscalation.IsSMS, Time = x.SLAEscalation.Time, TimeUnitId = x.SLAEscalation.TimeUnitId, IsAssignedToUser = x.SLAEscalation.IsAssignedToUser, IsAssignedToGroup = x.SLAEscalation.IsAssignedToGroup, SmsTemplateId = x.SLAEscalation.SmsTemplateId, MailTemplateId = x.SLAEscalation.MailTemplateId, }, }).FirstOrDefaultAsync(); if (SLAEscalationUser == null) { return(null); } return(SLAEscalationUser); }
public async Task <bool> Create(SLAEscalationUser SLAEscalationUser) { SLAEscalationUserDAO SLAEscalationUserDAO = new SLAEscalationUserDAO(); SLAEscalationUserDAO.Id = SLAEscalationUser.Id; SLAEscalationUserDAO.SLAEscalationId = SLAEscalationUser.SLAEscalationId; SLAEscalationUserDAO.AppUserId = SLAEscalationUser.AppUserId; SLAEscalationUserDAO.CreatedAt = StaticParams.DateTimeNow; SLAEscalationUserDAO.UpdatedAt = StaticParams.DateTimeNow; DataContext.SLAEscalationUser.Add(SLAEscalationUserDAO); await DataContext.SaveChangesAsync(); SLAEscalationUser.Id = SLAEscalationUserDAO.Id; await SaveReference(SLAEscalationUser); return(true); }
public async Task <bool> Update(SLAEscalationUser SLAEscalationUser) { SLAEscalationUserDAO SLAEscalationUserDAO = DataContext.SLAEscalationUser.Where(x => x.Id == SLAEscalationUser.Id).FirstOrDefault(); if (SLAEscalationUserDAO == null) { return(false); } SLAEscalationUserDAO.Id = SLAEscalationUser.Id; SLAEscalationUserDAO.SLAEscalationId = SLAEscalationUser.SLAEscalationId; SLAEscalationUserDAO.AppUserId = SLAEscalationUser.AppUserId; SLAEscalationUserDAO.UpdatedAt = StaticParams.DateTimeNow; await DataContext.SaveChangesAsync(); await SaveReference(SLAEscalationUser); return(true); }
public async Task <bool> ValidateId(SLAEscalationUser SLAEscalationUser) { SLAEscalationUserFilter SLAEscalationUserFilter = new SLAEscalationUserFilter { Skip = 0, Take = 10, Id = new IdFilter { Equal = SLAEscalationUser.Id }, Selects = SLAEscalationUserSelect.Id }; int count = await UOW.SLAEscalationUserRepository.Count(SLAEscalationUserFilter); if (count == 0) { SLAEscalationUser.AddError(nameof(SLAEscalationUserValidator), nameof(SLAEscalationUser.Id), ErrorCode.IdNotExisted); } return(count == 1); }
public async Task <SLAEscalationUser> Update(SLAEscalationUser SLAEscalationUser) { if (!await SLAEscalationUserValidator.Update(SLAEscalationUser)) { return(SLAEscalationUser); } try { var oldData = await UOW.SLAEscalationUserRepository.Get(SLAEscalationUser.Id); await UOW.Begin(); await UOW.SLAEscalationUserRepository.Update(SLAEscalationUser); await UOW.Commit(); SLAEscalationUser = await UOW.SLAEscalationUserRepository.Get(SLAEscalationUser.Id); await Logging.CreateAuditLog(SLAEscalationUser, oldData, nameof(SLAEscalationUserService)); return(SLAEscalationUser); } catch (Exception ex) { await UOW.Rollback(); if (ex.InnerException == null) { await Logging.CreateSystemLog(ex, nameof(SLAEscalationUserService)); throw new MessageException(ex); } else { await Logging.CreateSystemLog(ex.InnerException, nameof(SLAEscalationUserService)); throw new MessageException(ex.InnerException); } } }
private async Task SaveReference(SLAEscalationUser SLAEscalationUser) { }
public async Task <bool> Create(SLAEscalationUser SLAEscalationUser) { return(SLAEscalationUser.IsValidated); }