示例#1
0
        public IActionResult OnGet()
        {
            var danceevent = new DanceEvent();

            danceevent.DanceEventCategories = new List <DanceEventCategory>();
            PopulateAssignedCategoryData(_context, danceevent);
            return(Page());
        }
        public void PopulateAssignedCategoryData(DanceContext context, DanceEvent danceevent)
        {
            var allCategories        = context.Categories;
            var danceeventCategories = new HashSet <int>(
                danceevent.DanceEventCategories.Select(c => c.CategoryID));

            AssignedCategoryDataList = new List <AssignedCategoryData>();
            foreach (var category in allCategories)
            {
                AssignedCategoryDataList.Add(new AssignedCategoryData
                {
                    CategoryID     = category.CategoryID,
                    DanceEventType = category.DanceEventType,
                    Assigned       = danceeventCategories.Contains(category.CategoryID)
                });
            }
        }
示例#3
0
        public ActionResult AddTickets()
        {
            int EventId = int.Parse(Request.Form["EventId"]);
            int Amount  = int.Parse(Request.Form["TicketAmount"]);

            DanceEvent e = repo.GetDanceEvent(EventId);

            List <Ticket> tickets = new List <Ticket>();
            Ticket        ticket  = new Ticket();

            ticket.Amount         = Amount;
            ticket.EventId        = e.EventId;
            ticket.Event          = eventRepo.GetEvent(e.EventId);
            ticket.Price          = e.Price * Amount;
            ticket.SpecialRequest = null;

            if (ticket.Amount > (ticket.Event.MaxTickets - ticket.Event.CurrentTickets))
            {
                return(RedirectToAction("NoTickets", "Dance"));
            }
            else
            {
                // Create session if it doesn't exist or add ticket to existing session
                if (Session["currentTickets"] == null)
                {
                    tickets.Add(ticket);
                    Session["CurrentTickets"] = tickets;
                }
                else
                {
                    List <Ticket> sessionTickets = (List <Ticket>)Session["currentTickets"];
                    Ticket        t = sessionTickets.SingleOrDefault(ti => ti.EventId == EventId);
                    if (t != null)
                    {
                        ticket.Amount = ticket.Amount + t.Amount;
                        ticket.Price  = e.Price * ticket.Amount;
                        sessionTickets.Remove(t);
                    }
                    sessionTickets.Add(ticket);
                }
                return(RedirectToAction("Index", "Ticket"));
            }
        }
        public void UpdateDanceEventCategories(DanceContext context,
                                               string[] selectedCategories, DanceEvent danceeventToUpdate)
        {
            if (selectedCategories == null)
            {
                danceeventToUpdate.DanceEventCategories = new List <DanceEventCategory>();
                return;
            }

            var selectedCategoryHS = new HashSet <string>(selectedCategories);
            var danceeventCategory = new HashSet <int>
                                         (danceeventToUpdate.DanceEventCategories.Select(c => c.Category.CategoryID));

            foreach (var category in context.Categories)
            {
                if (selectedCategoryHS.Contains(category.CategoryID.ToString()))
                {
                    if (!danceeventCategory.Contains(category.CategoryID))
                    {
                        danceeventToUpdate.DanceEventCategories.Add(
                            new DanceEventCategory
                        {
                            DanceEventID = danceeventToUpdate.ID,
                            CategoryID   = category.CategoryID
                        });
                    }
                }
                else
                {
                    if (danceeventCategory.Contains(category.CategoryID))
                    {
                        DanceEventCategory categoryToRemove
                            = danceeventToUpdate
                              .DanceEventCategories
                              .SingleOrDefault(i => i.CategoryID == category.CategoryID);
                        context.Remove(categoryToRemove);
                    }
                }
            }
        }
 public TicketdayView DomainToView(DanceEvent d)
 {
     if (d.EventName.Contains("ALL-ACCESS") && (d.Price == 125.00))
     {
         TicketdayView a = new TicketdayView();
         a.EventId  = d.EventId;
         a.Start    = null;
         a.Location = "";
         a.Name     = "All access for this day";
         a.Session  = null;
         a.Price    = d.Price;
         return(a);
     }
     else if (d.EventName.Contains("ALL-ACCESS") && (d.Price == 250.00))
     {
         TicketdayView b = new TicketdayView();
         b.EventId  = d.EventId;
         b.Start    = null;
         b.Location = "";
         b.Name     = "All access for July 27, 28 and 29";
         b.Session  = null;
         b.Price    = d.Price;
         return(b);
     }
     else
     {
         TicketdayView c = new TicketdayView();
         c.EventId  = d.EventId;
         c.Start    = d.StartTime;
         c.Location = d.DanceVenue.Name;
         c.Name     = d.EventName;
         c.Session  = d.Session;
         c.Price    = d.Price;
         return(c);
     }
 }
示例#6
0
        public async Task <IActionResult> OnPostAsync(string[] selectedCategories)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var newDanceEvent = new DanceEvent();

            if (selectedCategories != null)
            {
                newDanceEvent.DanceEventCategories = new List <DanceEventCategory>();
                foreach (var category in selectedCategories)
                {
                    var categoryToAdd = new DanceEventCategory
                    {
                        CategoryID = int.Parse(category)
                    };
                    newDanceEvent.DanceEventCategories.Add(categoryToAdd);
                }
                ;
            }

            if (await TryUpdateModelAsync <DanceEvent>(
                    newDanceEvent,
                    "danceevent",
                    e => e.DanceEventName, e => e.EventDate, e => e.City, e => e.State, e => e.Website))
            {
                _context.DanceEvents.Add(newDanceEvent);
                await _context.SaveChangesAsync();

                return(RedirectToPage("./Index"));
            }
            PopulateAssignedCategoryData(_context, newDanceEvent);
            return(Page());
        }
        public DanceEvent GetDanceEvent(int ID)
        {
            DanceEvent d = (DanceEvent)db.Events.Where(b => b.EventId == ID).OfType <DanceEvent>().FirstOrDefault();

            return(d);
        }
示例#8
0
        public static void Initialize(DanceContext context)
        {
            context.Database.EnsureCreated();

            if (context.DanceEvents.Any())
            {
                return;
            }

            var danceevents = new DanceEvent[]
            {
                new DanceEvent {
                    DanceEventName = "Lindy Focus", EventDate = DateTime.Parse("12-26-2018"), City = "Ashville", State = "North Carolina", Website = "http://www.LindyFocus.com"
                },
                new DanceEvent {
                    DanceEventName = "Lindy on the Rocks", EventDate = DateTime.Parse("9-14-2018"), City = "Denver", State = "Colorado", Website = "http://www.lindyontherocks.com/"
                },
                new DanceEvent {
                    DanceEventName = "DCLX", EventDate = DateTime.Parse("04-20-2017"), City = "Washington", State = "D.C.", Website = "https://dclx.org/"
                },
                new DanceEvent {
                    DanceEventName = "International Lindy Hop Championships", EventDate = DateTime.Parse("08-23-2017"), City = "Alexandria", State = "Virginia", Website = "http://www.ilhc.com/"
                }
            };

            foreach (DanceEvent e in danceevents)
            {
                context.DanceEvents.Add(e);
            }
            context.SaveChanges();

            var categories = new Category[]
            {
                new Category {
                    CategoryID = 1, DanceEventType = "Workshop"
                },
                new Category {
                    CategoryID = 2, DanceEventType = "Exchange"
                },
                new Category {
                    CategoryID = 3, DanceEventType = "Competition"
                }
            };

            foreach (Category c in categories)
            {
                context.Categories.Add(c);
            }
            context.SaveChanges();

            var danceeventcategories = new DanceEventCategory[]
            {
                new DanceEventCategory {
                    DanceEventID = 1, CategoryID = 1
                },
                new DanceEventCategory {
                    DanceEventID = 1, CategoryID = 3
                },
                new DanceEventCategory {
                    DanceEventID = 2, CategoryID = 1
                },
                new DanceEventCategory {
                    DanceEventID = 3, CategoryID = 2
                },
                new DanceEventCategory {
                    DanceEventID = 4, CategoryID = 3
                },
            };

            foreach (DanceEventCategory d in danceeventcategories)
            {
                context.DanceEventCategories.Add(d);
            }
            context.SaveChanges();
        }
    public void interact(Vector3 hitPos)
    {
        DanceEvent d_event = GetComponentInParent <DanceEvent>();

        d_event.SendDanceMovement(moves);
    }
示例#10
0
        public async static Task Initialize(IServiceProvider serviceProvider)
        {
            var context     = serviceProvider.GetService <ApplicationDbContext>();
            var userManager = serviceProvider.GetService <UserManager <ApplicationUser> >();

            // Ensure db
            context.Database.EnsureCreated();

            // Ensure Stephen (IsAdmin)
            var reginald = await userManager.FindByNameAsync("*****@*****.**");

            if (reginald == null)
            {
                // create user
                reginald = new ApplicationUser
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };
                await userManager.CreateAsync(reginald, "Secret123!");

                // add claims
                await userManager.AddClaimAsync(reginald, new Claim("IsAdmin", "true"));
            }
            if (!context.Quotes.Any())
            {
                var myQuotes = new Quote[]
                {
                    new Quote {
                        Statement = "I wanted a perfect ending. Now I've learned, the hard way, that some poems don't rhyme, and some stories don't have a clear beginning, middle, and end. Life is about not knowing, having to change, taking the moment and making the best of it, without knowing what's going to happen next. Delicious Ambiguity.", Author = "Gilda Radner"
                    },
                    new Quote {
                        Statement = "The only way to have a friend is to be one.", Author = "Ralph Waldo Emerson"
                    },
                    new Quote {
                        Statement = "I don't spend much time thinking about whether God exists. I don't consider that a relevant question. It's unanswerable and irrelevant to my life, so I put it in the category of things I can't worry about.", Author = "Wendy Kaminer"
                    },
                    new Quote {
                        Statement = "Ideals are like stars: you will not succeed in touching them with your hands, but like the seafaring man on the desert of waters, you choose them as your guides, and following them you reach your destiny.", Author = "Carl Schurz"
                    },
                    new Quote {
                        Statement = "Success is not the key to happiness. Happiness is the key to success. If you love what you are doing, you will be successful.", Author = "Albert Schweitzer"
                    },
                    new Quote {
                        Statement = "My will shall shape the future. Whether I fail or succeed shall be no man's doing but my own. I am the force; I can clear any obstacle before me or I can be lost in the maze. My choice; my responsibility; win or lose, only I hold the key to my destiny.", Author = "Elaine Maxwell"
                    },
                    new Quote {
                        Statement = "How far you go in life depends on your being tender with the young, compassionate with the aged, sympathetic with the striving and tolerant of the weak and strong. Because someday in life you will have been all of these.", Author = "George Washington Carver"
                    },
                    new Quote {
                        Statement = "In these days, a man who says a thing cannot be done is quite apt to be interrupted by some idiot doing it.", Author = "Elbert Hubbard"
                    },
                    new Quote {
                        Statement = "You cannot dream yourself into a character; you must hammer and forge yourself one.", Author = "James A. Froude"
                    },
                    new Quote {
                        Statement = "Trust only movement. Life happens at the level of events, not of words. Trust movement.", Author = "Alfred Adler"
                    },
                    new Quote {
                        Statement = "We do not grow absolutely, chronologically. We grow sometimes in one dimension, and not in another; unevenly. We grow partially. We are relative. We are mature in one realm, childish in another. The past, present, and future mingle and pull us backward, forward, or fix us in the present. We are made up of layers, cells, constellations.", Author = "Anais Nin"
                    }
                };

                context.Quotes.AddRange(myQuotes);
                context.SaveChanges();
            }
            if (!context.DanceEvents.Any())
            {
                var listEvent = new DanceEvent[]
                {
                    new DanceEvent {
                        Name = "Capital Swing", City = "Sacramento", State = "CA", Category = "NASDE", URL = "http://www.capitalswingconvention.com/"
                    },
                    new DanceEvent {
                        Name = "MADjam", City = "Baltimore", State = "MD", Category = "NASDE", URL = "http://www.atlanticdancejam.com/"
                    },
                    new DanceEvent {
                        Name = "Chicago Classics", City = "Chicago", State = "IL", Category = "NASDE", URL = "https://thechicagoclassic.com/"
                    },
                    new DanceEvent {
                        Name = "Seattle Easter Swing", City = "Seattle", State = "WA", Category = "NASDE", URL = "http://easterswing.org/"
                    },
                    new DanceEvent {
                        Name = "Swing Diego", City = "San Diego", State = "CA", Category = "NASDE", URL = "https://www.swingdiego.com/"
                    },
                    new DanceEvent {
                        Name = "USA Grand Nationals", City = "Marietta", State = "GA", Category = "NASDE", URL = "http://usagrandnationals.com/GNDC/"
                    },
                    new DanceEvent {
                        Name = "Liberty Swing", City = "New Brunswick", State = "NJ", Category = "NASDE", URL = "http://www.libertyswing.com/"
                    },
                    new DanceEvent {
                        Name = "Swingtime in the Rockies", City = "Denver", State = "CO", Category = "NASDE", URL = "http://www.swingtimeintherockies.com/"
                    },
                    new DanceEvent {
                        Name = "Tampa Bay Classics", City = "Tampa Bay", State = "FL", Category = "NASDE", URL = "http://tampabayclassic.com/"
                    },
                    new DanceEvent {
                        Name = "Summer Hummer", City = "Boston", State = "MA", Category = "NASDE", URL = "http://dancepros.net/"
                    },
                    new DanceEvent {
                        Name = "Boogie by the Bay", City = "San Francisco", State = "CA", Category = "NASDE", URL = "https://boogiebythebay.com/"
                    },
                    new DanceEvent {
                        Name = "The US Open", City = "Burbank", State = "CA", Category = "NASDE", URL = "http://usopenswing.com/"
                    },
                    new DanceEvent {
                        Name = "West Coast Swing BudaFest", City = "Budapest", State = "Hungary", Category = "Global", URL = "http://wcs-budafest.com/"
                    },
                    new DanceEvent {
                        Name = "Austin Swing Dance Championship", City = "Austin", State = "TX", Category = "US", URL = "http://www.austinswingdancechampionships.com/"
                    },
                    new DanceEvent {
                        Name = "Charlotte Westie Fest", City = "Charlotte", State = "NC", Category = "US", URL = "http://www.charlottewestiefest.com/"
                    },
                    new DanceEvent {
                        Name = "U.K. & European WCS Championships", City = "London", State = "England", Category = "Global", URL = "http://www.jiveaddiction.com/event-type/west-coast-swing"
                    },
                    new DanceEvent {
                        Name = "Asia West Coast Swing Open", City = "Singapore", State = "China", Category = "Global", URL = "http://www.asiawcsopen.com/"
                    },
                    new DanceEvent {
                        Name = "Jack & Jill O'Rama", City = "Garden Grove", State = "CA", Category = "US", URL = "http://jackandjillorama.com/"
                    },
                    new DanceEvent {
                        Name = "Phoenix 4th of July", City = "Phoenix", State = "AZ", Category = "US", URL = "http://www.phoenix4thofjuly.com/2016-convention.html"
                    },
                    new DanceEvent {
                        Name = "Desert City Swing", City = "Phoenix", State = "AZ", Category = "US", URL = "http://www.desertcityswing.com/"
                    },
                    new DanceEvent {
                        Name = "Bavarian Open WCS", City = "Munich", State = "Germany", Category = "Global", URL = "https://bavarianopen.com/"
                    },
                    new DanceEvent {
                        Name = "Atlanta Swing Classics", City = "Atlanta", State = "GA", Category = "US", URL = "http://www.atlantaswingclassic.com/"
                    },
                    new DanceEvent {
                        Name = "DC Swing Experience", City = "Herndon", State = "VA", Category = "US", URL = "http://www.dcswingexperience.com/"
                    },
                    new DanceEvent {
                        Name = "New Year's Swing Fling", City = "Heathorw", State = "England", Category = "Global", URL = "https://www.nyswingfling.co.uk/"
                    },
                    new DanceEvent {
                        Name = "Spotlight Dance Celebration", City = "Dearborn", State = "MI", Category = "US", URL = "http://www.spotlightnewyears.com/"
                    }
                };

                context.DanceEvents.AddRange(listEvent);
                context.SaveChanges();
            }
        }
示例#11
0
 public UserRegistrationPage(DanceEvent currentEvent)
 {
     InitializeComponent();
     ProfileItem.SetProfileButton(this);
 }