public static void SaveDailyReflectionReflection(int reflectionId, string title, string content) { var service = new DailyReflectionReflectionService(); if (service.UserHasReflection(Auth.user().Id, reflectionId)) { var dailyReflectionReflection = new DailyReflectionReflection { UserId = Auth.user().Id, DailyReflectionId = reflectionId, Title = title, ReflectionContent = content }; if (string.IsNullOrWhiteSpace(title) && string.IsNullOrWhiteSpace(content)) { service.Delete(dailyReflectionReflection); } else { service.Update(reflectionId, dailyReflectionReflection); } } else { var dailyReflectionReflection = new DailyReflectionReflection { UserId = Auth.user().Id, DailyReflectionId = reflectionId, Title = title, ReflectionContent = content }; service.Create(dailyReflectionReflection); } }
public static List <DailyReflectionReflection> GetReflectionReflections() { var service = new DailyReflectionReflectionService(); return(service.Get(Auth.user().Id)); }
public static DailyReflectionReflection GetUserReflection(int reflectionId) { var service = new DailyReflectionReflectionService(); return(service.GetUserReflection(Auth.user().Id, reflectionId)); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DateTime reflectionDate; if (Request["date"] != null) { reflectionDate = Convert.ToDateTime(Request["date"]); } else { reflectionDate = DateTime.Now; } var reflection = GetReflection(reflectionDate); ReflectionID.Value = reflection.Id.ToString(); SourceContent.InnerHtml = reflection.Source; ReflectionDate.InnerHtml = reflection.DateOfReflection.DayOfWeek + ", " + reflection.DateOfReflection.ToString("MMMM dd, yyyy"); FirstTitle.InnerHtml = reflection.FirstContentTitle; FContent.InnerHtml = reflection.FirstContent; SCTitle.InnerHtml = reflection.SecondContentTitle; SContent.InnerHtml = reflection.SecondContent; TCTitle.InnerHtml = reflection.ThirdContentTitle; TContent.InnerHtml = reflection.ThirdContent; FTitle.InnerHtml = reflection.FourthContentTitle; FTContent.InnerHtml = reflection.FourthContent; FiveTitle.InnerHtml = reflection.FifthContentTitle; FiveContent.InnerHtml = reflection.FifthContent; SixTitle.InnerHtml = reflection.SixthContentTitle; SixContent.InnerHtml = reflection.SixthContent; PContent.InnerHtml = reflection.Prayer; if (reflection.SecondContentTitle == "") { SecondContent.Attributes.Add("style", "display:none"); } else { SecondContent.Attributes.Add("style", "display:block"); } if (reflection.SecondContent == "") { SecondContent.Attributes.Add("style", "display:none"); } else { SecondContent.Attributes.Add("style", "display:block"); } if (reflection.ThirdContentTitle == "") { ThirdContent.Attributes.Add("style", "display:none"); } else { ThirdContent.Attributes.Add("style", "display:block"); } if (reflection.ThirdContent == "") { ThirdContent.Attributes.Add("style", "display:none"); } else { ThirdContent.Attributes.Add("style", "display:block"); } if (reflection.FourthContentTitle == "") { FourthContent.Attributes.Add("style", "display:none"); } else { FourthContent.Attributes.Add("style", "display:block"); } if (reflection.FourthContent == "") { FourthContent.Attributes.Add("style", "display:none"); } else { FourthContent.Attributes.Add("style", "display:block"); } if (reflection.FifthContentTitle == "") { FifthContent.Attributes.Add("style", "display:none"); } else { FifthContent.Attributes.Add("style", "display:block"); } if (reflection.FifthContent == "") { FifthContent.Attributes.Add("style", "display:none"); } else { FifthContent.Attributes.Add("style", "display:block"); } if (reflection.SixthContentTitle == "") { SixthContent.Attributes.Add("style", "display:none"); } else { SixthContent.Attributes.Add("style", "display:block"); } if (reflection.SixthContent == "") { SixthContent.Attributes.Add("style", "display:none"); } else { SixthContent.Attributes.Add("style", "display:block"); } DateTime VerseDate; if (Request["date"] != null) { VerseDate = Convert.ToDateTime(Request["date"]); } else { VerseDate = DateTime.Now; } var verse = GetVerse(VerseDate); BibleQuote.InnerHtml = verse.BibleVerseContent; BibleVerse.InnerHtml = verse.ChapterTitle; DateTime QuoteDate; if (Request["date"] != null) { QuoteDate = Convert.ToDateTime(Request["date"]); } else { QuoteDate = DateTime.Now; } var quote = GetQuote(QuoteDate); RelQuote.InnerHtml = quote.Quote; Author.InnerHtml = quote.Author; var reflectionService = new DailyReflectionReflectionService(); if (reflectionService.UserHasReflection(Auth.user().Id, reflection.Id)) { var reflectionInstance = reflectionService.GetUserReflection(Auth.user().Id, reflection.Id); DReflectTitle.Value = reflectionInstance.Title; DReflectContent.Value = reflectionInstance.ReflectionContent; } } }