Inheritance: IAmPersistable
Ejemplo n.º 1
0
 public ActionResult Create(Retreat retreatModel)
 {
     if (!ModelState.IsValid)
         return View();
     _retreatRepository.Add(retreatModel);
     return this.RedirectToAction(c => c.Index(retreatModel.Id));
 }
        static string[] GetAvailableBedCodes(Bed bed, Retreat retreat, IEnumerable<Bed> beds)
        {
            var bedcodes = retreat.GetUnassignedBeds(beds).Select(x => x.Code).ToArray();
            if (bed != null) bedcodes = new[] { bed.Code }.Concat(bedcodes).ToArray();

            return bedcodes;
        }
Ejemplo n.º 3
0
        static void FillRetreat(Retreat retreat)
        {
            for (int x = 0; x < 29; x++)
            {
                var bed = new Bed { Code = "bedcode" + x };
                var participant = new Participant();

                retreat.AddParticipant(participant, bed);
            }
        }
Ejemplo n.º 4
0
 public void AddRetreatLines(StringBuilder sb, Retreat retreat)
 {
     AddReportLine(sb,
                 "Name/ContactInfo",
                 "NOTES",
                 "Special Notes: Alergies/Dietary and Mobility Issues",
                 "Room Assignment");
     foreach (var reg in retreat.Registrations)
     {
         AddReportLine(sb,
             reg.Participant.FirstName + " " + reg.Participant.LastName,
             string.Empty,
             reg.Participant.Notes,
             reg.Bed.Code);
     }
 }
Ejemplo n.º 5
0
 public ActionResult Create(Retreat viewModel)
 {
     var result = _commandInvoker.Invoke(viewModel,
                                         typeof(CreateRetreatCommand),
                                         () => this.RedirectToAction(c => c.Index(viewModel.Id)),
                                         () => this.RedirectToAction(c => c.Index(viewModel.Id)),
                                         ModelState);
     return result;
 }
Ejemplo n.º 6
0
 public void Save(Retreat retreat)
 {
     _session.SaveOrUpdate(retreat);
     _session.Flush();
 }
Ejemplo n.º 7
0
 void IRetreatRepository.Add(Retreat retreat)
 {
     _session.Save(retreat);
     _session.Flush();
 }
Ejemplo n.º 8
0
 Uri BuildDeleteLink(Retreat retreat, Participant participant)
 {
     // TODO: should have a delete view model here instead?
     return _urlMapper.MapAction<ParticipantController>(
         x => x.DeleteFromRetreat(
             retreat.Id,
             retreat.StartDate,
             participant.Id,
             participant.FirstName,
             participant.LastName));
 }
Ejemplo n.º 9
0
 Uri AddParticipantLinkForRetreat(Retreat retreat)
 {
     return _urlMapper.MapAction<ParticipantController>(
         x => x.AddToRetreat(retreat.Id));
 }
Ejemplo n.º 10
0
        string GenerateReportHtmlForRetreat(Retreat retreat, string seed)
        {
            if (retreat != null)
            {

                seed += string.Format(_reportHtmlRetreatInfo, retreat.StartDate.ToLongDateString(), retreat.Description);

                seed = retreat.Registrations.OrderBy(x=>x.Bed == null ? "waitlist" : x.Bed.Code).Aggregate(seed, (memo, r) =>
                {
                    var name = r.Participant.FirstName + " " + r.Participant.LastName;
                    var notes = r.Participant.Notes == null ? string.Empty : r.Participant.Notes;
                    var bedCode = r.Bed == null ? "waitlist" : r.Bed.Code;
                    var color = bedCode.StartsWith("waitlist") ? "gray" :
                        bedCode.StartsWith("CS") ? "rose" :
                        bedCode.StartsWith("L") ? "blue" :
                        bedCode.StartsWith("GH") ? "orange" :
                        "green";
                    return memo + string.Format(_reportHtmlRegistrationInfo, name, notes.Replace("\n", "<br />"), color, bedCode);
                });

            }
            return seed;
        }