public void DeleteDispatchesForUserAndRemapCalls(string remapToUserId, string userIdToDelete) { var dispatches = (from d in _callDispatchsRepository.GetAll() where d.UserId == userIdToDelete select d).ToList(); _callDispatchsRepository.DeleteAll(dispatches); var reportingCalls = (from c in _callsRepository.GetAll() where c.ReportingUserId == userIdToDelete select c).ToList(); foreach (var c in reportingCalls) { c.ReportingUserId = remapToUserId; _callsRepository.SaveOrUpdate(c); } var closingCalls = (from c in _callsRepository.GetAll() where c.ClosedByUserId == userIdToDelete select c).ToList(); foreach (var c in closingCalls) { c.ClosedByUserId = remapToUserId; _callsRepository.SaveOrUpdate(c); } }
public void RemoveUserFromAllRoles(string userId, int departmentId) { var personnelRoles = from personRole in _personnelRoleUsersRepository.GetAll() where personRole.UserId == userId && personRole.DepartmentId == departmentId select personRole; _personnelRoleUsersRepository.DeleteAll(personnelRoles); }
public void DeleteType(int typeId) { var type = GetTypeById(typeId); var inventories = _inventoryRepository.GetAll().Where(x => x.TypeId == typeId); _inventoryRepository.DeleteAll(inventories); _inventoryTypesRepository.DeleteOnSubmit(type); }
public void DeleteSelectedAuditLogs(int departmentId, List <int> auditLogIds) { var auditLogs = from al in _auditLogsRepository.GetAll() where al.DepartmentId == departmentId && auditLogIds.Contains(al.AuditLogId) select al; _auditLogsRepository.DeleteAll(auditLogs); }
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 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 void ClearRolesForUnit(int unitId) { if (unitId <= 0) { throw new ArgumentException("UnitId cannot be null", "unitId"); } var savedRoles = from r in _unitRolesRepository.GetAll() where r.UnitId == unitId select r; _unitRolesRepository.DeleteAll(savedRoles); }
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 DeleteLogsForUser(string userId, string newUserId) { var workLogs = from l in _logsRepository.GetAll().AsEnumerable() where l.LoggedByUserId == userId select l; var workLogUsers = from wlu in _logUsersRepository.GetAll().AsEnumerable() where wlu.UserId == userId select wlu; var logs = from l in _callLogsRepository.GetAll().AsEnumerable() where l.LoggedByUserId == userId select l; _callLogsRepository.DeleteAll(logs); _logUsersRepository.DeleteAll(workLogUsers); foreach (var wl in workLogs) { wl.LoggedByUserId = newUserId; _logsRepository.SaveOrUpdate(wl); } }
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 void DeleteUnitDispatches(List <CallDispatchUnit> dispatches) { _callDispatchUnitRepository.DeleteAll(dispatches); }
public void DeleteRoleDispatches(List <CallDispatchRole> dispatches) { _callDispatchRoleRepository.DeleteAll(dispatches); }
public void DeleteGroupDispatches(List <CallDispatchGroup> dispatches) { _callDispatchGroupRepository.DeleteAll(dispatches); }
public void DeleteAllCertificationsForUser(string userId) { var certs = GetCertificationsByUserId(userId); _personnelCertificationRepository.DeleteAll(certs); }