Beispiel #1
0
        private List <ACharts> getCharts(DateTime startDate, DateTime endDate)
        {
            var dianeId   = userCtx.GetUserIdWhithName("Diane");
            var clementId = userCtx.GetUserIdWhithName("Clem");

            var objByTypeDiane = objCtx.GetObjectifs()
                                 .GroupBy(a => a.ObjTypeId)
                                 .ToDictionary(a => objCtx.GetObjectifTypeById(a.Key).Name, z => z.
                                               Where(a => a.UserId.Equals(dianeId) && a.Date >= startDate && a.Date <= endDate).OrderBy(a => a.Date).ToList());
            var objByTypeClement = objCtx.GetObjectifs()
                                   .GroupBy(a => a.ObjTypeId).ToDictionary(a => objCtx.GetObjectifTypeById(a.Key).Name, z => z.
                                                                           Where(a => a.UserId.Equals(clementId) && a.Date >= startDate && a.Date <= endDate).OrderBy(a => a.Date).ToList());

            var allDate = objCtx.GetObjectifs().Select(a => a.Date).OrderBy(a => a.Date)
                          .Where(a => a >= startDate && a <= endDate)
                          .Select(a => a.ToString()).ToList();
            var Area = new Spline("area", objByTypeDiane, allDate);
            var Pie  = new Pie("Pie", objByTypeDiane);
            var aa   = new Spline("aa", objByTypeClement, allDate);
            var ee   = new Pie("ee", objByTypeClement);

            List <ACharts> higCharts = new List <ACharts> {
                Area, Pie, aa, ee
            };

            if (User.IsSignedIn())
            {
                foreach (var chart in higCharts)
                {
                    chart.ComputeChart();
                }
            }
            return(higCharts);
        }
Beispiel #2
0
        public ActionResult EditingInline_Read([DataSourceRequest] DataSourceRequest request)
        {
            var userId = userCtx.GetUserIdWhithName(User.Identity.Name);
            var result = depenseCtx.GetDepenses(userId);

            return(Json(result?.ToDataSourceResult(request)));
        }
        public ActionResult AddTask(ObjectifViewModel objVm)
        {
            string type = objVm.Type;

            if (ModelState.IsValid)
            {
                ObjectifType objectifType = objCtx.GetObjectifTypeByName(type);
                objectifType.Items = new List <Item>();

                if (!objVm.Items.Contains(objVm.Tache))
                {
                    objectifType.Items.Add(new Item {
                        Name = objVm.Tache
                    });
                }

                var objectif = new Objectif
                {
                    Date        = objVm.Date,
                    NbPoint     = objVm.NbPoint,
                    ObjTypeId   = objectifType.Id,
                    Commentaire = objVm.Commentaire,
                    UserId      = userCtx.GetUserIdWhithName(User.Identity.Name),
                    Tache       = objVm.Tache
                };

                objCtx.AddObjectif(objectif);
                objVm.Objectifs   = objCtx.GetObjectifsByType(type);
                objVm.Commentaire = string.Empty;
                objVm.Date        = DateTime.Now;
                objVm.NbPoint     = 0;
            }
            else
            {
                objVm.Date    = DateTime.Now;
                objVm.isValid = false;
            }
            initViewModel(objVm, type);
            return(View("Objectif", objVm));
        }