Inheritance: IAmPersistable
示例#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;
        }
        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);
            }
        }
 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);
     }
 }
示例#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;
 }
示例#6
0
 public void Save(Retreat retreat)
 {
     _session.SaveOrUpdate(retreat);
     _session.Flush();
 }
示例#7
0
 void IRetreatRepository.Add(Retreat retreat)
 {
     _session.Save(retreat);
     _session.Flush();
 }
示例#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));
 }
示例#9
0
 Uri AddParticipantLinkForRetreat(Retreat retreat)
 {
     return _urlMapper.MapAction<ParticipantController>(
         x => x.AddToRetreat(retreat.Id));
 }
        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;
        }