public List <IContentMetaInfo> GetMonthBlogUpdateList(Guid siteID, int iUpdates, bool bActiveOnly) { List <IContentMetaInfo> lstContent = new List <IContentMetaInfo>(); int n = 0; DateTime dateNow = DateTime.UtcNow.Date; while (n < iUpdates) { dateNow = DateTime.UtcNow.Date.AddMonths(0 - n); ContentCategory cc = new ContentCategory(); cc.SiteID = siteID; cc.UseCount = n * 3; cc.PublicUseCount = n * 2; cc.ContentCategoryID = Guid.NewGuid(); cc.EditDate = dateNow; cc.CategoryText = dateNow.ToString("MMMM yyyy"); cc.CategoryURL = "#" + SiteData.PreviewTemplateFilePage; lstContent.Add(cc); n++; } return(lstContent); }
public override bool Equals(Object obj) { //Check for null and compare run-time types. if (obj == null || GetType() != obj.GetType()) return false; if (obj is ContentCategory) { ContentCategory p = (ContentCategory)obj; return (this.SiteID == p.SiteID && this.ContentCategoryID == p.ContentCategoryID); } else { return false; } }
public static ContentCategory GetByURL(Guid SiteID, string requestedURL) { ContentCategory _item = null; using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { vw_carrot_CategoryURL query = CompiledQueries.cqGetContentCategoryByURL(_db, SiteID, requestedURL); if (query != null) { _item = new ContentCategory(query); } } return _item; }
public static ContentCategory Get(Guid CategoryID) { ContentCategory _item = null; using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { carrot_ContentCategory query = CompiledQueries.cqGetContentCategoryByID(_db, CategoryID); if (query != null) { _item = new ContentCategory(query); } } return _item; }
protected void btnSave_Click(object sender, EventArgs e) { ContentCategory item = ContentCategory.Get(guidItemID); if (item == null || (item != null && item.ContentCategoryID == Guid.Empty)) { item = new ContentCategory(); item.SiteID = SiteData.CurrentSiteID; item.ContentCategoryID = Guid.NewGuid(); } item.CategorySlug = txtSlug.Text; item.CategoryText = txtLabel.Text; item.IsPublic = chkPublic.Checked; item.Save(); Response.Redirect(SiteData.CurrentScriptName + "?id=" + item.ContentCategoryID.ToString()); }
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) { List<ValidationResult> errors = new List<ValidationResult>(); List<string> lst = new List<string>(); if (String.IsNullOrEmpty(this.CategorySlug)) { ValidationResult err = new ValidationResult("Slug is required", new string[] { "CategorySlug" }); errors.Add(err); } if (String.IsNullOrEmpty(this.CategoryText)) { ValidationResult err = new ValidationResult("Text is required", new string[] { "CategoryText" }); errors.Add(err); } if (ContentCategory.GetSimilar(SiteData.CurrentSite.SiteID, this.ContentCategoryID, this.CategorySlug) > 0) { ValidationResult err = new ValidationResult("Slug must be unique", new string[] { "CategorySlug" }); errors.Add(err); } return errors; }
public ActionResult CategoryDelete(ContentCategory model) { ContentCategory item = ContentCategory.Get(model.ContentCategoryID); item.Delete(); return RedirectToAction("CategoryIndex"); }
public ActionResult CategoryAddEdit(ContentCategory model) { Helper.ForceValidation(ModelState, model); if (ModelState.IsValid) { ContentCategory item = ContentCategory.Get(model.ContentCategoryID); if (item == null || (item != null && item.ContentCategoryID == Guid.Empty)) { item = new ContentCategory(); item.SiteID = SiteID; item.ContentCategoryID = Guid.NewGuid(); } item.CategorySlug = model.CategorySlug; item.CategoryText = model.CategoryText; item.IsPublic = model.IsPublic; item.Save(); return RedirectToAction("CategoryAddEdit", new { @id = item.ContentCategoryID }); } Helper.HandleErrorDict(ModelState); return View(model); }
public ActionResult CategoryAddEdit(Guid? id) { ContentCategory model = null; if (id.HasValue) { model = ContentCategory.Get(id.Value); } else { model = new ContentCategory(); model.ContentCategoryID = Guid.Empty; } return View(model); }
public static ContentPage GetSamplerView() { string sFile1 = String.Empty; string sFile2 = String.Empty; try { Assembly _assembly = Assembly.GetExecutingAssembly(); using (StreamReader oTextStream = new StreamReader(_assembly.GetManifestResourceStream("Carrotware.CMS.Core.SiteContent.Mock.SampleContent1.txt"))) { sFile1 = oTextStream.ReadToEnd(); } using (StreamReader oTextStream = new StreamReader(_assembly.GetManifestResourceStream("Carrotware.CMS.Core.SiteContent.Mock.SampleContent2.txt"))) { sFile2 = oTextStream.ReadToEnd(); } List<string> imageNames = (from i in _assembly.GetManifestResourceNames() where i.Contains("SiteContent.Mock.sample") && i.EndsWith(".png") select i).ToList(); foreach (string img in imageNames) { var imgURL = CMSConfigHelper.GetWebResourceUrl(typeof(ContentPage), img); sFile1 = sFile1.Replace(img, imgURL); sFile2 = sFile2.Replace(img, imgURL); } } catch { } ContentPage pageNew = new ContentPage(); pageNew.Root_ContentID = SiteData.CurrentSiteID; pageNew.ContentID = pageNew.Root_ContentID; pageNew.SiteID = SiteData.CurrentSiteID; pageNew.Parent_ContentID = null; pageNew.PageText = "<h2>Content CENTER</h2>\r\n" + sFile1; pageNew.LeftPageText = "<h2>Content LEFT</h2>\r\n" + sFile2; pageNew.RightPageText = "<h2>Content RIGHT</h2>\r\n" + sFile2; pageNew.IsLatestVersion = true; pageNew.NavOrder = -1; pageNew.TitleBar = "Template Preview - TITLE"; pageNew.NavMenuText = "Template PV - NAV"; ; pageNew.PageHead = "Template Preview - HEAD"; pageNew.PageActive = true; pageNew.ShowInSiteNav = true; pageNew.ShowInSiteMap = true; pageNew.EditUserId = SecurityData.CurrentUserGuid; pageNew.EditDate = DateTime.Now.Date.AddHours(-8); pageNew.CreateDate = DateTime.Now.Date.AddHours(-38); pageNew.GoLiveDate = pageNew.EditDate.AddHours(-5); pageNew.RetireDate = pageNew.CreateDate.AddYears(5); pageNew.TemplateFile = SiteData.PreviewTemplateFile; pageNew.FileName = SiteData.PreviewTemplateFilePage; pageNew.MetaDescription = "Meta Description"; pageNew.MetaKeyword = "Meta Keyword"; pageNew.ContentType = ContentPageType.PageType.BlogEntry; pageNew.PageSlug = "sampler-page-view"; List<ContentCategory> lstK = new List<ContentCategory>(); List<ContentTag> lstT = new List<ContentTag>(); for (int i = 0; i < 5; i++) { ContentCategory k = new ContentCategory { ContentCategoryID = Guid.NewGuid(), CategoryText = "Keyword Text " + i.ToString(), CategorySlug = "keyword-slug-" + i.ToString() }; ContentTag t = new ContentTag { ContentTagID = Guid.NewGuid(), TagText = "Tag Text " + i.ToString(), TagSlug = "tag-slug-" + i.ToString() }; lstK.Add(k); lstT.Add(t); } pageNew.ContentCategories = lstK; pageNew.ContentTags = lstT; return pageNew; }
public static ContentCategory GetByURL(Guid SiteID, string requestedURL) { ContentCategory _item = null; using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { vw_carrot_CategoryURL query = CompiledQueries.cqGetContentCategoryByURL(_db, SiteID, requestedURL); if (query != null) { _item = new ContentCategory(query); } } return _item; }
public static ContentCategory Get(Guid CategoryID) { ContentCategory _item = null; using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { carrot_ContentCategory query = CompiledQueries.cqGetContentCategoryByID(_db, CategoryID); if (query != null) { _item = new ContentCategory(query); } } return _item; }
public List<IContentMetaInfo> GetMonthBlogUpdateList(Guid siteID, int iUpdates, bool bActiveOnly) { List<IContentMetaInfo> lstContent = new List<IContentMetaInfo>(); int n = 0; DateTime dateNow = DateTime.UtcNow.Date; while (n < iUpdates) { dateNow = DateTime.UtcNow.Date.AddMonths(0 - n); ContentCategory cc = new ContentCategory(); cc.SiteID = siteID; cc.UseCount = n * 3; cc.PublicUseCount = n * 2; cc.ContentCategoryID = Guid.NewGuid(); cc.EditDate = dateNow; cc.CategoryText = dateNow.ToString("MMMM yyyy"); cc.CategoryURL = "#" + SiteData.PreviewTemplateFilePage; lstContent.Add(cc); n++; } return lstContent; }