/// <summary>
    /// Reloads data.
    /// </summary>
    /// <param name="setAutomatically">Indicates if table should be pre-set according to field type</param>
    /// <param name="forceReload">Forces data to reload even if they are already loaded.</param>
    public void ReloadData(bool setAutomatically, bool forceReload)
    {
        if (!mLoaded || forceReload)
        {
            mLoaded = true;
            pnlContent.Controls.Clear();

            if (ItemID > 0)
            {
                var dataClassInfo = DataClassInfoProvider.GetDataClassInfo(ItemID);

                mDci        = dataClassInfo;
                mAttributes = dataClassInfo.GetSearchIndexColumns()?.ToList();

                if (mDci != null)
                {
                    mSearchSettings = new SearchSettings();
                    mSearchSettings.LoadData(mDci.ClassSearchSettings);
                    if ((mDci.TypeInfo.ObjectType == PredefinedObjectType.CUSTOMTABLECLASS) || (mDci.TypeInfo.ObjectType == PredefinedObjectType.FORMCLASS))
                    {
                        DisplayAzureFields = false;
                    }
                }
            }

            btnAutomatically.Click += btnAutomatically_Click;

            // Display checkbox matrix only if field names array is not empty
            if (mAttributes?.Count > 0)
            {
                // Setup controls
                btnAutomatically.Visible = true;
                if (mFields == null)
                {
                    mFields = new SearchSettings();
                }

                if (mDci != null)
                {
                    mFields.LoadData(mDci.ClassSearchSettings);
                }
                mInfos = mFields.GetAllSettingsInfos();

                CreateTable(setAutomatically);

                Literal ltl = new Literal();
                ltl.Text = "<br />";
                pnlContent.Controls.Add(ltl);
            }
        }
    }
    /// <summary>
    /// Reloads data.
    /// </summary>
    /// <param name="setAutomatically">Indicates if table should be pre-set according to field type</param>
    /// <param name="forceReload">Forces data to reload even if they are already loaded.</param>
    public void ReloadData(bool setAutomatically, bool forceReload)
    {
        if (!mLoaded || forceReload)
        {
            mLoaded = true;
            pnlContent.Controls.Clear();

            mAttributes = SearchHelper.GetClassSearchFields(ItemID);

            mDci = DataClassInfoProvider.GetDataClassInfo(ItemID);

            if (mDci != null)
            {
                mSearchSettings = new SearchSettings();
                mSearchSettings.LoadData(mDci.ClassSearchSettings);
            }

            btnAutomatically.Click += btnAutomatically_Click;

            // Display checkbox matrix only if field names array is not empty
            if (mAttributes.Count > 0)
            {
                // Setup controls
                btnAutomatically.Visible = true;
                if (mFields == null)
                {
                    mFields = new SearchSettings();
                }

                if (mDci != null)
                {
                    mFields.LoadData(mDci.ClassSearchSettings);
                }
                mInfos = mFields.GetAllSettingsInfos();

                CreateTable(setAutomatically);

                Literal ltl = new Literal();
                ltl.Text = "<br />";
                pnlContent.Controls.Add(ltl);
            }
        }
    }
Exemplo n.º 3
0
    /// <summary>
    /// Reloads data.
    /// </summary>
    /// <param name="SetAutomatically">Indicates if table should be pre-set according to field type</param>
    public void ReloadData(bool setAutomatically, bool forceReload)
    {
        if ((!loaded) || ((loaded) && (forceReload)))
        {
            loaded = true;
            pnlContent.Controls.Clear();
            LoadData();
            btnAutomatically.Click += new EventHandler(btnAutomatically_Click);

            // Display checkbox matrix only if field names array is not empty
            if (attributes.Count > 0)
            {
                // Setup controls
                btnAutomatically.Visible = true;
                if (fields == null)
                {
                    fields = new SearchSettings();
                }

                if (dci != null)
                {
                    fields.LoadData(dci.ClassSearchSettings);
                }
                infos = fields.GetAllSettingsInfos();

                CreateTable(setAutomatically);

                Literal ltl = new Literal();
                ltl.Text = "<br />";
                pnlContent.Controls.Add(ltl);
            }

            // Setup OK button
            FormSubmitButton btnOk = new FormSubmitButton();
            btnOk.ID      = "btnOK";
            btnOk.Click  += new EventHandler(btnOK_Click);
            btnOk.Visible = DisplayOkButton;
            pnlContent.Controls.Add(btnOk);
        }
    }
Exemplo n.º 4
0
    /// <summary>
    /// Loads data.
    /// </summary>
    private void LoadData()
    {
        // Initialize properties
        List <IFormItem> itemList  = null;
        FormFieldInfo    formField = null;

        attributes.Clear();

        // Load DataClass
        dci = DataClassInfoProvider.GetDataClass(ItemID);

        DataClassInfo tree = null;

        // For 'cms.document' add 'ecommerce.sku' fields, too
        if ((dci != null) && (dci.ClassName == "cms.document"))
        {
            // For 'cms.document' add 'ecommerce.sku' fields, too
            tree = DataClassInfoProvider.GetDataClass("ecommerce.sku");

            if (tree != null)
            {
                // Load XML definition
                fi = FormHelper.GetFormInfo(tree.ClassName, false);
                // Get all fields
                itemList = fi.GetFormElements(true, true);
            }

            if (itemList != null)
            {
                // Store each field to array
                foreach (object item in itemList)
                {
                    if (item is FormFieldInfo)
                    {
                        formField = ((FormFieldInfo)(item));
                        object[] obj = { formField.Name, FormHelper.GetDataType(formField.DataType) };
                        attributes.Add(obj);
                    }
                }
            }
        }

        if (dci != null)
        {
            // Load XML definition
            fi = FormHelper.GetFormInfo(dci.ClassName, false);
            // Get all fields
            itemList = fi.GetFormElements(true, true);
            ss       = new SearchSettings();
            ss.LoadData(dci.ClassSearchSettings);
        }

        if (itemList != null)
        {
            // Store each field to array
            foreach (object item in itemList)
            {
                if (item is FormFieldInfo)
                {
                    formField = ((FormFieldInfo)(item));
                    object[] obj = { formField.Name, FormHelper.GetDataType(formField.DataType) };
                    attributes.Add(obj);
                }
            }
        }

        // For 'cms.document' add 'cms.tree' fields, too
        if ((dci != null) && (dci.ClassName == "cms.document"))
        {
            tree = DataClassInfoProvider.GetDataClass("cms.tree");

            if (tree != null)
            {
                // Load XML definition
                fi = FormHelper.GetFormInfo(tree.ClassName, false);
                // Get all fields
                itemList = fi.GetFormElements(true, true);
            }

            if (itemList != null)
            {
                // Store each field to array
                foreach (object item in itemList)
                {
                    if (item is FormFieldInfo)
                    {
                        formField = ((FormFieldInfo)(item));
                        object[] obj = { formField.Name, FormHelper.GetDataType(formField.DataType) };
                        attributes.Add(obj);
                    }
                }
            }
        }


        // For 'cms.user' add 'cms.usersettings' fields, too
        if ((dci != null) && (dci.ClassName.ToLowerCSafe() == "cms.user"))
        {
            tree = DataClassInfoProvider.GetDataClass("cms.usersettings");

            if (tree != null)
            {
                // Load XML definition
                fi = FormHelper.GetFormInfo(tree.ClassName, false);
                // Get all fields
                itemList = fi.GetFormElements(true, true);
            }

            if (itemList != null)
            {
                // Store each field to array
                foreach (object item in itemList)
                {
                    if (item is FormFieldInfo)
                    {
                        formField = ((FormFieldInfo)(item));
                        object[] obj = { formField.Name, FormHelper.GetDataType(formField.DataType) };
                        attributes.Add(obj);
                    }
                }
            }
        }
    }
    /// <summary>
    /// Loads data.
    /// </summary>
    private void LoadData()
    {
        // Initialize properties
        ArrayList itemList = null;
        FormFieldInfo formField = null;
        attributes.Clear();

        // Load DataClass
        dci = DataClassInfoProvider.GetDataClass(this.ItemID);

        DataClassInfo tree = null;

        // For 'cms.document' add 'ecommerce.sku' fields, too
        if ((dci != null) && (dci.ClassName == "cms.document"))
        {

            // For 'cms.document' add 'ecommerce.sku' fields, too
            tree = DataClassInfoProvider.GetDataClass("ecommerce.sku");

            if (tree != null)
            {
                // Load XML definition
                fi = FormHelper.GetFormInfo(tree.ClassName, false);
                // Get all fields
                itemList = fi.GetFormElements(true, true);
            }

            if (itemList != null)
            {
                // Store each field to array
                foreach (object item in itemList)
                {
                    if (item is FormFieldInfo)
                    {
                        formField = ((FormFieldInfo)(item));
                        object[] obj = { formField.Name, FormHelper.GetDataType(formField.DataType) };
                        attributes.Add(obj);
                    }
                }
            }
        }

        if (dci != null)
        {
            // Load XML definition
            fi = FormHelper.GetFormInfo(dci.ClassName, false);
            // Get all fields
            itemList = fi.GetFormElements(true, true);
            ss = new SearchSettings();
            ss.LoadData(dci.ClassSearchSettings);
        }

        if (itemList != null)
        {
            // Store each field to array
            foreach (object item in itemList)
            {
                if (item is FormFieldInfo)
                {
                    formField = ((FormFieldInfo)(item));
                    object[] obj = { formField.Name, FormHelper.GetDataType(formField.DataType) };
                    attributes.Add(obj);
                }
            }
        }

        // For 'cms.document' add 'cms.tree' fields, too
        if ((dci != null) && (dci.ClassName == "cms.document"))
        {
            tree = DataClassInfoProvider.GetDataClass("cms.tree");

            if (tree != null)
            {
                // Load XML definition
                fi = FormHelper.GetFormInfo(tree.ClassName, false);
                // Get all fields
                itemList = fi.GetFormElements(true, true);
            }

            if (itemList != null)
            {
                // Store each field to array
                foreach (object item in itemList)
                {
                    if (item is FormFieldInfo)
                    {
                        formField = ((FormFieldInfo)(item));
                        object[] obj = { formField.Name, FormHelper.GetDataType(formField.DataType) };
                        attributes.Add(obj);
                    }
                }
            }
        }

        // For 'cms.user' add 'cms.usersettings' fields, too
        if ((dci != null) && (dci.ClassName.ToLower() == "cms.user"))
        {
            tree = DataClassInfoProvider.GetDataClass("cms.usersettings");

            if (tree != null)
            {
                // Load XML definition
                fi = FormHelper.GetFormInfo(tree.ClassName, false);
                // Get all fields
                itemList = fi.GetFormElements(true, true);
            }

            if (itemList != null)
            {
                // Store each field to array
                foreach (object item in itemList)
                {
                    if (item is FormFieldInfo)
                    {
                        formField = ((FormFieldInfo)(item));
                        object[] obj = { formField.Name, FormHelper.GetDataType(formField.DataType) };
                        attributes.Add(obj);
                    }
                }
            }
        }
    }
    /// <summary>
    /// Reloads data.
    /// </summary>
    /// <param name="setAutomatically">Indicates if table should be pre-set according to field type</param>
    /// <param name="forceReload">Forces data to reload even if they are already loaded.</param>
    public void ReloadData(bool setAutomatically, bool forceReload)
    {
        if (!mLoaded || forceReload)
        {
            mLoaded = true;
            pnlContent.Controls.Clear();

            mAttributes = SearchHelper.GetClassSearchFields(ItemID);

            mDci = DataClassInfoProvider.GetDataClassInfo(ItemID);

            if (mDci != null)
            {
                mSearchSettings = new SearchSettings();
                mSearchSettings.LoadData(mDci.ClassSearchSettings);
            }

            btnAutomatically.Click += btnAutomatically_Click;

            // Display checkbox matrix only if field names array is not empty
            if (mAttributes.Count > 0)
            {
                // Setup controls
                btnAutomatically.Visible = true;
                if (mFields == null)
                {
                    mFields = new SearchSettings();
                }

                if (mDci != null)
                {
                    mFields.LoadData(mDci.ClassSearchSettings);
                }
                mInfos = mFields.GetAllSettingsInfos();

                CreateTable(setAutomatically);

                Literal ltl = new Literal();
                ltl.Text = "<br />";
                pnlContent.Controls.Add(ltl);
            }
        }
    }