Example #1
0
        public async Task <WorkerCalendarDto> GetWorkerCalendar(int workerId)
        {
            var worker = await context.Workers
                         .AsNoTracking()
                         .Include(w => w.Leave)
                         .Include(w => w.WorkerTraining)
                         .ThenInclude(wt => wt.Training)
                         .Include(w => w.WorkerShifts)
                         .ThenInclude(ws => ws.JobTask)
                         .SingleOrDefaultAsync(w => w.Id == workerId);

            var appointments = new List <Appointment>();

            appointments.AddRange(worker.Leave.Select(l => new Appointment(l)));
            appointments.AddRange(worker.WorkerShifts.Select(ws => new Appointment(ws.JobTask)));
            appointments.AddRange(worker.WorkerTraining.Select(wt => new Appointment(wt.Training)));
            Conflicts.GetConflicts(appointments);

            return(new WorkerCalendarDto
            {
                Id = worker.Id,
                Name = worker.Name,
                IsActive = worker.IsActive,
                Appointments = appointments
            });
        }
Example #2
0
        private static Conflicts NextClassesAtDifferentAddress(ScheduleList allClasses)
        {
            var conflicts = new Conflicts();
            var message   = "Адреса двух аудиторий, в которых проходят два соседних занятия, различны.";

            var classes = from c in allClasses
                          orderby c.Group.Name, c.Time.Day, c.Time.Number
            select c;

            var prevClass = classes.ElementAt(0);

            for (int i = 1; i < allClasses.Count; ++i)
            {
                var currClass = classes.ElementAt(i);
                if (prevClass.Time.Day == currClass.Time.Day &&
                    currClass.Time.Number - prevClass.Time.Number <= 1 &&
                    prevClass.Classroom.Address != currClass.Classroom.Address)
                {
                    var conflictingClasses = new List <FullClassRecord> {
                        prevClass, currClass
                    };
                    conflicts.Add(new Conflict(message, ConflictType.Warning, conflictingClasses));
                }
            }
            return(conflicts);
        }
        void SourceOnConflictModelChanged(object sender, IConflictModelFactory conflictModel)
        {
            try
            {
                if (!HasMergeStarted)
                {
                    HasMergeStarted = conflictModel.IsWorkflowNameChecked || conflictModel.IsVariablesChecked;
                }
                if (!conflictModel.IsVariablesChecked)
                {
                    return;
                }

                IsVariablesEnabled = HasVariablesConflict;
                if (conflictModel.IsVariablesChecked)
                {
                    DataListViewModel = conflictModel.DataListViewModel;
                }
                var completeConflict = Conflicts.First() as IToolConflictRow;
                completeConflict.ContainsStart = true;
                if (completeConflict.IsChecked)
                {
                    return;
                }
                completeConflict.CurrentViewModel.IsChecked = !completeConflict.HasConflict;
            }
            catch (Exception ex)
            {
                Dev2Logger.Error(ex, ex.Message);
            }
        }
Example #4
0
 /// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 public void Dispose()
 {
     if (disposed)
     {
         return;
     }
     GC.SuppressFinalize(this);
     disposed = true;
     AllConflicts?.Dispose();
     Conflicts?.Dispose();
     IgnoredConflicts?.Dispose();
     OrphanConflicts?.Dispose();
     ResolvedConflicts?.Dispose();
     RuleIgnoredConflicts?.Dispose();
     OverwrittenConflicts?.Dispose();
     CustomConflicts?.Dispose();
     AllConflicts         = null;
     Conflicts            = null;
     IgnoredConflicts     = null;
     ResolvedConflicts    = null;
     OrphanConflicts      = null;
     RuleIgnoredConflicts = null;
     OverwrittenConflicts = null;
     CustomConflicts      = null;
 }
Example #5
0
 public static void Init()
 {
     try
     {
         GameObjects.Initialize();
         try
         {
             _champion = LoadChampion();
             if (_champion != null)
             {
                 Global.Champion = _champion;
                 if (Global.Reset.Enabled)
                 {
                     Reset.Force(
                         Global.Name, Global.Reset.MaxAge, TargetSelector.Weights.RestoreDefaultWeights);
                 }
                 LeagueSharp.Common.Utility.DelayAction.Add(1000, () => Conflicts.Check(ObjectManager.Player.ChampionName));
                 Update.Check(
                     Global.Name, Assembly.GetExecutingAssembly().GetName().Version, Global.UpdatePath, 10000);
                 Core.Init(_champion, 50);
                 Core.Boot();
             }
         }
         catch (Exception ex)
         {
             Global.Logger.AddItem(new LogItem(ex));
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }
Example #6
0
        internal void PrescanOneTree()
        {
            var visitor = new AbstractIndexTreeVisitor
            {
                VisitEntry = (m, i, f) =>
                {
                    if (m != null)
                    {
                        if (!f.IsFile())
                        {
                            CheckConflictsWithFile(f);
                        }
                    }
                    else
                    {
                        if (f.Exists)
                        {
                            Removed.Add(i.Name);
                            Conflicts.Remove(i.Name);
                        }
                    }
                }
            };

            new IndexTreeWalker(_index, _merge, _root, visitor).Walk();

            Conflicts.RemoveAll(conflict => Removed.Contains(conflict));
        }
 private void Add(EntityChange local, EntityChange remote)
 {
     Debug.WriteLine(local != null ? local.Headers : remote.Headers);
     Debug.WriteLine(string.Format("Local value:{0}", local != null ? local.ToString() : "null"));
     Debug.WriteLine(string.Format("Remote value:{0}", remote != null ? remote.ToString() : "null"));
     Conflicts.Add(new Conflict(_entityInfo, local, remote, _syncSessionInfo));
 }
Example #8
0
        ///	<summary>
        /// Execute this checkout
        /// </summary>
        /// <exception cref="IOException"></exception>
        public void checkout()
        {
            if (_head == null)
            {
                PrescanOneTree();
            }
            else
            {
                PrescanTwoTrees();
            }

            if (Conflicts.Count != 0)
            {
                if (FailOnConflict)
                {
                    string[] entries = Conflicts.ToArray();
                    throw new CheckoutConflictException(entries);
                }
            }

            CleanUpConflicts();
            if (_head == null)
            {
                CheckoutOutIndexNoHead();
            }
            else
            {
                CheckoutTwoTrees();
            }
        }
Example #9
0
        public async Task <ResourceCalendarDto> GetResourceCalendar(int resourceId)
        {
            var resource = await context.Resources
                           .AsNoTracking()
                           .Include(r => r.OutOfServices)
                           .Include(r => r.ResourceShifts)
                           .ThenInclude(rs => rs.JobTask)
                           .SingleOrDefaultAsync(r => r.Id == resourceId);

            var appointments = new List <Appointment>();

            appointments.AddRange(resource.OutOfServices.Select(o => new Appointment(o)));
            appointments.AddRange(resource.ResourceShifts.Select(rs => new Appointment(rs.JobTask)));
            Conflicts.GetConflicts(appointments);

            var resourceDto = new ResourceCalendarDto
            {
                Id           = resource.Id,
                Name         = resource.Name,
                IsActive     = resource.IsActive,
                Description  = resource.Description,
                Appointments = appointments
            };

            return(resourceDto);
        }
Example #10
0
        public async Task <IEnumerable <WorkerCalendarDto> > GetWorkersCalendar(DateTimeRange period)
        {
            var leave = await context.Leave
                        .AsNoTracking()
                        .Where(l => l.LeavePeriod.Start < period.End && period.Start < l.LeavePeriod.End)
                        .ToListAsync();

            var workerTraining = await context.WorkerTraining
                                 .AsNoTracking()
                                 .Include(wt => wt.Training)
                                 .Where(wt => wt.Training.TrainingPeriod.Start < period.End && period.Start < wt.Training.TrainingPeriod.End)
                                 .ToListAsync();

            var workerShifts = await context.WorkerShifts
                               .AsNoTracking()
                               .Include(ws => ws.JobTask)
                               .Where(ws => ws.JobTask.TaskPeriod.Start < period.End && period.Start < ws.JobTask.TaskPeriod.End)
                               .ToListAsync();

            var workers = await context.Workers
                          .AsNoTracking()
                          .Where(w => w.IsActive)
                          .ToListAsync();

            var calendar = new List <WorkerCalendarDto>();

            foreach (var worker in workers)
            {
                var workerLeave = leave
                                  .Where(l => l.WorkerId == worker.Id)
                                  .Select(l => new Appointment(l));

                var workerJobTasks = workerShifts
                                     .Where(ws => ws.WorkerId == worker.Id)
                                     .Select(ws => new Appointment(ws.JobTask));

                var training = workerTraining
                               .Where(wt => wt.WorkerId == worker.Id)
                               .Select(wt => new Appointment(wt.Training));

                var appointments = new List <Appointment>();
                appointments.AddRange(workerLeave);
                appointments.AddRange(workerJobTasks);
                appointments.AddRange(training);
                Conflicts.GetConflicts(appointments);

                var workerDto = new WorkerCalendarDto
                {
                    Id           = worker.Id,
                    Name         = worker.Name,
                    IsActive     = worker.IsActive,
                    Appointments = appointments
                };

                calendar.Add(workerDto);
            }

            return(calendar);
        }
Example #11
0
        internal void PrescanTwoTrees()
        {
            var visitor = new AbstractIndexTreeVisitor
            {
                VisitEntryAux = (treeEntry, auxEntry, indexEntry, file) =>
                {
                    if (treeEntry is Tree || auxEntry is Tree)
                    {
                        throw new ArgumentException("Can't pass me a tree!");
                    }

                    ProcessEntry(treeEntry, auxEntry, indexEntry);
                },

                FinishVisitTree = (tree, auxTree, currentDirectory) =>
                {
                    if (currentDirectory.Length == 0)
                    {
                        return;
                    }
                    if (auxTree == null)
                    {
                        return;
                    }

                    if (_index.GetEntry(currentDirectory) != null)
                    {
                        Removed.Add(currentDirectory);
                    }
                }
            };

            new IndexTreeWalker(_index, _head, _merge, _root, visitor).Walk();

            // if there's a conflict, don't list it under
            // to-be-removed, since that messed up our next
            // section
            Removed.RemoveAll(removed => Conflicts.Contains(removed));

            foreach (string path in _updated.Keys)
            {
                if (_index.GetEntry(path) == null)
                {
                    FileSystemInfo file = new FileInfo(Path.Combine(_root.DirectoryName(), path));
                    if (file.IsFile())
                    {
                        Conflicts.Add(path);
                    }
                    else if (file.IsDirectory())
                    {
                        CheckConflictsWithFile(file);
                    }
                }
            }

            Conflicts.RemoveAll(conflict => Removed.Contains(conflict));
        }
Example #12
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = Conflicts != null?Conflicts.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (EntityName != null ? EntityName.GetHashCode() : 0);
                return(hashCode);
            }
        }
Example #13
0
        public static string GetStringValue(this Conflicts enumValue)
        {
            switch (enumValue)
            {
            case Conflicts.Abort: return("abort");

            case Conflicts.Proceed: return("proceed");
            }
            throw new ArgumentException($"'{enumValue.ToString()}' is not a valid value for enum 'Conflicts'");
        }
        public static void Init()
        {
            try
            {
                AppDomain.CurrentDomain.UnhandledException +=
                    delegate(object sender, UnhandledExceptionEventArgs eventArgs)
                {
                    try
                    {
                        var ex = sender as Exception;
                        if (ex != null)
                        {
                            Global.Logger.AddItem(new LogItem(ex));
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                    }
                };

                GameObjects.Initialize();

                CustomEvents.Game.OnGameLoad += delegate
                {
                    try
                    {
                        _champion = LoadChampion();
                        if (_champion != null)
                        {
                            Global.Champion = _champion;
                            if (Global.Reset.Enabled)
                            {
                                Reset.Force(
                                    Global.Name, Global.Reset.MaxAge, TargetSelector.Weights.RestoreDefaultWeights);
                            }
                            Utility.DelayAction.Add(1000, () => Conflicts.Check(ObjectManager.Player.ChampionName));
                            Update.Check(
                                Global.Name, Assembly.GetExecutingAssembly().GetName().Version, Global.UpdatePath, 10000);
                            Core.Init(_champion, 50);
                            Core.Boot();
                        }
                    }
                    catch (Exception ex)
                    {
                        Global.Logger.AddItem(new LogItem(ex));
                    }
                };
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
Example #15
0
        public static Conflicts SearchAllConflicts(ClassesSchedule schedule)
        {
            var conflicts  = new Conflicts();
            var allClasses = schedule.ToList();

            conflicts.AddRange(GreaterFourClassesPerDay(allClasses));
            conflicts.AddRange(GroupsInDifferentClassrooms(allClasses));
            conflicts.AddRange(LecterersInDifferentClassrooms(allClasses));
            conflicts.AddRange(NextClassesAtDifferentAddress(allClasses));
            return(conflicts);
        }
Example #16
0
        private void editLabelsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            EditLabelsDialog eld = new EditLabelsDialog(currentUser, Manager, mainModList.ModuleLabels);

            eld.ShowDialog(this);
            eld.Dispose();
            mainModList.ModuleLabels.Save(ModuleLabelList.DefaultPath);
            foreach (GUIMod module in mainModList.Modules)
            {
                mainModList.ReapplyLabels(module, Conflicts?.ContainsKey(module) ?? false, CurrentInstance.Name);
            }
        }
Example #17
0
        public ApplyTransactionResult Apply(TrackedTransaction trackedTransaction)
        {
            var result = ApplyTransactionResult.Passed;
            var hash   = trackedTransaction.Key.TxId;

            foreach (var coin in trackedTransaction.ReceivedCoins)
            {
                if (UTXOByOutpoint.ContainsKey(coin.Outpoint))
                {
                    result = ApplyTransactionResult.Conflict;
                    Conflicts.Add(coin.Outpoint, hash);
                }
            }

            foreach (var spentOutpoint in trackedTransaction.SpentOutpoints)
            {
                if (_KnownInputs.Contains(spentOutpoint) ||
                    (!UTXOByOutpoint.ContainsKey(spentOutpoint) && SpentUTXOs.Contains(spentOutpoint)))
                {
                    result = ApplyTransactionResult.Conflict;
                    Conflicts.Add(spentOutpoint, hash);
                }
            }
            if (result == ApplyTransactionResult.Conflict)
            {
                return(result);
            }

            _TransactionTimes.Add(trackedTransaction.FirstSeen);

            foreach (var coin in trackedTransaction.ReceivedCoins)
            {
                UTXOByOutpoint.TryAdd(coin.Outpoint, coin);
            }

            if (trackedTransaction.ReceivedCoins.Count == 0 && trackedTransaction.Transaction != null)
            {
                UTXOByOutpoint.Prunable.Add(new Prunable()
                {
                    PrunedBy = hash, TransactionId = hash
                });
            }

            foreach (var spentOutpoint in trackedTransaction.SpentOutpoints)
            {
                if (UTXOByOutpoint.Remove(spentOutpoint, hash))
                {
                    SpentUTXOs.Add(spentOutpoint);
                }
                _KnownInputs.Add(spentOutpoint);
            }
            return(result);
        }
Example #18
0
        /// <summary>
        /// Use to initialize the datastructure and set values to initial values
        /// </summary>
        private void Load()
        {
            // initialize the datastructure
            this._skeleton  = new GroupOfSlots();
            this._employees = new Roster();

            this._conflicts = new Conflicts();

            // default shifts available and filled
            this._totalShiftsAvailable = 0;
            this._totalShiftsFilled    = 0;
        }
Example #19
0
 public virtual DynamicJsonValue ToJson()
 {
     return(new DynamicJsonValue(GetType())
     {
         [nameof(Documents)] = Documents.ToJson(),
         [nameof(RevisionDocuments)] = RevisionDocuments.ToJson(),
         [nameof(Tombstones)] = Tombstones.ToJson(),
         [nameof(Conflicts)] = Conflicts.ToJson(),
         [nameof(Identities)] = Identities.ToJson(),
         [nameof(Indexes)] = Indexes.ToJson(),
     });
 }
Example #20
0
        public void ReadManifest(XmlReader reader, PlugIn plugIn)
        {
            if (reader.AttributeCount != 0)
            {
                throw new Exception(PlugInConst.Manifest + " node cannot have attributes.");
            }
            if (reader.IsEmptyElement)
            {
                throw new Exception(PlugInConst.Manifest + " node cannot be empty.");
            }

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                    string     nodeName   = reader.LocalName;
                    Properties properties = Properties.ReadFromAttributes(reader);
                    switch (nodeName)
                    {
                    case PlugInConst.ManifestIdentity:
                        AddIdentity(properties["name"], properties["version"], plugIn.PlugInDir);
                        break;

                    case PlugInConst.ManifestDependency:
                        Dependencies.Add(PlugInReference.Create(properties, plugIn.PlugInDir));
                        break;

                    case PlugInConst.ManifestConflict:
                        Conflicts.Add(PlugInReference.Create(properties, plugIn.PlugInDir));
                        break;

                    default:
                        throw new Exception("Unknown node in " + PlugInConst.Manifest + " section:" + nodeName + " plugIn:" + plugIn.PlugInFile);
                    }
                    break;

                case XmlNodeType.EndElement:
                    if (reader.LocalName == PlugInConst.Manifest)
                    {
                        return;
                    }
                    break;

                default:
                    break;
                }
            }
        }
Example #21
0
        public async Task <IEnumerable <ResourceCalendarDto> > GetResourcesCalendar(DateTimeRange period)
        {
            var outOfServices = await context.ResourceOutOfService
                                .AsNoTracking()
                                .Where(o => o.Period.Start < period.End && period.Start < o.Period.End)
                                .ToListAsync();

            var resourceShifts = await context.ResourceShifts
                                 .AsNoTracking()
                                 .Include(rs => rs.JobTask)
                                 .Where(rs => rs.JobTask.TaskPeriod.Start < period.End && period.Start < rs.JobTask.TaskPeriod.End)
                                 .ToListAsync();

            var resources = await context.Resources
                            .AsNoTracking()
                            .Where(r => r.IsActive)
                            .ToListAsync();

            var calendar = new List <ResourceCalendarDto>();

            foreach (var resource in resources)
            {
                var appointments = new List <Appointment>();

                var resourceOutOfServices = outOfServices
                                            .Where(o => o.ResourceId == resource.Id)
                                            .Select(o => new Appointment(o));

                var resourceJobTasks = resourceShifts.Where(rs => rs.ResourceId == resource.Id)
                                       .Select(rs => new Appointment(rs.JobTask));

                appointments.AddRange(resourceOutOfServices);
                appointments.AddRange(resourceJobTasks);
                Conflicts.GetConflicts(appointments);

                var resourceDto = new ResourceCalendarDto
                {
                    Id           = resource.Id,
                    Description  = resource.Description,
                    Name         = resource.Name,
                    IsActive     = resource.IsActive,
                    Appointments = appointments
                };

                calendar.Add(resourceDto);
            }

            return(calendar);
        }
Example #22
0
 public virtual DynamicJsonValue ToJson()
 {
     return(new DynamicJsonValue(GetType())
     {
         [nameof(DatabaseRecord)] = DatabaseRecord.ToJson(),
         [nameof(Documents)] = Documents.ToJson(),
         [nameof(RevisionDocuments)] = RevisionDocuments.ToJson(),
         [nameof(Tombstones)] = Tombstones.ToJson(),
         [nameof(Conflicts)] = Conflicts.ToJson(),
         [nameof(Identities)] = Identities.ToJson(),
         [nameof(Indexes)] = Indexes.ToJson(),
         [nameof(CompareExchange)] = CompareExchange.ToJson(),
         [nameof(Counters)] = Counters.ToJson()
     });
 }
Example #23
0
        /// <summary>
        /// Load previously save data
        /// </summary>
        /// <param name="info"></param>
        /// <param name="ctxt"></param>
        public Schedule(SerializationInfo info, StreamingContext ctxt)
        {
            this._skeleton   = (GroupOfSlots)info.GetValue("skeleton", typeof(GroupOfSlots));
            this._employees  = (Roster)info.GetValue("employees", typeof(Roster));
            this._author     = (string)info.GetValue("author", typeof(string));
            this._startDay   = (string)info.GetValue("startDay", typeof(string));
            this._endDay     = (string)info.GetValue("endDay", typeof(string));
            this._payDay     = (string)info.GetValue("payDay", typeof(string));
            this._scheduleID = (int)info.GetValue("scheduleID", typeof(int));

            this._totalShiftsAvailable = (int)info.GetValue("totalShiftsAvailable", typeof(int));
            this._totalShiftsFilled    = (int)info.GetValue("totlaShiftsFilled", typeof(int));

            this._conflicts = (Conflicts)info.GetValue("conflicts", typeof(Conflicts));
        }
Example #24
0
        public void Populate(ManifestMetadata manifestMetadata)
        {
            IPackageMetadata metadata = manifestMetadata;

            Id      = metadata.Id;
            Version = metadata.Version;
            Title   = metadata.Title;
            Authors.AddRange(metadata.Authors);
            Owners.AddRange(metadata.Owners);
            IconUrl    = metadata.IconUrl;
            LicenseUrl = metadata.LicenseUrl;
            ProjectUrl = metadata.ProjectUrl;
            RequireLicenseAcceptance = metadata.RequireLicenseAcceptance;
            DevelopmentDependency    = metadata.DevelopmentDependency;
            Description      = metadata.Description;
            Summary          = metadata.Summary;
            ReleaseNotes     = metadata.ReleaseNotes;
            Language         = metadata.Language;
            Copyright        = metadata.Copyright;
            MinClientVersion = metadata.MinClientVersion;
            ContentFiles     = new Collection <ManifestContentFiles>(manifestMetadata.ContentFiles);

            ProjectSourceUrl = metadata.ProjectSourceUrl;
            PackageSourceUrl = metadata.PackageSourceUrl;
            DocsUrl          = metadata.DocsUrl;
            WikiUrl          = metadata.WikiUrl;
            MailingListUrl   = metadata.MailingListUrl;
            BugTrackerUrl    = metadata.BugTrackerUrl;
            Replaces.AddRange(metadata.Replaces);
            Provides.AddRange(metadata.Provides);
            Conflicts.AddRange(metadata.Conflicts);

            SoftwareDisplayName    = metadata.SoftwareDisplayName;
            SoftwareDisplayVersion = metadata.SoftwareDisplayVersion;

            if (metadata.Tags != null)
            {
                Tags.AddRange(ParseTags(metadata.Tags));
            }

            DependencySets.AddRange(metadata.DependencySets);
            FrameworkReferences.AddRange(metadata.FrameworkAssemblies);

            if (manifestMetadata.ReferenceSets != null)
            {
                PackageAssemblyReferences.AddRange(manifestMetadata.ReferenceSets.Select(r => new PackageReferenceSet(r)));
            }
        }
Example #25
0
        public CustomParserAction(LanguageData language, ParserState state, ExecuteActionMethod executeRef)
        {
            Language   = language;
            State      = state;
            ExecuteRef = executeRef ?? throw new ArgumentNullException(nameof(executeRef));
            Conflicts.UnionWith(state.BuilderData.Conflicts);

            // Create default shift and reduce actions
            foreach (var shiftItem in state.BuilderData.ShiftItems)
            {
                ShiftActions.Add(new ShiftParserAction(shiftItem));
            }
            foreach (var item in state.BuilderData.ReduceItems)
            {
                ReduceActions.Add(ReduceParserAction.Create(item.Core.Production));
            }
        }
Example #26
0
        private void labelMenuItem_Click(object sender, EventArgs e)
        {
            var item   = sender   as ToolStripMenuItem;
            var mlbl   = item.Tag as ModuleLabel;
            var module = GetSelectedModule();

            if (item.Checked)
            {
                mlbl.Add(module.Identifier);
            }
            else
            {
                mlbl.Remove(module.Identifier);
            }
            mainModList.ReapplyLabels(module, Conflicts?.ContainsKey(module) ?? false, CurrentInstance.Name);
            mainModList.ModuleLabels.Save(ModuleLabelList.DefaultPath);
        }
Example #27
0
        public async Task <WorkerCalendarDto> GetWorkerCalendar(int workerId, DateTimeRange period)
        {
            var leave = await context.Leave
                        .AsNoTracking()
                        .Where(l => l.WorkerId == workerId)
                        .Where(l => l.LeavePeriod.Start < period.End && period.Start < l.LeavePeriod.End)
                        .Select(l => new Appointment(l))
                        .ToListAsync();

            var training = await context.WorkerTraining
                           .AsNoTracking()
                           .Include(wt => wt.Training)
                           .Where(wt => wt.WorkerId == workerId)
                           .Where(wt => wt.Training.TrainingPeriod.Start < period.End && period.Start < wt.Training.TrainingPeriod.End)
                           .Select(wt => new Appointment(wt.Training))
                           .ToListAsync();

            var jobTasks = await context.WorkerShifts
                           .AsNoTracking()
                           .Include(ws => ws.JobTask)
                           .Where(ws => ws.WorkerId == workerId)
                           .Where(ws => ws.JobTask.TaskPeriod.Start < period.End && period.Start < ws.JobTask.TaskPeriod.End)
                           .Select(ws => new Appointment(ws.JobTask))
                           .ToListAsync();

            var worker = await context.Workers
                         .AsNoTracking()
                         .SingleOrDefaultAsync(w => w.Id == workerId);

            var appointments = new List <Appointment>();

            appointments.AddRange(leave);
            appointments.AddRange(jobTasks);
            appointments.AddRange(training);
            Conflicts.GetConflicts(appointments);

            return(new WorkerCalendarDto
            {
                Id = worker.Id,
                Name = worker.Name,
                IsActive = worker.IsActive,
                Appointments = appointments
            });
        }
Example #28
0
 public virtual DynamicJsonValue ToJson()
 {
     return(new DynamicJsonValue(GetType())
     {
         [nameof(DatabaseRecord)] = DatabaseRecord.ToJson(),
         [nameof(Documents)] = Documents.ToJson(),
         [nameof(RevisionDocuments)] = RevisionDocuments.ToJson(),
         [nameof(Tombstones)] = Tombstones.ToJson(),
         [nameof(Conflicts)] = Conflicts.ToJson(),
         [nameof(Identities)] = Identities.ToJson(),
         [nameof(Indexes)] = Indexes.ToJson(),
         [nameof(CompareExchange)] = CompareExchange.ToJson(),
         [nameof(Subscriptions)] = Subscriptions.ToJson(),
         [nameof(Counters)] = Counters.ToJson(),
         [nameof(CompareExchangeTombstones)] = CompareExchangeTombstones.ToJson(),
         [nameof(TimeSeries)] = TimeSeries.ToJson(),
         [nameof(ReplicationHubCertificates)] = ReplicationHubCertificates.ToJson(),
     });
 }
Example #29
0
        public async Task <ResourceCalendarDto> GetResourceCalendar(int resourceId, DateTimeRange period)
        {
            var outOfServices = await context.ResourceOutOfService
                                .AsNoTracking()
                                .Where(o => o.ResourceId == resourceId)
                                .Where(o => o.Period.Start < period.End && period.Start < o.Period.End)
                                .Select(o => new Appointment(o))
                                .ToListAsync();

            var jobTasks = await context.ResourceShifts
                           .AsNoTracking()
                           .Include(rs => rs.JobTask)
                           .Where(rs => rs.ResourceId == resourceId)
                           .Where(rs => rs.JobTask.TaskPeriod.Start < period.End && period.Start < rs.JobTask.TaskPeriod.End)
                           .Select(rs => new Appointment(rs.JobTask))
                           .ToListAsync();

            var appointments = new List <Appointment>();

            appointments.AddRange(outOfServices);
            appointments.AddRange(jobTasks);
            Conflicts.GetConflicts(appointments);

            var resource = await context.Resources
                           .AsNoTracking()
                           .SingleOrDefaultAsync(r => r.Id == resourceId);

            return(new ResourceCalendarDto
            {
                Id = resource.Id,
                Name = resource.Name,
                IsActive = resource.IsActive,
                Description = resource.Description,
                Appointments = appointments
            });
        }
Example #30
0
 /// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 public void Dispose()
 {
     if (disposed)
     {
         return;
     }
     disposed = true;
     AllConflicts?.Dispose();
     Conflicts?.Dispose();
     IgnoredConflicts?.Dispose();
     OrphanConflicts?.Dispose();
     ResolvedConflicts?.Dispose();
     RuleIgnoredConflicts?.Dispose();
     OverwrittenConflicts?.Dispose();
     CustomConflicts?.Dispose();
     AllConflicts         = null;
     Conflicts            = null;
     IgnoredConflicts     = null;
     ResolvedConflicts    = null;
     OrphanConflicts      = null;
     RuleIgnoredConflicts = null;
     OverwrittenConflicts = null;
     CustomConflicts      = null;
 }
 public ReindexOnServerDescriptor Conflicts(Conflicts conflicts) => Assign(a => a.Conflicts = conflicts);