public ActionResult Index(FormCollection collection)
 {
     if (!AttendeeRegistrationIsOpen())
     {
         return View("RegistrationClosed");
     }
     var newAttendee = new Attendee();
     // This will try to update all the fields in the model based on the form collection
     if (TryUpdateModel(newAttendee, "Attendee", collection))
     {
         _repository.AddAttendee(newAttendee);
         _repository.Save();
         SettingsData settings = SettingsData.Default;
         //TODO: localize string replacement
         var message = new MailMessage(settings.EmailFrom,
                                       newAttendee.People.email,
                                       settings.RegistrationSubject,
                                       settings.RegistrationMessage.Replace(
                                         "{name}", newAttendee.People.name).Replace(
                                             "{role}", "Attendee"));
         try
         {
             Mailer.Send(message);
         }
         catch
         {
             //TODO: log this
         }
         return RedirectToAction("Success");
     }
     // TODO: make validation messages show
     // this isn't showing error messages; eventually that should be investigated
     AttendeeEditData data = MakeEditDateFromAttendee(newAttendee);
     return RedirectToAction("Index", data);
 }
 public ActionResult Create(FormCollection collection)
 {
     var newAttendee = new Attendee();
     // This will try to update all the fields in the model based on the form collection
     if (TryUpdateModel(newAttendee, "Attendee", collection))
     {
         _repository.AddAttendee(newAttendee);
         _repository.Save();
         return RedirectToAction("Index");
     }
     AttendeeEditData data = MakeEditDateFromAttendee(newAttendee);
     return View("Create", data);
 }
示例#3
0
 public void RegisterAttendeeForEvent(Attendee attendee, Event ev)
 {
     var eva = new EventsAttendee();
     eva.Attendee = attendee;
     eva.Event = ev;
     ev.EventsAttendees.Insert(0, eva);
     attendee.EventsAttendees.Insert(0, eva);
 }
示例#4
0
 public void UnRegisterAttendeeForEvent(Attendee attendee, Event ev)
 {
     throw new NotImplementedException();
 }
示例#5
0
        public void AddAttendee(Attendee attendee)
        {
            if (attendee.People == null)
                attendee.People = new People();

            attendee.People.id = ++_personMaxId;
            // this does not cause person_id to be set
            _attendees.Add(attendee);
        }
示例#6
0
 public void DeleteAttendee(Attendee attendee)
 {
     _attendees.Remove(attendee);
 }
 partial void UpdateAttendee(Attendee instance);
 private FormCollection ConvertAttendeeToFormCollection(Attendee attendee)
 {
     var fc = new FormCollection();
     fc.Add("person_id", attendee.person_id.ToString());
     fc.Add("People_name", attendee.People.name);
     fc.Add("People_email", attendee.People.email);
     fc.Add("People_phone_number", attendee.People.phone_number.ToString());
     fc.Add("tshirt_id", attendee.tshirt_id.ToString());
     fc.Add("food_choice_id", attendee.food_choice_id.ToString());
     fc.Add("People_is_alum", attendee.People.is_alum.ToString());
     return fc;
 }
 public void RegisterAttendeeForEvent(Attendee attendee, Event ev)
 {
     EventsAttendee eva =
         _conferenceware.EventsAttendees.SingleOrDefault(
             x => x.Attendee == attendee && x.Event == ev);
     if (eva == null)
     {
         eva = new EventsAttendee { Attendee = attendee, Event = ev };
         _conferenceware.EventsAttendees.InsertOnSubmit(eva);
     }
 }
 /// <summary>
 /// This method creates some data for the AttendeeRegistration Form inside the view 
 /// </summary>
 /// <param name="attendee">The attendee to put in the edit data</param>
 /// <returns>An AttendeeEditData object containing the Attendee</returns>
 private AttendeeEditData MakeEditDateFromAttendee(Attendee attendee)
 {
     return new AttendeeEditData
             {
                 Attendee = attendee,
                 Foods = new SelectList(_repository.GetAllFoods(), "id", "name"),
                 TShirtSizes =
                     new SelectList(_repository.GetAllTShirtSizes(), "id", "name")
             };
 }
 public void DeleteAttendee(Attendee attendee)
 {
     DeletePerson(attendee.person_id);
     _conferenceware.Attendees.DeleteOnSubmit(attendee);
 }
 public void AddAttendee(Attendee attendee)
 {
     _conferenceware.Attendees.InsertOnSubmit(attendee);
 }
		private void detach_Attendees(Attendee entity)
		{
			this.SendPropertyChanging();
			entity.Food = null;
		}
		private void attach_Attendees(Attendee entity)
		{
			this.SendPropertyChanging();
			entity.Food = this;
		}
 partial void DeleteAttendee(Attendee instance);
 private static bool EqualAttendees(Attendee item1, Attendee item2)
 {
     return EqualPeople(item1.People, item2.People)
            && item1.tshirt_id == item2.tshirt_id
            && item1.food_choice_id == item2.food_choice_id;
 }
		private void detach_Attendees(Attendee entity)
		{
			this.SendPropertyChanging();
			entity.TShirtSize = null;
		}
 /// <summary>
 /// Creates third tshirt example
 /// </summary>
 /// <returns>Example location 3</returns>
 private static Attendee GenerateNewAttendee3()
 {
     var item = new Attendee
                 {
                     Food = new Food
                             {
                                 name = "Regular3"
                             },
                     TShirtSize = new TShirtSize
                                     {
                                         name = "Medium3"
                                     },
                     People = new People
                                 {
                                     email = "*****@*****.**",
                                     is_alum = true,
                                     name = "name3",
                                     phone_number = "555-555-5555"
                                 }
                 };
     return item;
 }
        public void Initialize()
        {
            _repository = new TestRepository();

            attendee1 = new Attendee
            {
                person_id = 1,
                People = new People
                {
                    name = "John Dickface",
                    phone_number = "309-867-5309",
                    is_alum = false,
                    email = "*****@*****.**"
                },
                tshirt_id = 1,
                food_choice_id = 1
            };
        }
 public void UnRegisterAttendeeForEvent(Attendee attendee, Event ev)
 {
     EventsAttendee eva =
         _conferenceware.EventsAttendees.SingleOrDefault(
             x => x.Attendee == attendee && x.Event == ev);
     _conferenceware.EventsAttendees.DeleteOnSubmit(eva);
 }
 partial void InsertAttendee(Attendee instance);