public ActionResult Index(string resumeGUID)
        {
            try
            {
                if (resumeGUID == null || string.IsNullOrWhiteSpace(resumeGUID))
                {
                    resumeGUID = "6257B7B5-C4D0-4D00-ACB4-350A95861B7F";
                }
                var                 viewModel       = new ObjectiveViewModel();
                Repository          _repositoryMain = new Repository(_connectionString);
                ObjectiveRepository _repository     = new ObjectiveRepository(_connectionString);

                Applicant            applicant      = _repositoryMain.GetApplicant(resumeGUID);
                List <ObjectiveItem> objectivesList = _repository.GetObjectives(resumeGUID);

                viewModel.Objectives = objectivesList;
                viewModel.Applicant  = applicant;

                return(View(viewModel));
            }
            catch
            {
                return(View("Error"));
            }
        }
예제 #2
0
        public static void RolloverDailyBoosted()
        {
            AppIdentityDbContext context;

            using (context = AppIdentityDbContext.Create())
            {
                IUnitOfWork          unitOfWork          = new UnitOfWork(context);
                IObjectiveRepository objectiveRepository = new ObjectiveRepository(unitOfWork);

                List <BoostedObjective> boostedObjectives = objectiveRepository.GetBoostedObjectives().Where(b => b.IsLive() == false).ToList();

                foreach (BoostedObjective objective in boostedObjectives)
                {
                    objectiveRepository.DeleteBoostedObjective(objective.BoostedObjectiveID);
                }

                BoostedObjective newBoostedObjective = new BoostedObjective();

                // grab an active objective that has a product associated it (objectives without products are special and shouldn't be boosted via this method)
                Objective randomObjective = objectiveRepository.GetObjectives().Where(l => l.IsActive && l.Product != null && l.RequiresAdmin == false).OrderBy(x => Guid.NewGuid()).FirstOrDefault();

                if (randomObjective == null)
                {
                    unitOfWork.Save();
                    return;
                }

                SelectBoostAmount(newBoostedObjective);

                DateTime endDate = GetMidnightEST().AddDays(1);

                newBoostedObjective.EndDate = endDate;
                newBoostedObjective.IsDaily = true;

                randomObjective.AddBoostedObjective(newBoostedObjective);

                objectiveRepository.UpdateObjective(randomObjective);

                ISiteRepository siteRepository = new SiteRepository(unitOfWork);

                String urlAndName = String.Empty;

                if (randomObjective.Product.IsSteamAppID)
                {
                    urlAndName = "[url=https://store.steampowered.com/app/" + randomObjective.Product.AppID + "]" + randomObjective.Title + "[/url]";
                }
                else
                {
                    urlAndName = randomObjective.Title;
                }

                SiteNotification notification = new SiteNotification()
                {
                    Notification = "[boosted][/boosted] Objective [ptext]\"" + randomObjective.ObjectiveName + "\"[/ptext] for " + randomObjective.Title + " is [url=https://theafterparty.azurewebsites.net/objectives/boosted]boosted[/url] by [gtext]" + randomObjective.BoostedObjective.BoostAmount + "x[/gtext] for a boosted award of [gtext]" + randomObjective.FixedReward() + "[/gtext]!", NotificationDate = DateTime.Now
                };
                siteRepository.InsertSiteNotification(notification);

                unitOfWork.Save();
            }
        }
예제 #3
0
        protected async void FormSubmit(EditContext editContext)
        {
            if (!editContext.Validate())
            {
                return;
            }
            await ObjectiveRepository.Delete(Id);

            NavigationManager.NavigateTo("objective");
        }
예제 #4
0
        protected override async Task OnInitializedAsync()
        {
            Games = await GameRepository.GetList();

            GameRequests = await GameRequestRepository.GetList();

            Objectives = await ObjectiveRepository.GetList();

            CurrentDate = DateTime.Today;
            GetDates();
        }
예제 #5
0
        /// <summary>Creates an instance for the given language.</summary>
        /// <param name="culture">The culture.</param>
        /// <returns>A repository.</returns>
        public IObjectiveRepository ForCulture(CultureInfo culture)
        {
            if (culture == null)
            {
                throw new ArgumentNullException("culture");
            }

            IObjectiveRepository repository = new ObjectiveRepository(this.serviceClient, new ObjectiveConverter());

            repository.Culture = culture;
            return(repository);
        }
예제 #6
0
 protected override async Task OnInitializedAsync()
 {
     Objective = await ObjectiveRepository.GetById(Id);
 }
예제 #7
0
 protected override async Task OnInitializedAsync()
 {
     _user = UserManager.Users.FirstOrDefault(u =>
                                              u.UserName == HttpContextAccessor.HttpContext.User.Identity.Name);
     Objectives = await ObjectiveRepository.GetList();
 }
 ///<summary>
 /// Constructor for initialize
 ///</summary>
 public ObjectiveCoreModel()
 {
     _repository = new ObjectiveRepository <object>();
 }