/// <summary>
 ///     Initializes a new instance of the <see cref="DirectorEventAttribute" /> class.
 ///     Defines what type of event this will be recognized as in the director when it tells the factory to create a list of
 ///     all known events it can call and sort by.
 /// </summary>
 /// <param name="eventCategory">The event Category.</param>
 /// <param name="eventExecutionType">The event Execution Type.</param>
 public DirectorEventAttribute(
     EventCategory eventCategory,
     EventExecution eventExecutionType = EventExecution.RandomOrManual)
 {
     EventCategory      = eventCategory;
     EventExecutionType = eventExecutionType;
 }
Пример #2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DirectorEventAttribute" /> class.
 ///     Defines what type of event this will be recognized as in the director when it tells the factory to create a list of
 ///     all known events it can call and sort by.
 /// </summary>
 /// <param name="eventCategory">The event Category.</param>
 /// <param name="eventExecutionType">The event Execution Type.</param>
 public DirectorEventAttribute(
     EventCategory eventCategory,
     EventExecution eventExecutionType = EventExecution.RandomOrManual)
 {
     EventCategory = eventCategory;
     EventExecutionType = eventExecutionType;
 }
Пример #3
0
        public void PartiallyValidTopOrdering()
        {
            var executionHistory = new EventExecution[] {
                new EventExecution(exA.Event, exA.Tag.Uid),
                new EventExecution(exB.Event, exB.Tag.Uid),
            };

            for (int i = 0; i < PartiallyValid.GlobalHistory.Length; i++)
            {
                Assert.AreEqual(PartiallyValid.GlobalHistory[i], executionHistory[i]);
            }
        }
Пример #4
0
        public void SingleEventMultipleExecutionsTopOrdering()
        {
            var executionHistory = new EventExecution[] {
                new EventExecution(exA.Event, exA.Tag.Uid),
                new EventExecution(exA.Event, exA1.Tag.Uid),
                new EventExecution(exA.Event, exA2.Tag.Uid),
            };

            for (int i = 0; i < SingleEventMultipleExecutions.GlobalHistory.Length; i++)
            {
                Assert.AreEqual(SingleEventMultipleExecutions.GlobalHistory[i], executionHistory[i]);
            }
        }
Пример #5
0
        public ActionResult GetExecution(int address, Jsdate[] data)
        {
            var result =
                new EventExecution()
            {
                Address = new NHRepository <Address>().Get(address),
                Dates   = Parse(data).ToList()
            };


            EventExecution.Add(result);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Пример #6
0
        public ActionResult Add(Event @event, IEnumerable <int> volunteers, IEnumerable <int> organizers, IEnumerable <int> lecturers, IEnumerable <int> departments)
        {
            using (var repository = new NHGetAllRepository <Volunteer>())
            {
                var list = repository.GetAll().ToList();
                ViewData["Volunteers"] = new SelectList(list, "Id", "Name");
            }
            using (var repository = new NHGetAllRepository <Employee>())
            {
                var list = repository.GetAll().ToList();
                ViewData["Employees"] = new SelectList(list, "Id", "ContactInfo.FullName");
            }
            using (var repository = new NHGetAllRepository <Department>())
            {
                var list = repository.GetAll().ToList();
                ViewData["Departments"] = new SelectList(list, "Id", "Name");
            }

            if (@event.Name.IsNullOrEmpty() || @event.Info.IsNullOrEmpty())
            {
                EventExecution.Clear();
                return(View());
            }


            @event.Volunteers = Parse <Volunteer>(volunteers).ToList();
            @event.Volunteers = Parse <Volunteer>(organizers).ToList();
            @event.Volunteers = Parse <Volunteer>(lecturers).ToList();
            @event.Volunteers = Parse <Volunteer>(departments).ToList();



            if (EventExecution != null)
            {
                @event.EventExecutions = ParseEventExecutions(EventExecution).ToList();
            }

            using (var repository = new NHRepository <Event>())
            {
                repository.Add(@event);
            }

            EventExecution.Clear();

            return(RedirectToAction("Index"));
        }
Пример #7
0
        public void BranchingTopOrderingTest()
        {
            var executionHistory1 = new EventExecution[]
            {
                eea, eeb, eec, eed, eee
            };

            var executionHistory2 = new EventExecution[]
            {
                eea, eeb, eed, eec, eee
            };

            Assert.AreEqual(Branching.GlobalHistory.Distinct().Count(), executionHistory1.Length);

            for (int i = 0; i < Branching.GlobalHistory.Length; i++)
            {
                Assert.That(Branching.GlobalHistory[i].Equals(executionHistory1[i]) ||
                            Branching.GlobalHistory[i].Equals(executionHistory2[i]));
            }
        }
Пример #8
0
 /// <summary>Initializes a new instance of the <see cref="T:OregonTrailDotNet.Module.Director.EventKey" /> class.</summary>
 /// <param name="category">The category.</param>
 /// <param name="name">The name.</param>
 /// <param name="executionType">The execution Type.</param>
 public EventKey(EventCategory category, string name, EventExecution executionType)
 {
     ExecutionType = executionType;
     Category      = category;
     Name          = name;
 }