Пример #1
0
        public ActionResult SavePlanMetric(FormCollection collection)
        {
            var existingRecord = Boolean.Parse(collection["plan-metric-existing-record"].ToString());
            var id             = Guid.Parse(collection["plan-metric-id"].ToString());
            var goalId         = collection["plan-metric-goalid"].ToString();
            var planId         = collection["plan-metric-planid"].ToString();
            var value          = collection["plan-metric-value"].ToString();
            var valueAsOf      = collection["plan-metric-value-as-of"].ToString();
            var isBaseline     = collection["plan-metric-is-baseline"].ToString().Replace(",false", "");

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

            planMetric.GoalId     = Guid.Parse(goalId);
            planMetric.PlanId     = Guid.Parse(planId);
            planMetric.Value      = Decimal.Parse(value);
            planMetric.ValueAsOf  = DateTime.Parse(valueAsOf);
            planMetric.IsBaseline = bool.Parse(isBaseline);

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

            planMetric.SaveRecordToDatabase(userDih.UserId);

            return(View());
        }
Пример #2
0
        public static List <PlanMetric> Get()
        {
            var result    = new List <PlanMetric>();
            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 PlanMetric(id);
                result.Add(goal);
            }

            return(result);
        }
Пример #3
0
        public ActionResult DeletePlanMetric(FormCollection collection)
        {
            var id         = collection["plan-metric-id"].ToString();
            var planMetric = new PlanPerformance.Business.Entities.PlanMetric();

            if (String.IsNullOrWhiteSpace(id))
            {
                return(View());
            }
            else
            {
                planMetric = new PlanPerformance.Business.Entities.PlanMetric(Guid.Parse(id));
                var userDih = DataIntegrationHub.Business.Entities.User.AllUsers().Find(x => x.EmailAddress.ToUpper() == User.Identity.Name.ToUpper());
                planMetric.DeleteRecordFromDatabase(userDih.UserId);
            }

            return(View());
        }
Пример #4
0
        public ActionResult PlanMetric()
        {
            var id         = Request.QueryString["id"];
            var planId     = Request.QueryString["planId"];
            var planMetric = new PlanPerformance.Business.Entities.PlanMetric();

            if (!String.IsNullOrWhiteSpace(planId))
            {
                planMetric.PlanId = Guid.Parse(planId);
            }

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

            return(View(planMetric));
        }