public ViewResult StatProduct() { var vm = new List <StatViewModel>(); var types = producttypeRepository.All; var orders = orderpaidRepository.AllIncluding(p => p.Menus).ToList(); foreach (var type in types) { StatViewModel stat = new StatViewModel(); double benefice = 0; foreach (var order in orders) { foreach (var menu in order.Menus) { if (menu.ProductTypeId == type.Id) { benefice += menu.Prix; } } } stat.Benefice = benefice; stat.Title = type.Description; vm.Add(stat); } return(View(vm)); }
public ViewResult StatResto() { var vm = new List <StatViewModel>(); var restaurants = restaurantRepository.All; foreach (var resto in restaurants) { StatViewModel stat = new StatViewModel(); var ordersResto = orderpaidRepository.AllIncluding(p => p.Menus).Where(p => p.RestaurantId == resto.Id); double benefice = 0; foreach (var order in ordersResto) { foreach (var menu in order.Menus) { benefice += menu.Prix; } } stat.Benefice = benefice; stat.Title = resto.Name; vm.Add(stat); } return(View(vm)); }
public IActionResult DownloadResume(int Id, StatViewModel stat) { if (((Setting)ViewBag.Setting).ResumeDownloadSecurity == ResumeDownloadSecurity.NamePhoneEmailRequired) { Resume resume = _context.Resumes.FirstOrDefault(r => r.Id == Id); HttpContext.Session.SetString("Fullname", stat.Fullname); HttpContext.Session.SetString("Email", stat.Email); HttpContext.Session.SetString("Phone", stat.Phone); HttpContext.Session.SetString("CompanyName", stat.CompanyName); var s = new Stat(); s.Fullname = stat.Fullname; s.Email = stat.Email; s.Phone = stat.Phone; s.CompanyName = stat.CompanyName; s.ResumeId = Id; s.DownloadDate = DateTime.Now; s.ResumeFullName = resume.FirstName + " " + resume.LastName; s.Ip = Request.HttpContext.Connection.RemoteIpAddress.ToString(); _context.Add(s); _context.SaveChanges(); string filename = resume.ResumeFile; string filepath = env.WebRootPath + "\\uploads\\resumes\\" + filename; byte[] filedata = System.IO.File.ReadAllBytes(filepath); Response.Headers.Add("Content-Disposition", $"inline; filename={filename}"); return(File(filedata, "application/octet-stream")); } return(NotFound()); }
public ActionResult About(string project) { StatViewModel SVM = new StatViewModel(); if (String.IsNullOrEmpty(project)) { if (context.Projects.Count() > 0) { SVM.selectProject = context.Projects.OrderBy(p => p.title).FirstOrDefault(); SVM.projects = context.Projects.OrderBy(p => p.title).ToList(); } else { return(RedirectToAction("Index", "Home")); } } else { SVM.selectProject = context.Projects.Where(p => p.title == project).FirstOrDefault(); SVM.projects = context.Projects.OrderBy(p => p.title).ToList(); } SVM.countOfTests = context.Scenarios.Where(s => s.Projectid == SVM.selectProject.id).Count(); SVM.countWithSuccessCompleet = context.Scenarios.Where(s => s.Projectid == SVM.selectProject.id && s.typeOfError == "Не летально").Count(); SVM.countWithUnSuccessCompleet = context.Scenarios.Where(s => s.Projectid == SVM.selectProject.id && s.typeOfError != "Не летально").Count(); SVM.countOfFixedErreros = context.Scenarios.Where(s => s.Projectid == SVM.selectProject.id && s.isFixed == true).Count(); SVM.countOfWaitingToFix = context.Scenarios.Where(s => s.Projectid == SVM.selectProject.id && s.isFixed == false).Count(); return(View(SVM)); }
public Activity_statistics() { this.InitializeComponent(); statVM = new StatViewModel(); //on dit que le datacontext de la vue est le viewModel //S'abonner à l'évenement de ViewModel statVM.ValiderRecherche += StatViewModel_AffichageHistorique; }
public CharacterTabViewModel(Character character, SaveParty party) { Character = character; DetailsVm = new CharacterDetailsViewModel(Character, party); StatVm = new StatViewModel(Character); SaintVm = new SaintViewModel(StaticDataService.Saints, Character.SaintBitmask); FormulaeVm = new FormulaeViewModel(StaticDataService.Formulae, Character.FormulaeBitmask); EquipmentListVm = new EquipmentListViewModel(Character, StaticDataService.ItemDefinitions); }
public ActionResult GameLog(RenderModel model, int id) { var GameLog = db.GetStatGameLogByGameId(id); StatViewModel statViewModel = new StatViewModel(model.Content) { Game = db.GetGameById(id), GameLogPeriod = GameLog.Count == 0 ? null : statsBll.GameLogIntoGameLogPeriod(GameLog) }; return(CurrentTemplate(statViewModel)); }
public ActionResult Totals(RenderModel model, int id) { StatViewModel statViewModel = new StatViewModel(model.Content) { Game = db.GetGameById(id), RosterStats = statsBll.ProcessTotalStats(id), GameTotalsScore = statsBll.ProcessGameTotalsScore(id) }; statViewModel.StatTypes = statViewModel.RosterStats.Count == 0 ? null : db.GetAllStatTypes(); return(CurrentTemplate(statViewModel)); }
/// <summary> /// Obtiene toda la información relacionada con las estadísticas globales de los casos de COVID-19 /// </summary> /// <returns>La vista con las estadísticas globales de los casos de COVID-19</returns> public async Task <ActionResult <StatViewModel> > GetStats() { if (!_cache.Get(getStatsCacheKey, out StatViewModel statsVM)) { var stats = await GetRequestData <Stat>(AppSettingsConfig.STATS_KEY); statsVM = new StatViewModel() { Stat = stats }; _cache.Set(getStatsCacheKey, statsVM); } return(View("Index", statsVM)); }
public ActionResult Statistics() { StatViewModel Stv = new StatViewModel { pending = 0, recived = 0 }; foreach (var cm in getOrdersViewModel()) { if (cm.Cmd.status == 0) { Stv.pending++; } else { Stv.recived++; } } return(View(Stv)); }
public ActionResult Stats(RenderModel model) { StatViewModel statViewModel = new StatViewModel(model.Content); return(base.Index(statViewModel)); }
public StatPage() { DataContext = new StatViewModel(); InitializeComponent(); }
public ActionResult Index() { _context = new ApplicationDbContext(); if (HttpContext.User.Identity.IsAuthenticated) { string id = User.Identity.GetUserId(); ApplicationUser employee = _context.Users.SingleOrDefault(emp => emp.Id == id); if (employee == null) { return(RedirectToAction("Login", "Account")); } Session["DisplayName"] = employee.DisplayName; //get user image string storageAccountName = "aspnetpersoncontrol"; string keyOne = "GfiRnxHVXsaluga4L4R0zZOy4Ken4VnF3xM7I66OC263LJ9Sf2BOQgX41+/WpBlA8vMB5aP4wN/Uh00OF4MdXw=="; string nameOfStorage = "storage"; StorageCredentials storageCredentials = new StorageCredentials(storageAccountName, keyOne); CloudStorageAccount cloudStorageAccount = new CloudStorageAccount(storageCredentials, true); CloudBlobClient cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient(); //get users folder CloudBlobContainer cloudBlobContainer = cloudBlobClient.GetContainerReference(nameOfStorage); //get users folder string userFolder = ((ApplicationUser)_context.Users.SingleOrDefault(u => u.Id == id)).Email; CloudBlobDirectory cloudBlobDirectory = cloudBlobContainer.GetDirectoryReference(userFolder); //add file to sub dir CloudBlockBlob cloudBlockBlob = cloudBlobDirectory.GetBlockBlobReference("AccountImage.jpg"); try { cloudBlockBlob.FetchAttributes(); long fileByteLength = cloudBlockBlob.Properties.Length; employee.img = new byte[fileByteLength]; for (int i = 0; i < fileByteLength; i++) { employee.img[i] = 0x20; } cloudBlockBlob.DownloadToByteArray(employee.img, 0); } catch { employee.img = new byte[8]; } Session["Image"] = Convert.ToBase64String(employee.img); } //employee.DisplayName = profileVM.DisplayName; client = new FireSharp.FirebaseClient(config); if (client != null) { // TempData["msg"] = "<script>alert('Connect to DB_FB succesfully');</script>"; } /// to Admin List <TasksForUser> tasklist = (from gr in _context.TasksForUser.ToList() where gr.fromUserId == User.Identity.GetUserId() select gr).ToList(); List <TasksForGroups> tasklistGroups = (from gr in _context.TasksForGroups.ToList() where gr.fromUserId == User.Identity.GetUserId() select gr).ToList(); List <TasksForProjects> tasklistProjects = (from gr in _context.TasksForProjects.ToList() where gr.fromUserId == User.Identity.GetUserId() select gr).ToList(); var CountgetTaksAdmin = tasklist.Count() + tasklistGroups.Count() + tasklistProjects.Count(); //to Employees List <TasksForUser> tasklistEmp = (from gr in _context.TasksForUser.ToList() where gr.toUserId == User.Identity.GetUserId() select gr).ToList(); var CountgetTaskEml = tasklistEmp.Count(); // List <Projects> projectComplete = (from gr in _context.Projects.ToList() where gr.isComplite == true select gr).ToList(); int price = 0; foreach (Projects pj in projectComplete) { if (pj.PriceInDollars != 0 && pj.isComplite == true) { price += pj.PriceInDollars; } } var viewModel = new StatViewModel { Employees = _context.Users.Select(c => c).ToList(), countGetTaskAdmin = CountgetTaksAdmin, projectsList = projectComplete, countGetTaskEmpl = CountgetTaskEml, priceCompliteTotal = price }; return(View(viewModel)); }