Ejemplo n.º 1
0
        public ActionResult SaveGoalMetric(FormCollection collection)
        {
            var existingRecord = Boolean.Parse(collection["goal-metric-existing-record"].ToString());
            var id             = Guid.Parse(collection["goal-metric-id"].ToString());
            var goalId         = collection["goal-metric-goalid"].ToString();
            var planId         = collection["goal-metric-planid"].ToString();
            var industry       = collection["goal-metric-industry"].ToString();
            var value          = collection["goal-metric-value"].ToString();
            var valueAsOf      = collection["goal-metric-value-as-of"].ToString();

            PlanPerformance.Business.Entities.GoalMetric goalMetric;
            if (existingRecord == false)
            {
                goalMetric = new PlanPerformance.Business.Entities.GoalMetric();
            }
            else
            {
                goalMetric = new PlanPerformance.Business.Entities.GoalMetric(id);
            }

            goalMetric.GoalId    = Guid.Parse(goalId);
            goalMetric.PlanId    = Guid.Parse(planId);
            goalMetric.Industry  = industry;
            goalMetric.Value     = Decimal.Parse(value);
            goalMetric.ValueAsOf = DateTime.Parse(valueAsOf);

            var userDih = DataIntegrationHub.Business.Entities.User.AllUsers().Find(x => x.EmailAddress.ToUpper() == User.Identity.Name.ToUpper());

            goalMetric.SaveRecordToDatabase(userDih.UserId);

            return(View());
        }
        public static List <GoalMetric> Get()
        {
            var result    = new List <GoalMetric>();
            var dataTable = Access.DbAccess.ExecuteSqlQuery("SELECT " + _tableName + "Id FROM " + _tableName);

            foreach (DataRow row in dataTable.Rows)
            {
                var id   = Guid.Parse(row[_tableName + "Id"].ToString());
                var goal = new GoalMetric(id);
                result.Add(goal);
            }

            return(result);
        }
Ejemplo n.º 3
0
        public GoalMetric GetGoalMetric()
        {
            var goal        = new Goal(this.GoalId);
            var goalMetrics = GoalMetric.Get().FindAll(x => x.GoalId == goal.Id && x.ValueAsOf <= this.ValueAsOf);

            if (goal.Team == "RetireAdvisers")
            {
                //return goalMetrics.Find(x => x.Industry == this.GetPlan().Industry);
                return(goalMetrics.Find(x => x.PlanId == this.PlanId));
            }
            else if (goal.Team == "Vendor Services")
            {
                return(goalMetrics.Find(x => x.PlanId == this.PlanId));
            }
            else
            {
                return(goalMetrics.FirstOrDefault());
            }
        }
Ejemplo n.º 4
0
        public ActionResult DeleteGoalMetric(FormCollection collection)
        {
            var id         = collection["goal-metric-id"].ToString();
            var goalMetric = new PlanPerformance.Business.Entities.GoalMetric();

            if (String.IsNullOrWhiteSpace(id))
            {
                return(View());
            }
            else
            {
                goalMetric = new PlanPerformance.Business.Entities.GoalMetric(Guid.Parse(id));

                var userDih = DataIntegrationHub.Business.Entities.User.AllUsers().Find(x => x.EmailAddress.ToUpper() == User.Identity.Name.ToUpper());
                goalMetric.DeleteRecordFromDatabase(userDih.UserId);
            }

            return(View());
        }
Ejemplo n.º 5
0
        public ActionResult GoalMetric()
        {
            var id         = Request.QueryString["id"];
            var goalId     = Request.QueryString["goalId"];
            var goalMetric = new PlanPerformance.Business.Entities.GoalMetric();

            if (!String.IsNullOrWhiteSpace(goalId))
            {
                goalMetric.GoalId = Guid.Parse(goalId);
            }

            if (String.IsNullOrWhiteSpace(id))
            {
                ViewBag.Title        = "New Plan Metric";
                goalMetric.ValueAsOf = DateTime.Now;
            }
            else
            {
                goalMetric = new PlanPerformance.Business.Entities.GoalMetric(Guid.Parse(id));
                //ViewBag.Title = planMetric.Name;
            }

            return(View(goalMetric));
        }