Exemple #1
0
        /// <summary>
        /// Binds the form.
        /// </summary>
        private void BindForm()
        {
            // Bind Meta classes
            MetaClass catalogEntry = MetaClass.Load(CatalogContext.MetaDataContext, "CatalogEntry");

            MetaClassList.Items.Clear();
            if (catalogEntry != null)
            {
                MetaClassCollection metaClasses = catalogEntry.ChildClasses;
                foreach (MetaClass metaClass in metaClasses)
                {
                    MetaClassList.Items.Add(new ListItem(metaClass.FriendlyName, metaClass.Id.ToString()));
                }

                MetaClassList.DataBind();
            }

            // Bind Templates
            TemplateDto templates = DictionaryManager.GetTemplateDto();

            if (templates.main_Templates.Count > 0)
            {
                DataView view = templates.main_Templates.DefaultView;
                view.RowFilter             = "TemplateType = 'entry'";
                DisplayTemplate.DataSource = view;
                DisplayTemplate.DataBind();
            }

            if (CatalogEntryId > 0)
            {
                if (_CatalogEntryDto.CatalogEntry.Count > 0)
                {
                    Name.Text           = _CatalogEntryDto.CatalogEntry[0].Name;
                    AvailableFrom.Value = ManagementHelper.GetUserDateTime(_CatalogEntryDto.CatalogEntry[0].StartDate);
                    ExpiresOn.Value     = ManagementHelper.GetUserDateTime(_CatalogEntryDto.CatalogEntry[0].EndDate);
                    CodeText.Text       = _CatalogEntryDto.CatalogEntry[0].Code;
                    IsActive.IsSelected = _CatalogEntryDto.CatalogEntry[0].IsActive;

                    ManagementHelper.SelectListItem(DisplayTemplate, _CatalogEntryDto.CatalogEntry[0].TemplateName);
                    ManagementHelper.SelectListItem(MetaClassList, _CatalogEntryDto.CatalogEntry[0].MetaClassId);

                    // Bind Sort order
                    foreach (CatalogRelationDto.NodeEntryRelationRow row in _CatalogRelationDto.NodeEntryRelation)
                    {
                        if (row.CatalogEntryId == _CatalogEntryDto.CatalogEntry[0].CatalogEntryId &&
                            row.CatalogId == this.ParentCatalogId &&
                            row.CatalogNodeId == this.ParentCatalogNodeId)
                        {
                            SortOrder.Text = row.SortOrder.ToString();
                        }
                    }
                }
            }
            else
            {
                this.AvailableFrom.Value = ManagementHelper.GetUserDateTime(DateTime.UtcNow);
                this.ExpiresOn.Value     = ManagementHelper.GetUserDateTime(DateTime.UtcNow).AddYears(1);
            }
        }
Exemple #2
0
        /// <summary>
        /// Loads the specified node uid.
        /// </summary>
        /// <param name="NodeUid">The node uid.</param>
        /// <param name="ControlUid">The control uid.</param>
        void IPropertyPage.Load(string NodeUid, string ControlUid)
        {
            ControlSettings settings = new ControlSettings();

            DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid);

            if (dNode != null)
            {
                settings = dNode.GetSettings(NodeUid);
            }
            else
            {
                settings = PageDocument.Current.StaticNode.Controls[NodeUid];
            }

            // Bind templates
            DisplayTemplate.Items.Clear();
            DisplayTemplate.Items.Add(new ListItem("(use default)", ""));
            TemplateDto templates = DictionaryManager.GetTemplateDto();

            if (templates.main_Templates.Count > 0)
            {
                DataView view = templates.main_Templates.DefaultView;
                view.RowFilter = "TemplateType = 'menu'";

                foreach (DataRowView row in view)
                {
                    DisplayTemplate.Items.Add(new ListItem(row["FriendlyName"].ToString(), row["Name"].ToString()));
                }

                DisplayTemplate.DataBind();
            }

            string selectedMember = String.Empty;

            if (settings != null && settings.Params != null)
            {
                Param prm = settings.Params;

                if ((prm["DisplayTemplate"] != null) && (prm["DisplayTemplate"] is string))
                {
                    CommonHelper.SelectListItem(DisplayTemplate, prm["DisplayTemplate"].ToString());
                }

                if ((prm["DataSource"] != null) && (prm["DataSource"] is string))
                {
                    CommonHelper.SelectListItem(DataSourceList, prm["DataSource"].ToString());
                }

                if ((prm["DataMember"] != null) && (prm["DataMember"] is string))
                {
                    selectedMember = prm["DataMember"].ToString();
                }
            }

            BindSourceMembers(selectedMember);
        }
Exemple #3
0
        /// <summary>
        /// Binds the form.
        /// </summary>
        private void BindForm()
        {
            // Bind Meta classes
            MetaClass catalogNode = MetaClass.Load(CatalogContext.MetaDataContext, "CatalogNode");

            MetaClassList.Items.Clear();
            if (catalogNode != null)
            {
                MetaClassCollection metaClasses = catalogNode.ChildClasses;
                foreach (MetaClass metaClass in metaClasses)
                {
                    MetaClassList.Items.Add(new ListItem(metaClass.FriendlyName, metaClass.Id.ToString()));
                }
                MetaClassList.DataBind();
            }

            // Bind Templates
            TemplateDto templates = DictionaryManager.GetTemplateDto();

            if (templates.main_Templates.Count > 0)
            {
                DataView view = templates.main_Templates.DefaultView;
                view.RowFilter             = "TemplateType = 'node'";
                DisplayTemplate.DataSource = view;
                DisplayTemplate.DataBind();
            }

            if (CatalogNodeId > 0)
            {
                if (_CatalogNodeDto.CatalogNode.Count > 0)
                {
                    Name.Text                      = _CatalogNodeDto.CatalogNode[0].Name;
                    AvailableFrom.Value            = ManagementHelper.GetUserDateTime(_CatalogNodeDto.CatalogNode[0].StartDate);
                    ExpiresOn.Value                = ManagementHelper.GetUserDateTime(_CatalogNodeDto.CatalogNode[0].EndDate);
                    CodeText.Text                  = _CatalogNodeDto.CatalogNode[0].Code;
                    SortOrder.Text                 = _CatalogNodeDto.CatalogNode[0].SortOrder.ToString();
                    IsCatalogNodeActive.IsSelected = _CatalogNodeDto.CatalogNode[0].IsActive;

                    ManagementHelper.SelectListItem(DisplayTemplate, _CatalogNodeDto.CatalogNode[0].TemplateName);
                    ManagementHelper.SelectListItem(MetaClassList, _CatalogNodeDto.CatalogNode[0].MetaClassId);
                }
            }
            else
            {
                this.AvailableFrom.Value = DateTime.Now;
                this.ExpiresOn.Value     = DateTime.Now.AddYears(1);
                this.SortOrder.Text      = "0";
            }
        }
Exemple #4
0
        /// <summary>
        /// Loads the specified node uid.
        /// </summary>
        /// <param name="NodeUid">The node uid.</param>
        /// <param name="ControlUid">The control uid.</param>
        void IPropertyPage.Load(string NodeUid, string ControlUid)
        {
            ControlSettings settings = new ControlSettings();

            DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid);

            if (dNode != null)
            {
                settings = dNode.GetSettings(NodeUid);
            }

            // Bind Meta Types
            // Bind Meta classes
            // MetaDataContext.Current = CatalogContext.MetaDataContext;
            MetaClass catalogEntry = MetaClass.Load(CatalogContext.MetaDataContext, "CatalogEntry");

            MetaClassList.Items.Clear();
            if (catalogEntry != null)
            {
                MetaClassCollection metaClasses = catalogEntry.ChildClasses;
                foreach (MetaClass metaClass in metaClasses)
                {
                    MetaClassList.Items.Add(new ListItem(metaClass.FriendlyName, metaClass.Name));
                }
                MetaClassList.DataBind();
            }

            // Bind templates
            DisplayTemplate.Items.Clear();
            DisplayTemplate.Items.Add(new ListItem("(use default)", ""));
            TemplateDto templates = DictionaryManager.GetTemplateDto();

            if (templates.main_Templates.Count > 0)
            {
                DataView view = templates.main_Templates.DefaultView;
                view.RowFilter = "TemplateType = 'search-index'";

                foreach (DataRowView row in view)
                {
                    DisplayTemplate.Items.Add(new ListItem(row["FriendlyName"].ToString(), row["Name"].ToString()));
                }

                DisplayTemplate.DataBind();
            }

            // Bind Types
            EntryTypeList.Items.Clear();
            EntryTypeList.Items.Add(new ListItem(EntryType.Product, EntryType.Product));
            EntryTypeList.Items.Add(new ListItem(EntryType.Package, EntryType.Package));
            EntryTypeList.Items.Add(new ListItem(EntryType.Bundle, EntryType.Bundle));
            EntryTypeList.Items.Add(new ListItem(EntryType.DynamicPackage, EntryType.DynamicPackage));
            EntryTypeList.Items.Add(new ListItem(EntryType.Variation, EntryType.Variation));
            EntryTypeList.DataBind();

            // Bind catalogs
            CatalogList.Items.Clear();
            CatalogDto catalogs = CatalogContext.Current.GetCatalogDto(CMSContext.Current.SiteId);

            if (catalogs.Catalog.Count > 0)
            {
                foreach (CatalogDto.CatalogRow row in catalogs.Catalog)
                {
                    if (row.IsActive && row.StartDate <= FrameworkContext.Current.CurrentDateTime && row.EndDate >= FrameworkContext.Current.CurrentDateTime)
                    {
                        CatalogList.Items.Add(new ListItem(row.Name, row.Name));
                    }
                }

                CatalogList.DataBind();
            }

            //Bind Depositories
            this.ddlDepository.DataSource = Enum.GetNames(typeof(NWTD.InfoManager.Depository));
            this.ddlDepository.DataBind();

            if (settings != null && settings.Params != null)
            {
                Param prm = settings.Params;

                CommonHelper.LoadTextBox(settings, "NodeCode", NodeCode);
                CommonHelper.LoadTextBox(settings, "RecordsPerPage", NumberOfRecords);

                /*
                 * CommonHelper.LoadTextBox(settings, "FTSPhrase", FTSPhrase);
                 * CommonHelper.LoadTextBox(settings, "AdvancedFTSPhrase", AdvancedFTSPhrase);
                 * CommonHelper.LoadTextBox(settings, "MetaSQLClause", MetaSQLClause);
                 * CommonHelper.LoadTextBox(settings, "SQLClause", SQLClause);
                 * */

                if ((prm["DisplayTemplate"] != null) && (prm["DisplayTemplate"] is string))
                {
                    CommonHelper.SelectListItem(DisplayTemplate, prm["DisplayTemplate"].ToString());
                }

                CommonHelper.SelectList(settings, "Catalogs", CatalogList);
                CommonHelper.SelectList(settings, "EntryClasses", MetaClassList);
                CommonHelper.SelectList(settings, "EntryTypes", EntryTypeList);

                // Orderby
                if ((prm["OrderBy"] != null) && (prm["OrderBy"] is string))
                {
                    string orderBy = prm["OrderBy"].ToString();
                    bool   isDesc  = orderBy.Contains("DESC");

                    string listOrderBy = orderBy.Replace(" DESC", "");
                    listOrderBy = listOrderBy.Replace(" ASC", "");

                    CommonHelper.SelectListItem(OrderByList, listOrderBy);

                    if (!String.IsNullOrEmpty(OrderByList.SelectedValue))
                    {
                        if (OrderByList.SelectedValue == "custom")
                        {
                            OrderBy.Text = orderBy;
                        }
                        else
                        {
                            OrderDesc.Checked = isDesc;
                        }
                    }
                }


                if (prm[DEPOSITORY_KEY] == null)
                {
                    prm[DEPOSITORY_KEY] = NWTD.InfoManager.Depository.NWTD.ToString();
                }
                this.ddlDepository.SelectedValue = settings.Params[DEPOSITORY_KEY].ToString();
            }
        }
Exemple #5
0
        /// <summary>
        /// Loads the specified node uid.
        /// </summary>
        /// <param name="NodeUid">The node uid.</param>
        /// <param name="ControlUid">The control uid.</param>
        void IPropertyPage.Load(string NodeUid, string ControlUid)
        {
            ControlSettings settings = new ControlSettings();

            DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid);

            if (dNode != null)
            {
                settings = dNode.GetSettings(NodeUid);
            }

            // Bind templates
            DisplayTemplate.Items.Clear();
            DisplayTemplate.Items.Add(new ListItem("(use default)", ""));
            TemplateDto templates = DictionaryManager.GetTemplateDto();

            if (templates.main_Templates.Count > 0)
            {
                DataView view = templates.main_Templates.DefaultView;
                view.RowFilter = "TemplateType = 'entry'";

                foreach (DataRowView row in view)
                {
                    DisplayTemplate.Items.Add(new ListItem(row["FriendlyName"].ToString(), row["Name"].ToString()));
                }

                DisplayTemplate.DataBind();
            }

            // Bind catalogs
            CatalogList.Items.Clear();
            CatalogList.Items.Add(new ListItem("(use default)", ""));
            CatalogDto catalogs = CatalogContext.Current.GetCatalogDto(CMSContext.Current.SiteId);

            if (catalogs.Catalog.Count > 0)
            {
                foreach (CatalogDto.CatalogRow row in catalogs.Catalog)
                {
                    if (row.IsActive && row.StartDate <= FrameworkContext.Current.CurrentDateTime && row.EndDate >= FrameworkContext.Current.CurrentDateTime)
                    {
                        CatalogList.Items.Add(new ListItem(row.Name, row.Name));
                    }
                }

                CatalogList.DataBind();
            }

            //Bind Depositories
            this.ddlDepository.DataSource = Enum.GetNames(typeof(NWTD.InfoManager.Depository));
            this.ddlDepository.DataBind();


            if (settings != null && settings.Params != null)
            {
                Param prm = settings.Params;
                if ((prm["NodeCode"] != null) && (prm["NodeCode"] is string))
                {
                    NodeCode.Text = prm["NodeCode"].ToString();
                }

                if ((prm["EntryCode"] != null) && (prm["EntryCode"] is string))
                {
                    EntryCode.Text = prm["EntryCode"].ToString();
                }

                if ((prm["DisplayTemplate"] != null) && (prm["DisplayTemplate"] is string))
                {
                    CommonHelper.SelectListItem(DisplayTemplate, prm["DisplayTemplate"].ToString());
                }

                if ((prm["CatalogName"] != null) && (prm["CatalogName"] is string))
                {
                    CommonHelper.SelectListItem(CatalogList, prm["CatalogName"].ToString());
                }

                if (prm[DEPOSITORY_KEY] == null)
                {
                    prm[DEPOSITORY_KEY] = NWTD.InfoManager.Depository.NWTD.ToString();
                }
                this.ddlDepository.SelectedValue = settings.Params[DEPOSITORY_KEY].ToString();
            }
        }