Beispiel #1
0
        public void AddEvent(EventViewModel e)
        {
            e.Category = ListOfCategories.Find(x => x.ID == e.CategoryID);

            ListOfEvents.Add(e);
            ListOfEvents = ListOfEvents.OrderBy(x => x.StartYear).ToList();
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,DictTypeOfKMMId,DistLocId,EventTopic,StartDateTime,EndDateTime,DictInitiatorOfProjId,CreateDate,ApplicationUserId")] ListOfEvents listOfEvents)
        {
            if (id != listOfEvents.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    string uid = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
                    listOfEvents.ApplicationUserId = uid;
                    _context.Update(listOfEvents);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ListOfEventsExists(listOfEvents.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DictInitiatorOfProjId"] = new SelectList(_context.DictInitiatorOfProj, "Id", "Name", listOfEvents.DictInitiatorOfProjId);
            ViewData["DictTypeOfKMMId"]       = new SelectList(_context.DictTypeOfKMM, "Id", "Name", listOfEvents.DictTypeOfKMMId);
            ViewData["DistLocId"]             = new SelectList(_context.DictLoc, "Id", "Name", listOfEvents.DistLocId);
            return(View(listOfEvents));
        }
        protected override IEnumerable <IEvent> Accept(IEvent @event)
        {
            log.DebugFormat("Incrementing counter ({2}) because {0} satisfied {1}", @event.GetType(), filter.GetType(),
                            counter.GetType());
            counter.Increment(@event);

            return(ListOfEvents.Create(new NumberOfSpecificEventEvent(counter.Count, @event)));
        }
Beispiel #4
0
        protected override IEnumerable <IEvent> Accept(IEvent @event)
        {
            log.DebugFormat("Notifier ({2}) invoked because {0} satisfied {1}", @event.GetType(), filter.GetType(),
                            notifier.GetType());
            notifier.Raise(@event);

            return(ListOfEvents.Create(new NotificationRaisedEvent(@event)));
        }
        protected override IEnumerable <IEvent> Accept(IEvent @event)
        {
            log.DebugFormat("Publishing {0} to {1} publiser", @event.GetType(), publisher.GetType());

            publisher.Publish(@event);

            return(ListOfEvents.EmptyList());
        }
        protected override IEnumerable <IEvent> Accept(IEvent @event)
        {
            log.DebugFormat("Trigger ({2}) invoked because {0} satisfied {1}", @event.GetType(), filter.GetType(),
                            trigger.GetType());
            trigger.Trigger(@event);

            return(ListOfEvents.Create(new ActionTriggeredEvent(@event)));
        }
Beispiel #7
0
 private void ShowMyEventsButton_Click(object sender, EventArgs e)
 {
     new Thread(() =>
                eventBindingSource.DataSource = r_FBLogic.m_LoggedInUser.Events).Start();
     ListOfEvents.Invoke(new Action(() =>
     {
         ListOfEvents.DisplayMember = "Name";
         ListOfEvents.DataSource    = eventBindingSource;
     }));
 }
        // GET: CulturalEvents/ListOfEvents/Create
        public IActionResult Create()
        {
            ViewData["DictInitiatorOfProjId"] = new SelectList(_context.DictInitiatorOfProj, "Id", "Name");
            ViewData["DictTypeOfKMMId"]       = new SelectList(_context.DictTypeOfKMM, "Id", "Name");
            ViewData["DistLocId"]             = new SelectList(_context.DictLoc, "Id", "Name");
            string       uid   = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
            ListOfEvents model = new ListOfEvents();

            model.CreateDate        = DateTime.Now;
            model.ApplicationUserId = uid;

            return(View(model));
        }
Beispiel #9
0
        public IEnumerable <IEvent> Flow(IEvent @event)
        {
            log.InfoFormat("Received {0} in pipelet {1}", @event.GetType(), this.GetType());

            if (!WantsEvent(@event))
            {
                log.InfoFormat("Ignoring event {0} because filter is not satisfied", @event.GetType());

                return(ListOfEvents.EmptyList());
            }

            return(Accept(@event));
        }
        public async Task <IActionResult> Create([Bind("Id,DictTypeOfKMMId,DistLocId,EventTopic,StartDateTime,EndDateTime,DictInitiatorOfProjId,CreateDate,ApplicationUserId")] ListOfEvents listOfEvents)
        {
            if (ModelState.IsValid)
            {
                _context.Add(listOfEvents);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DictInitiatorOfProjId"] = new SelectList(_context.DictInitiatorOfProj, "Id", "Name", listOfEvents.DictInitiatorOfProjId);
            ViewData["DictTypeOfKMMId"]       = new SelectList(_context.DictTypeOfKMM, "Id", "Name", listOfEvents.DictTypeOfKMMId);
            ViewData["DistLocId"]             = new SelectList(_context.DictLoc, "Id", "Name", listOfEvents.DistLocId);
            return(View(listOfEvents));
        }
Beispiel #11
0
        /// <summary>
        /// Set up fighters for fight.
        /// </summary>
        /// <param name="isBlocking">if set to <c>true</c> [is blocking].</param>
        /// <param name="isCrouched">if set to <c>true</c> [is crouched].</param>
        /// <param name="torn_size"></param>
        /// <param name="pop_size"></param>
        public void SetUp(bool isBlocking, bool isCrouched, int torn_size, int pop_size) 
        {
            //reset the counters
            treeCounter = 0;
            fighterCounter = 0;
            roundNum = 0;

            ListEventsAlgorithm.Clear();
            ListOfEvents.Clear();

            listOfEvents.Add(":: SET-UP FIGHTERS ::");

            roundNum++;

            listOfEvents.Add("Round NO: " + roundNum);

            //CREATE new NON_AI_FIGHTER
            NoAiFighter = new NonAIFighter(roundNum, isBlocking, isCrouched);

            //set relevent values for NON_AI_FIGHTER
            //NoAiFighter.Blocking = isBlocking;
            //NoAiFighter.Crouching = isCrouched;
            //add new fighter o event list
            listOfEvents.Add(NoAiFighter.ToString());

            //CREATE new AI_FIGHTER
            AiFighter = new AIFighter(roundNum);

             //create a new connection to Genetic programming class
            gp = new GeneticProgramming(this, AiFighter, NoAiFighter,torn_size,pop_size);

            gp.Crouched = Crouched;
            gp.Close = Close;
            gp.Medium = Medium;
            gp.Far = Far;

            //set up the Genetic programming class
            gp.setup();

            //set tree to first in generation list
            treeCounter = 0;
            AiFighter.Tree = gp.Generation[treeCounter];

            //add AI fighter to list
            listOfEvents.Add(AiFighter.ToString());
        }
Beispiel #12
0
 protected override IEnumerable <IEvent> Accept(IEvent @event)
 {
     log.DebugFormat("Incrementing counter ({1}) for {0}", @event.GetType(), counter.GetType());
     counter.Increment(@event);
     return(ListOfEvents.Create(new NumberOfEventsEvent(counter.Count)));
 }
Beispiel #13
0
        static void testClone(SBase s)
        {
            string ename = s.getElementName();
            SBase  c     = s.clone();

            if (c is Compartment)
            {
                Compartment x = (s as Compartment).clone(); c = x;
            }
            else if (c is CompartmentType)
            {
                CompartmentType x = (s as CompartmentType).clone(); c = x;
            }
            else if (c is Constraint)
            {
                Constraint x = (s as Constraint).clone(); c = x;
            }
            else if (c is Delay)
            {
                Delay x = (s as Delay).clone(); c = x;
            }
            else if (c is Event)
            {
                Event x = (s as Event).clone(); c = x;
            }
            else if (c is EventAssignment)
            {
                EventAssignment x = (s as EventAssignment).clone(); c = x;
            }
            else if (c is FunctionDefinition)
            {
                FunctionDefinition x = (s as FunctionDefinition).clone(); c = x;
            }
            else if (c is InitialAssignment)
            {
                InitialAssignment x = (s as InitialAssignment).clone(); c = x;
            }
            else if (c is KineticLaw)
            {
                KineticLaw x = (s as KineticLaw).clone(); c = x;
            }
            // currently return type of ListOf::clone() is SBase
            else if (c is ListOf)
            {
                SBase x = (s as ListOf).clone(); c = x;
            }
            else if (c is Model)
            {
                Model x = (s as Model).clone(); c = x;
            }
            else if (c is Parameter)
            {
                Parameter x = (s as Parameter).clone(); c = x;
            }
            else if (c is Reaction)
            {
                Reaction x = (s as Reaction).clone(); c = x;
            }
            else if (c is AlgebraicRule)
            {
                AlgebraicRule x = (s as AlgebraicRule).clone(); c = x;
            }
            else if (c is AssignmentRule)
            {
                AssignmentRule x = (s as AssignmentRule).clone(); c = x;
            }
            else if (c is RateRule)
            {
                RateRule x = (s as RateRule).clone(); c = x;
            }
            else if (c is SBMLDocument)
            {
                SBMLDocument x = (s as SBMLDocument).clone(); c = x;
            }
            else if (c is Species)
            {
                Species x = (s as Species).clone(); c = x;
            }
            else if (c is SpeciesReference)
            {
                SpeciesReference x = (s as SpeciesReference).clone(); c = x;
            }
            else if (c is SpeciesType)
            {
                SpeciesType x = (s as SpeciesType).clone(); c = x;
            }
            else if (c is SpeciesReference)
            {
                SpeciesReference x = (s as SpeciesReference).clone(); c = x;
            }
            else if (c is StoichiometryMath)
            {
                StoichiometryMath x = (s as StoichiometryMath).clone(); c = x;
            }
            else if (c is Trigger)
            {
                Trigger x = (s as Trigger).clone(); c = x;
            }
            else if (c is Unit)
            {
                Unit x = (s as Unit).clone(); c = x;
            }
            else if (c is UnitDefinition)
            {
                UnitDefinition x = (s as UnitDefinition).clone(); c = x;
            }
            else if (c is ListOfCompartmentTypes)
            {
                ListOfCompartmentTypes x = (s as ListOfCompartmentTypes).clone(); c = x;
            }
            else if (c is ListOfCompartments)
            {
                ListOfCompartments x = (s as ListOfCompartments).clone(); c = x;
            }
            else if (c is ListOfConstraints)
            {
                ListOfConstraints x = (s as ListOfConstraints).clone(); c = x;
            }
            else if (c is ListOfEventAssignments)
            {
                ListOfEventAssignments x = (s as ListOfEventAssignments).clone(); c = x;
            }
            else if (c is ListOfEvents)
            {
                ListOfEvents x = (s as ListOfEvents).clone(); c = x;
            }
            else if (c is ListOfFunctionDefinitions)
            {
                ListOfFunctionDefinitions x = (s as ListOfFunctionDefinitions).clone(); c = x;
            }
            else if (c is ListOfInitialAssignments)
            {
                ListOfInitialAssignments x = (s as ListOfInitialAssignments).clone(); c = x;
            }
            else if (c is ListOfParameters)
            {
                ListOfParameters x = (s as ListOfParameters).clone(); c = x;
            }
            else if (c is ListOfReactions)
            {
                ListOfReactions x = (s as ListOfReactions).clone(); c = x;
            }
            else if (c is ListOfRules)
            {
                ListOfRules x = (s as ListOfRules).clone(); c = x;
            }
            else if (c is ListOfSpecies)
            {
                ListOfSpecies x = (s as ListOfSpecies).clone(); c = x;
            }
            else if (c is ListOfSpeciesReferences)
            {
                ListOfSpeciesReferences x = (s as ListOfSpeciesReferences).clone(); c = x;
            }
            else if (c is ListOfSpeciesTypes)
            {
                ListOfSpeciesTypes x = (s as ListOfSpeciesTypes).clone(); c = x;
            }
            else if (c is ListOfUnitDefinitions)
            {
                ListOfUnitDefinitions x = (s as ListOfUnitDefinitions).clone(); c = x;
            }
            else if (c is ListOfUnits)
            {
                ListOfUnits x = (s as ListOfUnits).clone(); c = x;
            }
            else
            {
                ERR("[testClone] Error: (" + ename + ") : clone() failed.");
                return;
            }

            if (c == null)
            {
                ERR("[testClone] Error: (" + ename + ") : clone() failed.");
                return;
            }

            string enameClone = c.getElementName();

            if (ename == enameClone)
            {
                //Console.Out.WriteLine("[testClone] OK: (" + ename + ") clone(" + enameClone + ") : type match.");
                OK();
            }
            else
            {
                ERR("[testClone] Error: (" + ename + ") clone(" + enameClone + ") : type mismatch.");
            }
        }
 public IEnumerable <IEvent> MakeDecision(IEvent @event)
 {
     return(ListOfEvents.EmptyList());
 }