public async Task <bool> Delete(SLAAlertFRTUser SLAAlertFRTUser) { if (await ValidateId(SLAAlertFRTUser)) { } return(SLAAlertFRTUser.IsValidated); }
public async Task <bool> Delete(SLAAlertFRTUser SLAAlertFRTUser) { await DataContext.SLAAlertFRTUser.Where(x => x.Id == SLAAlertFRTUser.Id).UpdateFromQueryAsync(x => new SLAAlertFRTUserDAO { DeletedAt = StaticParams.DateTimeNow }); return(true); }
public async Task <SLAAlertFRTUser> Get(long Id) { SLAAlertFRTUser SLAAlertFRTUser = await UOW.SLAAlertFRTUserRepository.Get(Id); if (SLAAlertFRTUser == null) { return(null); } return(SLAAlertFRTUser); }
public TicketIssueLevel_SLAAlertFRTUserDTO(SLAAlertFRTUser SLAAlertFRTUser) { this.Id = SLAAlertFRTUser.Id; this.SLAAlertFRTId = SLAAlertFRTUser.SLAAlertFRTId; this.AppUserId = SLAAlertFRTUser.AppUserId; this.AppUser = SLAAlertFRTUser.AppUser == null ? null : new TicketIssueLevel_AppUserDTO(SLAAlertFRTUser.AppUser); this.SLAAlertFRT = SLAAlertFRTUser.SLAAlertFRT == null ? null : new TicketIssueLevel_SLAAlertFRTDTO(SLAAlertFRTUser.SLAAlertFRT); this.CreatedAt = SLAAlertFRTUser.CreatedAt; this.UpdatedAt = SLAAlertFRTUser.UpdatedAt; this.Errors = SLAAlertFRTUser.Errors; }
public async Task <SLAAlertFRTUser> Get(long Id) { SLAAlertFRTUser SLAAlertFRTUser = await DataContext.SLAAlertFRTUser.AsNoTracking() .Where(x => x.Id == Id).Select(x => new SLAAlertFRTUser() { CreatedAt = x.CreatedAt, UpdatedAt = x.UpdatedAt, Id = x.Id, SLAAlertFRTId = x.SLAAlertFRTId, 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, }, 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 (SLAAlertFRTUser == null) { return(null); } return(SLAAlertFRTUser); }
public async Task <bool> Create(SLAAlertFRTUser SLAAlertFRTUser) { SLAAlertFRTUserDAO SLAAlertFRTUserDAO = new SLAAlertFRTUserDAO(); SLAAlertFRTUserDAO.Id = SLAAlertFRTUser.Id; SLAAlertFRTUserDAO.SLAAlertFRTId = SLAAlertFRTUser.SLAAlertFRTId; SLAAlertFRTUserDAO.AppUserId = SLAAlertFRTUser.AppUserId; SLAAlertFRTUserDAO.CreatedAt = StaticParams.DateTimeNow; SLAAlertFRTUserDAO.UpdatedAt = StaticParams.DateTimeNow; DataContext.SLAAlertFRTUser.Add(SLAAlertFRTUserDAO); await DataContext.SaveChangesAsync(); SLAAlertFRTUser.Id = SLAAlertFRTUserDAO.Id; await SaveReference(SLAAlertFRTUser); return(true); }
public async Task <bool> Update(SLAAlertFRTUser SLAAlertFRTUser) { SLAAlertFRTUserDAO SLAAlertFRTUserDAO = DataContext.SLAAlertFRTUser.Where(x => x.Id == SLAAlertFRTUser.Id).FirstOrDefault(); if (SLAAlertFRTUserDAO == null) { return(false); } SLAAlertFRTUserDAO.Id = SLAAlertFRTUser.Id; SLAAlertFRTUserDAO.SLAAlertFRTId = SLAAlertFRTUser.SLAAlertFRTId; SLAAlertFRTUserDAO.AppUserId = SLAAlertFRTUser.AppUserId; SLAAlertFRTUserDAO.UpdatedAt = StaticParams.DateTimeNow; await DataContext.SaveChangesAsync(); await SaveReference(SLAAlertFRTUser); return(true); }
public async Task <bool> ValidateId(SLAAlertFRTUser SLAAlertFRTUser) { SLAAlertFRTUserFilter SLAAlertFRTUserFilter = new SLAAlertFRTUserFilter { Skip = 0, Take = 10, Id = new IdFilter { Equal = SLAAlertFRTUser.Id }, Selects = SLAAlertFRTUserSelect.Id }; int count = await UOW.SLAAlertFRTUserRepository.Count(SLAAlertFRTUserFilter); if (count == 0) { SLAAlertFRTUser.AddError(nameof(SLAAlertFRTUserValidator), nameof(SLAAlertFRTUser.Id), ErrorCode.IdNotExisted); } return(count == 1); }
public async Task <SLAAlertFRTUser> Update(SLAAlertFRTUser SLAAlertFRTUser) { if (!await SLAAlertFRTUserValidator.Update(SLAAlertFRTUser)) { return(SLAAlertFRTUser); } try { var oldData = await UOW.SLAAlertFRTUserRepository.Get(SLAAlertFRTUser.Id); await UOW.Begin(); await UOW.SLAAlertFRTUserRepository.Update(SLAAlertFRTUser); await UOW.Commit(); SLAAlertFRTUser = await UOW.SLAAlertFRTUserRepository.Get(SLAAlertFRTUser.Id); await Logging.CreateAuditLog(SLAAlertFRTUser, oldData, nameof(SLAAlertFRTUserService)); return(SLAAlertFRTUser); } catch (Exception ex) { await UOW.Rollback(); if (ex.InnerException == null) { await Logging.CreateSystemLog(ex, nameof(SLAAlertFRTUserService)); throw new MessageException(ex); } else { await Logging.CreateSystemLog(ex.InnerException, nameof(SLAAlertFRTUserService)); throw new MessageException(ex.InnerException); } } }
private async Task SaveReference(SLAAlertFRTUser SLAAlertFRTUser) { }
public async Task <bool> Create(SLAAlertFRTUser SLAAlertFRTUser) { return(SLAAlertFRTUser.IsValidated); }