public ActionResult CreateRanking() { //Deze wordt ook voor Donut gebruikt RankViewModel rankModel = TempData["rankModel"] as RankViewModel; string naam = rankModel.Naam; int aantal = rankModel.Aantal; int interval = rankModel.interval; //Zie dat je bent ingelogd //TODO: redirect naar inlog pagina <-- ApplicationUser currUser = _userManager.FindById(System.Web.HttpContext.Current.User.Identity.GetUserId()); string userName = currUser.UserName; Gebruiker user = _gebrManager.FindUser(userName); // =============== Opslaan grafiek : opgesplitst om te debuggen =================== // List <GraphData> graphDataList = _dataManager.GetRanking(aantal, interval, false); DashItem newDashItem = _dashManager.CreateDashitem(true, "Rank", naam); List <int> arrayPersoonId = _dataManager.ExtractListPersoonId(graphDataList); List <Follow> follows = _dashManager.CreateFollow(newDashItem.DashItemId, arrayPersoonId); DashItem dashItem = _dashManager.SetupDashItem(user, follows); _dashManager.LinkGraphsToUser(graphDataList, dashItem.DashItemId); // ================================================================================ // _dashManager.SyncWithAdmins(user.GebruikerId, dashItem.DashItemId); Dashbord dash = _dashManager.GetDashboardWithFollows(user); return(View()); }
public async Task <IActionResult> Put(int id, int value) { var existingRank = await _context.Rankings.SingleOrDefaultAsync(r => r.Id == id); if (existingRank == null) { return(BadRequest()); } existingRank.Value = value; _context.Update(existingRank); await _context.SaveChangesAsync(); var rankCount = 0; var rankAverage = 0.0; var ranks = await _context.Rankings.Where(r => r.SubmissionId == existingRank.SubmissionId).ToListAsync(); if (ranks != null) { rankCount = ranks.Count; rankAverage = ranks.Select(r => r.Value).Average(); } var rankVm = new RankViewModel { SubmissionId = existingRank.SubmissionId, User = existingRank.RankedBy, Value = existingRank.Value, Average = rankAverage, RankCount = rankCount, UserRankId = existingRank.Id }; return(Ok(rankVm)); }
public ViewResult UsersRank(string sortBy, string orderBy) { var model = new RankViewModel() { SortBy = sortBy ?? "AllExperience", OrderBy = orderBy ?? (sortBy == "UserName" ? "ASC" : "DESC") }; List <string> sort = new List <string> { "UserName", "Level", "AllExperience", "Strength", "Dexterity", "Stamina", "Intelligence" }; List <string> order = new List <string> { "ASC", "DESC" }; if (!sort.Any(x => x.Contains(model.SortBy))) { model.SortBy = "AllExperience"; } if (!order.Any(x => x.Contains(model.OrderBy))) { model.OrderBy = model.SortBy == "UserName" ? "ASC" : "DESC"; } model.Users = _userManager.Users.OrderBy($"{model.SortBy} {model.OrderBy}"); return(View(model)); }
public ActionResult CreateRank(RankViewModel model) { if (ModelState.IsValid) { if (!model.IsRoleRank && _rankRepository.First(x => x.PostCount == model.PostCount) != null) { ModelState.AddModelError("PostCount", "A rank with " + model.PostCount + " post count already exists"); } } if (IsModelValidAndPersistErrors()) { Rank rank = new Rank() { Color = model.Color, Image = model.Image, IsRoleRank = model.IsRoleRank, PostCount = model.PostCount, Title = model.Title }; _rankRepository.Add(rank); SetSuccess("Rank created"); return(RedirectToAction("Ranks")); } return(RedirectToSelf()); }
public ActionResult EditRank(RankViewModel model) { if (ModelState.IsValid) { Rank rankExists = _rankRepository.First(item => item.RankID != model.RankID && item.PostCount.Equals(model.PostCount)); if (rankExists != null && !model.IsRoleRank) { ModelState.AddModelError("PostCount", "A rank with " + model.PostCount + " post count already exists"); } } if (IsModelValidAndPersistErrors()) { Rank rank = _rankRepository.Get(model.RankID); rank.RankID = model.RankID; rank.Color = model.Color; rank.Image = model.Image; rank.IsRoleRank = model.IsRoleRank; rank.PostCount = model.PostCount; rank.Title = model.Title; _rankRepository.Update(rank); SetSuccess("Rank updated"); return(RedirectToAction("Ranks")); } return(RedirectToSelf(new { RankID = model.RankID })); }
public Acticity_ranking() { this.InitializeComponent(); rankVM = new RankViewModel(); //on dit que le datacontext de la vue est le viewModel ClassementPanel.DataContext = rankVM; //S'abonner à l'évenement de ViewModel rankVM.ValiderRecherche += RankingViewModel_AffichageClassement; }
public IActionResult Dashboard(Contractor contractor) { LicenseViewModel licenseViewModel = new LicenseViewModel(); RankViewModel rankViewModel = new RankViewModel(); List <RecordsViewModel> records = new List <RecordsViewModel>(); string contractor_name = contractor.contractors_business_name.ToString(); foreach (var doc in _contractor.getLicenseByName(contractor_name)) { licenseViewModel.address = doc.address; licenseViewModel.city = doc.city; licenseViewModel.state = doc.state; licenseViewModel.license_number = doc.license_number; licenseViewModel.license_type = doc.license_type; licenseViewModel.license_expire_date = doc.license_expire_date; } foreach (var doc in _contractor.getRankByName(contractor_name)) { rankViewModel.rating = doc.rating.ToString(); rankViewModel.total_ratings = doc.total_ratings; rankViewModel.website = doc.website; } foreach (var doc in _projects.Get(contractor_name)) { records.Add(new RecordsViewModel() { permitnum = doc.permitnum, permit_type = doc.permit_type, permit_subtype = doc.permit_subtype, category = doc.category, address_full = doc.address_full, issue_date = doc.issue_date, status = doc.status, status_date = doc.status_date, valuation = doc.valuation, longitude = doc.longitude, latitude = doc.latitude }); } ContractorDashboardViewModel contractorDashboardViewModel = new ContractorDashboardViewModel() { PageTitle = contractor_name, License = licenseViewModel, Rank = rankViewModel, Records = records }; ViewData["Data"] = contractorDashboardViewModel; ViewData["Contractor Name"] = contractorDashboardViewModel.PageTitle.ToString(); ModelState.Clear(); return(View()); }
public ActionResult Add(RankViewModel model, FormCollection formInfo) { if (ModelState.IsValid) { model.ParentRankId = int.Parse(formInfo["rank"]); rank.Add(model); TempData["result"] = rank.Result; return(RedirectToAction("List")); } return(Add()); }
private void RegisterShowRankingsPageMessage(RankViewModel rankViewModel) { _messenger.Register <ShowRankingsPageMessage>(this, x => { IPage page = _vs.ExecuteFunction <RankViewModel, IPage>((IWindow)Current.MainWindow, rankViewModel); _viewModel.CurrentPage = page; }); _messenger.Send(new RefreshDataFromRepositoriesMessage()); }
public async Task <ActionResult <string> > PostRank(RankViewModel rank) { Rank newRank = new Rank() { Name = rank.Name }; _context.Ranks.Add(newRank); await _context.SaveChangesAsync(); return($"Rank {newRank.Name} has been created!"); }
public ActionResult CreateRankingInput(string naam, int aantal, int interval) { RankViewModel rankModel = new RankViewModel() { Naam = naam, Aantal = aantal, interval = interval }; TempData["rankModel"] = rankModel; return(RedirectToAction("CreateRanking")); }
public ActionResult Create(RankViewModel vm) { if (this.orgTasks.GetRank(vm.RankName) != null) { ModelState.AddModelError("RankName", "Rank name already exists."); } if (ModelState.IsValid) { Rank rank = new Rank(); rank = Mapper.Map(vm, rank); rank = this.orgTasks.SaveRank(rank); return(RedirectToAction("Details", "Ranks", new { id = rank.Id })); } return(Create()); }
public ActionResult EditRank(int RankID) { Rank rank = _rankRepository.Get(RankID); RankViewModel model = new RankViewModel() { RankID = rank.RankID, Color = rank.Color, Image = rank.Image, IsRoleRank = rank.IsRoleRank, PostCount = rank.PostCount, Title = rank.Title }; return(View(model)); }
public JsonNetResult EditModal(RankViewModel vm) { Rank rank = this.orgTasks.GetRank(vm.Id); Rank newRank = this.orgTasks.GetRank(vm.RankName); if (rank != null && newRank != null && newRank.Id != rank.Id) { ModelState.AddModelError("RankName", "Rank name already exists."); } if (ModelState.IsValid) { rank = Mapper.Map(vm, rank); return(JsonNet(string.Empty)); } return(JsonNet(this.GetErrorsForJson())); }
public ActionResult Edit(RankViewModel vm) { Rank rank = this.orgTasks.GetRank(vm.Id); Rank newRank = this.orgTasks.GetRank(vm.RankName); if (rank != null && newRank != null && newRank.Id != rank.Id) { ModelState.AddModelError("RankName", "Rank name already exists."); } if (ModelState.IsValid) { rank = Mapper.Map(vm, rank); return(RedirectToAction("Details", new { id = vm.Id })); } return(Edit(vm.Id)); }
public ActionResult Rank() { var model = new RankViewModel(); model.Ranks = Exigo.GetRanks().OrderBy(c => c.RankID); var currentperiod = Exigo.GetCurrentPeriod(PeriodTypes.Default); model.CurrentRank = Exigo.GetCustomerVolumes(new GetCustomerVolumesRequest { CustomerID = Identity.Current.CustomerID, PeriodTypeID = currentperiod.PeriodTypeID, PeriodID = currentperiod.PeriodID }).PayableAsRank; return(View(model)); }
public JsonNetResult CreateModal(RankViewModel vm) { if (this.orgTasks.GetRank(vm.RankName) != null) { ModelState.AddModelError("RankName", "Rank name already exists."); } if (ModelState.IsValid) { Rank rank = new Rank(); rank = Mapper.Map(vm, rank); rank = this.orgTasks.SaveRank(rank); return(JsonNet(new { Id = rank.Id, Name = rank.RankName, WasSuccessful = true })); } return(JsonNet(this.GetErrorsForJson())); }
public ActionResult Rank() { var model = new RankViewModel(); //Pull in all the ranks model.Ranks = RankService.GetRanks().OrderBy(c => c.RankID); var currentperiod = ExigoDAL.GetCurrentPeriod(PeriodTypes.Default); //Get the current rank from the current paid as rank from the current commission period model.CurrentRank = ExigoDAL.GetCustomerVolumes(new GetCustomerVolumesRequest { CustomerID = Identity.Current.CustomerID, PeriodTypeID = currentperiod.PeriodTypeID, PeriodID = currentperiod.PeriodID }).PayableAsRank; //Get the next rank so we can jump to the next qualification model.NextRank = model.Ranks.OrderBy(c => c.RankID).Where(c => c.RankID > model.CurrentRank.RankID).FirstOrDefault(); return(View(model)); }
public async Task <IActionResult> CreatePost([Bind("Title,Description,CoverImage")] RankViewModel rankViewModel) { if (ModelState.IsValid == false) { return(RedirectToAction(actionName: nameof(Create))); } var uploadedPhoto = await _photoUploader.Upload(rankViewModel.CoverImage, new RankPhotoUploadPath()); var rank = new Rank { Title = rankViewModel.Title, Description = rankViewModel.Description, CoverImgPath = uploadedPhoto != null ? uploadedPhoto.PhotoOriginalPath : string.Empty }; await _context.Ranks.AddAsync(rank); await _context.SaveChangesAsync(); return(View()); }
public async Task <IActionResult> Post(Rank newRank) { if (newRank.SubmissionId == 0 && newRank.Value == 0) { return(BadRequest()); } var createRank = new Rank { Value = newRank.Value, RankedBy = User.Identity.Name, SubmissionId = newRank.SubmissionId }; _context.Add(createRank); await _context.SaveChangesAsync(); var rankCount = 0; var rankAverage = 0.0; var ranks = await _context.Rankings.Where(r => r.SubmissionId == newRank.SubmissionId).ToListAsync(); if (ranks != null) { rankCount = ranks.Count; rankAverage = ranks.Select(r => r.Value).Average(); } var rankVm = new RankViewModel { SubmissionId = createRank.SubmissionId, User = createRank.RankedBy, Value = createRank.Value, Average = rankAverage, RankCount = rankCount, UserRankId = createRank.Id }; return(Ok(rankVm)); }
public async Task <ViewResult> Area(string sortBy, string orderBy) { var user = await _userManager.GetUserAsync(User); var model = new RankViewModel() { SortBy = sortBy ?? "AllExperience", OrderBy = orderBy ?? (sortBy == "UserName" ? "ASC" : "DESC") }; List <string> sort = new List <string> { "UserName", "Level", "AllExperience", "Strength", "Dexterity", "Stamina", "Intelligence" }; List <string> order = new List <string> { "ASC", "DESC" }; if (!sort.Any(x => x.Contains(model.SortBy))) { model.SortBy = "AllExperience"; } if (!order.Any(x => x.Contains(model.OrderBy))) { model.OrderBy = model.SortBy == "UserName" ? "ASC" : "DESC"; } model.Users = _userManager.Users.OrderBy($"{model.SortBy} {model.OrderBy}") .Where(x => x.PositionX == user.PositionX) .Where(x => x.PositionY == user.PositionY); return(View(model)); }
public RankPage() { this.InitializeComponent(); this.videoMediaPlayer.AutoPlay = SettingsStore.GetValueOrDefault <bool>(AppCommonConst.IS_AUTOPLAY_TOGGLLESWITCH_ON, true); if (rankViewModel == null) { if (!SimpleIoc.Default.IsRegistered <RankViewModel>()) { SimpleIoc.Default.Register <RankViewModel>(); } rankViewModel = SimpleIoc.Default.GetInstance <RankViewModel>(); } this.DataContext = rankViewModel; this.navigationHelper = new NavigationHelper(this); this.videoMediaPlayer.ControlPanelTemplate = AppEnvironment.IsPhone ? Application.Current.Resources["ControlPanelControlTemplatePhone"] as ControlTemplate : Application.Current.Resources["ControlPanelControlTemplatePC"] as ControlTemplate; this.szListView.ItemContainerStyle = AppEnvironment.IsPhone ? Application.Current.Resources["PhoneListViewItemStyle"] as Style : Application.Current.Resources["PCPastCategoryListViewItemStyle"] as Style; this.szListView.Padding = AppEnvironment.IsPhone ? new Thickness(0, 0, 0, 0) : new Thickness(0, 0, 0, 3); this.Loaded += (ss, ee) => { if (AppEnvironment.IsPhone) { videoMediaPlayer.IsFullScreenVisible = false; this.videoMediaPlayer.DoubleTapped += videoMediaPlayer_DoubleTapped; TopTapGuestureBox.Instance.ShowTopTapGuestureUIControl(); } else { videoMediaPlayer.IsFullScreenVisible = true; this.KeyUp += RankPage_KeyUp; //szPCDailyFlipView.SelectionChanged += szPCDailyFlipView_SelectionChanged; } szListPC.IsZoomedInViewActive = true; szListPC.ViewChangeStarted -= szListPC_ViewChangeStarted; szListPC.ViewChangeCompleted -= szListPC_ViewChangeCompleted; szListPC.ViewChangeStarted += szListPC_ViewChangeStarted; szListPC.ViewChangeCompleted += szListPC_ViewChangeCompleted; if (rankViewModel != null && rankViewModel.RankPerformanceCollection.Count == 0) { rankViewModel.GetRank(rankViewModel.RankPerformanceCollection, rankViewModel.WeekCollection, ApiRankRoot.Instance.RankUrl, AppCacheNewsFileNameConst.CACHE_RANK_WEEK_FILENAME); } }; this.Unloaded += (ss, ee) => { //这里是用来即可激发ZoomSemanticButtonMessenger,使zoomSemanticButton马上隐藏 if (!AppEnvironment.IsPhone) { Messenger.Default.Send <bool>(false, AppMessengerTokenConst.IS_ZOOMSEMANTIC_BUTTON_VISIBLE); } if (AppEnvironment.IsPhone) { videoMediaPlayer.IsFullScreenVisible = false; this.videoMediaPlayer.DoubleTapped -= videoMediaPlayer_DoubleTapped; //TopTapGuestureBox.Instance.HideTopTapGuestureUIControl(); } else { videoMediaPlayer.IsFullScreenVisible = true; this.KeyUp -= RankPage_KeyUp; //szPCDailyFlipView.SelectionChanged -= szPCDailyFlipView_SelectionChanged; //szPCDailyFlipView.SelectedIndex = -1; } szListPC.IsZoomedInViewActive = true; }; }
public void ConfigureContainer() { ShootingRangeEntities entities = new ShootingRangeEntities(); _messenger = new Messenger(); ContainerBuilder builder = new ContainerBuilder(); builder.RegisterInstance(_messenger).As <IMessenger>(); IShooterNumberService shooterNumberService = new ShooterNumberService(new ShooterNumberConfigDataStore(entities)); IPersonDataStore personDataStore = new PersonDataStore(entities); IShooterCollectionDataStore shooterCollectionDataStore = new ShooterCollectionDataStore(entities); ICollectionShooterDataStore collectionShooterDataStore = new CollectionShooterDataStore(entities); IShooterDataStore shooterDataStore = new ShooterDataStore(entities); IShooterParticipationDataStore shooterParticipationDataStore = new ShooterParticipationDataStore(entities); ISessionDataStore sessionDataStore = new SessionDataStore(entities); ISessionSubtotalDataStore sessionSubtotalDataStore = new SessionSubtotalDataStore(entities); IShotDataStore shotDataStore = new ShotDataStore(entities); IBarcodePrintService barcodePrinter = new PtouchBarcodePrinter(); IBarcodeBuilderService barcodeBuilder = new Barcode2Of5InterleavedService(); ISsvShooterDataWriterService shooterDataWriter = new SsvFileWriter(@"C:\Sius\SiusData\SSVDaten\SSV_schuetzen.txt"); builder.RegisterInstance(shooterNumberService).As <IShooterNumberService>(); builder.RegisterInstance(personDataStore).As <IPersonDataStore>(); builder.RegisterInstance(shooterDataStore).As <IShooterDataStore>(); builder.RegisterInstance(new ShooterParticipationDataStore(entities)).As <IShooterParticipationDataStore>(); builder.RegisterInstance(shooterCollectionDataStore).As <IShooterCollectionDataStore>(); builder.RegisterInstance(collectionShooterDataStore).As <ICollectionShooterDataStore>(); builder.RegisterInstance(sessionDataStore).As <ISessionDataStore>(); builder.RegisterInstance(sessionSubtotalDataStore).As <ISessionSubtotalDataStore>(); builder.RegisterInstance(shotDataStore).As <IShotDataStore>(); builder.RegisterInstance(barcodePrinter).As <IBarcodePrintService>(); builder.RegisterInstance(barcodeBuilder).As <IBarcodeBuilderService>(); builder.RegisterInstance(shooterDataWriter).As <ISsvShooterDataWriterService>(); _vs = new ViewService(); ViewServiceHandler vsh = new ViewServiceHandler(); #region Windows and Dialogs _vs.RegisterFunction <MainWindowViewModel, IWindow>( (window, model) => vsh.GetOwnedWindow <MainWindow>((Window)window, model)); #endregion _vs.RegisterFunction <PersonsPageViewModel, IPage>( (window, model) => vsh.GetUserControl <UcPersons>((Window)window, model)); _vs.RegisterFunction <GroupsPageViewModel, IPage>( (window, model) => vsh.GetUserControl <UcGroups>((Window)window, model)); _vs.RegisterFunction <ResultsPageViewModel, IPage>( (window, model) => vsh.GetUserControl <UcResults>((Window)window, model)); _vs.RegisterFunction <RankViewModel, IPage>( (window, model) => vsh.GetUserControl <UcRankings>((Window)window, model)); _vs.RegisterFunction <CreatePersonViewModel, IWindow>( (window, model) => vsh.GetOwnedWindow <CreatePerson>((Window)window, model)); _vs.RegisterFunction <CreateGroupingViewModel, IWindow>( (window, model) => vsh.GetOwnedWindow <CreateGrouping>((Window)window, model)); _vs.RegisterFunction <EditGroupingViewModel, IWindow>( (window, model) => vsh.GetOwnedWindow <EditGrouping>((Window)window, model)); _vs.RegisterFunction <SelectParticipationViewModel, IWindow>( (window, model) => vsh.GetOwnedWindow <AddParticipationToShooterDialog>((Window)window, model)); _vs.RegisterFunction <SelectGroupingViewModel, IWindow>( (window, model) => vsh.GetOwnedWindow <AddGroupingToShooterDialog>((Window)window, model)); _vs.RegisterFunction <SelectShooterViewModel, IWindow>( (window, model) => vsh.GetOwnedWindow <AddShooterToGroupingDialog>((Window)window, model)); _vs.RegisterFunction <ReassignSessionViewModel, IWindow>( (window, model) => vsh.GetOwnedWindow <ReassignSessionDialog>((Window)window, model)); _vs.RegisterFunction <ReassignProgramNumberViewModel, IWindow>( (window, model) => vsh.GetOwnedWindow <ReassignProgramNumber>((Window)window, model)); _vs.RegisterFunction <YesNoMessageBoxViewModel, IWindow>( (w, m) => vsh.GetOwnedWindow <YesNoMessageBox>((Window)w, m)); _vs.RegisterFunction <MessageBoxViewModel, IWindow>((w, m) => vsh.GetOwnedWindow <OkMessageBox>((Window)w, m)); InitializeServiceDeskConfiguration(); _config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); ServiceDeskConfiguration serviceDeskConfiguration = _config.GetSection("ServiceDeskConfiguration") as ServiceDeskConfiguration; if (serviceDeskConfiguration == null) { serviceDeskConfiguration = new ServiceDeskConfiguration(); _config.Sections.Add("ServiceDeskConfiguration", serviceDeskConfiguration); } builder.Register(c => serviceDeskConfiguration); IContainer container = builder.Build(); ServiceLocator.SetLocatorProvider(() => new AutofacServiceLocator(container)); PersonsPageViewModel personsPageViewModel = new PersonsPageViewModel(); personsPageViewModel.Initialize(); GroupsPageViewModel groupsPageViewModel = new GroupsPageViewModel(); groupsPageViewModel.Initialize(); ResultsPageViewModel resultsPageViewModel = new ResultsPageViewModel(); resultsPageViewModel.Initialize(); RankViewModel rankViewModel = new RankViewModel(); rankViewModel.Initialize(); RegisterCreatePersonDialog(personDataStore); RegisterEditPersonDialog(personDataStore); RegisterCreateGroupingDialog(shooterCollectionDataStore, serviceDeskConfiguration); RegisterEditGroupingDialog(shooterCollectionDataStore); RegisterDeletePersonDialog(personDataStore); RegisterDeleteGroupingDialog(shooterCollectionDataStore); RegisterAddShooterToGroupingDialog(collectionShooterDataStore); RegisterDeleteShooterDialog(shooterDataStore); RegisterAddGroupingToShooterDialog(collectionShooterDataStore); RegisterRemoveGroupingFromShooterDialog(collectionShooterDataStore); RegisterAddParticipationToShooterDialog(shooterParticipationDataStore); RegisterRemoveParticipationFromShooterDialog(shooterParticipationDataStore); RegisterMessageBoxDialog(); RegisterReassignSessionDialog(sessionDataStore); RegisterReassignShooterNumberDialog(sessionDataStore); RegisterShowShooterPageMessage(personsPageViewModel); RegisterShowGroupsPageMessage(groupsPageViewModel); // RegisterShowResultsPageMessage(resultsPageViewModel); RegisterShowRankingsPageMessage(rankViewModel); }
public ActionResult CreateRank() { RankViewModel model = new RankViewModel(); return(View(model)); }
public ActionResult Create() { RankViewModel vm = new RankViewModel(); return(View(vm)); }
public async void init() { await RankViewModel.InitializeAsync(); BoxPays.ItemsSource = RankViewModel.listePays; }