public void Insert(string ContentName, int StatusId, string Body, string Culture) { QuickContentContent item = new QuickContentContent(); item.ContentName = ContentName; item.StatusId = StatusId; item.Body = Body; item.Culture = Culture; item.CreatedOn = DateTime.Now; item.CreatedBy = UserName; item.Save(UserName); }
public void Update(int Id, string ContentName, int StatusId, string Body, string Culture) { QuickContentContent item = new QuickContentContent(); item.MarkOld(); item.IsLoaded = true; item.Id = Id; item.ContentName = ContentName; item.StatusId = StatusId; item.Body = Body; item.Culture = Culture; item.Save(UserName); }
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 void InsertAndReturnIdentity(string ContentName, int StatusId, string Body, string Culture, out object newId) { QuickContentContent item = new QuickContentContent(); item.ContentName = ContentName; item.StatusId = StatusId; item.Body = Body; item.Culture = Culture; item.CreatedOn = DateTime.Now; item.CreatedBy = UserName; item.Save(UserName); newId = item.Id; }