コード例 #1
0
        void ResetContentControls()
        {
            _content                = null;
            _contentId.Text         = "";
            _contentIdtitle.Visible = false;

            _contentFieldList.DataSource = null;
            _contentFieldList.DataBind();

            ShowHideContentControls(false);
        }
コード例 #2
0
        /// <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();
        }