Пример #1
0
        public void DenyObjective(Account admin, FoundObjective foundObjective)
        {
            if (foundObjective.Hunter.HuntInstance.EndTime < DateTime.Now)
                throw new HuntEndedException();

            if (foundObjective.Hunter.HuntInstance.Admin != admin)
                throw new SecurityException();

            foundObjective.Hunter.FoundObjectives.Remove(foundObjective);
            _container.SaveChanges();
            _notifier.NotifyObjectiveDenied(foundObjective);
        }
Пример #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>
 /// Create a new FoundObjective object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="hunterId">Initial value of the HunterId property.</param>
 /// <param name="timeFound">Initial value of the TimeFound property.</param>
 /// <param name="approved">Initial value of the Approved property.</param>
 /// <param name="imageUrl">Initial value of the ImageUrl property.</param>
 public static FoundObjective CreateFoundObjective(global::System.Guid id, global::System.Guid hunterId, global::System.DateTime timeFound, global::System.Boolean approved, global::System.String imageUrl)
 {
     FoundObjective foundObjective = new FoundObjective();
     foundObjective.Id = id;
     foundObjective.HunterId = hunterId;
     foundObjective.TimeFound = timeFound;
     foundObjective.Approved = approved;
     foundObjective.ImageUrl = imageUrl;
     return foundObjective;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the FoundObjectives EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToFoundObjectives(FoundObjective foundObjective)
 {
     base.AddObject("FoundObjectives", foundObjective);
 }
Пример #5
0
 public void NotifyObjectiveFound(FoundObjective objective)
 {
     var request =
         new ObjectPusherRequest(
             objective.Hunter.HuntInstance.Id.ToString("D") + "_" +
             objective.Hunter.HuntInstance.Admin.Id.ToString("D"),
             EventTypes.ObjectiveFound.ToString(),
             new
                 {
                     hunter = new
                         {
                             id = objective.Hunter.Id.ToString("D"),
                             name = objective.Hunter.Account.Name,
                             profileImageUrl = objective.Hunter.Account.ProfileImageUrl
                         },
                     objective = new
                         {
                             id = objective.Objective.Id.ToString("D"),
                             name = objective.Objective.Name,
                             imgUrl = objective.ImageUrl
                         }
                 });
     _provider.Trigger(request);
 }
Пример #6
0
 public void NotifyObjectiveDenied(FoundObjective objective)
 {
     // TODO: use pusher to notify
     // TODO: objective.Hunter
 }
Пример #7
0
 public void NotifyObjectiveApproved(FoundObjective objective)
 {
     // TODO: use pusher to notify
     // TODO: objective.Hunter.HuntInstance.Hunters
 }