// GET: SocialEvents/Edit/5 public ActionResult Edit(int?id) { var userId = User.Identity.GetUserId(); var eventLists = db.SocialEvents.Where(s => s.UserUserId == userId).ToList(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SocialEvent socialEvent = db.SocialEvents.Find(id); if (socialEvent == null) { return(HttpNotFound()); } bool alreadyExist = eventLists.Contains(socialEvent); if (alreadyExist == true) { ViewBag.UserUserId = new SelectList(db.AspNetUsers, "Id", "Email", socialEvent.UserUserId); ViewBag.POIPlaceId = new SelectList(db.POIs, "PlaceId", "Name", socialEvent.POIPlaceId); return(View(socialEvent)); } else { return(RedirectToAction("AccessDenied")); } }
// GET: SocialEvents/Details/5 public ActionResult Details(int?id) { var userId = User.Identity.GetUserId(); var eventLists = db.SocialEvents.Where(s => s.UserUserId == userId).ToList(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SocialEvent socialEvent = db.SocialEvents.Find(id); if (socialEvent == null) { return(HttpNotFound()); } bool alreadyExist = eventLists.Contains(socialEvent); if (alreadyExist == true) { return(View(socialEvent)); } else { return(RedirectToAction("AccessDenied")); } }
static void Seed() { Customer customer1 = new Customer("1", "1", "1"); Customer customer2 = new Customer("2", "2", "2"); Organizer organizer1 = new Organizer("3", "3", "3"); SocialEvent socialEvent1 = new SocialEvent(5, 133, organizer1, "Art", "Kristine og Ramona synger bæ bæ lille lam"); SocialEvent socialEvent2 = new SocialEvent(7, 5643, organizer1, "Sports", "Stian og Jørgen Sjonglerer med datamus"); SocialEvent socialEvent3 = new SocialEvent(9, 2312, organizer1, "TalentShow", "Juan kjører solo dukkeshow"); SocialEvent socialEvent4 = new SocialEvent(5, 436, organizer1, "Sports", "Test event 1 (sports)"); SocialEvent socialEvent5 = new SocialEvent(7, 12, organizer1, "Sports", "Test event 2 (sports)"); SocialEvent socialEvent6 = new SocialEvent(9, 432, organizer1, "Concert", "Test event 3 (concert)"); SocialEvent socialEvent7 = new SocialEvent(5, 768, organizer1, "Concert", "Test event 4 (concert)"); SocialEvent socialEvent8 = new SocialEvent(7, 654, organizer1, "Art", "Test event 5 (art)"); SocialEvent socialEvent9 = new SocialEvent(9, 564, organizer1, "TalentShow", "Test event 6 (talentShow)"); Ticket ticket1 = new Ticket(socialEvent1); Ticket ticket2 = new Ticket(socialEvent1); Ticket ticket3 = new Ticket(socialEvent1); Ticket ticket4 = new Ticket(socialEvent1); Ticket ticket5 = new Ticket(socialEvent2); Ticket ticket6 = new Ticket(socialEvent2); Ticket ticket7 = new Ticket(socialEvent2); Ticket ticket8 = new Ticket(socialEvent3); }
private void SocialManagerEventProcessed(object sender, SocialEvent socialEvent) { if (this.XboxLiveUser.User == null || socialEvent.User.XboxUserId != this.XboxLiveUser.User.XboxUserId) { // Ignore the social event return; } if (socialEvent.EventType == SocialEventType.LocalUserAdded) { if (socialEvent.ErrorCode != 0 && XboxLiveServicesSettings.Instance.DebugLogsOn) { Debug.LogFormat("Failed to add local user to SocialManager: {0}", socialEvent.ErrorMessage); LoadProfileInfo(false); } else { LoadProfileInfo(); } } else if (socialEvent.EventType == SocialEventType.SocialUserGroupLoaded && ((SocialUserGroupLoadedEventArgs)socialEvent.EventArgs).SocialUserGroup.UsersTrackedBySocialUserGroup.Contains(this.XboxLiveUser.User.XboxUserId)) { if (socialEvent.ErrorCode != 0 && XboxLiveServicesSettings.Instance.DebugLogsOn) { Debug.LogFormat("Failed to load the SocialUserGroup: {0}", socialEvent.ErrorMessage); } else { StartCoroutine(FinishLoadingProfileInfo()); } } }
public static ListenerAction OnSocialInteraction(Event e) { // Turns out a social interaction like "Chat" triggers 4 events of EventTypeId kSocialInteraction. // Two cast to SocialEvent, one for the recipient and one for the initiator. I have no idea what // the other two are, but we don't want them. if (e is SocialEvent) { SocialEvent cevent = (SocialEvent)e; // There are two social interactions for discussing kelp recipes -- on land and in water. // I don't know that Discussing Kelp Recipes can be rejected, but obviously you shouldn't learn // anything if it was. if (cevent != null && cevent.SocialName.Contains("Discuss Kelp") && cevent.WasAccepted) { Sim speaker = (Sim)cevent.Actor; // Anyone can learn a kelp recipe from initiating a conversation with a Mermaid, even other Mermaids. // If you're not a Mermaid, you can also learn one if a Mermaid initiates the conversation with you. if ((!cevent.WasRecipient && cevent.TargetSimDescription.IsMermaid) || cevent.WasRecipient && !speaker.OccultManager.HasOccultType(Sims3.UI.Hud.OccultTypes.Mermaid)) { if (speaker.SkillManager.HasElement(SkillNames.Cooking) && // Must know Cooking to learn RandomUtil.GetInt(1, kChanceOfLearningKelpRecipe) == 1) // 1 in [default 4] chance of learning recipe { LearnKelpRecipe(speaker); } } } } return(ListenerAction.Keep); }
public BuyTicketForm(SocialEvent socialEvent) { InitializeComponent(); this.socialEvent = socialEvent; InitializeInfo(); }
private void OnEventProcessed(object sender, SocialEvent socialEvent) { if (this.XboxLiveUser == null) { this.XboxLiveUser = XboxLiveUserManager.Instance.GetSingleModeUser(); } if (this.XboxLiveUser != null && this.XboxLiveUser.User != null && socialEvent.User.Gamertag == this.XboxLiveUser.User.Gamertag) { switch (socialEvent.EventType) { case SocialEventType.LocalUserAdded: if (socialEvent.ErrorCode == 0) { this.CreateDefaultSocialGraphs(); } break; case SocialEventType.SocialUserGroupLoaded: case SocialEventType.SocialUserGroupUpdated: case SocialEventType.PresenceChanged: this.RefreshSocialGroups(); break; } } else { if (this.XboxLiveUser == null) { this.XboxLiveUser = XboxLiveUserManager.Instance.GetSingleModeUser(); } } }
public ActionResult DeleteConfirmed(int id) { SocialEvent socialEvent = db.SocialEvents.Find(id); db.SocialEvents.Remove(socialEvent); db.SaveChanges(); return(RedirectToAction("Index")); }
public void SetUp() { organizer = new Organizer(); socialEvent1 = new SocialEvent(10, 100, organizer); socialEvent2 = new SocialEvent(10, 100, organizer); ticket1 = new Ticket(socialEvent1); ticket2 = new Ticket(socialEvent2); }
public ActionResult DeleteConfirmed(int id) { SocialEvent socialEvent = db.SocialEvents.Find(id); db.SocialEvents.Remove(socialEvent); db.SaveChanges(); return(Redirect("/SocialEvents?Success=Delete")); }
public void Create_SocialEvent_Success() { var adminUser = new User() { AddressContactId = 1, Email = "*****@*****.**", FirstName = "Robin", LastName = "Edbom", Password = "******", DateOfBirth = DateTime.Parse("1996-11-07"), Id = 1 }; var eventToAdd = new SocialEvent { Id = 1, EventId = 1, Name = "Korv grillning" }; var data = new List <SocialEvent>().AsQueryable(); // Arrange var fakeDbSet = A.Fake <DbSet <SocialEvent> >(o => o.Implements(typeof(IQueryable <SocialEvent>)).Implements(typeof(IDbAsyncEnumerable <SocialEvent>))); A.CallTo(() => ((IQueryable <SocialEvent>)fakeDbSet).Provider).Returns(data.Provider); A.CallTo(() => ((IQueryable <SocialEvent>)fakeDbSet).Expression).Returns(data.Expression); A.CallTo(() => ((IQueryable <SocialEvent>)fakeDbSet).ElementType).Returns(data.ElementType); A.CallTo(() => ((IQueryable <SocialEvent>)fakeDbSet).GetEnumerator()).Returns(data.GetEnumerator()); var fakeContext = A.Fake <SocialEventContext>(); A.CallTo(() => fakeContext.SocialEvents).Returns(fakeDbSet); A.CallTo(() => fakeContext.SocialEvents.Add(eventToAdd)).Returns(eventToAdd); var fakeAdminService = A.Fake <IAdminService>(); A.CallTo(() => fakeAdminService.IsUserSysAdmin(adminUser)).Returns(true); var socialEventService = new SocialEventService(fakeContext, fakeAdminService); var socialEvent = socialEventService.Add(eventToAdd, adminUser); // // var raceEventService = new RaceEventService(fakeContext, fakeAdminSercice); // // Act // // var raceEvent = raceEventService.Add(eventToAdd, adminUser); // // Assert Assert.AreEqual(1, socialEvent.Id); Assert.AreEqual("Korv grillning", socialEvent.Name); Assert.AreEqual(1, socialEvent.EventId); }
protected virtual void OnEventProcessed(SocialEvent socialEvent) { var handler = this.EventProcessed; if (handler != null) { handler(this, socialEvent); } }
protected static void OnSocial(Event e) { SocialEvent socialEvent = e as SocialEvent; if (socialEvent == null) { return; } Sim actorSim = socialEvent.Actor as Sim; if (actorSim == null) { return; } Sim targetSim = socialEvent.TargetObject as Sim; if (targetSim == null) { return; } if (actorSim.LotCurrent != targetSim.LotCurrent) { return; } if (actorSim.RoomId != targetSim.RoomId) { return; } if (socialEvent.SocialName == "Vaccinate") { if (socialEvent.WasAccepted) { Inoculate(targetSim, actorSim); } } else { SimDescription actor = actorSim.SimDescription; SimDescription target = targetSim.SimDescription; foreach (DiseaseVector vector in Vector.Settings.GetVectors(actor)) { if (vector.Infect(target, actor, Virulence.Social, e)) { ScoringLog.sLog.IncStat(vector.UnlocalizedName + " Success Social"); } } } }
public void Assert_receipt_is_correct() { Organizer organizer = new Organizer(); SocialEvent socialEvent = new SocialEvent(10, 100, organizer, "TestCategory", "TestName"); Ticket ticket = new Ticket(socialEvent); Vipps vipps = new Vipps(); Receipt receipt = new Receipt(4, ticket, "kr", vipps.ToString()); string result = receipt.GenerateReceipt(); Approvals.Verify(result); }
private IActionResult processUpdate(SocialEvent socialEvent) { var existingSocialEvent = _dbContext.SocialEvents.FirstOrDefault(x => x.Id == socialEvent.Id); existingSocialEvent.MapUrl = socialEvent.MapUrl; existingSocialEvent.Title = socialEvent.Title; existingSocialEvent.Content = socialEvent.Content; existingSocialEvent.CreationDate = socialEvent.CreationDate.ToLocalTime(); existingSocialEvent.EventDate = socialEvent.EventDate.ToLocalTime(); _dbContext.SaveChanges(); return(new ObjectResult(existingSocialEvent)); }
public ActionResult Edit([Bind(Include = "EventId,EventName,EventDate,EventTime,UserUserId,POIPlaceId")] SocialEvent socialEvent) { if (ModelState.IsValid) { db.Entry(socialEvent).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UserUserId = new SelectList(db.AspNetUsers, "Id", "Email", socialEvent.UserUserId); ViewBag.POIPlaceId = new SelectList(db.POIs, "PlaceId", "Name", socialEvent.POIPlaceId); return(View(socialEvent)); }
public SocialEvent Add(SocialEvent eventToAdd, User adminUser) { if (!_adminService.IsUserSysAdmin(adminUser)) { throw new InvalidCredentialException( $"That user with id '{adminUser.Id}' does not have premission to run method {nameof(Add)} in service {nameof(RaceEventService)}"); } var eve = _context.SocialEvents.Add(eventToAdd); return(eve); }
protected override void Seed(MyDbContext context) { Customer customer1 = new Customer("1", "1", "1"); Customer customer2 = new Customer("2", "2", "2"); context.Customers.Add(customer1); context.Customers.Add(customer2); Organizer organizer1 = new Organizer("3", "3", "3"); context.Organizers.Add(organizer1); SocialEvent socialEvent1 = new SocialEvent(5, 133, organizer1, "Art", "Kristine og Ramona synger bæ bæ lille lam"); SocialEvent socialEvent2 = new SocialEvent(7, 5643, organizer1, "Sports", "Stian og Jørgen Sjonglerer med datamus"); SocialEvent socialEvent3 = new SocialEvent(9, 2312, organizer1, "TalentShow", "Juan kjører solo dukkeshow"); SocialEvent socialEvent4 = new SocialEvent(5, 436, organizer1, "Sports", "Test event 1 (sports)"); SocialEvent socialEvent5 = new SocialEvent(7, 12, organizer1, "Sports", "Test event 2 (sports)"); SocialEvent socialEvent6 = new SocialEvent(9, 432, organizer1, "Concert", "Test event 3 (concert)"); SocialEvent socialEvent7 = new SocialEvent(5, 768, organizer1, "Concert", "Test event 4 (concert)"); SocialEvent socialEvent8 = new SocialEvent(7, 654, organizer1, "Art", "Test event 5 (art)"); SocialEvent socialEvent9 = new SocialEvent(9, 564, organizer1, "TalentShow", "Test event 6 (talentShow)"); context.SocialEvents.Add(socialEvent1); context.SocialEvents.Add(socialEvent2); context.SocialEvents.Add(socialEvent3); context.SocialEvents.Add(socialEvent4); context.SocialEvents.Add(socialEvent5); context.SocialEvents.Add(socialEvent6); context.SocialEvents.Add(socialEvent7); context.SocialEvents.Add(socialEvent8); context.SocialEvents.Add(socialEvent9); Ticket ticket1 = new Ticket(socialEvent1); Ticket ticket2 = new Ticket(socialEvent1); Ticket ticket3 = new Ticket(socialEvent1); Ticket ticket4 = new Ticket(socialEvent1); Ticket ticket5 = new Ticket(socialEvent2); Ticket ticket6 = new Ticket(socialEvent2); Ticket ticket7 = new Ticket(socialEvent2); Ticket ticket8 = new Ticket(socialEvent3); context.Tickets.Add(ticket1); context.Tickets.Add(ticket2); context.Tickets.Add(ticket3); context.Tickets.Add(ticket4); context.Tickets.Add(ticket5); context.Tickets.Add(ticket6); context.Tickets.Add(ticket7); context.Tickets.Add(ticket8); base.Seed(context); }
private void ButtonCreateSocialEvent_Click(object sender, EventArgs e) { if (AllFieldsFilledOut()) { SocialEvent newSocialEvent = new SocialEvent((int)NumericUpDownTotalTickets.Value, (int)NumericUpDownTicketPrice.Value, (Organizer)currentUser, TextBoxCategory.Text, TextBoxSocialEventName.Text); MessageBox.Show($"SocialEvent: {TextBoxSocialEventName.Text} created"); } else { MessageBox.Show("Please fill out all fields"); } }
public ActionResult Create([Bind(Include = "EventId,EventName,EventDate,EventTime,UserUserId,POIPlaceId")] SocialEvent socialEvent) { if (ModelState.IsValid) { db.SocialEvents.Add(socialEvent); db.SaveChanges(); return(Redirect("/SocialEvents?Success=Create")); } ViewBag.UserUserId = new SelectList(db.AspNetUsers, "Id", "Email", socialEvent.UserUserId); ViewBag.POIPlaceId = new SelectList(db.POIs, "PlaceId", "Name", socialEvent.POIPlaceId); return(View(socialEvent)); }
protected override bool Allow(SocialEvent e) { if (!e.WasAccepted) { return(false); } if (!e.ActorWonFight) { return(false); } return(base.Allow(e)); }
// GET: SocialEvents/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SocialEvent socialEvent = db.SocialEvents.Find(id); if (socialEvent == null) { return(HttpNotFound()); } return(View(socialEvent)); }
protected static void OnSocialEvent(Event e) { using (Common.TestSpan span = new Common.TestSpan(ScoringLookup.Stats, "Duration AttractionHelper:OnSocialEvent")) { if (Common.AssemblyCheck.IsInstalled("NRaasChemistry")) { return; } SocialEvent socialEvent = e as SocialEvent; if ((socialEvent != null) && (socialEvent.WasAccepted)) { Sim actor = socialEvent.Actor as Sim; Sim target = socialEvent.TargetObject as Sim; if ((actor != null) && (target != null)) { bool created = false; LastCheck lastCheck = GetLastCheck(actor.SimDescription.SimDescriptionId, target.SimDescription.SimDescriptionId, true, out created); if (created) { SetLastCheck(target.SimDescription.SimDescriptionId, actor.SimDescription.SimDescriptionId, lastCheck); } bool force = false; if ((!lastCheck.mAttractionNotice) && ((SimTypes.IsSelectable(actor)) || (SimTypes.IsSelectable(target)))) { force = true; } if ((force) || ((lastCheck.mTime + SimClock.kSimulatorTicksPerSimDay) > SimClock.CurrentTicks)) { lastCheck.mTime = SimClock.CurrentTicks; Relationship relation = Relationship.Get(actor, target, false); if (relation != null) { RelationshipEx.CalculateAttractionScore(relation, !lastCheck.mAttractionNotice); if ((SimTypes.IsSelectable(actor)) || (SimTypes.IsSelectable(target))) { lastCheck.mAttractionNotice = true; } } } } } } }
// GET: SocialEvents/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SocialEvent socialEvent = db.SocialEvents.Find(id); if (socialEvent == null) { return(HttpNotFound()); } ViewBag.UserUserId = new SelectList(db.AspNetUsers, "Id", "Email", socialEvent.UserUserId); ViewBag.POIPlaceId = new SelectList(db.POIs, "PlaceId", "Name", socialEvent.POIPlaceId); return(View(socialEvent)); }
private void SocialManagerEventProcessed(object sender, SocialEvent socialEvent) { if (this.xboxLiveUser == null) { this.xboxLiveUser = SignInManager.Instance.GetPlayer(this.PlayerNumber); } if (this.xboxLiveUser == null || (socialEvent.User.XboxUserId != this.xboxLiveUser.XboxUserId)) { // Ignore the social event return; } if (socialEvent.EventType == SocialEventType.LocalUserAdded) { if (socialEvent.ErrorCode != 0) { ExceptionManager.Instance.ThrowException( ExceptionSource.SocialManager, ExceptionType.AddLocalUserFailed, new Exception(socialEvent.ErrorMessge)); LoadProfileInfo(false); } else { LoadProfileInfo(); } } else if (socialEvent.EventType == SocialEventType.SocialUserGroupLoaded && ((SocialUserGroupLoadedEventArgs)socialEvent.EventArgs).SocialUserGroup == userGroup) { if (socialEvent.ErrorCode != 0) { ExceptionManager.Instance.ThrowException( ExceptionSource.SocialManager, ExceptionType.LoadSocialUserGroupFailed, new Exception(socialEvent.ErrorMessge)); } else { StartCoroutine(FinishLoadingProfileInfo()); } } }
private void SocialManagerEventProcessed(object sender, SocialEvent socialEvent) { if (socialEvent.EventType == SocialEventType.LocalUserAdded) { socialAddedLocalUser = true; this.Refresh(); } else if (socialEvent.EventType == SocialEventType.SocialUserGroupLoaded) //&& ((SocialUserGroupLoadedEventArgs)socialEvent.EventArgs).SocialUserGroup == this.userGroup //TODO { var entries = this.contentPanel.GetComponentsInChildren <LeaderboardEntry>(); for (int i = 0; i < entries.Length; i++) { XboxSocialUser user = userGroup.Users.FirstOrDefault(x => x.Gamertag == entries[i].gamertagText.text); if (user != null) { entries[i].GamerpicUrl = user.DisplayPicUrlRaw + "&w=128"; } } } }
public override bool IsSuccess(Event e) { SocialEvent socialEvent = e as SocialEvent; if (socialEvent == null) { return(false); } if (!mAllowAccept) { if (socialEvent.WasAccepted) { return(false); } } else if (!mAllowReject) { if (!socialEvent.WasAccepted) { return(false); } } if (!mAllowRecipient) { if (!socialEvent.WasRecipient) { return(false); } } else if (!mAllowInitiator) { if (socialEvent.WasRecipient) { return(false); } } return(mSocials.Contains(socialEvent.SocialName)); }
private void SocialManagerEventProcessed(object sender, SocialEvent socialEvent) { if (socialEvent.EventType == SocialEventType.LocalUserAdded) { socialAddedLocalUser = true; this.Refresh(); } else if (socialEvent.EventType == SocialEventType.SocialUserGroupLoaded && ((SocialUserGroupLoadedEventArgs)socialEvent.EventArgs).SocialUserGroup == this.userGroup) { var entries = this.contentPanel.GetComponentsInChildren <PlayerProfile>(); for (int i = 0; i < entries.Length; i++) { XboxSocialUser user = userGroup.Users.FirstOrDefault(x => x.Gamertag == entries[i].GamerTagText.text); if (user != null) { this.StartCoroutine(entries[i].LoadGamerpic(user.DisplayPicRaw + "&w=128")); } } } }
public IActionResult Post([FromBody] SocialEvent socialEvent) { if (ModelState.IsValid) { if (socialEvent.Id == 0) { socialEvent.CreationDate = DateTime.UtcNow; socialEvent.EventDate = socialEvent.EventDate.ToLocalTime(); _dbContext.SocialEvents.Add(socialEvent); _dbContext.SaveChanges(); return(new ObjectResult(socialEvent)); } else { return(processUpdate(socialEvent)); } } else { return(new BadRequestObjectResult(ModelState)); } }
protected virtual void OnEventProcessed(SocialEvent socialEvent) { this.EventProcessed?.Invoke(this, socialEvent); }