Skip to content
Browse files

Added CodeCamperDbContext

  • Loading branch information...
1 parent 62b5d25 commit f672c640fe70fd113f20d0e45ac49f05f5e75480 @NicholasMurray committed Sep 17, 2012
View
119 CodeCamper.Data/CodeCamper.Data.csproj
@@ -1,59 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>d97f2ba4-b8c0-41b8-8c1f-70ac7e925ee0</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>CodeCamper.Data</RootNamespace>
- <AssemblyName>CodeCamper.Data</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System"/>
-
- <Reference Include="System.Core"/>
- <Reference Include="System.Xml.Linq"/>
- <Reference Include="System.Data.DataSetExtensions"/>
-
-
- <Reference Include="Microsoft.CSharp"/>
-
- <Reference Include="System.Data"/>
- <Reference Include="System.Xml"/>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Class1.cs" />
-
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{CFB5CCDB-8F5F-4F67-8F7F-E571523ED384}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>CodeCamper.Data</RootNamespace>
+ <AssemblyName>CodeCamper.Data</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="EntityFramework">
+ <HintPath>..\packages\EntityFramework.5.0.0\lib\net45\EntityFramework.dll</HintPath>
+ </Reference>
+ <Reference Include="NLipsum.Core">
+ <HintPath>..\LIB\NLipsum.Core.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Data.Entity" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="CodeCamperDbContext.cs" />
+ <Compile Include="Configuration\AttendanceConfiguration.cs" />
+ <Compile Include="Configuration\SessionConfiguration.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="SampleData\CodeCamperDatabaseInitializer.cs" />
+ <Compile Include="SampleData\PeopleNames.cs" />
+ <Compile Include="SampleData\RandomSelector.cs" />
+ <Compile Include="SampleData\SampleTextGenerator.cs" />
+ <Compile Include="SampleData\SampleTrack.cs" />
+ <Compile Include="SampleData\TagsGenerator.cs" />
+ <Compile Include="SampleData\TheChosen.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\CodeCamper.Model\CodeCamper.Model.csproj">
+ <Project>{353810b1-c8cb-4a8b-86bc-f74929a1bf57}</Project>
+ <Name>CodeCamper.Model</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ <None Include="packages.config" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
-
- </Project>
+</Project>
View
37 CodeCamper.Data/CodeCamperDbContext.cs
@@ -0,0 +1,37 @@
+using System.Data.Entity;
+using System.Data.Entity.ModelConfiguration.Conventions;
+using CodeCamper.Model;
+using CodeCamper.Data.SampleData;
+
+namespace CodeCamper.Data
+{
+ public class CodeCamperDbContext : DbContext
+ {
+ // ToDo: Move Initializer to Global.asax; don't want dependence on SampleData
+ static CodeCamperDbContext()
+ {
+ Database.SetInitializer(new CodeCamperDatabaseInitializer());
+ }
+
+ public CodeCamperDbContext()
+ : base(nameOrConnectionString: "CodeCamper") { }
+
+ protected override void OnModelCreating(DbModelBuilder modelBuilder)
+ {
+ // Use singular table names
+ modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
+
+ modelBuilder.Configurations.Add(new SessionConfiguration());
+ modelBuilder.Configurations.Add(new AttendanceConfiguration());
+ }
+
+ public DbSet<Person> Persons { get; set; }
+ public DbSet<Session> Sessions { get; set; }
+ public DbSet<Attendance> Attendance { get; set; }
+
+ // Lookup Lists
+ public DbSet<Room> Rooms { get; set; }
+ public DbSet<TimeSlot> TimeSlots { get; set; }
+ public DbSet<Track> Tracks { get; set; }
+ }
+}
View
26 CodeCamper.Data/Configuration/AttendanceConfiguration.cs
@@ -0,0 +1,26 @@
+using System.Data.Entity.ModelConfiguration;
+using CodeCamper.Model;
+
+namespace CodeCamper.Data
+{
+ public class AttendanceConfiguration : EntityTypeConfiguration<Attendance>
+ {
+ public AttendanceConfiguration()
+ {
+ // Attendance has a composite key: SessionId and PersonId
+ HasKey(a => new { a.SessionId, a.PersonId });
+
+ // Attendance has 1 Session, Sessions have many Attendance records
+ HasRequired(a => a.Session)
+ .WithMany(s => s.AttendanceList)
+ .HasForeignKey(a => a.SessionId)
+ .WillCascadeOnDelete(false);
+
+ // Attendance has 1 Person, Persons have many Attendance records
+ HasRequired(a => a.Person)
+ .WithMany(p => p.AttendanceList)
+ .HasForeignKey(a => a.PersonId)
+ .WillCascadeOnDelete(false);
+ }
+ }
+}
View
16 CodeCamper.Data/Configuration/SessionConfiguration.cs
@@ -0,0 +1,16 @@
+using System.Data.Entity.ModelConfiguration;
+using CodeCamper.Model;
+
+namespace CodeCamper.Data
+{
+ public class SessionConfiguration : EntityTypeConfiguration<Session>
+ {
+ public SessionConfiguration()
+ {
+ // Session has 1 Speaker, Speaker has many Session records
+ HasRequired(s => s.Speaker)
+ .WithMany(p => p.SpeakerSessions)
+ .HasForeignKey(s => s.SpeakerId);
+ }
+ }
+}
View
417 CodeCamper.Data/SampleData/CodeCamperDatabaseInitializer.cs
@@ -0,0 +1,417 @@
+using System;
+using System.Collections.Generic;
+using System.Data.Entity;
+using System.Linq;
+using System.Text;
+using CodeCamper.Model;
+
+namespace CodeCamper.Data.SampleData
+{
+ public class CodeCamperDatabaseInitializer :
+ //CreateDatabaseIfNotExists<CodeCamperDbContext> // when model is stable
+ DropCreateDatabaseIfModelChanges<CodeCamperDbContext> // when iterating
+ {
+ private const int AttendeeCount = 1000;
+
+ // I think we can say definitively that EF is NOT a good way to add a lot of new records.
+ // Never has been really. Not built for that.
+ // People should (and do) switch to ADO and bulk insert for that kind of thing
+ // It's really for interactive apps with humans driving data creation, not machines
+ private const int AttendeesWithFavoritesCount = 4;
+
+ protected override void Seed(CodeCamperDbContext context)
+ {
+ // Seed code here
+ var rooms = AddRooms(context);
+ var tracks = AddTracks(context);
+
+ // Keep well-known sessions in separate room from generated sessions
+ _roomsForGeneratedSessions = rooms.Take(tracks.Count).ToList();
+ _roomsForWellKnownSessions = rooms.Skip(tracks.Count).ToList();
+
+ var timeSlots = AddTimeSlots(context);
+ var persons = AddPersons(context, AttendeeCount);
+ AddSessions(context, persons, timeSlots, tracks);
+ AddAttendance(context,
+ persons.Take(AttendeesWithFavoritesCount).ToArray());
+ }
+
+ protected Random Rand = new Random();
+
+ private List<Room> _roomsForGeneratedSessions;
+ private List<Room> _roomsForWellKnownSessions;
+
+ private List<Room> AddRooms(CodeCamperDbContext context)
+ {
+ // Total number of rooms = (number of tracks) + (number of TheChosen people); see note in TheChosen.
+ var names = new[] {
+ // 'Track' rooms (10 in use)
+ "Surf A", "Surf B", "Mendocino A", "Mendocino B", "Mendocino C",
+ "Stromboli", "Chico", "Frisco", "Miami", "Boston",
+ "Venice", "Rome", "Paris", "Madrid", "London",
+ // 'TheChosen' rooms (13 in use)
+ "Levenworth", "Pelham Bay", "San Quentin", "Alcatraz", "Folsom",
+ "Aqueduct", "Saratoga", "Golden Gate", "Santa Anita", "Monmouth Park",
+ "Ossining", "Danbury", "Allenwood", "Lompoc", "La Tuna",
+ "Caliente", "Churchill Downs", "Calder", "Del Mar","Hollywood Park"
+ };
+ var rooms = new List<Room>();
+ Array.ForEach(names, name =>
+ {
+ var item = new Room {Name = name};
+ rooms.Add(item);
+ context.Rooms.Add(item);
+ });
+ context.SaveChanges();
+ return rooms;
+ }
+
+ private TimeSlot _keyNoteTimeSlot;
+ private List<TimeSlot> AddTimeSlots(CodeCamperDbContext context)
+ {
+
+ var seed1 = new DateTime(2013, 5, 18, 8, 0, 0);
+ var seed2 = new DateTime(2013, 5, 19, 8, 0, 0);
+ var slots =
+ new List<TimeSlot>
+ {
+ // Sat May 18, 2013 - Registration
+ new TimeSlot {Start = seed1, Duration = 45, IsSessionSlot = false},
+ (_keyNoteTimeSlot = new TimeSlot {Start = seed1 = seed1.AddMinutes(60), Duration = 60}),
+ new TimeSlot {Start = seed1 = seed1.AddMinutes(70), Duration = 60},
+ new TimeSlot {Start = seed1 = seed1.AddMinutes(70), Duration = 60},
+ // Lunch
+ new TimeSlot {Start = seed1 = seed1.AddMinutes(60), Duration = 60, IsSessionSlot = false},
+ new TimeSlot {Start = seed1 = seed1.AddMinutes(70), Duration = 60},
+ new TimeSlot {Start = seed1 = seed1.AddMinutes(70), Duration = 60},
+ new TimeSlot {Start = seed1 = seed1.AddMinutes(70), Duration = 60},
+ // Close
+ new TimeSlot {Start = seed1.AddMinutes(70), Duration = 30, IsSessionSlot = false},
+
+ // Sun May 19, 2013 - Registration
+ new TimeSlot {Start = seed2, Duration = 45, IsSessionSlot = false},
+ new TimeSlot {Start = seed2 = seed2.AddMinutes(60), Duration = 60},
+ new TimeSlot {Start = seed2 = seed2.AddMinutes(70), Duration = 60},
+ new TimeSlot {Start = seed2 = seed2.AddMinutes(70), Duration = 60},
+ // Lunch
+ new TimeSlot {Start = seed2 = seed2.AddMinutes(70), Duration = 60, IsSessionSlot = false},
+ new TimeSlot {Start = seed2 = seed2.AddMinutes(70), Duration = 60},
+ new TimeSlot {Start = seed2 = seed2.AddMinutes(70), Duration = 60},
+ new TimeSlot {Start = seed2.AddMinutes(70), Duration = 60},
+ };
+
+ slots.ForEach( slot => context.TimeSlots.Add(slot));
+ context.SaveChanges();
+ return slots;
+ }
+
+ private List<Track> AddTracks(CodeCamperDbContext context)
+ {
+ var names= SampleTrack.Names;
+ var tracks = new List<Track>();
+ names.ForEach(name =>
+ {
+ var item = new Track { Name = name };
+ tracks.Add(item);
+ context.Tracks.Add(item);
+ });
+ context.SaveChanges();
+ return tracks;
+ }
+
+ private List<Person> AddPersons(CodeCamperDbContext context, int count)
+ {
+ var persons = new List<Person>();
+ AddKnownAttendees( persons);
+ TheChosen.AddPersons(persons);
+ AddTheCrowd(count, persons);
+ persons.ForEach(p => context.Persons.Add(p));
+ context.SaveChanges();
+ return persons;
+ }
+
+ /// <summary>Add the "well-known" attendees (who will not be speakers)</summary>
+ private void AddKnownAttendees(List<Person> persons)
+ {
+ var bioTextGenerator = new SampleTextGenerator();
+ const SampleTextGenerator.SourceNames bioTextSource =
+ SampleTextGenerator.SourceNames.ChildHarold;
+
+ persons.Add(new Person
+ {
+ FirstName = "Landon",
+ LastName = "Papa",
+ Email = "landon@contoso.com",
+ Blog = "http://johnpapa.net",
+ Twitter = "landonpapa",
+ Gender = "M",
+ ImageSource = "felix_fanboi.jpg",
+ Bio = bioTextGenerator.GenSentences(12, bioTextSource),
+ });
+ persons.Add(new Person
+ {
+ FirstName = "Ella",
+ LastName = "Papa",
+ Email = "ellap@contoso.com",
+ Blog = "http://contoso.com/",
+ Twitter = "ellapapa",
+ Gender = "F",
+ ImageSource = "sue_menot.jpg",
+ Bio = bioTextGenerator.GenSentences(20, bioTextSource),
+ });
+ }
+
+ /// <summary>Add everyone else, some of whom may be speakers.</summary>
+ private void AddTheCrowd(int count, List<Person> persons)
+ {
+ var enumerator = PeopleNames.RandomNameEnumerator();
+ const string netNameFmt = "{0}.{1}{2}";
+ var netNameCounter = 1;
+ var bioTextGenerator = new SampleTextGenerator();
+ const SampleTextGenerator.SourceNames bioTextSource =
+ SampleTextGenerator.SourceNames.TheRaven;
+
+ while (count-- > 0)
+ {
+ enumerator.MoveNext();
+ var name = enumerator.Current;
+
+ var netName = string.Format(netNameFmt, name.First, name.Last, netNameCounter++);
+ var item =
+ new Person
+ {
+ FirstName = name.First,
+ LastName = name.Last,
+ Email = netName+"@contoso.com",
+ Blog = "http://"+netName+"/contoso.com",
+ Twitter = "@"+netName,
+ Gender = name.Gender,
+ Bio = bioTextGenerator.GenSentences(8, bioTextSource),
+ };
+
+ persons.Add(item);
+ }
+ }
+
+ // TODO: We never use this methods
+ // but let's keep it here just in case.
+ private List<Session> AddSessions(
+ CodeCamperDbContext context,
+ IList<Person> persons,
+ IEnumerable<TimeSlot> timeSlots,
+ IList<Track> tracks)
+ {
+ var slots = timeSlots.Where(t => t.IsSessionSlot).ToArray();
+
+ var knownSessions = TheChosen.AddSessions(
+ slots, tracks, _levels, _roomsForWellKnownSessions);
+
+ var sessions = new List<Session>(knownSessions);
+
+ AddGeneratedSessions(sessions, persons, slots , tracks);
+
+ // Done populating sessions
+ sessions.ForEach(s => context.Sessions.Add(s));
+ context.SaveChanges();
+
+ return knownSessions;
+ // return sessions;
+ }
+
+ private readonly string[] _levels = new[] {"Beginner", "Intermediate", "Advanced"};
+
+ private void AddGeneratedSessions(List<Session> sessions, IList<Person> persons, IEnumerable<TimeSlot> timeSlots, IList<Track> tracks)
+ {
+ var textGenerator = new SampleTextGenerator();
+ const SampleTextGenerator.SourceNames descTextSource =
+ SampleTextGenerator.SourceNames.Decameron;
+
+ // levels setup so "intermediate" sessions occur more frequently
+ var levels = new[] { _levels[0], _levels[1], _levels[1], _levels[1], _levels[2] };
+ var levelCount = levels.Length;
+
+ var trackCount = tracks.Count;
+ var trackIx = 0;
+
+ var slots = timeSlots.Where(t => t != _keyNoteTimeSlot).ToArray();
+ var slotsCount = slots.Length;
+
+ var personsCount = persons.Count;
+ const int firstKnownSpeakerIx = 2; // skip the "reserved" attendees who we know are not speakers.
+ const int firstCrowdIx = 4; // first person in the crowd who could be a speaker
+
+ var chosenCount = TheChosen._theChosen.Count();
+
+ var speakerIxs = new List<int>(); // speakers assigned in the current timeslot
+
+
+ // Populate sessions
+ var slotIx = 0; // current slot
+ while (slotIx < slotsCount)
+ {
+ var slot = slots[slotIx];
+
+ // Assign sessions by track, looping through tracks
+ var track = tracks[trackIx];
+ var room = _roomsForGeneratedSessions[trackIx]; // track sessions are in the same room
+
+ // Weight the draw of speakers towards the "well-known" speakers
+ // Ensure a person only speaks once in a timeslot
+ //var speakerIx = Rand.Next(firstKnownSpeakerIx, firstCrowdIx+5);
+ var speakerIx = Rand.Next(firstKnownSpeakerIx, firstKnownSpeakerIx + chosenCount);
+ if (speakerIx >= firstCrowdIx || speakerIxs.Contains(speakerIx))
+ {
+ do
+ {
+ speakerIx = Rand.Next(firstCrowdIx, Math.Min(75, personsCount)); //Max speakers allowed are 75
+ } while (speakerIxs.Contains(speakerIx));
+ }
+ speakerIxs.Add(speakerIx);
+
+ var speaker = persons[speakerIx];
+ var level = levels[Rand.Next(0, levelCount)];
+ var session =
+ new Session
+ {
+ Title = GenerateTitle(track),
+ Code = GenSessionCode(track.Name, level),
+ SpeakerId = speaker.Id,
+ TrackId = track.Id,
+ TimeSlotId = slot.Id,
+ RoomId = room.Id,
+ Level = level,
+ Tags = TagsGenerator.GenTags(track.Name),
+ Description = textGenerator.GenSentences(40, descTextSource),
+ };
+
+ sessions.Add(session);
+
+ // Limit to 110 sessions
+ if (sessions.Count > 110) return;
+
+ if (++trackIx != trackCount) continue;
+
+ // Ran around the tracks; bump to next TimeSlot and reset
+ slotIx++;
+ trackIx = 0;
+ speakerIxs.Clear();
+ }
+ }
+
+ private string GenerateTitle(Track track)
+ {
+ var textGenerator = new SampleTextGenerator();
+ var title = textGenerator.GenWords(2) + " " + track.Name + " " + textGenerator.GenWords(3);
+ var c = title[1];
+ var sb = new StringBuilder();
+ sb.Append(char.ToUpper(c));
+ sb.Append(title.Substring(1));
+ return sb.ToString();
+ }
+
+ private string GenSessionCode(string trackName, string level)
+ {
+ var codeNumber = (100 * Array.IndexOf(_levels, level)) + _sessionCodeNumberSeed++;
+ return SampleTrack.GetCodeRoot(trackName) + codeNumber;
+ }
+ private int _sessionCodeNumberSeed = 142;
+
+ private void AddAttendance(CodeCamperDbContext context, IEnumerable<Person> attendees)
+ {
+ var attendanceList = new List<Attendance>();
+
+ var textGenerator = new SampleTextGenerator();
+ const SampleTextGenerator.SourceNames textSource = SampleTextGenerator.SourceNames.Faust;
+
+ // NEEDED FOR RANDOMIZING WHICH WE NO LONGER DO
+ // Unique TimeSlot.Ids and Ids of Sessions in those slots
+ //var slotAndSessionIds = GetSlotAndSessionIds(sessions);
+ //var numberOfAttendedSessions = Math.Min(slotAndSessionIds.Count(), 8);
+
+ var sids = TheChosen.ChoosenAttendeeSessions
+ .Select(s => s.Id).ToList();
+
+ foreach(var person in attendees)
+ {
+ // NO LONGER RANDOMIZING ASSIGNMENTS
+ //var sids = GetRandomAttendeeSessionIds(
+ // numberOfAttendedSessions,
+ // slotAndSessionIds);
+
+ var evalCount = 4; // person evals the first 'n' sessions attended
+ foreach (var sid in sids)
+ {
+ var attendance =
+ new Attendance
+ {
+ PersonId = person.Id,
+ SessionId = sid,
+ };
+ attendanceList.Add(attendance);
+
+ if (evalCount <= 0) continue;
+
+ attendance.Rating = Rand.Next(1, 6);// rating in 1..5
+ attendance.Text = textGenerator.GenSentences(10, textSource);
+ evalCount--;
+ }
+ }
+
+ // Done populating Attendance
+ attendanceList.ForEach(ps => context.Attendance.Add(ps));
+ context.SaveChanges();
+ }
+
+ // NO LONGER ASSIGNING SESSION ATTENDANCE RANDOMLY
+ #region For Random Session Attendance Assignment
+
+ //private Session _keynoteSession;
+
+ // IF restore this, add the following to Seed()
+ //var knownSessions = AddSessions(context, persons, timeSlots, tracks);
+ //_keynoteSession = knownSessions.First();
+
+ //// Dictionary of non-keynote Session Ids, keyed by TimeSlot id
+ //private Dictionary<int, List<int>> GetSlotAndSessionIds(IEnumerable<Session> sessions)
+ //{
+ // // Unique TimeSlot.Ids and Ids of Sessions in those slots
+ // var slotsAndSessionIds = new Dictionary<int, List<int>>();
+ // sessions
+ // .Where(s => s.Id != _keynoteSession.Id)
+ // .GroupBy(s => s.TimeSlot).ToList()
+ // .ForEach(g =>
+ // slotsAndSessionIds.Add(
+ // g.Key.Id, g.Select(s => s.Id).ToList()));
+
+ // return slotsAndSessionIds;
+ //}
+
+ //// Get "attendedSlots" number of randomly selected sessions
+ //// where each session is in a different TimeSlot
+ //private List<int> GetRandomAttendeeSessionIds(
+ // int attendedSlots, Dictionary<int, List<int>> slotAndSessionIds)
+ //{
+ // // Random list of TimeSlot Ids
+ // var tsids = slotAndSessionIds.Keys
+ // .OrderBy(_ => Guid.NewGuid())
+ // .Take(attendedSlots).ToList();
+
+ // // The list of sessions in those TimeSlots
+ // var sids = new List<int>();
+
+ // // Populate with randomly selected session from each TimeSlot
+ // tsids.ForEach(tsid =>
+ // {
+ // var c = slotAndSessionIds[tsid];
+ // sids.Add(c[Rand.Next(0, c.Count)]);
+ // });
+
+ // // everyone attends the keynote.
+ // sids.Insert(0,_keynoteSession.Id);
+
+ // return sids;
+ //}
+
+ #endregion
+ }
+}
View
437 CodeCamper.Data/SampleData/PeopleNames.cs
@@ -0,0 +1,437 @@
+using System.Collections.Generic;
+
+namespace CodeCamper.Data.SampleData
+{
+ public static class PeopleNames
+ {
+ public enum NameGender
+ {
+ Male,
+ Female,
+ Both,
+ }
+
+ public class Name
+ {
+ public Name()
+ {
+ Gender = "M"; // generated techie person is probably male
+ }
+ public string First { get; set; }
+ public string Last { get; set; }
+ public string Gender { get; set; }
+ }
+
+ public static IEnumerable<Name> GetRandomNames(int count, NameGender nameGender = NameGender.Both)
+ {
+ var enumerator = RandomNameEnumerator(nameGender);
+ while (count-- > 0)
+ {
+ enumerator.MoveNext();
+ yield return enumerator.Current;
+ }
+ }
+
+ // ReSharper disable FunctionNeverReturns
+ // These are enumerators that keep yielding values as long as you ask for them
+ // They never stop returning names; a caller pulls the number of names that it needs.
+
+ public static IEnumerator<Name> RandomNameEnumerator(NameGender nameGender = NameGender.Both)
+ {
+ // If NameGender.Both, alternate between male and female names
+ var isMaleA = nameGender == NameGender.Both || nameGender == NameGender.Male;
+ var isMaleB = nameGender == NameGender.Male;
+
+ var genderA = isMaleA ? "M" : "F";
+ var firstNameEnumeratorA =
+ RandomFirstNameEnumerator((isMaleA) ? NameGender.Male : NameGender.Female);
+
+ var genderB = isMaleB ? "M" : "F";
+ var firstNameEnumeratorB =
+ RandomFirstNameEnumerator((isMaleB) ? NameGender.Male : NameGender.Female);
+
+ var lastNameEnumerator = RandomLastNameEnumerator();
+
+ while (true)
+ {
+ firstNameEnumeratorA.MoveNext();
+ lastNameEnumerator.MoveNext();
+ yield return new Name
+ {
+ First = firstNameEnumeratorA.Current,
+ Last = lastNameEnumerator.Current,
+ Gender = genderA,
+ };
+
+ firstNameEnumeratorB.MoveNext();
+ lastNameEnumerator.MoveNext();
+ yield return new Name
+ {
+ First = firstNameEnumeratorB.Current,
+ Last = lastNameEnumerator.Current,
+ Gender = genderB,
+ };
+ }
+
+ }
+
+ public static IEnumerable<string> GetRandomLastNames(int count)
+ {
+ var enumerator = RandomLastNameEnumerator();
+ while (count-- > 0)
+ {
+ enumerator.MoveNext();
+ yield return enumerator.Current;
+ }
+ }
+
+ public static IEnumerator<string> RandomLastNameEnumerator()
+ {
+ var max = Surnames.Length;
+ var rand = new System.Random();
+
+ while (true)
+ {
+ yield return Surnames[rand.Next(0, max)];
+ }
+ }
+
+ public static IEnumerable<string> GetRandomFirstNames(int count, NameGender nameGender = NameGender.Both)
+ {
+ var enumerator = RandomFirstNameEnumerator(nameGender);
+ while (count-- > 0)
+ {
+ enumerator.MoveNext();
+ yield return enumerator.Current;
+ }
+ }
+
+ public static IEnumerator<string> RandomFirstNameEnumerator(NameGender nameGender = NameGender.Both)
+ {
+ var maleMax = MaleFirstNames.Length;
+ var femaleMax = FemaleFirstNames.Length;
+ var rand = new System.Random();
+
+ while (true)
+ {
+ if (nameGender == NameGender.Male || nameGender == NameGender.Both )
+ yield return MaleFirstNames[rand.Next(0, maleMax)];
+
+ if (nameGender == NameGender.Female || nameGender == NameGender.Both)
+ yield return FemaleFirstNames[rand.Next(0, femaleMax)];
+ }
+ }
+ // ReSharper restore FunctionNeverReturns
+
+ public static string[] FemaleFirstNames = new[]
+ {
+ "Isabella",
+ "Sophia",
+ "Emma",
+ "Olivia",
+ "Colleen",
+ "Emily",
+ "Abigail",
+ "Madison",
+ "Chloe",
+ "Mia",
+ "Addison",
+ "Elizabeth",
+ "Ella",
+ "Natalie",
+ "Samantha",
+ "Alexis",
+ "Lily",
+ "Grace",
+ "Hailey",
+ "Alyssa",
+ "Lillian",
+ "Hannah",
+ "Avery",
+ "Leah",
+ "Nevaeh",
+ "Sofia",
+ "Ashley",
+ "Anna",
+ "Brianna",
+ "Sarah",
+ "Zoe",
+ "Victoria",
+ "Gabriella",
+ "Brooklyn",
+ "Kaylee",
+ "Taylor",
+ "Layla",
+ "Allison",
+ "Evelyn",
+ "Riley",
+ "Amelia",
+ "Khloe",
+ "Makayla",
+ "Aubrey",
+ "Charlotte",
+ "Savannah",
+ "Zoey",
+ "Bella",
+ "Kayla",
+ "Alexa",
+ "Peyton",
+ "Audrey",
+ "Claire",
+ "Arianna",
+ "Julia",
+ "Haley",
+ "Kylie",
+ "Lauren",
+ "Sophie",
+ "Sydney",
+ "Camila",
+ "Jasmine",
+ "Morgan",
+ "Alexandra",
+ "Jocelyn",
+ "Gianna",
+ "Maya",
+ "Kimberly",
+ "Mackenzie",
+ "Katherine",
+ "Destiny",
+ "Brooke",
+ "Trinity",
+ "Faith",
+ "Lucy",
+ "Madelyn",
+ "Madeline",
+ "Bailey",
+ "Payton",
+ "Andrea",
+ "Autumn",
+ "Melanie",
+ "Ariana",
+ "Serenity",
+ "Stella",
+ "Maria",
+ "Molly",
+ "Caroline",
+ "Genesis",
+ "Kaitlyn",
+ "Eva",
+ "Jessica",
+ "Angelina",
+ "Valeria",
+ "Gabrielle",
+ "Naomi",
+ "Mariah",
+ "Natalia",
+ "Paige"
+ };
+
+ public static string[] MaleFirstNames = new[]
+ {
+ "Jacob",
+ "Ethan",
+ "Michael",
+ "Jayden",
+ "William",
+ "Alexander",
+ "Noah",
+ "Daniel",
+ "Aiden",
+ "Anthony",
+ "Joshua",
+ "Mason",
+ "Christopher",
+ "Andrew",
+ "David",
+ "Matthew",
+ "Logan",
+ "Elijah",
+ "James",
+ "Joseph",
+ "Gabriel",
+ "Benjamin",
+ "Ryan",
+ "Samuel",
+ "Jackson",
+ "John",
+ "Nathan",
+ "Jonathan",
+ "Christian",
+ "Liam",
+ "Dylan",
+ "Landon",
+ "Caleb",
+ "Tyler",
+ "Lucas",
+ "Evan",
+ "Gavin",
+ "Nicholas",
+ "Isaac",
+ "Brayden",
+ "Luke",
+ "Angel",
+ "Brandon",
+ "Jack",
+ "Isaiah",
+ "Jordan",
+ "Owen",
+ "Carter",
+ "Connor",
+ "Justin",
+ "Jose",
+ "Jeremiah",
+ "Julian",
+ "Robert",
+ "Aaron",
+ "Adrian",
+ "Wyatt",
+ "Kevin",
+ "Hunter",
+ "Cameron",
+ "Zachary",
+ "Thomas",
+ "Charles",
+ "Austin",
+ "Eli",
+ "Chase",
+ "Henry",
+ "Sebastian",
+ "Jason",
+ "Levi",
+ "Xavier",
+ "Ian",
+ "Colton",
+ "Dominic",
+ "Juan",
+ "Cooper",
+ "Josiah",
+ "Luis",
+ "Ayden",
+ "Carson",
+ "Adam",
+ "Nathaniel",
+ "Brody",
+ "Tristan",
+ "Diego",
+ "Parker",
+ "Blake",
+ "Oliver",
+ "Cole",
+ "Carlos",
+ "Jaden",
+ "Jesus",
+ "Alex",
+ "Aidan",
+ "Eric",
+ "Hayden",
+ "Bryan",
+ "Max",
+ "Jaxon",
+ "Brian"
+ };
+
+ public static string[] Surnames = new[]
+ {
+ "Smith",
+ "Johnson",
+ "Williams",
+ "Jones",
+ "Brown",
+ "Davis",
+ "Miller",
+ "Wilson",
+ "Moore",
+ "Taylor",
+ "Anderson",
+ "Thomas",
+ "Jackson",
+ "White",
+ "Harris",
+ "Martin",
+ "Thompson",
+ "Garcia",
+ "Martinez",
+ "Robinson",
+ "Clark",
+ "Rodriguez",
+ "Lewis",
+ "Lee",
+ "Walker",
+ "Hall",
+ "Allen",
+ "Young",
+ "Hernandez",
+ "King",
+ "Wright",
+ "Lopez",
+ "Hill",
+ "Scott",
+ "Green",
+ "Adams",
+ "Baker",
+ "Gonzalez",
+ "Nelson",
+ "Carter",
+ "Mitchell",
+ "Perez",
+ "Roberts",
+ "Turner",
+ "Phillips",
+ "Campbell",
+ "Parker",
+ "Evans",
+ "Edwards",
+ "Collins",
+ "Stewart",
+ "Sanchez",
+ "Morris",
+ "Rogers",
+ "Reed",
+ "Cook",
+ "Morgan",
+ "Bell",
+ "Murphy",
+ "Bailey",
+ "Rivera",
+ "Cooper",
+ "Richardson",
+ "Cox",
+ "Howard",
+ "Ward",
+ "Torres",
+ "Peterson",
+ "Gray",
+ "Ramirez",
+ "James",
+ "Watson",
+ "Brooks",
+ "Kelly",
+ "Sanders",
+ "Price",
+ "Bennett",
+ "Wood",
+ "Barnes",
+ "Ross",
+ "Henderson",
+ "Coleman",
+ "Jenkins",
+ "Perry",
+ "Powell",
+ "Long",
+ "Patterson",
+ "Hughes",
+ "Flores",
+ "Washington",
+ "Butler",
+ "Simmons",
+ "Foster",
+ "Gonzales",
+ "Bryant",
+ "Alexander",
+ "Russell",
+ "Griffin",
+ "Diaz",
+ "Hayes"
+ };
+ }
+}
View
28 CodeCamper.Data/SampleData/RandomSelector.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+
+namespace CodeCamper.Data.SampleData
+{
+ public static class RandomSelector
+ {
+ public static Random Rand = new Random();
+
+ public static List<T> Deal<T>(IList<T> items, int needed)
+ {
+ var selected = new List<T>();
+
+ var available = items.Count;
+
+ while (selected.Count < needed)
+ {
+ if (Rand.NextDouble() < (double) needed / available)
+ {
+ selected.Add(items[available - 1]);
+ needed--;
+ }
+ available--;
+ }
+ return selected;
+ }
+ }
+}
View
55 CodeCamper.Data/SampleData/SampleTextGenerator.cs
@@ -0,0 +1,55 @@
+namespace CodeCamper.Data.SampleData
+{
+ /// <summary>
+ /// Generate sample text for the database
+ /// </summary>
+ /// <remarks>
+ /// Uses the open source nlipsum "Lorem Ipsum Generator"
+ /// downloaded from here: http://code.google.com/p/nlipsum/
+ /// Licensed under the MIT License here: http://www.opensource.org/licenses/mit-license.php
+ /// </remarks>
+ public class SampleTextGenerator
+ {
+ public string GenWords(int wordCount = 1, SourceNames sourceNames = 0)
+ {
+ var gen = new NLipsum.Core.LipsumGenerator(GetSource(sourceNames), false);
+ return string.Join(" ", gen.GenerateWords(wordCount));
+ }
+
+ public string GenSentences(int sentenceCount=1, SourceNames sourceNames = 0)
+ {
+ var gen = new NLipsum.Core.LipsumGenerator(GetSource(sourceNames), false);
+ return string.Join(" ", gen.GenerateSentences(sentenceCount));
+ }
+
+ /// <summary>
+ /// Original sources of text from which to generate sample text.
+ /// All are out of copyright.
+ /// </summary>
+ public enum SourceNames
+ {
+ LoremIpsum,
+ ChildHarold,
+ TheRaven,
+ Decameron,
+ Faust,
+ }
+
+ protected string GetSource(SourceNames sourceName)
+ {
+ switch (sourceName)
+ {
+ case SourceNames.ChildHarold:
+ return NLipsum.Core.Lipsums.ChildHarold;
+ case SourceNames.TheRaven:
+ return NLipsum.Core.Lipsums.TheRaven;
+ case SourceNames.Decameron:
+ return NLipsum.Core.Lipsums.Decameron;
+ case SourceNames.Faust:
+ return NLipsum.Core.Lipsums.Faust;
+ default:
+ return NLipsum.Core.Lipsums.LoremIpsum;
+ }
+ }
+ }
+}
View
56 CodeCamper.Data/SampleData/SampleTrack.cs
@@ -0,0 +1,56 @@
+using System.Collections.Generic;
+using System.Linq;
+
+namespace CodeCamper.Data.SampleData
+{
+ public class SampleTrack
+ {
+ public static List<SampleTrack> Tracks =
+ new List<SampleTrack>
+ {
+ new SampleTrack("Windows 8", "WIN","Windows", "XAML", "WinRT", "C++", "C#", "VB","HTML5", "Metro"),
+ new SampleTrack("JavaScript", "JVS","JavaScript", "jQuery", "Knockout","JsRender", "MVVM","HTML5", "SPA", "Amplify", "Underscore", "Backbone", "Web"),
+ new SampleTrack("CSS", "CSS","CSS3", "CSS", "Responsive Design", "Bootstrap", "Media Queries", "Web"),
+ new SampleTrack("ASP.NET", "ASP","MVC","Web Matrix","HTML5","SignalR", "Web Forms", "Web", "Web API"),
+ new SampleTrack(".NET", "NET","Memory", "Debugging","WCF", "Silverlight", "WPF", "XAML", "Web"),
+ new SampleTrack("Data", "DAT","Entity Framework", "SQL Server", "OData", "BI", "Oracle", "ORM"),
+ new SampleTrack("Mobile", "MOB","Mobile","WP7", "PhoneGap", "Android", "iPad", "iOS", "Xamarin","Kinect", "XNA", "Web"),
+ new SampleTrack("Cloud", "CLD","Cloud", "Node","Azure","Amazon", "EC2", "Service Bus", "SkyDrive", "Web"),
+ new SampleTrack("Practices", "PRC","Practices", "TFS", "Agility","TDD","Testing", "Mocks", "Scrum", "Lean", "Web"),
+ new SampleTrack("Design", "DSN","Design", "Animation","3D","UX", "Metro", "SketchFlow"),
+ };
+
+ public static List<string> Names { get { return Tracks.Select(t => t.Name).ToList(); } }
+ public static List<string> CodeRoots { get { return Tracks.Select(t => t.CodeRoot).ToList(); } }
+
+ public static SampleTrack GetByName(string trackName)
+ {
+ return Tracks.First(t => t.Name == trackName);
+ }
+
+ public static string GetCodeRoot(string trackName)
+ {
+ return Tracks.Where(t => t.Name == trackName).Select(t => t.CodeRoot).First();
+ }
+
+ public static List<string> GetTags(string trackName = null)
+ {
+ trackName = trackName ?? string.Empty;
+ var trackInfo = Tracks.FirstOrDefault(t => t.Name == trackName);
+ if (trackInfo != null) return trackInfo.Tags;
+ return Tracks.SelectMany(t => t.Tags).ToList();
+ }
+
+ public SampleTrack(string name, string codeRoot, params string[] tags)
+ {
+ Name = name;
+ CodeRoot = codeRoot;
+ Tags = tags.ToList();
+ }
+
+ public string Name { get; set; }
+ public string CodeRoot { get; set; }
+ public List<string> Tags { get; set; }
+
+ }
+}
View
22 CodeCamper.Data/SampleData/TagsGenerator.cs
@@ -0,0 +1,22 @@
+using System;
+
+namespace CodeCamper.Data.SampleData
+{
+ public static class TagsGenerator
+ {
+ public static string TagSeparator = "|";
+
+ public static Random Rand = new Random();
+
+ /// <summary>
+ /// Generate a session tag string for a given track in form of "foo|bar|baz"
+ /// </summary>
+ public static string GenTags(string track = null)
+ {
+ var tagDomain = SampleTrack.GetTags(track);
+ var selected = RandomSelector.Deal(tagDomain, Rand.Next(1, 6));
+ return string.Join(TagSeparator, selected);
+ }
+
+ }
+}
View
880 CodeCamper.Data/SampleData/TheChosen.cs
@@ -0,0 +1,880 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using CodeCamper.Model;
+
+namespace CodeCamper.Data.SampleData
+{
+ public static class TheChosen
+ {
+ public static List<Person> _theChosen;
+ private static Person
+ _johnPapa, _danWahlin, _wardBell, _hansFjallemark,
+ _jimCowart, _ryanNiemeyer, _scottGuthrie, _steveSanderson,
+ _aaronSkonnard, _fritzOnion, _scottHunter, _howardDierking,
+ _madsKristensen, _elijahManor, _johnSmith, _estebanGarcia,
+ _shawnWildermuth, _peteBrown, _timHeuer, _julieLerman,
+ _scottHanselman, _glennBlock, _jesseLiberty, _ericBarnard,
+ _daveWard, _mikeCallaghan;
+
+ /// <summary>Add the Chosen people</summary>
+ public static void AddPersons(List<Person> persons)
+ {
+ _theChosen = new List<Person>();
+
+ _theChosen.Add(_johnPapa = new Person
+ {
+ FirstName = "John",
+ LastName = "Papa",
+ Email = "johnp@contoso.com",
+ Blog = "http://johnp.contoso.com",
+ Twitter = "@john_papa",
+ Gender = "M",
+ Bio = "Husband, father, and Catholic enjoying every minute with my family. Microsoft Regional Director, Evangelist, speaker, author, and Pluralsight trainer.",
+ });
+ _theChosen.Add(_danWahlin =new Person
+ {
+ FirstName = "Dan",
+ LastName = "Wahlin",
+ Email = "danw@contoso.com",
+ Blog = "http://danw.contoso.com",
+ Twitter = "@danwahlin",
+ Gender = "M",
+ Bio = "Chief Architect at Wahlin Consulting. Provide consulting & training on jQuery, HTML5, ASP.NET, SharePoint. Husband & father, like to write and record music.",
+ });
+ _theChosen.Add(_wardBell = new Person
+ {
+ FirstName = "Ward",
+ LastName = "Bell",
+ Email = "wardb@contoso.com",
+ Blog = "http://wardb.contoso.com",
+ Twitter = "@wardbell",
+ Gender = "M",
+ Bio = "V.P. of Technology at IdeaBlade. Speaks often on client application development issues to anyone who will listen. Likes sociology, history, poetry, and ridiculous clothes.",
+ });
+ _theChosen.Add(_hansFjallemark = new Person
+ {
+ FirstName = "Hans",
+ LastName = "Fjällemark",
+ Email = "hansf@contoso.com",
+ Blog = "http://hansf.contoso.com",
+ Twitter = "@hfjallemark",
+ Gender = "M",
+ Bio = "Freelancing developer & designer based in Sweden. I spend most of my time implementing usable and attractive UX in HTML5 or Silverli.. no wait, just HTML5:) ",
+ });
+ _theChosen.Add(_jimCowart = new Person
+ {
+ FirstName = "Jim",
+ LastName = "Cowart",
+ Email = "jimc@contoso.com",
+ Blog = "http://jimc.contoso.com",
+ Twitter = "@ifandelse",
+ Gender = "M",
+ Bio = "Husband, father, architect, developer, tea drinker. Opinions are my own. Unless they're good",
+ });
+ _theChosen.Add(_ryanNiemeyer = new Person
+ {
+ FirstName = "Ryan",
+ LastName = "Niemeyer",
+ Email = "ryann@contoso.com",
+ Blog = "http://ryann.contoso.com/",
+ Twitter = "@rpniemeyer",
+ Gender = "M",
+ Bio = "Coder, tester, father, and husband. Never short on ideas. Love to learn and collaborate.",
+ });
+ _theChosen.Add(_scottGuthrie = new Person
+ {
+ FirstName = "Scott",
+ LastName = "Guthrie",
+ Email = "scottg@contoso.com",
+ Blog = "http://scottg.contoso.com",
+ Twitter = "@scottgu",
+ Gender = "M",
+ Bio = "I live in Seattle and build a few products for Microsoft",
+ });
+ _theChosen.Add(_steveSanderson = new Person
+ {
+ FirstName = "Steve",
+ LastName = "Sanderson",
+ Email = "steves@contoso.com",
+ Blog = "http://steves.contoso.com",
+ Twitter = "@stevensanderson",
+ Gender = "M",
+ Bio = "Also known as Steven Sanderson",
+ });
+ _theChosen.Add(_aaronSkonnard = new Person
+ {
+ FirstName = "Aaron",
+ LastName = "Skonnard",
+ Email = "aarons@contoso.com",
+ Blog = "http://aarons.contoso.com",
+ Twitter = "@skonnard",
+ Gender = "M",
+ Bio = "Changing the way software professionals learn. President/CEO of Pluralsight.",
+ });
+ _theChosen.Add(_fritzOnion = new Person
+ {
+ FirstName = "Fritz",
+ LastName = "Onion",
+ Email = "fritzo@contoso.com",
+ Blog = "http://fritzo.contoso.com",
+ Twitter = "",
+ Gender = "M",
+ Bio = "A co-founder of Pluralsight where he serves as the Editor in Chief.",
+ });
+ _theChosen.Add(_johnSmith = new Person
+ {
+ FirstName = "John",
+ LastName = "Smith",
+ Email = "johns@contoso.com",
+ Blog = "http://johns.contoso.com",
+ Twitter = "@onefloridacoder",
+ Gender = "M",
+ Bio = "Christian .NET Dev & Orlando .NET User Group VP; 4,5,6-string bass player.",
+ });
+ _theChosen.Add(_scottHunter = new Person
+ {
+ FirstName = "Scott",
+ LastName = "Hunter",
+ Email = "scotth@contoso.com",
+ Blog = "http://scotth.contoso.com",
+ Twitter = "@coolcsh",
+ Gender = "M",
+ Bio = "Program Manager at Microsoft on web technologies such as Azure, ASP.NET, MVC, Web API, Entity Framework, NuGet and more...",
+ });
+ _theChosen.Add(_madsKristensen = new Person
+ {
+ FirstName = "Mads",
+ LastName = "Kristensen",
+ Email = "madsk@contoso.com",
+ Blog = "http://madsk.contoso.com",
+ Twitter = "@mkristensen",
+ Gender = "M",
+ Bio = "Program Manager for Microsoft Web Platform & Tools and founder of BlogEngine.NET",
+ });
+ _theChosen.Add(_howardDierking = new Person
+ {
+ FirstName = "Howard",
+ LastName = "Dierking",
+ Email = "howardd@contoso.com",
+ Blog = "http://howardd.contoso.com",
+ Twitter = "@howard_dierking",
+ Gender = "M",
+ Bio = "I like technology...a lot...",
+ });
+ _theChosen.Add(_elijahManor = new Person
+ {
+ FirstName = "Elijah",
+ LastName = "Manor",
+ Email = "elijahm@contoso.com",
+ Blog = "http://elijiahm.contoso.com",
+ Twitter = "@elijahmanor",
+ Gender = "M",
+ Bio = "I am a Christian and a family man. I develops at appendTo as a Senior Architect providing corporate jQuery support, training, and consulting.",
+ });
+ _theChosen.Add(_estebanGarcia = new Person
+ {
+ FirstName = "Esteban",
+ LastName = "Garcia",
+ Email = "estebang@contoso.com",
+ Blog = "http://estebang.contoso.com",
+ Twitter = "@EstebanFGarcia",
+ Gender = "M",
+ Bio = "TFS | Visual Studio ALM Ranger | Scrum | .NET Development | Solutions Architect at @AgileThought | @ONETUG President | UCF Knight",
+ });
+ _theChosen.Add(_shawnWildermuth = new Person
+ {
+ FirstName = "Shawn",
+ LastName = "Wildermuth",
+ Email = "shawnw@contoso.com",
+ Blog = "http://shawnw.contoso.com",
+ Twitter = "@ShawnWildermuth",
+ Gender = "M",
+ Bio = "Author, trainer, software guy, Braves fan, guitar player, Xbox maven, coffee addict and astronomy fan.",
+ });
+ _theChosen.Add(_peteBrown = new Person
+ {
+ FirstName = "Pete",
+ LastName = "Brown",
+ Email = "peteb@contoso.com",
+ Blog = "http://peteb.contoso.com",
+ Twitter = "@Pete_Brown",
+ Gender = "M",
+ Bio = "Microsoft XAML and blinky lights guy. Father of two, author, woodworker, C64.",
+ });
+ _theChosen.Add(_timHeuer = new Person
+ {
+ FirstName = "Tim",
+ LastName = "Heuer",
+ Email = "timh@contoso.com",
+ Blog = "http://timh.contoso.com",
+ Twitter = "@timheuer",
+ Gender = "M",
+ Bio = "I work on XAML client platforms at Microsoft and trying to be the best dad/husband I can be when I'm not working.",
+ });
+ _theChosen.Add(_julieLerman = new Person
+ {
+ FirstName = "Julie",
+ LastName = "Lerman",
+ Email = "juliel@contoso.com",
+ Blog = "http://juliel.contoso.com",
+ Twitter = "@julielerman",
+ Gender = "F",
+ Bio = "Vermont Geekette, .NET (and Entity Framework) Mentor/Consultant, Author, MS MVP, INETA Speaker, Vermont.NET User Group Leader",
+ });
+ _theChosen.Add(_glennBlock = new Person
+ {
+ FirstName = "Glenn",
+ LastName = "Block",
+ Email = "glennb@contoso.com",
+ Blog = "http://glennb.contoso.com",
+ Twitter = "@gblock",
+ Gender = "M",
+ Bio = "Father, Husband, Spiritualist, Software geek, Change agent, REST Head",
+ });
+ _theChosen.Add(_scottHanselman = new Person
+ {
+ FirstName = "Scott",
+ LastName = "Hanselman",
+ Email = "shanselman@contoso.com",
+ Blog = "http://shanselman.contoso.com",
+ Twitter = "@shanselman",
+ Gender = "M",
+ Bio = "Tech, Diabetes, Parenting, Race, Linguistics, Fashion, Podcasting, Open Source, Culture, Code, Ratchet, Phony.",
+ });
+ _theChosen.Add(_jesseLiberty = new Person
+ {
+ FirstName = "Jesse",
+ LastName = "Liberty",
+ Email = "jliberty@contoso.com",
+ Blog = "http://jliberty.contoso.com",
+ Twitter = "@JesseLiberty",
+ Gender = "M",
+ Bio = "Telerik XAML Evangelist",
+ });
+ _theChosen.Add(_ericBarnard = new Person
+ {
+ FirstName = "Eric",
+ LastName = "Barnard",
+ Email = "ebarnard@contoso.com",
+ Blog = "http://ebarnard.contoso.com",
+ Twitter = "@EricBarnard",
+ Gender = "M",
+ Bio = "Technologist and Entrepreneur trying to find my where my path and the world's needs cross",
+ });
+ _theChosen.Add(_daveWard = new Person
+ {
+ FirstName = "Dave",
+ LastName = "Ward",
+ Email = "dward@contoso.com",
+ Blog = "http://dward.contoso.com",
+ Twitter = "@encosia",
+ Gender = "M",
+ Bio = "Microsoft Regional Director",
+ });
+
+ _theChosen.Add(_mikeCallaghan = new Person
+ {
+ FirstName = "Mike",
+ LastName = "Callaghan",
+ Email = "mcallaghan@contoso.com",
+ Blog = "http://mcallaghan.contoso.com",
+ Twitter = "@walkingriver",
+ Gender = "M",
+ Bio = "Mike has been developing software professionally since 1995, primarily in Microsoft environments.",
+ });
+
+
+ _theChosen.ForEach(p => p.ImageSource =
+ (p.FirstName + "_" + p.LastName + ".jpg").ToLowerInvariant());
+
+ _hansFjallemark.ImageSource = "hans_fjallemark.jpg"; // get rid of 'ä'
+
+ persons.AddRange(_theChosen);
+ }
+
+ /**
+ * Hard-coded sessions for TheChoosen people
+ *
+ * Speaker:
+ * Each "Chosen" one gets own variable (e.g., _scottGuthrie)
+ * as assigned in AddPersons method above.
+ * Organize your added sessions by person.
+ *
+ * Rooms:
+ * Each person gets his/her own room (easier to prevent conflicts)
+ * taken from 'roomsForSessions' which are rooms NOT assigned during
+ * session autogeneration; that constraint is obtained by limiting
+ * auto-generation session room assignment to the "Track Set" of rooms,
+ * the first 'n' rooms where 'n'==number of tracks.
+ * The remaining rooms are available for TheChoosen;
+ * (see the 'roomsForSessions' param).
+ * The getRoomId(person) func assigns the next chosen one's room.
+ *
+ * Make sure that the total number of rooms is adequate
+ * (see CodeCamperDatabaseInitializer.cs)
+ *
+ * TimeSlots:
+ * Only 'session' TimeSlots can be assigned (see the 'timeSlots' param).
+ * The first such TimeSlot is the keynote timeslot
+ * which is assigned to Gu's keynote session.
+ * Subsequent addeded sessions are assigned round-robin, in order,
+ * to the non-keynote, session TimeSlots.
+ * (see getNextSpeakerTimeSlotId()).
+ *
+ * Track: Hard coded for each session
+ *
+ * Code:
+ * Each added session gets a 6 char "Code".
+ * The naming convention is
+ * (1-3) are the three char SampleTrack.CodeRoot) +
+ * (4) the level (a number {1..3}) +
+ * (5-6) two arbitrary digits.
+ *
+ * The remaining session values are up to you.
+ *
+ * ChoosenAttendeeSessions:
+ * These are the sessions which are the favorite of the
+ * well-known current user.
+ *
+ * You determine which sessions the current user has
+ * "favorited" (decided to attend) by setting the first
+ * parameter of the addSession method to 'true';
+ * the default is 'false', meaning that session is not
+ * the current user's "favorite."
+ *
+ * For example, Scott Gu's keynote has been favorited.
+ *
+ * EnsureTimeSlotIdIsFree guards against conflicting attendee timeslots
+ *
+ * Logic in CodeCamperDatabaseInitializer.AddAttendance
+ * arbitrarily assigns ratings and evals to the first
+ * 'n' (n==4?) ChoosenAttendeeSessions.
+ */
+ public static List<Session> AddSessions(
+ IList<TimeSlot> timeSlots,
+ IList<Track> tracks,
+ string[] levels,
+ IList<Room> roomsForSessions)
+ {
+
+ var sessions = new List<Session>();
+ ChoosenAttendeeSessions = new List<Session>();
+
+ var choosenAttendeeTimeSlotIds = new List<int>();
+
+ // **Non-keynote** timeslot ids (the 1st is the keynote)
+ var availableTimeSlotIds = timeSlots.Skip(1).Select(ts => ts.Id).ToArray();
+
+ var nextSlotIx = -1;
+ // Deterministic way to get id of next speaker timeslot
+ Func<int> getNextSpeakerTimeSlotId =
+ () =>
+ {
+ if (++nextSlotIx == availableTimeSlotIds.Count()) nextSlotIx = 0;
+ return availableTimeSlotIds[nextSlotIx];
+ };
+
+ Func<Person, int> getRoomId = choosenOne => roomsForSessions[_theChosen.IndexOf(choosenOne) % roomsForSessions.Count].Id;
+
+ // Adds session to Sessions and optionally to ChoosenAttendeeSessions
+ Func<bool, Session, Session> addSession =
+ (choosen, s) =>
+ {
+ sessions.Add(s);
+ if (choosen)
+ {
+ EnsureTimeSlotIdIsFree(choosenAttendeeTimeSlotIds, s, getNextSpeakerTimeSlotId);
+ ChoosenAttendeeSessions.Add(s);
+ }
+ return s;
+ };
+
+ // Scott Guthrie
+ addSession(true, new Session
+ {
+ Title = "Keynote",
+ Code = "KEY001",
+ SpeakerId = _scottGuthrie.Id,
+ TrackId = tracks.First(t => t.Name == ".NET").Id,
+ TimeSlotId = timeSlots[0].Id,
+ RoomId = getRoomId(_scottGuthrie),
+ Level = levels[1],
+ Tags = "Keynote",
+ Description = "Change the World",
+ });
+
+ // John Papa
+ addSession(false, new Session
+ {
+ Title = "Building HTML/JavaScript Apps with Knockout and MVVM",
+ Code = "JVS300",
+ SpeakerId = _johnPapa.Id,
+ TrackId = tracks.First(t => t.Name == "JavaScript").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_johnPapa),
+ Level = levels[2],
+ Tags = "JavaScript|Knockout|MVVM|HTML5|Web",
+ Description =
+ "Do you write a lot of HTML and JavaScript code to push and pull data? In this session, learn popular techniques to use data binding to bind your data to your target controls in HTML writing less code, but gaining more power. See how to consume json data, use json objects in JavaScript, use declarative binding, using KnockoutJS. Also, see how to use the MVVM pattern to write data centric JavaScript code that follows good separation patterns and creates highly maintainable code.",
+ });
+ addSession(false, new Session
+ {
+ Title = "Introduction to Building Windows 8 Metro Applications",
+ Code = "WIN102",
+ SpeakerId = _johnPapa.Id,
+ TrackId = tracks.First(t => t.Name == "Windows 8").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_johnPapa),
+ Level = levels[0],
+ Tags = "Windows|Metro",
+ Description =
+ "This session covers everything you need to know to get started building Metro apps.",
+ });
+
+ // Scott Guthrie
+ addSession(false, new Session
+ {
+ Title = "MVC 4 in Perspective",
+ Code = "ASP162",
+ SpeakerId = _scottGuthrie.Id,
+ TrackId = tracks.First(t => t.Name == "ASP.NET").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_scottGuthrie),
+ Level = levels[1],
+ Tags = "ASP|MVC|Web",
+ Description =
+ "MVC 4 enables a wider variety of web applications than ever before. The libraries that are easily managed through Nuget and are truly opens source. Learn about the new capabilities and how you can contribute to ASP.NET MVC's evolution.",
+ });
+
+ // Julie Lerman
+ addSession(false, new Session
+ {
+ Title = "Entity Framework Code First",
+ Code = "DAT192",
+ SpeakerId = _julieLerman.Id,
+ TrackId = tracks.First(t => t.Name == "Data").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_julieLerman),
+ Level = levels[0],
+ Tags = "Data|Entity Framework|ORM",
+ Description =
+ "Discover how Entity Framework Code First can improve your life!",
+ });
+
+ // Dan Wahlin;
+ addSession(false, new Session
+ {
+ Title = "Building ASP.NET MVC Apps with EF Code First, HTML5, and jQuery",
+ Code = "ASP310",
+ SpeakerId = _danWahlin.Id,
+ TrackId = tracks.First(t => t.Name == "ASP.NET").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_danWahlin),
+ Level = levels[2],
+ Tags = "MVC|HTML5|Entity Framework|jQuery|Web",
+ Description = "This session provides an end-to-end look at building a Web application using several different technologies.",
+ });
+
+ // John Papa
+ addSession(true, new Session
+ {
+ Title = "Build a Custom Single Page Application",
+ Code = "JVS277",
+ SpeakerId = _johnPapa.Id,
+ TrackId = tracks.First(t => t.Name == "JavaScript").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_johnPapa),
+ Level = levels[2],
+ Tags = "Knockout|JavaScript|Web",
+ Description =
+ "Build a SPA, then hang out in one.",
+ });
+ addSession(false, new Session
+ {
+ Title = "JsRender Fundamentals",
+ Code = "JVS201",
+ SpeakerId = _johnPapa.Id,
+ TrackId = tracks.First(t => t.Name == "JavaScript").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_johnPapa),
+ Level = levels[1],
+ Tags = "JavaScript|JsRender|Web",
+ Description =
+ "Learn how to build fast, robust, and maintainable Web applications with JavaScript, jQuery and JsRender: the successor to jQuery Templates.",
+ });
+
+ //Scott Hunter
+ addSession(true, new Session
+ {
+ Title = "Azure: to the Cloud",
+ Code = "CLD163",
+ SpeakerId = _scottHunter.Id,
+ TrackId = tracks.First(t => t.Name == "Cloud").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_scottHunter),
+ Level = levels[1],
+ Tags = "Cloud|Azure|Node|Web",
+ Description = "Windows Azure offers reliable, affordable cloud computing for almost any application of any scale, built with any technology. Scott demonstates with examples of both Windows and non-Windows applications.",
+ });
+
+ // Mads Kristensen
+ addSession(true, new Session
+ {
+ Title = "Be More Productive in Visual Studio 2012",
+ Code = "NET282",
+ SpeakerId = _madsKristensen.Id,
+ TrackId = tracks.First(t => t.Name == ".NET").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_madsKristensen),
+ Level = levels[1],
+ Tags = "Web Forms|ASP|Web|.NET|",
+ Description =
+ "Scale tall buildings, defeat fire breathing dragons, and be more productive in Visual Studio!",
+ });
+
+ // Ward Bell
+ addSession(false, new Session
+ {
+ Title = "Dressing for Success",
+ Code = "DSN320",
+ SpeakerId = _wardBell.Id,
+ TrackId = tracks.First(t => t.Name == "Design").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_wardBell),
+ Level = levels[2],
+ Tags = "Design|Animation|Metro",
+ Description = "You must have style to design with style. A proper wardrobe is an essential first step to application success. Learn to dress from this old pro.",
+ });
+ addSession(false, new Session
+ {
+ Title = "Entity Framework for Poets",
+ Code = "DAT121",
+ SpeakerId = _wardBell.Id,
+ TrackId = tracks.First(t => t.Name == "Data").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_wardBell),
+ Level = levels[0],
+ Tags = "Data|Entity Framework|ORM",
+ Description =
+ "If you can pronounce 'O-R-M', you're on your way to a lucrative career in the fast-paced world of data processing. Discover how Entity Framework can make you a star, in the office and around town.",
+ });
+ addSession(true, new Session
+ {
+ Title = "A JavaScript Toolbox",
+ Code = "JVS222",
+ SpeakerId = _wardBell.Id,
+ TrackId = tracks.First(t => t.Name == "JavaScript").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_wardBell),
+ Level = levels[1],
+ Tags = "JavaScript|Web",
+ Description =
+ "You need a good set of tools to be a rock star JavaScript developer. What does Ward use to write, test and debug? Come to this session and find out.",
+ });
+
+ // Howard Dierking
+ addSession(false, new Session
+ {
+ Title = "ASP.NET MVC 4 Loves HTML5",
+ Code = "ASP333",
+ SpeakerId = _howardDierking.Id,
+ TrackId = tracks.First(t => t.Name == "ASP.NET").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_howardDierking),
+ Level = levels[2],
+ Tags = "MVC|HTML5|Entity Framework|jQuery|Web",
+ Description = "TBD",
+ });
+
+ // Hans Fjällemark
+ addSession(false, new Session
+ {
+ Title = "Bootstrap and Back",
+ Code = "CSS132",
+ SpeakerId = _hansFjallemark.Id,
+ TrackId = tracks.First(t => t.Name == "CSS").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_hansFjallemark),
+ Level = levels[0],
+ Tags = "CSS|Responsive Design|Web",
+ Description =
+ "TBD",
+ });
+ addSession(true, new Session
+ {
+ Title = "Responsive Web Design with CSS3",
+ Code = "CSS233",
+ SpeakerId = _hansFjallemark.Id,
+ TrackId = tracks.First(t => t.Name == "CSS").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_hansFjallemark),
+ Level = levels[1],
+ Tags = "CSS3|Responsive Design|Web",
+ Description =
+ "TBD",
+ });
+
+ // Jim Cowart
+ addSession(false, new Session
+ {
+ Title = "Jim Cowart Underscores",
+ Code = "JVS340",
+ SpeakerId = _jimCowart.Id,
+ TrackId = tracks.First(t => t.Name == "JavaScript").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_jimCowart),
+ Level = levels[2],
+ Tags = "JavaScript|Underscore|jQuery|Web",
+ Description = "TBD",
+ });
+
+ // Eric Barnard
+ addSession(true, new Session
+ {
+ Title = "KnockoutJS Validation",
+ Code = "JVS234",
+ SpeakerId = _ericBarnard.Id,
+ TrackId = tracks.First(t => t.Name == "JavaScript").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_ericBarnard),
+ Level = levels[0],
+ Tags = "Knockout|JavaScript|Web",
+ Description =
+ "This session guides you through model validation with Knockout",
+ });
+
+ // Shawn Wildermuth
+ addSession(false, new Session
+ {
+ Title = "A Better CSS: LESS is More",
+ Code = "CSS142",
+ SpeakerId = _shawnWildermuth.Id,
+ TrackId = tracks.First(t => t.Name == "CSS").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_shawnWildermuth),
+ Level = levels[0],
+ Tags = "CSS|Web",
+ Description =
+ "TBD",
+ });
+
+ // Tim Heuer
+ addSession(true, new Session
+ {
+ Title = "Building Windows 8 Business Apps",
+ Code = "WIN348",
+ SpeakerId = _timHeuer.Id,
+ TrackId = tracks.First(t => t.Name == "Windows 8").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_timHeuer),
+ Level = levels[2],
+ Tags = "Windows 8|XAML|WinRT|Metro|C#",
+ Description =
+ "TBD",
+ });
+
+ // Pete Brown
+ addSession(true, new Session
+ {
+ Title = "Windows 8 Form Factors",
+ Code = "WIN338",
+ SpeakerId = _peteBrown.Id,
+ TrackId = tracks.First(t => t.Name == "Windows 8").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_peteBrown),
+ Level = levels[2],
+ Tags = "Windows 8|XAML|WinRT|Metro|C#",
+ Description =
+ "TBD",
+ });
+
+ // Steve Sanderson
+ addSession(false, new Session
+ {
+ Title = "The Upshot is ...",
+ Code = "JVS250",
+ SpeakerId = _steveSanderson.Id,
+ TrackId = tracks.First(t => t.Name == "JavaScript").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_steveSanderson),
+ Level = levels[2],
+ Tags = "Knockout|JavaScript|Web",
+ Description =
+ "TBD",
+ });
+
+ // Ryan Niemeyer
+ addSession(false, new Session
+ {
+ Title = "Knockout Performance Gotchas",
+ Code = "JVS152",
+ SpeakerId = _ryanNiemeyer.Id,
+ TrackId = tracks.First(t => t.Name == "JavaScript").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_ryanNiemeyer),
+ Level = levels[0],
+ Tags = "Knockout|JavaScript|Web",
+ Description = "TBD",
+ });
+
+ // Jesse Liberty
+ addSession(false, new Session
+ {
+ Title = "Building A Succesful Windows 8 Metro App",
+ Code = "WIN110",
+ SpeakerId = _jesseLiberty.Id,
+ TrackId = tracks.First(t => t.Name == "Windows 8").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_jesseLiberty),
+ Level = levels[1],
+ Tags = "XAML|WinRT|C#|Metro|Windows",
+ Description = "TBD",
+ });
+
+ // Elijiah Manor
+ addSession(false, new Session
+ {
+ Title = "Amplify It!",
+ Code = "JVS271",
+ SpeakerId = _elijahManor.Id,
+ TrackId = tracks.First(t => t.Name == "JavaScript").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_elijahManor),
+ Level = levels[1],
+ Tags = "Amplify|JavaScript|Web",
+ Description = "TBD",
+ });
+
+ // Aaron Skonnard
+ addSession(true, new Session
+ {
+ Title = "Web Services at their Finest",
+ Code = "NET451",
+ SpeakerId = _aaronSkonnard.Id,
+ TrackId = tracks.First(t => t.Name == ".NET").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_aaronSkonnard),
+ Level = levels[2],
+ Tags = "WCF|REST|Web",
+ Description = "TBD",
+ });
+
+ // Fritz Onion
+ addSession(true, new Session
+ {
+ Title = "What's New in the world of UX",
+ Code = "DSN141",
+ SpeakerId = _fritzOnion.Id,
+ TrackId = tracks.First(t => t.Name == "Design").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_fritzOnion),
+ Level = levels[1],
+ Tags = "Design",
+ Description = "TBD",
+ });
+
+ // John Smith
+ addSession(true, new Session
+ {
+ Title = "Azure: 0 to 60",
+ Code = "CLD172",
+ SpeakerId = _johnSmith.Id,
+ TrackId = tracks.First(t => t.Name == "Cloud").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_johnSmith),
+ Level = levels[1],
+ Tags = "ASP.NET|Web|Azure",
+ Description = "TBD",
+ });
+
+ // Esteban Garcia
+ addSession(false, new Session
+ {
+ Title = "TFS For the Win!",
+ Code = "PRC141",
+ SpeakerId = _estebanGarcia.Id,
+ TrackId = tracks.First(t => t.Name == "Practices").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_estebanGarcia),
+ Level = levels[0],
+ Tags = "TFS|Practices",
+ Description =
+ "TBD",
+ });
+
+ // Glenn BLock
+ addSession(true, new Session
+ {
+ Title = "Web API Best Practices",
+ Code = "ASP245",
+ SpeakerId = _glennBlock.Id,
+ TrackId = tracks.First(t => t.Name == "ASP.NET").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_glennBlock),
+ Level = levels[1],
+ Tags = "ASP.NET|Web|Web API",
+ Description = "TBD",
+ });
+
+ // Dave Ward
+ addSession(true, new Session
+ {
+ Title = "RPC and REST with Web API",
+ Code = "ASP285",
+ SpeakerId = _daveWard.Id,
+ TrackId = tracks.First(t => t.Name == "ASP.NET").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_daveWard),
+ Level = levels[1],
+ Tags = "ASP.NET|Web|Web API",
+ Description = "TBD",
+ });
+
+ // Scott Hanselman
+ addSession(true, new Session
+ {
+ Title = "NuGet Package Management",
+ Code = "PRC150",
+ SpeakerId = _scottHanselman.Id,
+ TrackId = tracks.First(t => t.Name == "Practices").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_scottHanselman),
+ Level = levels[1],
+ Tags = "NuGet",
+ Description = "TBD",
+ });
+
+ // Mike Callaghan
+ addSession(true, new Session
+ {
+ Title = "Database CRUD using SignalR",
+ Code = "ASP129",
+ SpeakerId = _mikeCallaghan.Id,
+ TrackId = tracks.First(t => t.Name == "ASP.NET").Id,
+ TimeSlotId = getNextSpeakerTimeSlotId(),
+ RoomId = getRoomId(_mikeCallaghan),
+ Level = levels[1],
+ Tags = "Web | SignalR",
+ Description = "Learn how to build a multidimensional universal transporter using SignalR. Not really ... but we will cover some cool SignalR code.",
+ });
+
+ return sessions;
+ }
+
+ public static List<Session> ChoosenAttendeeSessions { get; private set; }
+
+ private static void EnsureTimeSlotIdIsFree(List<int> usedAttendeeSlots, Session session, Func<int> getNextTimeSlotId)
+ {
+ var origSlot = session.TimeSlotId;
+ var slot = origSlot;
+ while (usedAttendeeSlots.Contains(slot))
+ {
+ slot = getNextTimeSlotId();
+ if (origSlot == slot) return; // couldn't find a free slot
+ session.TimeSlotId = slot;
+ }
+ usedAttendeeSlots.Add(slot); // used a free slot
+ }
+ }
+}
View
1 CodeCamper.Model/CodeCamper.Model.csproj
@@ -31,6 +31,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
View
12 CodeCamper.Web.sln
@@ -3,16 +3,28 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Web
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeCamper.Web", "CodeCamper.Web\CodeCamper.Web.csproj", "{96511E6F-DD27-44A8-AD7E-002699F5AE87}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeCamper.Model", "CodeCamper.Model\CodeCamper.Model.csproj", "{353810B1-C8CB-4A8B-86BC-F74929A1BF57}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeCamper.Data", "CodeCamper.Data\CodeCamper.Data.csproj", "{CFB5CCDB-8F5F-4F67-8F7F-E571523ED384}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {353810B1-C8CB-4A8B-86BC-F74929A1BF57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {353810B1-C8CB-4A8B-86BC-F74929A1BF57}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {353810B1-C8CB-4A8B-86BC-F74929A1BF57}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {353810B1-C8CB-4A8B-86BC-F74929A1BF57}.Release|Any CPU.Build.0 = Release|Any CPU
{96511E6F-DD27-44A8-AD7E-002699F5AE87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{96511E6F-DD27-44A8-AD7E-002699F5AE87}.Debug|Any CPU.Build.0 = Debug|Any CPU
{96511E6F-DD27-44A8-AD7E-002699F5AE87}.Release|Any CPU.ActiveCfg = Release|Any CPU
{96511E6F-DD27-44A8-AD7E-002699F5AE87}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CFB5CCDB-8F5F-4F67-8F7F-E571523ED384}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CFB5CCDB-8F5F-4F67-8F7F-E571523ED384}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CFB5CCDB-8F5F-4F67-8F7F-E571523ED384}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CFB5CCDB-8F5F-4F67-8F7F-E571523ED384}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
View
30 CodeCamper.Web/CodeCamper.Web.csproj
@@ -160,14 +160,18 @@
<Content Include="Content\themes\base\jquery.ui.slider.css" />
<Content Include="Content\themes\base\jquery.ui.tabs.css" />
<Content Include="Content\themes\base\jquery.ui.theme.css" />
+ <Content Include="Content\toastr-responsive.css" />
+ <Content Include="Content\toastr.css" />
<Content Include="favicon.ico" />
<Content Include="Global.asax" />
- <None Include="Scripts\jquery-1.6.2-vsdoc.js" />
- <Content Include="Scripts\jquery-1.6.2.js" />
- <Content Include="Scripts\jquery-1.6.2.min.js">
- <DependentUpon>jquery-1.6.2.js</DependentUpon>
- </Content>
<None Include="Scripts\jquery.validate-vsdoc.js" />
+ <None Include="Scripts\jquery-1.8.1.intellisense.js">
+ <DependentUpon>jquery-1.8.1.js</DependentUpon>
+ </None>
+ <Content Include="Scripts\jquery-1.8.1.js" />
+ <Content Include="Scripts\jquery-1.8.1.min.js">
+ <DependentUpon>jquery-1.8.1.js</DependentUpon>
+ </Content>
<Content Include="Scripts\jquery-ui-1.8.11.js" />
<Content Include="Scripts\jquery-ui-1.8.11.min.js">
<DependentUpon>jquery-ui-1.8.11.js</DependentUpon>
@@ -184,9 +188,10 @@
<Content Include="Scripts\jquery.validate.unobtrusive.min.js">
<DependentUpon>jquery.validate.unobtrusive.js</DependentUpon>
</Content>
- <Content Include="Scripts\knockout-2.0.0.debug.js" />
- <Content Include="Scripts\knockout-2.0.0.js" />
+ <Content Include="Scripts\knockout-2.1.0.debug.js" />
+ <Content Include="Scripts\knockout-2.1.0.js" />
<Content Include="Scripts\modernizr-2.0.6-development-only.js" />
+ <Content Include="Scripts\toastr.js" />
<Content Include="Web.config" />
<Content Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
@@ -223,11 +228,20 @@
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
- <Folder Include="Models\" />
</ItemGroup>
<ItemGroup>
<Content Include="packages.config" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\CodeCamper.Data\CodeCamper.Data.csproj">
+ <Project>{cfb5ccdb-8f5f-4f67-8f7f-e571523ed384}</Project>
+ <Name>CodeCamper.Data</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\CodeCamper.Model\CodeCamper.Model.csproj">
+ <Project>{353810b1-c8cb-4a8b-86bc-f74929a1bf57}</Project>
+ <Name>CodeCamper.Model</Name>
+ </ProjectReference>
+ </ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
View
1 CodeCamper.Web/Web.config
@@ -10,6 +10,7 @@
</configSections>
<connectionStrings>
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-CodeCamper.Web-20120916165257;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-CodeCamper.Web-20120916165257.mdf" />
+ <add name="CodeCamper" connectionString="Data Source=MACBOOK-PC\SQLEXPRESS;Initial Catalog=CodeCamper;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
View
BIN LIB/NLipsum.Core.dll
Binary file not shown.

0 comments on commit f672c64

Please sign in to comment.
Something went wrong with that request. Please try again.