Exemple #1
0
        void PopulateForm()
        {
            ResetControls();

            //Get Content Info
            AWAPI_Data.Data.awContent content = _contentLib.Get(ContentId);
            if (content == null)
            {
                return;
            }

            lblTitle.Text = "Manage Content Form - " + content.alias;

            //Get Form Info
            AWAPI_Data.Data.awContentForm form = _formLib.GetByContentId(ContentId, false);
            if (form == null)
            {
                return;
            }

            _contentFormId.Text        = form.contentFormId.ToString();
            _title.Text                = form.title;
            _description.Text          = form.description;
            _isEnabled.Checked         = form.isEnabled;
            _applyToSubContent.Checked = form.applyToSub;
            _canCreateNew.Checked      = form.canCreateNew;
            _canUpdate.Checked         = form.canUpdate;
            _canDelete.Checked         = form.canDelete;
            ShowHildeControls(true);

            PopulateFields(form.contentFormId);
        }
Exemple #2
0
        void PopulateContent(Int64 contentId, string cultureCode)
        {
            ResetControls();
            if (String.IsNullOrEmpty(cultureCode) && _culture.Items.FindByValue(App_Code.SessionInfo.CurrentSite.cultureCode) != null)
            {
                _culture.SelectedValue = App_Code.SessionInfo.CurrentSite.cultureCode;
            }

            awContent content = _contentLib.Get(contentId, cultureCode);

            if (content == null)
            {
                return;
            }

            _contentId.Text          = content.contentId.ToString();
            _alias.Text              = content.alias;
            cbStatusContent_.Checked = content.isEnabled;
            _contentSortOrder.Text   = content.sortOrder.ToString();
            if (content.eventStartDate != null)
            {
                _contentEventStartDate.Text = content.eventStartDate.Value.ToString("MM/dd/yyyy HH:mm");
            }
            if (content.eventEndDate != null)
            {
                _contentEventEndDate.Text = content.eventEndDate.Value.ToString("MM/dd/yyyy HH:mm");
            }
            if (content.pubDate != null)
            {
                _contentPublishStartDate.Text = content.pubDate.Value.ToString("MM/dd/yyyy HH:mm");
            }
            if (content.pubEndDate != null)
            {
                _contentPublishEndDate.Text = content.pubEndDate.Value.ToString("MM/dd/yyyy HH:mm");
            }
            if (content.parentContentId == null)
            {
                content.parentContentId = 0;
            }
            _contentIsCommentable.Checked = content.isCommentable;

            _title.Text           = content.title;
            _description.Value    = content.description;
            _contentImageUrl.Text = content.imageurl;
            //_contentType.Text = content.contentType;

            SetImage(content.imageurl);

            PopulateCustomFields(contentId, content.parentContentId);
            PopulateContentsTags(contentId);

            //POPULATE OTHER ---------------
            PopulateContentParentList(content.contentId);
            _contentParentList.SelectedValue = content.parentContentId.ToString();

            SetMethodLinks();
            ShowHideContentButtons(true, content.contentType);
        }
        /// <summary>
        /// if contentid is 0, then only get the fields, not the field values.
        /// </summary>
        /// <param name="contentFormId"></param>
        /// <param name="contentId"></param>
        void PopulateFields(long contentFormId, long contentId)
        {
            ResetContentControls();

            _content = _contentLib.Get(contentId);

            IList <AWAPI_Data.CustomEntities.ContentFormFieldSettingExtended> fieldList = _formLib.GetFieldList(contentFormId);

            if (fieldList == null || fieldList.Count == 0)
            {
                return;
            }

            var list2 = from l in fieldList
                        where l.isVisible
                        select l;

            if (list2 == null || list2.Count() == 0)
            {
                return;
            }

            System.Data.DataTable dt = AWAPI_Common.library.DataLibrary.LINQToDataTable(list2);
            dt.Columns.Add("fieldValue");

            //GET LIST OF THE VALUES
            if (contentId > 0)
            {
                IList <AWAPI_Data.CustomEntities.ContentCustomFieldValueExtended> valueList = _customLib.GetFieldValueList(contentId, "");

                for (int n = 0; n < dt.Rows.Count; n++)
                {
                    long customFieldId = dt.Rows[n]["contentCustomFieldId"] == DBNull.Value ? 0 : (long)dt.Rows[n]["contentCustomFieldId"];
                    dt.Rows[n]["fieldValue"] = GetFieldValue(customFieldId, valueList, dt.Rows[n]["staticFieldName"].ToString());
                }
                _contentId.Text = contentId.ToString();

                ShowHideContentControls(true);
            }

            _contentFieldList.DataSource = dt;

            _contentFieldList.DataBind();
        }