public Log SaveLog(Log log) { log.LoggedOn = DateTime.UtcNow; _logsRepository.SaveOrUpdate(log); return(GetWorkLogById(log.LogId)); }
public PushLog LogPushResult(string deviceConnectionStatus, string httpStatusCode, string messageId, string notificationStatus, string subscriptionStatus, string channelUri) { PushLog log = new PushLog(); _pushLogsRepository.SaveOrUpdate(log); return(log); }
public CustomStateDetail SaveDetail(CustomStateDetail customStateDetail) { _customStateDetailRepository.SaveOrUpdate(customStateDetail); _eventAggregator.SendMessage <DepartmentSettingsUpdateEvent>(new DepartmentSettingsUpdateEvent() { DepartmentId = customStateDetail.CustomState.DepartmentId }); return(customStateDetail); }
public void RejectTradeRequest(int shiftTradeId, string userId, string reason) { var trade = GetShiftTradeById(shiftTradeId); var userTradeRequest = trade.Users.FirstOrDefault(x => x.UserId == userId); if (userTradeRequest != null) { userTradeRequest.Declined = true; userTradeRequest.Reason = reason; _shiftSignupTradeUserRepository.SaveOrUpdate(userTradeRequest); } }
public void AddUnitStateRoleForEvent(int unitStateId, string userId, int roleId, string unitName, DateTime timestamp, string roleName = "Unknown") { if (unitStateId <= 0) { throw new ArgumentException("Unit State Id cannot be 0", "unitStateId"); } if (String.IsNullOrWhiteSpace(userId)) { throw new ArgumentException("User Id cannot be an empty Guid", "userId"); } if (roleId <= 0) { throw new ArgumentException("Role Id cannot be 0", "roleId"); } //var role = GetRoleById(roleId); //string roleName = "Unknown"; //if (role != null) // roleName = role.Name; var unitStateRole = new UnitStateRole(); unitStateRole.UnitStateId = unitStateId; unitStateRole.UserId = userId; unitStateRole.Role = roleName; //_userStateService.CreateUserState(userId, (int)UserStateTypes.Committed, string.Format("On {0}", unitName), timestamp); _unitStateRoleRepository.SaveOrUpdate(unitStateRole); }
public DepartmentCallPriority SaveCallPriority(DepartmentCallPriority callPriority) { _departmentCallPriorityRepository.SaveOrUpdate(callPriority); InvalidateCallPrioritiesForDepartmentInCache(callPriority.DepartmentId); return(callPriority); }
public DepartmentCallPruning SavelDepartmentCallPruning(DepartmentCallPruning callPruning) { _departmentCallPruningRepository.SaveOrUpdate(callPruning); return(callPruning); }
public UnitType AddUnitType(int departmentId, string name, int customStatesId) { var type = new UnitType(); type.DepartmentId = departmentId; type.Type = name; if (customStatesId != 0) { type.CustomStatesId = customStatesId; } _unitTypesRepository.SaveOrUpdate(type); return(type); }
public DepartmentCallPruning SavelDepartmentCallPruning(DepartmentCallPruning callPruning) { _departmentCallPruningRepository.SaveOrUpdate(callPruning); return(GetDepartmentCallPruningSettings(callPruning.DepartmentId)); }
public AuditLog SaveAuditLog(AuditLog auditLog) { auditLog.LoggedOn = DateTime.UtcNow; _auditLogsRepository.SaveOrUpdate(auditLog); return(auditLog); }
public CallLog SaveCallLog(CallLog log) { log.LoggedOn = DateTime.UtcNow; _callLogsRepository.SaveOrUpdate(log); return(GetCallLogById(log.CallLogId)); }
public void CreateInvites(Department department, string addingUserId, List <string> emailAddresses) { var sendingUser = _usersService.GetUserById(addingUserId); var sendingProfile = _userProfileService.GetProfileByUserId(addingUserId); for (int i = 0; i < emailAddresses.Count; i++) { Invite invite = new Invite(); invite.Code = Guid.NewGuid(); invite.DepartmentId = department.DepartmentId; invite.EmailAddress = emailAddresses[i]; invite.SendingUserId = addingUserId; invite.SentOn = DateTime.Now.ToUniversalTime(); _invitesRepository.SaveOrUpdate(invite); if (invite.Department == null) { invite.Department = _departmentsService.GetDepartmentById(department.DepartmentId); } _emailService.SendInvite(invite, sendingProfile.FullName.AsFirstNameLastName, sendingUser.Email); } //foreach (var email in emailAddresses) //{ // Invite invite = new Invite(); // invite.Code = Guid.NewGuid(); // invite.DepartmentId = department.DepartmentId; // invite.EmailAddress = email; // invite.SendingUserId = addingUserId; // invite.SentOn = DateTime.Now.ToUniversalTime(); // _invitesRepository.SaveOrUpdate(invite); // if (invite.Department == null) // invite.Department = _departmentsService.GetDepartmentById(department.DepartmentId); // _emailService.SendInvite(invite); //} }
public Unit SaveUnit(Unit unit) { _unitsRepository.SaveOrUpdate(unit); _eventAggregator.SendMessage <DepartmentSettingsUpdateEvent>(new DepartmentSettingsUpdateEvent() { DepartmentId = unit.DepartmentId }); return(unit); }
public Note Save(Note note) { _notesRepository.SaveOrUpdate(note); _eventAggregator.SendMessage <NoteAddedEvent>(new NoteAddedEvent() { DepartmentId = note.DepartmentId, Note = note }); return(note); }
public DistributionList SaveDistributionList(DistributionList distributionList) { if (distributionList.DistributionListId == 0) { _distributionListRepository.SaveOrUpdate(distributionList); } else { var members = (from m in _distributionListMemberRepository.GetAll() where m.DistributionListId == distributionList.DistributionListId select m).AsEnumerable(); _distributionListMemberRepository.DeleteAll(members); _distributionListRepository.SaveOrUpdate(distributionList); } return(distributionList); }
public void UpdateShiftGroups(Shift shift, List <ShiftGroup> groups) { _shiftGroupsRepository.DeleteAll(shift.Groups.ToList()); foreach (var group in groups) { group.ShiftId = shift.ShiftId; _shiftGroupsRepository.SaveOrUpdate(group); } }
public void SetTrainingAsViewed(int trainingId, string userId) { var trainingUser = _trainingUserRepository.GetAll().FirstOrDefault(x => x.TrainingId == trainingId && x.UserId == userId); if (trainingUser != null) { trainingUser.Viewed = true; trainingUser.ViewedOn = DateTime.UtcNow; if (trainingUser.Training.Questions == null || trainingUser.Training.Questions.Count <= 0) { trainingUser.Complete = true; trainingUser.CompletedOn = DateTime.UtcNow; } _trainingUserRepository.SaveOrUpdate(trainingUser); } }
public DepartmentCertificationType SaveNewCertificationType(string certificationType, int departmentId) { DepartmentCertificationType newCertType = new DepartmentCertificationType(); newCertType.DepartmentId = departmentId; newCertType.Type = certificationType; _departmentCertificationTypeRepository.SaveOrUpdate(newCertType); return(GetCertificationTypeById(newCertType.DepartmentCertificationTypeId)); }
public void UpdateShiftPersonnel(Shift shift, List <ShiftPerson> newPersonnel) { var dbShift = GetShiftById(shift.ShiftId); _shiftPersonRepository.DeleteAll(dbShift.Personnel.ToList()); foreach (var person in newPersonnel) { person.ShiftId = shift.ShiftId; _shiftPersonRepository.SaveOrUpdate(person); } }
public CustomState Save(CustomState customState) { _customStateRepository.SaveOrUpdate(customState); _cacheProvider.Remove(string.Format(CacheKey, customState.DepartmentId)); _eventAggregator.SendMessage <DepartmentSettingsUpdateEvent>(new DepartmentSettingsUpdateEvent() { DepartmentId = customState.DepartmentId }); return(customState); }
public ShiftSignup SignupForShiftDay(int shiftId, DateTime shiftDay, int departmentGroupId, string userId) { var signup = new ShiftSignup(); signup.ShiftId = shiftId; signup.ShiftDay = shiftDay; signup.SignupTimestamp = DateTime.UtcNow; signup.UserId = userId; signup.DepartmentGroupId = departmentGroupId; signup.Denied = false; _shiftSignupRepository.SaveOrUpdate(signup); return(signup); }
public List <QueueItem> Dequeue(QueueTypes type) { var items = (from q in _queueItemsRepository.GetAll() where q.QueueType == (int)type && q.PickedUp == null && q.CompletedOn == null select q).ToList(); foreach (var i in items) { i.PickedUp = DateTime.Now.ToUniversalTime(); _queueItemsRepository.SaveOrUpdate(i); } return(items); }
public Permission SetPermissionForDepartment(int departmentId, string userId, PermissionTypes type, PermissionActions action, string data, bool lockToGroup) { var permission = GetPermisionByDepartmentType(departmentId, type) ?? new Permission(); permission.DepartmentId = departmentId; permission.PermissionType = (int)type; permission.Action = (int)action; permission.Data = data; permission.LockToGroup = lockToGroup; permission.UpdatedBy = userId; permission.UpdatedOn = DateTime.UtcNow; _permissionsRepository.SaveOrUpdate(permission); return(permission); }
public void SignupForEvent(int calendarEventItemId, string userId, string note, int attendeeType) { CalendarItemAttendee attendee = GetCalendarItemAttendeeByUser(calendarEventItemId, userId); if (attendee == null) { attendee = new CalendarItemAttendee(); } attendee.CalendarItemId = calendarEventItemId; attendee.UserId = userId; attendee.Note = note; attendee.AttendeeType = attendeeType; attendee.Timestamp = DateTime.UtcNow; _calendarItemAttendeeRepository.SaveOrUpdate(attendee); }
public void SetRolesForUser(int departmentId, string userId, string[] roleIds) { RemoveUserFromAllRoles(userId, departmentId); var roles = GetAllRolesForDepartment(departmentId); foreach (var roleId in roleIds) { var role = roles.FirstOrDefault(x => x.PersonnelRoleId == int.Parse(roleId)); if (role != null) { var roleUser = new PersonnelRoleUser(); roleUser.UserId = userId; roleUser.DepartmentId = departmentId; roleUser.PersonnelRoleId = role.PersonnelRoleId; _personnelRoleUsersRepository.SaveOrUpdate(roleUser); } } }
public Job SetJobAsStarted(JobTypes jobType, int checkInterval) { Job job = _jobsRepository.GetAll().FirstOrDefault(x => x.JobType == (int)jobType); if (job != null) { job.DoRestart = false; job.StartTimestamp = DateTime.UtcNow; _jobsRepository.SaveOrUpdate(job); } else { job = new Job(); job.JobType = (int)jobType; job.CheckInterval = checkInterval; job.StartTimestamp = DateTime.UtcNow; _jobsRepository.SaveOrUpdate(job); } return(job); }
public void UpdateShiftDates(Shift shift, List <ShiftDay> days) { // Adding Days foreach (var day in days) { // Don't re-add days already that are apart of the shift if (!shift.Days.Any(x => x.Day.Day == day.Day.Day && x.Day.Month == day.Day.Month && x.Day.Year == day.Day.Year)) { day.ShiftId = shift.ShiftId; _shiftDaysRepository.SaveOrUpdate(day); } } // Removing Days var daysToRemove = from sd in shift.Days let day = days.FirstOrDefault(x => x.Day.Day == sd.Day.Day && x.Day.Month == sd.Day.Month && x.Day.Year == sd.Day.Year) where day == null select sd; if (daysToRemove != null && daysToRemove.Any()) { _shiftDaysRepository.DeleteAll(daysToRemove.ToList()); } }
public DepartmentLink Save(DepartmentLink link) { _departmentLinksRepository.SaveOrUpdate(link); return(link); }
public CallAttachment SaveCallAttachment(CallAttachment attachment) { _callAttachmentRepository.SaveOrUpdate(attachment); return(attachment); }
public CallNote SaveCallNote(CallNote note) { _callNotesRepository.SaveOrUpdate(note); return(note); }