public ActionResult FullArticle(string id) { db = new RobinsonsDBContext(); dynamic fullarticle = new ExpandoObject(); try { if (!string.IsNullOrEmpty(id)) { var content = (from c in db.Contents where c.Id == new Guid(id) select c).First(); fullarticle.Content = content; var template = (from t in db.Templates where t.Id == new Guid(content.TemplateId) select t).First(); fullarticle.Template = template; } } catch { fullarticle.Template = new Templates(); fullarticle.Content = new Contents(); } return(View(fullarticle)); }
public ActionResult Index() { db = new RobinsonsDBContext(); dynamic homepage = new ExpandoObject(); /*var template = (from t in db.Templates * where t.Name == "Events and Promos" * select t.Id).AsEnumerable().Select(x => new SelectListItem { Text = x.ToString(), Value = x.ToString() });*/ var contents = from c in db.Contents where c.IsPublished == true && c.IncludeInHomePage == true && c.IsDeleted == false orderby c.Sequence select c; homepage.Contents = contents; var sliders = from s in db.Sliders where s.IsDeleted == false orderby s.Sequence select s; homepage.Sliders = sliders; return(View(homepage)); }
public ActionResult RobinsonsStores(string id) { db = new RobinsonsDBContext(); dynamic articles = new ExpandoObject(); try { if (!string.IsNullOrEmpty(id)) { var template = (from t in db.Templates where t.Id == new Guid(id) select t).First(); articles.Template = template; string templateId = template.Id.ToString(); var contents = from c in db.Contents where c.IsPublished == true && c.IsDeleted == false && c.TemplateId == templateId orderby c.PublishedDate select c; articles.Contents = contents; } } catch { articles.Template = new Templates(); articles.Contents = new Contents[] { new Contents() }; } return(View(articles)); }
public ActionResult Add(WebUser WebUser) { if (ModelState.IsValid) { db = new RobinsonsDBContext(); WebUser.Id = Guid.NewGuid(); db.WebUser.Add(WebUser); db.SaveChanges(); } else { TempData["ErrMessage"] = "Registration Unsuccessful! Check fields with (*) "; TempData["ShowSignUp"] = "Grid"; } return(RedirectToAction("MyRewards", "Home")); }
public ActionResult FAQAndTC(string id) { db = new RobinsonsDBContext(); var contents = from c in db.Contents where c.TemplateId == id && c.IsDeleted == false orderby c.Sequence select c; List <dynamic> Faqs = new List <dynamic>(); foreach (Contents content in contents) { dynamic Faq = new ExpandoObject(); Faq.Id = content.Id; Faq.Name = content.Name; Faq.Markup = HttpUtility.HtmlDecode(content.Markup); Faqs.Add(Faq); } return(View(Faqs.AsEnumerable())); }
public ActionResult Partners(string id) { db = new RobinsonsDBContext(); var contents = from c in db.Contents where c.TemplateId == id && c.IsDeleted == false orderby c.PublishedDate descending select c; List <dynamic> Partners = new List <dynamic>(); foreach (Contents content in contents) { dynamic Partner = new ExpandoObject(); Partner.Name = content.Name; Partner.Image = content.Image; Partner.Markup = HttpUtility.HtmlDecode(content.Markup); Partners.Add(Partner); } return(View(Partners.AsEnumerable())); }
public ActionResult EventsAndPromos(string id) { db = new RobinsonsDBContext(); var contents = from c in db.Contents where c.TemplateId == id && c.IsDeleted == false orderby c.PublishedDate descending select c; List <dynamic> Events = new List <dynamic>(); foreach (Contents content in contents) { dynamic Event = new ExpandoObject(); Event.Id = content.Id; Event.Name = content.Name; Event.Description = content.Description; Event.Image = content.Image; Event.Markup = HttpUtility.HtmlDecode(content.Markup); Events.Add(Event); } return(View(Events.AsEnumerable())); }
private dynamic SearchKeyword(string Keywords) { db = new RobinsonsDBContext(); dynamic lists = new ExpandoObject(); //dynamic resultcontent = new ExpandoObject(); //List<dynamic> resultcontentsList = new List<dynamic>(); //try //{ // if (!string.IsNullOrEmpty(Keywords)) // { // var contents = from c in db.Contents // where c.IsPublished == true && c.IsDeleted == false // && (c.Name.Contains(Keywords) || c.Description.Contains(Keywords) || c.Markup.Contains(Keywords)) // select c; // foreach (Contents content in contents.ToList()) // { // var template = (from t in db.Templates // where t.Id == new Guid(content.TemplateId) // select t).First(); // resultcontent.Id = content.Id; // resultcontent.Name = content.Name; // resultcontent.TemplateId = content.TemplateId; // resultcontent.Type = template.Type; // string description = string.Empty; // if (content.Name.ToLower().Contains(Keywords.ToLower())) // description = content.Name; // else if (content.Description.ToLower().Contains(Keywords.ToLower())) // description = content.Description; // else if (content.Markup.ToLower().Contains(Keywords.ToLower())) // { // int index = content.Markup.ToLower().IndexOf(Keywords.ToLower()); // string substringdesc = description = content.Markup.Substring(index); // if (substringdesc.Count() > 100) // description = substringdesc.Substring(0, 100); // else // description = substringdesc; // } // resultcontent.Description = HttpUtility.HtmlDecode(description); // resultcontentsList.Add(resultcontent); // } // lists.Contents = resultcontentsList.AsEnumerable(); // } try { if (!string.IsNullOrEmpty(Keywords)) { Keywords = Keywords.ToLower(); dynamic resultcontent = new ExpandoObject(); List <dynamic> resultcontentsList = new List <dynamic>(); var contents = from c in db.Contents where c.IsPublished == true && c.IsDeleted == false && (c.Name.ToLower().Contains(Keywords) || c.Description.ToLower().Contains(Keywords) || c.Markup.ToLower().Contains(Keywords)) select c; List <Contents> contentList = new List <Contents>(); foreach (Contents content in contents.ToList()) { string substringdesc = content.Description; if (substringdesc.Count() > 100) { substringdesc = substringdesc.Substring(0, 100); } content.Description = substringdesc; contentList.Add(content); } lists.Contents = contentList.ToList(); } else { Keywords = string.Empty; dynamic resultcontent = new ExpandoObject(); List <dynamic> resultcontentsList = new List <dynamic>(); var contents = from c in db.Contents where c.IsPublished == true && c.IsDeleted == false && (c.Name.Contains(Keywords) || c.Description.Contains(Keywords) || c.Markup.Contains(Keywords)) select c; List <Contents> contentList = new List <Contents>(); foreach (Contents content in contents.ToList()) { contentList.Add(content); } lists.Contents = contentList.ToList(); } } catch { lists.Contents = new Contents[] { new Contents() }; } return(lists); }
public void EmailSender(string sender, string subject, string body) { db = new RobinsonsDBContext(); var homepagesettings = (from h in db.HomePageSettings select h).FirstOrDefault(); if (homepagesettings != null) { Logger.LogInfo(this.GetType(), string.Concat("Host:", homepagesettings.ContactUsEmailHost)); Logger.LogInfo(this.GetType(), string.Concat("Port:", homepagesettings.ContactUsEmailPort)); Logger.LogInfo(this.GetType(), string.Concat("Recipient:", homepagesettings.ContactUsEmailRecipient)); Logger.LogInfo(this.GetType(), string.Concat("UserName:"******"smtpUsername"])); Logger.LogInfo(this.GetType(), string.Concat("UserName:"******"smtpPassword"])); string host = homepagesettings.ContactUsEmailHost; int port = int.Parse(homepagesettings.ContactUsEmailPort); string recipient = homepagesettings.ContactUsEmailRecipient; string UserName = System.Configuration.ConfigurationManager.AppSettings["smtpUsername"]; string Password = System.Configuration.ConfigurationManager.AppSettings["smtpPassword"]; #region New try { WebMail.SmtpServer = host; WebMail.From = sender; WebMail.Send( to: recipient, subject: subject, body: body, isBodyHtml: true ); } catch (Exception ex) { Logger.LogError(this.GetType(), ex); throw ex; } } #endregion #region old /*db = new RobinsonsDBContext(); * var homepagesettings = (from h in db.HomePageSettings * select h).FirstOrDefault(); * * if (homepagesettings != null) * { * string host = homepagesettings.ContactUsEmailHost; * int port = int.Parse(homepagesettings.ContactUsEmailPort); * string recipient = homepagesettings.ContactUsEmailRecipient; * try * { * //HomePageSettings settings = new HomePageSettings(); * SmtpClient client = new SmtpClient(host, port); * System.Net.NetworkCredential credential = new System.Net.NetworkCredential(); * * string UserName = System.Configuration.ConfigurationManager.AppSettings["smtpUsername"]; * string Password = System.Configuration.ConfigurationManager.AppSettings["smtpPassword"]; * * client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "csr123$$"); * * //credential.UserName = UserName;//settings.Email_Credential_User; * //credential.Password = Password;//settings.Email_Credential_Password; * * client.UseDefaultCredentials = false; * client.DeliveryMethod = SmtpDeliveryMethod.Network; * client.DeliveryFormat = SmtpDeliveryFormat.International; * client.EnableSsl = true;//Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["enableSsl"]); * MailMessage message = new MailMessage(); * message.From = new MailAddress("*****@*****.**"); * message.To.Add("*****@*****.**"); * message.Subject = "Inquiry"; * message.Body = "test"; * message.IsBodyHtml = true; * client.Send(message); * * } * catch (Exception ex) * { * throw ex; * } * }*/ #endregion }
public BaseController() { RobinsonsDBContext db = new RobinsonsDBContext(); var templates = from t in db.Templates where t.IncludeInMenu == true orderby t.Sequence select t; ViewData["TemplateList"] = templates.ToList().AsEnumerable(); var footer = from t in db.HomePageSettings select t; ViewData["FooterList"] = footer.ToList().AsEnumerable(); var contentlst = from z in db.Contents where z.TempName.Contains("FAQ") orderby z.Sequence select z; ViewData["ContentList"] = contentlst.ToList().AsEnumerable(); var contentlst2 = from z in db.Contents where z.TempName.Contains("Events and Promos") orderby z.Sequence select z; ViewData["ContentList2"] = contentlst2.ToList().AsEnumerable(); var termsofuselist = from z in db.TermsofUse where z.Id != null select z; ViewData["TermsofUseList"] = termsofuselist.ToList().AsEnumerable(); //var WhatsNewP = from x in db.Contents // where x.IsPublished == true && x.IncludeInHomePage == true && x.TempName.Contains("Partners") // orderby x.Sequence descending // select x; //ViewData["WhatsNewP"] = WhatsNewP.ToList().AsEnumerable(); //var WhatsNewEP = from x in db.Contents // where x.IsPublished == true && x.IncludeInHomePage == true && x.TempName.Contains("Events and Promos") // orderby x.Sequence descending // select x; //ViewData["WhatsNewEP"] = WhatsNewEP.ToList().AsEnumerable(); //var WhatsNewFAQ = from x in db.Contents // where x.IsPublished == true && x.IncludeInHomePage == true && x.TempName.Contains("FAQ") // orderby x.Sequence descending // select x; //ViewData["WhatsNewFAQ"] = WhatsNewFAQ.ToList().AsEnumerable(); //var WhatsNewStores = from x in db.Contents // where x.IsPublished == true && x.IncludeInHomePage == true && x.TempName.Contains("Stores") // orderby x.Sequence descending // select x; //ViewData["WhatsNewStores"] = WhatsNewStores.ToList().AsEnumerable(); var contentsliders = from x in db.ContentSliders where x.IsDeleted == false orderby x.Sequence select x; ViewBag.ContentSliders = contentsliders.ToList().AsEnumerable(); var sociallinks = from s in db.SocialMediaLinks where s.IsDeleted == false select s; ViewData["SocialLinks"] = sociallinks.ToList().AsEnumerable(); var facebooklink = (from s in db.SocialMediaLinks where s.IsDeleted == false && s.Name == "facebook" select s).FirstOrDefault(); ViewData["FacebookLink"] = facebooklink.Value; var homepagesettings = from h in db.HomePageSettings select h; int i = sociallinks.Count(); ViewData["HeaderLogo"] = homepagesettings.First().HeaderLogo; ViewData["FooterLogo"] = homepagesettings.First().FooterLogo; ViewData["CompanyName"] = homepagesettings.First().CompanyName; ViewData["CompanyAddress"] = homepagesettings.First().CompanyAddress; ViewData["CompanyPhone"] = homepagesettings.First().CompanyPhone; ViewData["CompanyEmail"] = homepagesettings.First().CompanyEmail; //ViewData["HeaderLogo"] = homepagesettings.First().; }