private void LoadActiveContent()
        {
            if (!string.IsNullOrEmpty(ContentName))
            {
                QuickContentContent text = GetActiveContent();
                if (text.IsLoaded)
                {
                    ContentText = text.Body;
                }
            }
            else
            {
                ContentText = "Missing ContentName attribute in the ContentArea user control";
            }

            if (UserCanEdit())
            {
                if (ContentText.Trim().Length == 0)
                {
                    literalContentEdit.Text = "Double-click to add text...";
                }
                else
                {
                    literalContentEdit.Text = ContentText;
                }
            }
            else
            {
                literalContentView.Text = ContentText;
            }
        }
Пример #2
0
        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();
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Get list of active quick content areas
            Query q = QuickContentContent.CreateQuery();

            q.SelectList = QuickContentContent.Columns.ContentName;
            q.AddWhere(QuickContentContent.Columns.StatusId, 2);
            q.AddWhere(QuickContentContent.Columns.Culture, Thread.CurrentThread.CurrentUICulture.Name.ToLower());
            q.ORDER_BY(QuickContentContent.Columns.ContentName);

            GridView1.DataSource = q.ExecuteReader();
            GridView1.DataBind();
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }
Пример #6
0
        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.";
        }
Пример #7
0
        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;
        }
Пример #8
0
 public bool Delete(object Id)
 {
     return(QuickContentContent.Delete(Id) == 1);
 }
Пример #9
0
 public bool Destroy(object Id)
 {
     return(QuickContentContent.Destroy(Id) == 1);
 }