public static VolunteerEditData CreateEditDataFromVolunteer(
			Volunteer volunteer, IRepository repo)
        {
            var ved = new VolunteerEditData
                        {
                            Volunteer = volunteer,
                            VolunteerTimeSlots = repo.GetAllVolunteerTimeSlots(),
                            ChosenTimeSlots =
                                new int[volunteer.VolunteersVolunteerTimeSlots.Count],
                            Foods = new SelectList(repo.GetAllFoods(), "id", "name"),
                            TShirtSizes =
                                new SelectList(repo.GetAllTShirtSizes(), "id", "name")
                        };
            for (int i = 0; i < volunteer.VolunteersVolunteerTimeSlots.Count; i++)
            {
                ved.ChosenTimeSlots[i] =
                    volunteer.VolunteersVolunteerTimeSlots.ElementAt(i).volunteer_timeslot_id;
            }
            return ved;
        }
 //TODO: make scheduling interface for volunteers and events
 private String GetMessageForVolunteer(Volunteer vol)
 {
     if (vol.NeedsVideoTraining)
     {
         return GetVideoMessageForVolunteer(vol);
     }
     return GetRegularMessageForVolunteer(vol);
 }
 private static string GetVideoMessageForVolunteer(Volunteer vol)
 {
     var sd = SettingsData.Default;
     var message =
         new StringBuilder(String.Format(sd.VolunteerScheduleEmailOpening,
                                         vol.People.name,
                                         "Video")); //TODO: localize
     message.AppendLine();
     foreach (var vvts in vol.VolunteersVolunteerTimeSlots.Where(x => x.is_confirmed))
     {
         var vts = vvts.VolunteerTimeSlot;
         var format = vts.is_video
                      	? sd.VolunteerScheduleEmailVideoTimeSlotFormatString
                      	: sd.VolunteerScheduleEmailRegularTimeSlotFormatString;
         message.AppendFormat(format,
                              vts.TimeSlot.start_time.ToString("D"),
                              vts.TimeSlot.start_time.ToString("t"),
                              vts.TimeSlot.end_time.ToString("t"),
                              vvts.comment);
         message.AppendLine();
     }
     message.AppendLine(
         sd.VolunteerScheduleEmailExtraInformationForVideoVolunteers);
     message.Append(sd.VolunteerScheduleEmailClosing);
     return message.ToString();
 }
示例#4
0
 public void DeleteVolunteer(Volunteer v)
 {
     _volunteers.Remove(v);
 }
示例#5
0
 public void UnRegisterVolunteerForVolunteerTimeSlot(Volunteer v, VolunteerTimeSlot vts)
 {
     throw new NotImplementedException();
 }
        public void UnRegisterVolunteerForVolunteerTimeSlot(Volunteer v,
															VolunteerTimeSlot vts)
        {
            // there appears to be a weird race condition here where if someone times it just right
            // or is editted just right, they can actually get registered for something twice
            // that would cause this to blow up if we look for SingleOrDefault
            IEnumerable<VolunteersVolunteerTimeSlot> vvtss =
                _conferenceware.VolunteersVolunteerTimeSlots.Where(
                    x => x.Volunteer == v && x.VolunteerTimeSlot == vts);
            _conferenceware.VolunteersVolunteerTimeSlots.DeleteAllOnSubmit(vvtss);
        }
示例#7
0
 public void AddVolunteer(Volunteer v)
 {
     v.People.id = ++_personMaxId;
     _volunteers.Add(v);
 }
 public void DeleteVolunteer(Volunteer v)
 {
     _conferenceware.Volunteers.DeleteOnSubmit(v);
 }
        public void RegisterVolunteerForVolunteerTimeSlot(Volunteer v,
														  VolunteerTimeSlot vts)
        {
            if (_conferenceware.VolunteersVolunteerTimeSlots.SingleOrDefault(x =>
                                                                             x.Volunteer ==
                                                                             v &&
                                                                             x.
                                                                                VolunteerTimeSlot ==
                                                                             vts) == null)
            {
                var vvts = new VolunteersVolunteerTimeSlot
                            {
                                Volunteer = v,
                                VolunteerTimeSlot = vts,
                                comment = ""
                            };
                _conferenceware.VolunteersVolunteerTimeSlots.InsertOnSubmit(vvts);
            }
        }
 partial void DeleteVolunteer(Volunteer instance);
 public void AddVolunteer(Volunteer v)
 {
     _conferenceware.Volunteers.InsertOnSubmit(v);
 }
 partial void UpdateVolunteer(Volunteer instance);
 partial void InsertVolunteer(Volunteer instance);
		private void detach_Volunteers(Volunteer entity)
		{
			this.SendPropertyChanging();
			entity.Food = null;
		}
		private void attach_Volunteers(Volunteer entity)
		{
			this.SendPropertyChanging();
			entity.Food = this;
		}
		private void attach_Volunteers(Volunteer entity)
		{
			this.SendPropertyChanging();
			entity.TShirtSize = this;
		}