Beispiel #1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Returns HashCode</returns>
 public override int GetHashCode()
 {
     return(String.Format("{0}|{1}|{2}|",
                          FooterLinks.Aggregate(0, (acc, next) => acc += (next != null ? next.GetHashCode() : 0)),
                          DisplayName.GetHashCode(),
                          Url?.GetHashCode() ?? 0
                          ).GetHashCode());
 }
        public ViewResult FooterLinks()
        {
            var model            = new FooterLinks();
            var footerlinksOther = new List <MenuLink>();
            var footerlinks      = _sitecoreContext.Database.GetItem(new ID(Consts.Ids.FooterLinks));

            foreach (MenuLink footer in footerlinks.Children.Select(c => _sitecoreContext.Cast <MenuLink>(c)))
            {
                if (Guid.Parse(Consts.Ids.FooterLinksDisclosure).Equals(footer.Id))
                {
                    model.Disclosure = footer;
                }
                else
                {
                    footerlinksOther.Add(footer);
                }
            }
            model.Footerlink = footerlinksOther;
            return(View(model));
        }
Beispiel #3
0
        /// <summary>
        /// Пишет скрипт инициализаии элемента управления.
        /// </summary>
        /// <param name="writer">Экземпляр класса <see cref="TextWriter"/></param>
        public override void WriteInitializationScript(TextWriter writer)
        {
            base.WriteInitializationScript(writer);
            List <object> links       = new List <object>();
            dynamic       detailsLink = null;

            if (DetailsLink != null)
            {
                detailsLink = new {
                    caption      = DetailsLink.Caption,
                    uri          = DetailsLink.Uri,
                    dialogTitle  = DetailsLink.DialogTitle,
                    dialogWidth  = DetailsLink.DialogWidth,
                    dialogHeight = DetailsLink.DialogHeight
                };
            }

            string onselectHandler   = String.IsNullOrEmpty(ClientEvents.OnSelect) ? "null" : ClientEvents.OnSelect;
            string formatItemHandler = String.IsNullOrEmpty(ClientEvents.FormatItem) ? "null" : ClientEvents.FormatItem;

            var options = new {
                onselect             = "$$$OnSelect$$$",
                formatItemFunc       = "$$$formatItemFunc$$$",
                value                = Value,
                displayValue         = DisplayValue,
                uri                  = AutocompleteUri,
                limit                = AutocompleteMaxItems,
                keyField             = KeyField,
                displayField         = DisplayField,
                searchButtonImage    = SearchButtonImage,
                refreshUri           = RefreshUri,
                refreshUriKeyField   = RefreshUriKeyField,
                refreshUriLabelField = RefreshUriLabelField,
                detailsLink          = detailsLink,
                footerLinks          = new List <dynamic>(),
                resources            = new {
                    searchTitle         = Kesco.Web.Mvc.UI.Controls.Localization.Resources.KescoSelectControl_SearchResult,
                    NoSourceString      = Kesco.Web.Mvc.UI.Controls.Localization.Resources.KescoSelectControl_NoSourceString,
                    foundMore           = Kesco.Web.Mvc.UI.Controls.Localization.Resources.KescoSelectControl_foundMore,
                    foundRecordsMessage = Kesco.Web.Mvc.UI.Controls.Localization.Resources.KescoSelectControl_foundRecordsMessage
                }
            };


            FooterLinks.ForEach((item) =>
            {
                options.footerLinks.Add(new { caption = item.Caption, uri = item.Uri, dialogTitle = item.DialogTitle, dialogWidth = item.DialogWidth, dialogHeight = item.DialogHeight });
            });


            string jsonizedOptions = new JavaScriptSerializer().Serialize(options);

            jsonizedOptions = jsonizedOptions
                              .Replace("\"$$$OnSelect$$$\"", onselectHandler)
                              .Replace("\"$$$formatItemFunc$$$\"", formatItemHandler);

            writer.WriteLine(@"
					$(document).ready(function() {{
						InitLookupTextBox('#{0}___AUTOCOMPLETE', '#{0}', '#{0}___SEARCH_BUTTON', {1});
					}});
					"
                             , ID, jsonizedOptions);
        }
Beispiel #4
0
 public override string ToString()
 {
     return(string.Format("���{0}���ؼ���{1}������{2}��ҳ��ͷ����{3}��ҳ��β����{4}��������ɫ{5}����Ȩ��Ϣ{6}", Id, SiteKeyWord, SiteDescription, HeaderLinks.Join(",", item => item.ToString()), FooterLinks.Join(",", item => item.ToString()), BGColor, CopyrightInfo));
 }