Пример #1
0
 internal Occurence(Place linkedLocation, PastEvent linkedEvent, OccurenceType type, Guid referenceId, GameTime.GameTime started, GameTime.GameTime ended = null) : base(type, referenceId)
 {
     LinkedLocation = linkedLocation;
     LinkedEvent    = linkedEvent;
     Started        = started;
     Ended          = ended;
     ItemType       = MemoryItemType.Occurence;
 }
Пример #2
0
        public override void ChangeType(Enum newType)
        {
            var type = (OccurenceType)newType;

            Type               = type;
            Description        = OccurenceDescription.ResourceManager.GetString(type.ToString());
            ReverseDescription = OccurenceReverseDescription.ResourceManager.GetString(type.ToString());
        }
Пример #3
0
        /// <inheritdoc />
        public override MemoryItem GetInaccurateCopy()
        {
            GameTime.GameTime started = Started;
            GameTime.GameTime ended   = Ended;
            OccurenceType     type    = Type;

            //TODO : Randomize name

            int falsificationCase = RandomValueGenerator.GenerateIntWithMaxValue(4);

            switch (falsificationCase)
            {
            case 1:
                int variance = RandomValueGenerator.GenerateRealWithinValues(-10, 10);
                started?.SetYear(started.GetYear() + variance);
                break;

            case 2:
                int deathVariance = RandomValueGenerator.GenerateRealWithinValues(-10, 10);
                ended?.SetYear(ended.GetYear() + deathVariance);
                break;

            case 3:
                type = (OccurenceType)RandomValueGenerator.GenerateIntWithMaxValue(Enum.GetNames(typeof(OccurenceType)).Length);
                break;

            case 4:
                type     = (OccurenceType)RandomValueGenerator.GenerateIntWithMaxValue(Enum.GetNames(typeof(OccurenceType)).Length);
                variance = RandomValueGenerator.GenerateRealWithinValues(-10, 10);
                started?.SetYear(started.GetYear() + variance);
                break;
            }

            var copy = new Occurence(LinkedLocation, LinkedEvent, type, ReferenceId)
            {
                ItemType           = ItemType,
                Description        = Description,
                ReverseDescription = ReverseDescription,
                Started            = started,
                Ended = ended,
                Name  = Name
            };

            return(copy);
        }
Пример #4
0
 public PastEvent FindLinkedEventByType(OccurenceType type)
 {
     return(_linkedEvents?.FirstOrDefault(e => e.Type == type)?.LinkedEvent);
 }
 public ReflectedMemberOccurence(IReference reference, IDeclaredElement target, OccurenceType occurenceType, IProjectFile projectFile = null)
     : base(reference, target, occurenceType, projectFile)
 {
     Kinds.Clear();
     Kinds.Add(ReflectedMemberOccurenceKindProvider.ReflectionOccurenceKind);
 }
Пример #6
0
        public JobTriggerContent ScheduleMonthlyJob(long jobId, DateTime startDateTime, DateTime endDateTime, List <Months> selectedMonths, OccurenceType monthlyOccurence, WeekDays weekday, int?everyHours = null, int?everyMinute = null)
        {
            if (jobId < 1 || selectedMonths.Count < 1)
            {
                return(_result.ErrorToObject(new JobTriggerContent(), "Invalid parameter(s)!"));
            }

            var requestArg = JsonConvert.SerializeObject(
                new { TriggerType = 4, JobDetailID = jobId, MonthlyType = 2, MonthlyOccurance = (short)monthlyOccurence, SelectedMonths = string.Join(",", selectedMonths), StartDateTime = startDateTime, EndDateTime = endDateTime, EveryHours = everyHours, EveryMinute = everyMinute, Weekday = weekday.ToString() });

            requestArg = JsonConvert.SerializeObject(new { Data = requestArg });
            Task <Result> x = RequestHandler.SendRequestAsync(
                string.Empty,
                "api/UserSchedule/ScheduleJob",
                HttpMethod.Post,
                RouteStyle.Rpc,
                requestArg);

            x.Wait();
            return(x.Result.JsonToObject(new JobTriggerContent(), "TriggerContent"));
        }
Пример #7
0
        /// <summary>
        /// Creates a link between an Event and a Place
        /// </summary>
        /// <param name="linkedEvent">Event linked</param>
        /// <param name="linkedPlace">Linked Place</param>
        /// <param name="type">Nature of the link between Place and Event</param>
        /// <param name="started">Date Started</param>
        /// <param name="ended">Date Ended</param>
        /// <returns>The new link</returns>
        public Occurence CreateOccurenceBetweenEventAndPlace(PastEvent linkedEvent, Place linkedPlace, OccurenceType type, GameTime.GameTime started, GameTime.GameTime ended = null)
        {
            var occurence = new Occurence(linkedPlace, linkedEvent, type, Guid.NewGuid(), started, ended);

            linkedPlace.AddLinkedEvent(occurence);
            linkedEvent.AddLinkedPlace(occurence);

            return(occurence);
        }
Пример #8
0
        /// <summary>
        /// Creates a link between an Event and a Place
        /// </summary>
        /// <param name="linkedEvent">Event linked</param>
        /// <param name="linkedPlace">Linked Place</param>
        /// <param name="type">Nature of the link between Place and Event</param>
        /// <returns>The new link</returns>
        public Occurence CreateOccurenceBetweenEventAndPlace(PastEvent linkedEvent, Place linkedPlace, OccurenceType type)
        {
            var occurence = new Occurence(linkedPlace, linkedEvent, type, Guid.NewGuid());

            linkedPlace.AddLinkedEvent(occurence);
            linkedEvent.AddLinkedPlace(occurence);

            return(occurence);
        }
Пример #9
0
 public Place FindLinkedPlaceByOccurenceType(OccurenceType occurenceType)
 {
     return(_linkedPlaces.FirstOrDefault(o => o.Type == occurenceType)?.LinkedLocation);
 }
Пример #10
0
 internal Occurence(Place linkedLocation, PastEvent linkedEvent, OccurenceType type, Guid referenceId) : base(type, referenceId)
 {
     LinkedLocation = linkedLocation;
     LinkedEvent    = linkedEvent;
     ItemType       = MemoryItemType.Occurence;
 }