Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        public void DeleteType(int typeId)
        {
            var type        = GetTypeById(typeId);
            var inventories = _inventoryRepository.GetAll().Where(x => x.TypeId == typeId);

            _inventoryRepository.DeleteAll(inventories);
            _inventoryTypesRepository.DeleteOnSubmit(type);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
            }
        }
Ejemplo n.º 6
0
        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);
            }
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        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);
            }
        }
Ejemplo n.º 10
0
        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());
            }
        }
Ejemplo n.º 11
0
 public void DeleteUnitDispatches(List <CallDispatchUnit> dispatches)
 {
     _callDispatchUnitRepository.DeleteAll(dispatches);
 }
Ejemplo n.º 12
0
 public void DeleteRoleDispatches(List <CallDispatchRole> dispatches)
 {
     _callDispatchRoleRepository.DeleteAll(dispatches);
 }
Ejemplo n.º 13
0
 public void DeleteGroupDispatches(List <CallDispatchGroup> dispatches)
 {
     _callDispatchGroupRepository.DeleteAll(dispatches);
 }
Ejemplo n.º 14
0
        public void DeleteAllCertificationsForUser(string userId)
        {
            var certs = GetCertificationsByUserId(userId);

            _personnelCertificationRepository.DeleteAll(certs);
        }