private void SetEditableContent(bool cultureChange) { lblMessage.Text = string.Empty; txtContent.Value = String.Empty; QuickContentContentCollection cmsColl; if (cultureChange) { cmsColl = new QuickContentContentCollection() .Where(QuickContentContent.Columns.ContentName, ContentName) .Where(QuickContentContent.Columns.Culture, ddlCulture.SelectedValue) .OrderByDesc(QuickContentContent.Columns.CreatedOn) .Load(); // Load the version history dropdown BindVersionDropDown(cmsColl); } else { // Load a specific record from the version history cmsColl = new QuickContentContentCollection() .Where(QuickContentContent.Columns.Id, Convert.ToInt32(ddlVersion.SelectedValue)) .Load(); } if (cmsColl.Count > 0) { QuickContentContent versionContent = cmsColl[0]; txtContent.Value = versionContent.Body; } //EditorModalPopup.Show(); }
public QuickContentContentCollection FetchByQuery(Query qry) { QuickContentContentCollection coll = new QuickContentContentCollection(); coll.LoadAndCloseReader(qry.ExecuteReader()); return(coll); }
private void BindVersionDropDown(QuickContentContentCollection coll) { // Load the version dropdown ddlVersion.DataValueField = QuickContentContent.Columns.Id; ddlVersion.DataTextField = QuickContentContent.Columns.CreatedOn; ddlVersion.DataSource = coll; ddlVersion.DataBind(); }
public QuickContentContent GetActiveContent() { if (!string.IsNullOrEmpty(ContentName)) { QuickContentContentCollection coll = new QuickContentContentCollection() .Where(QuickContentContent.Columns.ContentName, ContentName) .Where(QuickContentContent.Columns.Culture, Thread.CurrentThread.CurrentUICulture.Name.ToLower()) .Where(QuickContentContent.Columns.StatusId, 2) .Load(); if (coll.Count > 0) { return(coll[0]); } } return(new QuickContentContent()); }
public QuickContentContentCollection FetchAll() { QuickContentContentCollection coll = new QuickContentContentCollection(); Query qry = new Query(QuickContentContent.Schema); // Begin Bayshore custom code block (rread 6/26/07) // Ignore records marked for deletion when doing a FetchAll if (QuickContentContent.Schema.GetColumn("IsDeleted") != null) { qry.WHERE("IsDeleted <> true"); } else if (QuickContentContent.Schema.GetColumn("Deleted") != null) { qry.WHERE("Deleted <> true"); } // End Bayshore custom code block coll.LoadAndCloseReader(qry.ExecuteReader()); return(coll); }
protected void btnSave_Click(object sender, System.EventArgs e) { lblMessage.Text = string.Empty; // If a previous version of the content exists, mark it as old. // Also, maintain a max of 10 recs in the version history QuickContentContentCollection coll = new QuickContentContentCollection() .Where(QuickContentContent.Columns.ContentName, ContentName) .Where(QuickContentContent.Columns.Culture, ddlCulture.SelectedValue) .OrderByDesc(QuickContentContent.Columns.CreatedOn) .Load(); int i = 1; foreach (QuickContentContent rec in coll) { if (i >= MAX_CONTENT_HISTORY_RECS) { QuickContentContent.Delete(rec.Id); } else if (rec.StatusId == 2) { rec.StatusId = 3; // 3 = Past Content rec.Save(); } i++; } // Insert the latest content QuickContentContent newContent = new QuickContentContent(true); newContent.IsNew = true; newContent.StatusId = 2; // 2 = Active Content newContent.Culture = ddlCulture.SelectedValue; newContent.ContentName = ContentName; newContent.Body = txtContent.Value; newContent.Save(Page.User.Identity.Name); // Reload version dropdown SetEditableContent(true); lblMessage.Text = "<br>Your changes have been saved."; }
public QuickContentContentCollection FetchByID(object Id) { QuickContentContentCollection coll = new QuickContentContentCollection().Where("Id", Id).Load(); return(coll); }