Exemplo n.º 1
0
        public async Task <ActionResult> GroupStadistics(Guid?GroupId)
        {
            if (GroupId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Group group = await Db.Groups.Where(x => x.Id == GroupId).FirstOrDefaultAsync();

            if (group == null)
            {
                return(HttpNotFound());
            }
            ViewBag.GroupName = group.Name;
            ViewBag.SectionId = group.SectionId;
            Section      section    = group.Section;
            StadisticsBL stadistics = new StadisticsBL();
            ResultBL     results    = new ResultBL();

            ViewBag.PeriodNumber = section.CaseStudy.Periods;
            StadisticsViewModel stadisticsViewModel = new StadisticsViewModel();

            stadisticsViewModel.TotalCost         = stadistics.GetTotalCost(group);
            stadisticsViewModel.DemandCost        = stadistics.GetDemandCost(group);
            stadisticsViewModel.OrderCost         = stadistics.GetOrderCost(group);
            stadisticsViewModel.StockCost         = stadistics.GetStockCost(group);
            stadisticsViewModel.AverageTotalCost  = stadistics.GetAverageTotalCost(section);
            stadisticsViewModel.AverageDemandCost = stadistics.GetAverageDemandCost(section);
            stadisticsViewModel.AverageOrderCost  = stadistics.GetAverageOrderCost(section);
            stadisticsViewModel.AverageStockCost  = stadistics.GetAverageStockCost(section);
            stadisticsViewModel.Groups            = results.GetRanking(section);
            return(View(stadisticsViewModel));
        }
Exemplo n.º 2
0
        public void GetRanking()
        {
            Section  section  = Db.Sections.Where(x => x.Number == "1001").FirstOrDefault();
            ResultBL resultBL = new ResultBL();
            List <GroupRankingViewModel> groups = resultBL.GetRanking(section);

            foreach (var group in groups)
            {
                Console.WriteLine("==========================================");
                Console.WriteLine("Nombre Grupo: " + group.GroupName);
                Console.WriteLine("Puntaje Total: " + group.Score);
            }
        }
Exemplo n.º 3
0
        public ActionResult StudentStadistics()
        {
            Section section = CurrentUser.Section;

            if (section.CaseStudy == null)
            {
                Flash.Error("Error", "No existe un modelo de gestión asignado para esta sección");
                return(RedirectToAction("Index", "Home"));
            }
            Group group = CurrentUser.Group;

            if (group == null)
            {
                Flash.Error("Error", "No pertenece a ningún grupo para poder visualizar estadisticas");
                return(RedirectToAction("Index", "Home"));
            }
            if (group.IsInSimulation == false)
            {
                Flash.Error("Error", "No participa en el modelo de gestión para poder visualizar estadisticas");
                return(RedirectToAction("Index", "Home"));
            }
            if (section.Periods.Count() == 0)
            {
                Flash.Warning("Adventencia", "No hay datos para mostrar");
            }
            StadisticsBL stadistics = new StadisticsBL();
            ResultBL     results    = new ResultBL();

            ViewBag.PeriodNumber = section.CaseStudy.Periods;
            StadisticsViewModel stadisticsViewModel = new StadisticsViewModel();

            stadisticsViewModel.TotalCost         = stadistics.GetTotalCost(group);
            stadisticsViewModel.DemandCost        = stadistics.GetDemandCost(group);
            stadisticsViewModel.OrderCost         = stadistics.GetOrderCost(group);
            stadisticsViewModel.StockCost         = stadistics.GetStockCost(group);
            stadisticsViewModel.AverageTotalCost  = stadistics.GetAverageTotalCost(section);
            stadisticsViewModel.AverageDemandCost = stadistics.GetAverageDemandCost(section);
            stadisticsViewModel.AverageOrderCost  = stadistics.GetAverageOrderCost(section);
            stadisticsViewModel.AverageStockCost  = stadistics.GetAverageStockCost(section);
            stadisticsViewModel.Groups            = results.GetRanking(section);
            return(View(stadisticsViewModel));
        }