Esempio n. 1
0
        public void AddObjective(Objective objective)
        {
            Objective = objective;

            if (objective.BalanceEntries == null)
            {
                objective.BalanceEntries = new List<BalanceEntry>();
                objective.BalanceEntries.Add(this);
            }
        }
        public void InsertObjective(Objective objective)
        {
            context.Objectives.Add(objective);

            if (objective.BoostedObjective != null)
            {
                if (objective.BoostedObjective.BoostedObjectiveID == 0)
                {
                    InsertBoostedObjective(objective.BoostedObjective);
                }
            }
        }
Esempio n. 3
0
        public void EditObjective(Objective objective, int productId)
        {
            Objective updatedObjective = objectiveRepository.GetObjectiveByID(objective.ObjectiveID);

            updatedObjective.Category = objective.Category;
            updatedObjective.Description = objective.Description;
            updatedObjective.IsActive = objective.IsActive;
            updatedObjective.ObjectiveName = objective.ObjectiveName;
            updatedObjective.RequiresAdmin = objective.RequiresAdmin;
            updatedObjective.Reward = objective.Reward;
            updatedObjective.Title = objective.Title;

            if (productId != 0 && updatedObjective.Product != null && updatedObjective.Product.ProductID != productId)
            {
                updatedObjective.Product = listingRepository.GetProductByID(productId);
            }

            objectiveRepository.UpdateObjective(updatedObjective);
            unitOfWork.Save();
        }
Esempio n. 4
0
 public void AddObjective(Objective objective)
 {
     objectiveRepository.InsertObjective(objective);
     unitOfWork.Save();
 }
        public void UpdateObjective(Objective objective)
        {
            Objective targetObjective = context.Objectives.Find(objective.ObjectiveID);

            if (targetObjective != null)
            {
                targetObjective.Description = objective.Description;
                targetObjective.Category = objective.Category;
                targetObjective.RequiresAdmin = objective.RequiresAdmin;
                targetObjective.Reward = objective.Reward;
                targetObjective.IsActive = objective.IsActive;
                targetObjective.Title = objective.Title;
                targetObjective.ObjectiveName = objective.ObjectiveName;
            }

            if (objective.BoostedObjective != null)
            {
                if (objective.BoostedObjective.BoostedObjectiveID == 0)
                {
                    InsertBoostedObjective(objective.BoostedObjective);
                }
            }
        }
Esempio n. 6
0
        public void CreateBalanceEntry(string notes, int pointsAdjusted, DateTime date, Objective objective)
        {
            if (pointsAdjusted == 0)
            {
                return;
            }

            BalanceEntry entry = new BalanceEntry(this, notes, pointsAdjusted, date);

            entry.Objective = objective;

            if (objective.BalanceEntries == null)
            {
                objective.BalanceEntries = new HashSet <BalanceEntry>();
            }

            objective.BalanceEntries.Add(entry);

            if (BalanceEntries == null)
            {
                BalanceEntries = new HashSet <BalanceEntry>();
            }

            BalanceEntries.Add(entry);

            Balance = Balance + pointsAdjusted;
        }