예제 #1
0
        private void SplitAndSpillOverlappingIntervals(AllocationContext context, LiveInterval current)
        {
            foreach (int iIndex in context.Active)
            {
                LiveInterval interval = _intervals[iIndex];

                if (!interval.IsFixed && interval.Register == current.Register)
                {
                    SplitAndSpillOverlappingInterval(context, current, interval);

                    context.Active.Clear(iIndex);
                }
            }

            foreach (int iIndex in context.Inactive)
            {
                LiveInterval interval = _intervals[iIndex];

                if (!interval.IsFixed && interval.Register == current.Register && interval.Overlaps(current))
                {
                    SplitAndSpillOverlappingInterval(context, current, interval);

                    context.Inactive.Clear(iIndex);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Delete a staff member from the database by their ID
        /// </summary>
        /// <param name="staffId">the database ID of the staff member entry</param>
        /// <returns>true if the staff member was found and deleted, false otherwise</returns>
        public bool Delete(int staffId)
        {
            using (var dbContext = new AllocationContext(_dbOptions))
            {
                StaffMember staffMember = dbContext.StaffMembers
                                          .Include(sm => sm.Positions)
                                          .ThenInclude(sp => sp.Position)
                                          .SingleOrDefault(sm => sm.StaffMemberId == staffId);

                if (staffMember == null)
                {
                    return(false);
                }

                // Replace allocations with static variant
                foreach (var pos in staffMember.Positions)
                {
                    pos.Position.StaffPosition = new UnknownStaffPosition
                    {
                        StaffName = staffMember.FirstName,
                    };
                }

                dbContext.StaffMembers.Remove(staffMember);
                dbContext.SaveChanges();
                return(true);
            }
        }
예제 #3
0
        /// <summary>
        /// Update the specified id and handoverDTO.
        /// </summary>
        /// <returns>The update.</returns>
        /// <param name="id">Identifier.</param>
        /// <param name="handoverDTO">Handover dto.</param>
        public bool Update(int id, HandoverDTO handoverDTO)
        {
            using (var dbContext = new AllocationContext(_dbContextOptions))
            {
                Model.Handover handover = dbContext.Handovers
                                          .Include(h => h.HandoverIssues)
                                          .SingleOrDefault(h => h.HandoverID == id);
                if (handover == null)
                {
                    return(false);
                }
                //Update all the attributes
                Model.Handover newHandover = HandoverDTOToModel(handoverDTO);
                handover.AdmissionUnit       = newHandover.AdmissionUnit;
                handover.AdmissionDate       = newHandover.AdmissionDate;
                handover.Alerts              = newHandover.Alerts;
                handover.BedNumber           = newHandover.BedNumber;
                handover.NurseName           = newHandover.NurseName;
                handover.HandoverIssues      = newHandover.HandoverIssues;
                handover.Isolation           = newHandover.Isolation;
                handover.PatientName         = newHandover.PatientName;
                handover.PatientId           = newHandover.PatientId;
                handover.PastMedicalHistory  = newHandover.PastMedicalHistory;
                handover.PresentingComplaint = newHandover.PresentingComplaint;
                handover.SignificantEvents   = newHandover.SignificantEvents;
                handover.StudentName         = newHandover.StudentName;
                handover.SwabSent            = newHandover.SwabSent;
                handover.SwabSentDate        = newHandover.SwabSentDate;

                // Update
                dbContext.Update(handover);
                dbContext.SaveChanges();
                return(true);
            }
        }
예제 #4
0
        /// <summary>
        /// Search for the allocation at a certain time for the senior team.
        /// </summary>
        /// <param name="time">The time to search for in seconds since UNIX epoch.</param>
        /// <returns>The senior team allocation at the time if it exists, null otherwise.</returns>
        public SeniorTeam GetPastSeniorTeam(long time)
        {
            using (var context = new AllocationContext(_dbOptions))
            {
                var allocations = context.TeamAllocations
                                  .Include(t => t.Positions)
                                  .ThenInclude(p => p.StaffPosition)
                                  .Where(p => p.Type == Model.TeamType.Senior)
                                  .Where(p => time >= p.Time);

                var allocation = allocations.FirstOrDefault(p => p.Time == allocations.Max(q => q.Time));
                if (allocation == null)
                {
                    return(null);
                }
                else
                {
                    foreach (var pos in allocation.Positions.Where(p => p.StaffPosition is KnownStaffPosition))
                    {
                        context.Entry(pos.StaffPosition as KnownStaffPosition)
                        .Reference(sp => sp.StaffMember)
                        .Load();
                    }

                    return(ModelConverter.SeniorTeamFromModel(allocation));
                }
            }
        }
예제 #5
0
        /// <summary>
        /// Retrieve an existing staff member from the database by their database ID
        /// </summary>
        /// <param name="staffId">The database ID of the staff member.</param>
        /// <returns>A data object representation of the retrieved staff member.</returns>
        public DataObject.StaffMember Get(int staffId)
        {
            using (var dbContext = new AllocationContext(_dbOptions))
            {
                // Retrieve the staff member by ID, including all fields
                StaffMember staffMember = dbContext.StaffMembers
                                          .Include(sm => sm.Designation)
                                          .Include(sm => sm.StaffSkills)
                                          .ThenInclude(ss => ss.Skill)
                                          .SingleOrDefault(sm => sm.StaffMemberId == staffId);

                // If we got nothing, bail out
                if (staffMember == null)
                {
                    return(null);
                }

                // Turn the skills back into skill names
                ICollection <string> skills = staffMember.StaffSkills
                                              .Select(ss => ss.Skill.Name)
                                              .ToList();

                // Return a fresh data passing object
                return(new DataObject.StaffMember(staffMember.FirstName,
                                                  staffMember.LastName,
                                                  staffMember.Alias,
                                                  staffMember.Designation.Name,
                                                  skills,
                                                  staffMember.LastDouble,
                                                  null,
                                                  staffMember.PhotoId,
                                                  staffMember.RosterOnId));
            }
        }
예제 #6
0
        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="T:HospitalAllocation.Providers.Allocation.Database.AllocationDatabaseStore"/>
        /// class using the specified options.
        /// </summary>
        /// <param name="dbOptions">The options used to access the database.</param>
        public AllocationDatabaseStore(DbContextOptions <AllocationContext> dbOptions)
        {
            _dbOptions = dbOptions;

            using (var context = new AllocationContext(dbOptions))
            {
                // Fill the memory store with the latest allocations, if any exist
                _allocation = new AllocationMemoryStore();
                if (context.TeamAllocations.Where(t => t.Type == Model.TeamType.A).Any())
                {
                    AllocationProvider.SetPodAllocation(_allocation.PodA,
                                                        ModelConverter.PodFromModel(GetLatestAllocation(Model.TeamType.A, context)));
                }
                if (context.TeamAllocations.Where(t => t.Type == Model.TeamType.B).Any())
                {
                    AllocationProvider.SetPodAllocation(_allocation.PodB,
                                                        ModelConverter.PodFromModel(GetLatestAllocation(Model.TeamType.B, context)));
                }
                if (context.TeamAllocations.Where(t => t.Type == Model.TeamType.C).Any())
                {
                    AllocationProvider.SetPodAllocation(_allocation.PodC,
                                                        ModelConverter.PodFromModel(GetLatestAllocation(Model.TeamType.C, context)));
                }
                if (context.TeamAllocations.Where(t => t.Type == Model.TeamType.D).Any())
                {
                    AllocationProvider.SetPodAllocation(_allocation.PodD,
                                                        ModelConverter.PodFromModel(GetLatestAllocation(Model.TeamType.D, context)));
                }
                if (context.TeamAllocations.Where(t => t.Type == Model.TeamType.Senior).Any())
                {
                    AllocationProvider.SetSeniorTeamAllocation(_allocation.SeniorTeam,
                                                               ModelConverter.SeniorTeamFromModel(GetLatestAllocation(Model.TeamType.Senior, context)));
                }
            }
        }
 /// <summary>
 /// Check if a designation exists
 /// </summary>
 /// <param name="name">The given name</param>
 /// <returns>If it exists</returns>
 public bool Exists(string name)
 {
     using (var dbContext = new AllocationContext(_dbContextOptions))
     {
         // If there is any existing desigation in the database that has the same name.
         return(dbContext.Designations.Any(d => String.Equals(d.Name, name, StringComparison.OrdinalIgnoreCase)));
     }
 }
예제 #8
0
 /// <summary>
 /// Lists the entire collection of skills
 /// </summary>
 /// <returns>Immutable list of all the skills in the database</returns>
 public ImmutableList <KnownSkill> List()
 {
     using (var dbContext = new AllocationContext(_dbContextOptions))
     {
         List <Model.Skill> skills = dbContext.Skills.Select(x => x).ToList();
         // Map the Model list to immutable data list
         return(skills.Select(x => new KnownSkill(x.Name, x.SkillId)).ToImmutableList());
     }
 }
예제 #9
0
        /// <summary>
        /// Create a new staff member from a given staff member object and return their new allocted database ID
        /// </summary>
        /// <param name="staffMember">the staff member data to save in the database</param>
        /// <returns>the integer identifier of the new staff entry</returns>
        public int Create(DataObject.StaffMember staffMember)
        {
            using (var dbContext = new AllocationContext(_dbOptions))
            {
                // Find if this staff member's designation is already known
                Model.Designation designation = dbContext.Designations
                                                .SingleOrDefault(d => String.Equals(d.Name, staffMember.Designation, StringComparison.OrdinalIgnoreCase));

                if (designation == null)
                {
                    throw new ArgumentException(String.Format("Unrecognised designation: {0}", staffMember.Designation));
                }

                // Now dig out the skills we already know about. We could ask for only the skills that this
                // staff member has, but then we need to check those skills against the staff member's with
                // case insensitive comparison on the DB's side. It's probably both faster and simpler to read
                // in all the skills and then filter on our side
                IDictionary <string, Model.Skill> dbSkills = new Dictionary <string, Model.Skill>(dbContext.Skills.ToDictionary(s => s.Name, s => s),
                                                                                                  StringComparer.OrdinalIgnoreCase);

                // Create the new staff member entry
                StaffMember dbStaffMember = new StaffMember()
                {
                    FirstName   = staffMember.FirstName,
                    LastName    = staffMember.LastName,
                    Alias       = staffMember.Alias,
                    Designation = designation,
                    LastDouble  = staffMember.LastDouble,
                    PhotoId     = staffMember.PhotoId,
                    RosterOnId  = staffMember.RosterOnId,
                };

                // Now generate their skill entries
                var skills = new List <StaffSkill>();
                foreach (string skillName in staffMember.Skills)
                {
                    if (!dbSkills.ContainsKey(skillName))
                    {
                        throw new ArgumentException(String.Format("Unrecognised skill: {0}", skillName));
                    }

                    skills.Add(new StaffSkill()
                    {
                        StaffMember = dbStaffMember, Skill = dbSkills[skillName]
                    });
                }
                dbStaffMember.StaffSkills = skills;

                // Finally, stick them in the database
                dbContext.StaffMembers.Add(dbStaffMember);
                dbContext.SaveChanges();

                // EF Core should magically populate this property after the commit
                return(dbStaffMember.StaffMemberId);
            }
        }
 /// <summary>
 /// Lists the entire collection of designations
 /// </summary>
 /// <returns>Immutable list of all the designations in the database</returns>
 public ImmutableList <KnownDesignation> List()
 {
     using (var dbContext = new AllocationContext(_dbContextOptions))
     {
         return(dbContext.Designations
                .Select(x =>
                        new KnownDesignation(x.DesignationId, x.Name))
                .ToImmutableList());
     }
 }
예제 #11
0
 /// <summary>
 /// Gets the handover.
 /// </summary>
 /// <returns>The handover.</returns>
 /// <param name="id">Identifier.</param>
 public HandoverDTO GetHandover(int id)
 {
     using (var dbContext = new AllocationContext(_dbContextOptions))
     {
         Model.Handover handover = dbContext.Handovers
                                   .Include(h => h.HandoverIssues)
                                   .SingleOrDefault(h => h.HandoverID == id);
         return(HandoverModelToDTO(handover));
     }
 }
예제 #12
0
        public static ModelConverter FromDb(DbContextOptions <AllocationContext> dbOptions)
        {
            using (var dbContext = new AllocationContext(dbOptions))
            {
                IDictionary <int, StaffMember> staff = dbContext.StaffMembers
                                                       .ToDictionary(sm => sm.StaffMemberId, sm => sm);

                return(new ModelConverter(staff));
            }
        }
예제 #13
0
        public AllocationResult RunPass(
            ControlFlowGraph cfg,
            StackAllocator stackAlloc,
            RegisterMasks regMasks)
        {
            NumberLocals(cfg);

            AllocationContext context = new AllocationContext(stackAlloc, regMasks, _intervals.Count);

            BuildIntervals(cfg, context);

            for (int index = 0; index < _intervals.Count; index++)
            {
                LiveInterval current = _intervals[index];

                if (current.IsEmpty)
                {
                    continue;
                }

                if (current.IsFixed)
                {
                    context.Active.Set(index);

                    if (current.Register.Type == RegisterType.Integer)
                    {
                        context.IntUsedRegisters |= 1 << current.Register.Index;
                    }
                    else /* if (interval.Register.Type == RegisterType.Vector) */
                    {
                        context.VecUsedRegisters |= 1 << current.Register.Index;
                    }

                    continue;
                }

                AllocateInterval(context, current, index);
            }

            for (int index = RegistersCount * 2; index < _intervals.Count; index++)
            {
                if (!_intervals[index].IsSpilled)
                {
                    ReplaceLocalWithRegister(_intervals[index]);
                }
            }

            InsertSplitCopies();
            InsertSplitCopiesAtEdges(cfg);

            return(new AllocationResult(
                       context.IntUsedRegisters,
                       context.VecUsedRegisters,
                       context.StackAlloc.TotalSize));
        }
예제 #14
0
        /// <summary>
        /// Generates the recent doubles for a staff member.
        /// </summary>
        /// <param name="context">The database context to use.</param>
        /// <param name="staffId">The ID of the staff member.</param>
        /// <param name="recentDoubleTime">The earliest time considered recent.</param>
        /// <returns>The recent doubles for the staff member.</returns>
        private static ICollection <long> GenerateRecentDoubles(
            AllocationContext context, int staffId, long recentDoubleTime)
        {
            // Find recent doubles for the staff member
            var doubles = context.StaffMembers
                          .Include(s => s.Positions)
                          .ThenInclude(sp => sp.Position)
                          .ThenInclude(p => p.Allocation)
                          .Single(s => s.StaffMemberId == staffId)
                          .Positions
                          .Where(p => p.Position.Allocation.Time >= recentDoubleTime)
                          .GroupBy(p => p.Position.Allocation.Time)
                          .Where(g => g.Count() > 1)
                          .Select(g => g.Key)
                          .ToList();

            // Add the stored last double value if it is relevant
            var staff = context.StaffMembers.Find(staffId);

            if (staff.LastDouble.HasValue && staff.LastDouble.Value >= recentDoubleTime)
            {
                doubles.Add(staff.LastDouble.Value);
            }

            if (doubles.Count == 0)
            {
                return(doubles);
            }

            // Find and remove the last doubles that occur within a time interval
            doubles.Sort();
            long intervalStart = doubles.Min();
            var  removeList    = new List <int>();

            for (int i = 1; i < doubles.Count; i++)
            {
                if (doubles[i] > intervalStart + DoubleIntervalSeconds)
                {
                    intervalStart = doubles[i];
                }
                else
                {
                    removeList.Add(i);
                }
            }

            removeList.Reverse();
            foreach (var index in removeList)
            {
                doubles.RemoveAt(index);
            }

            return(doubles);
        }
예제 #15
0
 /// <summary>
 /// Get a skill matching the Id
 /// </summary>
 /// <param name="skillId">The id with which to query the database</param>
 /// <returns>The matching skill</returns>
 public KnownSkill Get(int id)
 {
     using (var dbContext = new AllocationContext(_dbContextOptions))
     {
         Model.Skill skill = dbContext.Skills.Find(id);
         if (skill == null)
         {
             return(null);
         }
         return(new KnownSkill(skill.Name, skill.SkillId));
     }
 }
 /// <summary>
 /// Get a designation matching the Id
 /// </summary>
 /// <param name="designationId">The id with which to query the databse</param>
 /// <returns>The matching designation</returns>
 public KnownDesignation Get(int id)
 {
     using (var dbContext = new AllocationContext(_dbContextOptions))
     {
         Model.Designation designation = dbContext.Designations.Find(id);
         if (designation == null)
         {
             return(null);
         }
         return(new KnownDesignation(designation.DesignationId, designation.Name));
     }
 }
예제 #17
0
        public ICSVFileStream GetCSVFile(DateTime timestamp)
        {
            using (var dbContext = new AllocationContext(_dbOptions))
            {
                CSVFileStorage csvfilestorage = dbContext.CSVFileStorages.Single(c => c.CSVTimeStamp == timestamp);
                if (csvfilestorage == null)
                {
                    return(null);
                }

                return(new MemoryCSVFileStream(csvfilestorage.CSVFileData, csvfilestorage.CSVTimeStamp, csvfilestorage.CSVFileFormat));
            }
        }
예제 #18
0
        public ICSVFileStream GetMostRecentCSVFile()
        {
            using (var dbContext = new AllocationContext(_dbOptions))
            {
                CSVFileStorage csvfilestorage = dbContext.CSVFileStorages.OrderBy(c => c.CSVTimeStamp).Last();
                if (csvfilestorage == null)
                {
                    return(null);
                }

                return(new MemoryCSVFileStream(csvfilestorage.CSVFileData, csvfilestorage.CSVTimeStamp, csvfilestorage.CSVFileFormat));
            }
        }
예제 #19
0
        private void Spill(AllocationContext context, LiveInterval interval)
        {
            Debug.Assert(!interval.IsFixed, "Trying to spill a fixed interval.");
            Debug.Assert(interval.UsesCount == 0, "Trying to spill a interval with uses.");

            // We first check if any of the siblings were spilled, if so we can reuse
            // the stack offset. Otherwise, we allocate a new space on the stack.
            // This prevents stack-to-stack copies being necessary for a split interval.
            if (!interval.TrySpillWithSiblingOffset())
            {
                interval.Spill(context.StackAlloc.Allocate(interval.Local.Type));
            }
        }
 /// <summary>
 /// Update an existing designation
 /// </summary>
 /// <param name="designationId">The id of existing designation</param>
 /// <param name="designation">The new designation to update to</param>
 /// <returns>Success status</returns>
 public bool Update(int designationId, KnownDesignation designation)
 {
     using (var dbContext = new AllocationContext(_dbContextOptions))
     {
         Model.Designation dbDesignation = dbContext.Designations.Find(designationId);
         if (dbDesignation == null)
         {
             return(false);
         }
         dbDesignation.Name = designation.Name;
         dbContext.SaveChanges();
         return(true);
     }
 }
예제 #21
0
 /// <summary>
 /// Update an existing skill
 /// </summary>
 /// <param name="skillId">The id of the existing skill</param>
 /// <param name="skill">The new skill to update to</param>
 /// <returns>Success status</returns>
 public bool Update(int skillId, KnownSkill skill)
 {
     using (var dbContext = new AllocationContext(_dbContextOptions))
     {
         Model.Skill dbSkill = dbContext.Skills.Find(skillId);
         if (dbSkill == null)
         {
             return(false);
         }
         dbSkill.Name = skill.Name;
         dbContext.SaveChanges();
         return(true);
     }
 }
예제 #22
0
        /// <summary>
        /// Retrieve an image with the given identifier from the database
        /// </summary>
        /// <param name="id">the database identifier of the image to retrieve</param>
        /// <returns>a data stream of the image</returns>
        public IImageStream GetImage(int id)
        {
            using (var dbContext = new AllocationContext(_dbOptions))
            {
                Photo photo = dbContext.Photos.SingleOrDefault(p => p.PhotoId == id);

                if (photo == null)
                {
                    return(null);
                }

                return(new MemoryImageStream(photo.Image, photo.Format));
            }
        }
예제 #23
0
 /// <summary>
 /// Deletes a note
 /// </summary>
 /// <param name="noteId">The given note id</param>
 /// <returns>Success status</returns>
 public bool Delete(int noteId)
 {
     using (var dbContext = new AllocationContext(_dbContextOptions))
     {
         Model.Note note = dbContext.Notes.Find(noteId);
         if (note == null)
         {
             return(false);
         }
         dbContext.Notes.Remove(note);
         dbContext.SaveChanges();
         return(true);
     }
 }
예제 #24
0
 /// <summary>
 /// Delete the specified id.
 /// </summary>
 /// <returns>The delete.</returns>
 /// <param name="id">Identifier.</param>
 public bool Delete(int id)
 {
     using (var dbContext = new AllocationContext(_dbContextOptions))
     {
         Model.Handover handover = dbContext.Handovers.Find(id);
         if (handover == null)
         {
             return(false);
         }
         // Remove the object in database
         dbContext.Handovers.Remove(handover);
         dbContext.SaveChanges();
         return(true);
     }
 }
예제 #25
0
 public ICSVFileStream GetCSVFile(int id)
 {
     using (var dbContext = new AllocationContext(_dbOptions))
     {
         try
         {
             CSVFileStorage csvfilestorage = dbContext.CSVFileStorages.Single(c => c.CSVFileID == id);
             return(new MemoryCSVFileStream(csvfilestorage.CSVFileData, csvfilestorage.CSVTimeStamp, csvfilestorage.CSVFileFormat));
         }
         catch
         {
             return(null);
         }
     }
 }
예제 #26
0
        /// <summary>
        /// Create the specified handoverDTO.
        /// </summary>
        /// <returns>The create.</returns>
        /// <param name="handoverDTO">Handover dto.</param>
        public int Create(HandoverDTO handoverDTO)
        {
            using (var dbContext = new AllocationContext(_dbContextOptions))
            {
                // Create the handover Model object
                Model.Handover handover = HandoverDTOToModel(handoverDTO);

                // Store the object in database
                dbContext.Handovers.Add(handover);
                dbContext.SaveChanges();

                // EF Core should magically populate this property after the commit
                return(handover.HandoverID);
            }
        }
예제 #27
0
 /// <summary>
 /// Updates an existing note
 /// </summary>
 /// <param name="noteId">Id of the existing note</param>
 /// <param name="newNote">The new note</param>
 /// <returns>Success status</returns>
 public bool Update(int noteId, KnownNote newNote)
 {
     using (var dbContext = new AllocationContext(_dbContextOptions))
     {
         Model.Note note = dbContext.Notes.Find(noteId);
         if (note == null)
         {
             return(false);
         }
         note.Contents             = newNote.Contents;
         note.LastModificationTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
         dbContext.SaveChanges();
         return(true);
     }
 }
예제 #28
0
 public ImmutableList <KnownNote> GetNotes()
 {
     using (var dbContext = new AllocationContext(_dbContextOptions))
     {
         ImmutableList <KnownNote> notes = dbContext.Notes
                                           .Select(n => new KnownNote(
                                                       n.NoteId,
                                                       n.StaffMemberId,
                                                       n.Contents,
                                                       n.CreationTime,
                                                       n.LastModificationTime))
                                           .ToImmutableList();
         return(notes);
     }
 }
예제 #29
0
        /// <summary>
        /// Inserts an allocation into the database by updating the existing allocation if an
        /// allocation already exists at that time, and creating a new allocation otherwise.
        /// </summary>
        /// <param name="context">The context to insert into.</param>
        /// <param name="time">The time of the allocation in UNIX time seconds.</param>
        /// <param name="oldAllocations">The allocations at time.</param>
        /// <param name="allocation">The allocation to insert.</param>
        private static void InsertAllocation(AllocationContext context, long time,
                                             IQueryable <TeamAllocation> oldAllocations, TeamAllocation allocation)
        {
            var oldAllocation = oldAllocations.SingleOrDefault(a => a.Type == allocation.Type);

            if (oldAllocation != null)
            {
                oldAllocation.Positions = allocation.Positions;
                context.Update(oldAllocation);
            }
            else
            {
                allocation.Time = time;
                context.TeamAllocations.Add(allocation);
            }
        }
 /// <summary>
 /// Deletes a designation if not associated with any staff
 /// </summary>
 /// <param name="designationID">The id of designation to delete</param>
 /// <returns>Success status</returns>
 public bool Delete(int designationId)
 {
     using (var dbContext = new AllocationContext(_dbContextOptions))
     {
         Model.Designation designation = dbContext.Designations
                                         .Include(d => d.StaffMembers)
                                         .SingleOrDefault(d => d.DesignationId == designationId);
         // Only delete a skill that exists and is not associated with other staff
         if (designation == null || designation.StaffMembers?.Any() == true)
         {
             return(false);
         }
         dbContext.Designations.Remove(designation);
         dbContext.SaveChanges();
         return(true);
     }
 }