Exemplo n.º 1
0
        public static HuntInstance CreateDummyHuntInstance()
        {
            var theObjective = new Objective()
                {
                    Id = new Guid("{81573EBA-C5AA-4423-B308-BCB3026AE771}"),
                    Name = "Find a fountain!",
                    Description = "It must be green.",
                    Score = 100
                };

            var theAdmin = new Account()
                {
                    Id = new Guid("{714DC8D9-42EA-43F2-8148-DDFAC1E585C5}"),
                    Name = "SuperTom"
                };

            var britAccount = new Account()
                {
                    Id = new Guid("{614DC8D9-42EA-43F2-8148-DDFAC1E585C6}"),
                    Name = "Brit"
                };

            var theHunt = new Hunt()
                {
                    Id = new Guid("{741BB781-531D-4354-A840-777E267A809E}"),
                    Name = "DummyHunt",
                    Description = "A dummy hunt!",
                    Creator = theAdmin,

                };

            var theInstance = new HuntInstance()
                {
                    Id = new Guid("{E41BB781-531D-4354-A840-777E267A809E}"),
                    Admin = theAdmin,
                    StartTime = new DateTime(2012, 12, 1, 12, 0, 0, 0),
                    EndTime = new DateTime(2012, 12, 2, 12, 0, 0, 0),
                    Hunt = theHunt
                };

            var britHunter = new Hunter()
                {
                    Id = new Guid("{F41BB781-531D-4354-A840-777E267A809E}"),
                    Account = britAccount,
                    HuntInstance = theInstance
                };

            theInstance.Hunters.Add(britHunter);
            theHunt.Objectives.Add(theObjective);
            theObjective.Hunt = theHunt;

            return theInstance;
        }
Exemplo n.º 2
0
        public void FoundObjective(Hunter hunter, Objective objective, string locationAndImage)
        {
            if (hunter.HuntInstance.EndTime < DateTime.Now)
                throw new HuntEndedException();

            var foundObjective = new FoundObjective()
                {
                    Objective = objective,
                    TimeFound = DateTime.Now
                    // todo: location and image
                };

            hunter.FoundObjectives.Add(foundObjective);

            _container.SaveChanges();
            _notifier.NotifyObjectiveFound(foundObjective);
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Objectives EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToObjectives(Objective objective)
 {
     base.AddObject("Objectives", objective);
 }
 /// <summary>
 /// Create a new Objective object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 /// <param name="score">Initial value of the Score property.</param>
 /// <param name="huntId">Initial value of the HuntId property.</param>
 public static Objective CreateObjective(global::System.Guid id, global::System.String name, global::System.String description, global::System.Int16 score, global::System.Guid huntId)
 {
     Objective objective = new Objective();
     objective.Id = id;
     objective.Name = name;
     objective.Description = description;
     objective.Score = score;
     objective.HuntId = huntId;
     return objective;
 }