Ejemplo n.º 1
0
        public static IHtmlControl GetNewsListView(SiteState state, LightObject currentUser, int pageNumber)
        {
            //int pageCount = BinaryHlp.RoundUp(allNewsIds.Length, newsCountOnPage);
            //int curPos = pageNumber * newsCountOnPage;
            //if (curPos < 0 || curPos >= allNewsIds.Length)
            //  return null;

            //int[] newsIds = ArrayHlp.GetRange(allNewsIds, curPos, Math.Min(newsCountOnPage, allNewsIds.Length - curPos));
            //LightHead[] newsList = ArrayHlp.Convert(newsIds, delegate (int id)
            //{ return new LightHead(context.News, id); }
            //);

            int[]          allNewsIds = context.News.AllObjectIds;
            IHtmlControl[] items      = GetNewsItems(state, allNewsIds, pageNumber);
            if (items == null)
            {
                return(null);
            }

            //string title = StringHlp.IsEmpty(tag) ? "Новости" : "Теги";
            return(new HPanel(
                       Decor.Title("Новости"),
                       //Decor.Subtitle(string.Format("Тег — {0}", tag)),
                       new HPanel(
                           new HPanel(
                               items
                               ),
                           ViewJumpHlp.JumpBar("/novosti", allNewsIds.Length, newsCountOnPage, pageNumber)
                           )
                       ));
        }
Ejemplo n.º 2
0
        public static IHtmlControl GetNewsView(SiteState state, LightObject currentUser, TopicStorage topic,
                                               out string description)
        {
            LightObject news = topic.Topic;

            description = BasketballHlp.GetDescriptionForNews(news);

            DateTime    localTime   = (news.Get(ObjectType.ActFrom) ?? DateTime.UtcNow).ToLocalTime();
            int         publisherId = news.Get(NewsType.PublisherId);
            LightObject publisher   = context.UserStorage.FindUser(publisherId);

            IHtmlControl editPanel = null;

            if (currentUser != null && (currentUser.Id == publisherId || currentUser.Get(BasketballUserType.IsModerator)))
            {
                editPanel = ViewNewsHlp.GetNewsEditPanel(state, topic);
            }

            IHtmlControl moderatorPanel = GetModeratorPanel(state, currentUser, topic, localTime);

            return(new HPanel(
                       Decor.Title(news.Get(NewsType.Title)),
                       new HLabel(localTime.ToString(Decor.timeFormat)).Block().FontBold(),
                       new HTextView(news.Get(NewsType.Text)).PositionRelative().Overflow("hidden"),
                       new HPanel(
                           new HLabel("Добавил:").MarginRight(5),
                           new HLink(UrlHlp.ShopUrl("user", publisherId), publisher?.Get(UserType.Login))
                           ),
                       new HLink(news.Get(NewsType.OriginUrl), news.Get(NewsType.OriginName)),
                       ViewTagHlp.GetViewTagsPanel(context.Tags.TagBox, topic.Topic),
                       editPanel,
                       moderatorPanel,
                       ViewCommentHlp.GetCommentsPanel(context.MessageConnection, state, currentUser, topic, topic.MessageLink.AllRows)
                       ));
        }
Ejemplo n.º 3
0
        public static IHtmlControl GetFoundTagListView(SiteState state, out string title)
        {
            title = string.Format("Найденные теги по запросу: {0}", state.Option.Get(OptionType.SearchQuery));

            List <IHtmlControl> elements = new List <IHtmlControl>();

            int[] foundTagIds = state.Option.Get(OptionType.FoundTagIds);
            if (foundTagIds != null)
            {
                foreach (int tagId in foundTagIds)
                {
                    RowLink tagRow = context.Tags.TagBox.ObjectById.AnyRow(tagId);
                    if (tagRow == null)
                    {
                        continue;
                    }

                    string tagDisplay = TagType.DisplayName.Get(tagRow);

                    elements.Add(
                        new HPanel(
                            new HLink(ViewTagHlp.TagUrl(tagId, 0), tagDisplay)
                            ).MarginBottom(4)
                        );
                }
            }


            return(new HPanel(
                       Decor.Title(title),
                       new HPanel(
                           elements.ToArray()
                           )
                       ));
        }
Ejemplo n.º 4
0
        public static IHtmlControl GetDialogueView(SiteState state,
                                                   IDataLayer forumConnection, UserStorage userStorage, LightObject user, out string title)
        {
            title = "Диалоги";

            TableLink dialogueLink = DialogueHlp.LoadDialogueLink(forumConnection,
                                                                  "user_id = @userId order by modify_time desc",
                                                                  new DbParameter("userId", user.Id)
                                                                  );

            IHtmlControl[] messageBlocks = new IHtmlControl[dialogueLink.AllRows.Length];
            int            i             = -1;

            foreach (RowLink dialog in dialogueLink.AllRows)
            {
                ++i;
                messageBlocks[i] = GetDialogBlock(forumConnection, userStorage, user, dialog, i);
            }

            return(new HPanel(
                       Decor.Title("Диалоги"),
                       new HPanel(
                           messageBlocks
                           )
                       ));
        }
Ejemplo n.º 5
0
        public static IHtmlControl GetArticleListView(SiteState state, LightObject currentUser, int pageNumber)
        {
            int[] allArticleIds = context.Articles.AllObjectIds;
            int   pageCount     = BinaryHlp.RoundUp(allArticleIds.Length, articleCountOnPage);
            int   curPos        = pageNumber * articleCountOnPage;

            if (curPos < 0 || curPos >= allArticleIds.Length)
            {
                return(new HPanel());
            }

            int[] articleIds = ArrayHlp.GetRange(allArticleIds, curPos,
                                                 Math.Min(articleCountOnPage, allArticleIds.Length - curPos)
                                                 );
            LightObject[] articleList = ArrayHlp.Convert(articleIds, delegate(int id)
                                                         { return(new LightObject(context.Articles, id)); }
                                                         );

            IHtmlControl[] items = GetArticleItems(state, articleList);

            return(new HPanel(
                       Decor.Title("Статьи").MarginBottom(15),
                       new HPanel(
                           new HPanel(
                               items
                               ),
                           ViewJumpHlp.JumpBar("/stati", context.Articles.AllObjectIds.Length, articleCountOnPage, pageNumber)
                           )
                       ));
        }
Ejemplo n.º 6
0
        public static IHtmlControl GetTopicView(SiteState state,
                                                LightObject currentUser, TopicStorage topic, int pageNumber)
        {
            if (topic == null || topic.Topic == null)
            {
                return(null);
            }

            int?         forumSectionId = topic.Topic.GetParentId(ForumSectionType.TopicLinks);
            LightSection forumSection   = context.Store.Sections.FindSection(forumSectionId);

            if (forumSection == null)
            {
                return(null);
            }

            IHtmlControl editPanel = null;

            if (state.ModeratorMode)
            {
                editPanel = GetTopicRedoPanel(state, currentUser, forumSection, topic);
            }

            RowLink[] allMessages  = topic.MessageLink.AllRows;
            RowLink[] pageMessages = ViewJumpHlp.GetPageItems(allMessages, forumMessageCountOnPage, pageNumber);

            if (pageMessages == null)
            {
                return(null);
            }

            return(new HPanel(
                       Decor.Title(topic.Topic.Get(TopicType.Title)).MarginBottom(15),
                       new HPanel(
                           new HLink("/forum", "Форумы"),
                           ArrowElement(),
                           new HLink(UrlHlp.ShopUrl("page", forumSectionId),
                                     forumSection?.Get(SectionType.Title)
                                     )
                           ).MarginBottom(10),
                       editPanel,
                       ViewJumpHlp.JumpBar(string.Format("/topic/{0}", topic.TopicId),
                                           allMessages.Length, forumMessageCountOnPage, pageNumber
                                           ).MarginBottom(5),
                       ViewCommentHlp.GetCommentsPanel(context.ForumConnection, state, currentUser, topic, pageMessages),
                       ViewJumpHlp.JumpBar(string.Format("/topic/{0}", topic.TopicId),
                                           allMessages.Length, forumMessageCountOnPage, pageNumber
                                           ).MarginTop(10)
                       ));
        }
Ejemplo n.º 7
0
        public static IHtmlControl GetArticleView(SiteState state, LightObject currentUser, TopicStorage topic)
        {
            if (topic == null || topic.Topic == null)
            {
                return(null);
            }

            LightObject article = topic.Topic;

            DateTime    localTime   = (article.Get(ObjectType.ActFrom) ?? DateTime.UtcNow).ToLocalTime();
            int         publisherId = article.Get(NewsType.PublisherId);
            LightObject publisher   = context.UserStorage.FindUser(publisherId);

            IHtmlControl editPanel = null;

            if (currentUser != null && (currentUser.Id == publisherId || currentUser.Get(BasketballUserType.IsModerator)))
            {
                editPanel = ViewArticleHlp.GetArticleEditPanel(state, topic);
            }

            string author       = article.Get(ArticleType.Author);
            int    commentCount = topic.MessageLink.AllRows.Length;
            string articleUrl   = UrlHlp.ShopUrl("article", article.Id);

            return(new HPanel(
                       Decor.Title(article.Get(NewsType.Title)),
                       new HPanel(
                           new HLabel(string.Format("{0},", author)).FontBold().MarginRight(5).Hide(StringHlp.IsEmpty(author)),
                           new HLabel(article.Get(ArticleType.OriginName))
                           .FontBold().MarginRight(5),
                           new HLabel(string.Format("| {0}", localTime.ToString("dd MMMM yyyy")))
                           ).FontSize("90%"),
                       new HPanel(
                           new HLabel("Комментарии:").Color(Decor.minorColor),
                           ViewNewsHlp.GetCommentElement(commentCount, articleUrl)
                           ).FontSize("90%"),
                       //new HLabel(localTime.ToString(Decor.timeFormat)).Block().FontBold(),
                       new HTextView(article.Get(NewsType.Text)),
                       new HLabel("Автор:").MarginRight(5).Hide(StringHlp.IsEmpty(author)),
                       new HLabel(author).FontBold().MarginRight(5).Hide(StringHlp.IsEmpty(author)),
                       new HLabel("|").MarginRight(5).Hide(StringHlp.IsEmpty(author)),
                       new HLink(article.Get(NewsType.OriginUrl), article.Get(NewsType.OriginName)),
                       new HPanel(
                           new HLabel("Добавил:").MarginRight(5),
                           new HLink(UrlHlp.ShopUrl("user", publisherId), publisher?.Get(UserType.Login))
                           ).MarginTop(5),
                       editPanel,
                       ViewCommentHlp.GetCommentsPanel(context.MessageConnection, state, currentUser, topic, topic.MessageLink.AllRows)
                       ));
        }
Ejemplo n.º 8
0
        public static IHtmlControl GetForumView(SiteState state, LightObject currentUser, LightSection forum)
        {
            return(new HPanel(
                       Decor.Title("Форумы").MarginBottom(15),
                       new HGrid <LightSection>(forum.Subsections,
                                                delegate(LightSection subSection)
            {
                TopicStorage lastTopic = GetLastTopicForForumSection(subSection);
                RowLink lastMessage = lastTopic == null ? null : _.Last(lastTopic.MessageLink.AllRows);
                LightObject lastUser = FindUserForMessage(lastMessage);

                return new HPanel(
                    new HPanel(
                        new HLink(UrlHlp.ShopUrl("page", subSection.Id),
                                  subSection.Get(SectionType.Title)
                                  ).FontBold()
                        ).RelativeWidth(50).PaddingLeft(5).VAlign(true).PaddingTop(15)
                    .MediaTablet(new HStyle().Block().Width("auto")),
                    new HPanel(
                        new HPanel(
                            new HLink(UrlHlp.ShopUrl("topic", lastTopic?.TopicId),
                                      lastTopic?.Topic.Get(TopicType.Title)
                                      )
                            ).MarginTop(7).MarginBottom(3),
                        new HPanel(
                            new HLink(UrlHlp.ShopUrl("user", lastUser?.Id),
                                      lastUser?.Get(UserType.Login)
                                      ),
                            new HLabel(
                                lastMessage?.Get(MessageType.CreateTime).ToLocalTime().ToString(Decor.timeFormat)
                                ).MarginLeft(7).MarginRight(7),
                            new HLink(
                                string.Format("{0}?page=last#bottom", UrlHlp.ShopUrl("topic", lastTopic?.TopicId)),
                                new HImage("/images/full.gif")
                                ).Hide(lastMessage == null)
                            ).MarginBottom(7)
                        ).RelativeWidth(50).Padding(0, 5).Height(45).BorderLeft(Decor.columnBorder)
                    .MediaTablet(new HStyle().Width("auto").Border("none"))
                    );
            },
                                                new HRowStyle().Even(new HTone().Background(Decor.evenBackground))
                                                ).BorderBottom(Decor.bottomBorder).MarginBottom(10),
                       DecorEdit.AdminGroupPanel(state.EditMode, forum.Id)
                       ));
        }
Ejemplo n.º 9
0
        public static IHtmlControl GetTagView(SiteState state, LightObject currentUser,
                                              int?tagId, int pageNumber, out string title, out string description)
        {
            title       = "";
            description = "";

            if (tagId == null)
            {
                return(null);
            }

            RowLink tagRow = context.Tags.TagBox.ObjectById.AnyRow(tagId.Value);

            if (tagRow == null)
            {
                return(null);
            }

            string tagDisplay = TagType.DisplayName.Get(tagRow);

            title       = string.Format("{0} - все новости на basketball.ru.com", tagDisplay);
            description = string.Format("{0} - все новости. Живое обсуждение баскетбольных событий на basketball.ru.com", tagDisplay);

            int[] newsIds = ViewTagHlp.GetNewsIdsForTag(context.FabricConnection, tagId.Value);

            IHtmlControl[] items = GetNewsItems(state, newsIds, pageNumber);
            if (items == null)
            {
                return(null);
            }

            string urlWithoutPageIndex = string.Format("/tags?tag={0}", tagId.Value);

            return(new HPanel(
                       Decor.Title(tagDisplay), //.Color(Decor.subtitleColor),
                       //Decor.Subtitle(string.Format("Тег — {0}", tagDisplay)).MarginTop(5),
                       new HPanel(
                           new HPanel(
                               items
                               ),
                           ViewJumpHlp.JumpBar(urlWithoutPageIndex, newsIds.Length, newsCountOnPage, pageNumber)
                           )
                       ));
        }
Ejemplo n.º 10
0
        public static IHtmlControl GetUserView(SiteState state, LightObject currentUser, LightObject user)
        {
            string communityMember = user.Get(BasketballUserType.CommunityMember);

            bool     isModerator     = user.Get(BasketballUserType.IsModerator);
            DateTime?bannedUntil     = user.Get(BasketballUserType.BannedUntil);
            DateTime?noRedactorUntil = user.Get(BasketballUserType.NotRedactorUntil);
            string   bannedUntilStr  = "";

            if (bannedUntil != null && bannedUntil > DateTime.UtcNow)
            {
                bannedUntilStr = bannedUntil.Value.ToLocalTime().ToString(Decor.timeFormat);
            }
            string noRedactorUntilStr = "";

            if (noRedactorUntil != null && noRedactorUntil > DateTime.UtcNow)
            {
                noRedactorUntilStr = noRedactorUntil.Value.ToLocalTime().ToString(Decor.timeFormat);
            }

            IHtmlControl[] rows = new IHtmlControl[] {
                UserField("Имя", ValueLabel(user.Get(UserType.FirstName)).FontBold()),
                UserField("Дата регистрации",
                          ValueLabel(user.Get(ObjectType.ActFrom)?.ToLocalTime().ToString(Decor.timeFormat))
                          ),
                !StringHlp.IsEmpty(communityMember) ? UserField("На basketball.ru c", ValueLabel(communityMember)) : null,
                UserField("Страна", ValueLabel(user.Get(BasketballUserType.Country))),
                UserField("Город", ValueLabel(user.Get(BasketballUserType.City))),
                UserField("Интересы", ValueLabel(user.Get(BasketballUserType.Interests))),
                UserField("О себе", ValueLabel(user.Get(BasketballUserType.AboutMe))),
                UserField("Статус", ValueLabel("Модератор").FontBold()).Hide(!isModerator),
                UserField("Заблокирован до", ValueLabel(bannedUntilStr).FontBold()).Hide(StringHlp.IsEmpty(bannedUntilStr)),
                UserField("Не добавляет до", ValueLabel(noRedactorUntilStr).FontBold()).Hide(StringHlp.IsEmpty(noRedactorUntilStr))
            };

            int i = -1;

            foreach (IHtmlControl row in rows)
            {
                if (row == null)
                {
                    continue;
                }

                ++i;
                if (i % 2 == 0)
                {
                    row.Background(Decor.pageBackground);
                }
            }

            IHtmlControl redoAvatarPanel = null;
            IHtmlControl editPanel       = null;

            if (currentUser != null && currentUser.Id == user.Id)
            {
                redoAvatarPanel = GetRedoAvatarPanel(user);
                editPanel       = GetUserEditPanel(state, user);
            }

            IHtmlControl adminPanel = null;

            if (state.EditMode)
            {
                adminPanel = GetAdminPanel(user);
            }

            IHtmlControl moderatorPanel = null;

            if (state.ModeratorMode)
            {
                moderatorPanel = GetModeratorPanel(user);
            }

            return(new HPanel(
                       Decor.Title(user.Get(UserType.Login)),
                       new HPanel(
                           AvatarBlock(user).PositionAbsolute().Left(12).Top("50%").MarginTop(-25),
                           new HPanel(
                               rows
                               ).Padding(1).Border("1px solid #eeeeee")
                           ).PositionRelative().BoxSizing().WidthLimit("", "480px").PaddingLeft(74),
                       ViewDialogueHlp.GetAddPanel(context, state, currentUser, user, true),
                       redoAvatarPanel,
                       editPanel,
                       adminPanel,
                       moderatorPanel
                       ));
        }
Ejemplo n.º 11
0
        public static IHtmlControl GetForumSectionView(SiteState state, LightObject currentUser, LightSection section)
        {
            LightHead[] topics = context.Forum.ForSection(section.Id).Topics;

            IHtmlControl addPanel = null;

            if (currentUser != null)
            {
                addPanel = GetTopicAddPanel(state, currentUser, section);
            }

            return(new HPanel(
                       Decor.Title(section.Get(SectionType.Title)).MarginBottom(15),
                       new HPanel(
                           new HLink("/forum", "Форумы")
                           ).MarginBottom(25),
                       //new HPanel(
                       //  new HLink("/forum", "Форумы"),
                       //  ArrowElement(),
                       //  new HLabel(section.Get(SectionType.Title))
                       //).MarginBottom(10),
                       addPanel,
                       new HGrid <LightHead>(topics, delegate(LightHead topic)
            {
                TopicStorage topicStorage = context.Forum.TopicsStorages.ForTopic(topic.Id);
                //int publisherId = topicStorage.Topic.Get(TopicType.PublisherId);
                //LightObject user = context.UserStorage.FindUser(publisherId);

                RowLink lastMessage = _.Last(topicStorage.MessageLink.AllRows);
                LightObject lastUser = FindUserForMessage(lastMessage);

                return new HPanel(
                    new HPanel(
                        new HLink(string.Format("{0}?page=last", UrlHlp.ShopUrl("topic", topic.Id)),
                                  topic.Get(TopicType.Title)
                                  ).FontBold()
                        ).RelativeWidth(55).Padding(8, 5, 9, 5).BorderRight(Decor.columnBorder)
                    .MediaTablet(new HStyle().Block().Width("auto")),
                    //new HPanel(
                    //  new HLink(UrlHlp.ShopUrl("user", publisherId),
                    //    user?.Get(UserType.Login)
                    //  ).FontBold()
                    //).Align(null),
                    new HPanel(
                        new HLabel(topicStorage.MessageLink.AllRows.Length)
                        ).Align(null).RelativeWidth(10).PaddingTop(8).PaddingBottom(9).BorderRight(Decor.columnBorder)
                    .MediaTablet(new HStyle().Width(50).PaddingTop(0)),
                    new HPanel(
                        new HLink(UrlHlp.ShopUrl("user", lastUser?.Id),
                                  lastUser?.Get(UserType.Login)
                                  ),
                        new HLabel(
                            lastMessage?.Get(MessageType.CreateTime).ToLocalTime().ToString(Decor.timeFormat)
                            ).MarginLeft(7).MarginRight(7),
                        new HLink(
                            string.Format("{0}?page=last#bottom", UrlHlp.ShopUrl("topic", topic.Id)),
                            new HImage("/images/full.gif")
                            )
                        ).RelativeWidth(35).Padding(0, 5)
                    .MediaTablet(new HStyle().Width("auto"))
                    );
            },
                                             new HRowStyle().Even(new HTone().Background(Decor.evenBackground))
                                             ).BorderBottom(Decor.bottomBorder).MarginBottom(10)
                       ));
        }
Ejemplo n.º 12
0
        public static IHtmlControl GetRegisterView(SiteState state)
        {
            return(new HPanel(
                       Decor.Title("Регистрация"),
                       Decor.AuthEdit("login", "Логин (*):"),
                       Decor.AuthEdit("yourname", "Ваше имя (*):"),
                       Decor.AuthEdit("email", "E-mail (*):"),
                       Decor.AuthEdit(new HPasswordEdit("password"), "Пароль (*):"),
                       Decor.AuthEdit(new HPasswordEdit("passwordRepeat"), "Введите пароль ещё раз (*):"),
                       new HPanel(
                           Decor.Button("Зарегистрироваться").Event("user_register", "registerData",
                                                                    delegate(JsonData json)
            {
                string login = json.GetText("login");
                string name = json.GetText("yourname");
                string email = json.GetText("email");
                string password = json.GetText("password");
                string passwordRepeat = json.GetText("passwordRepeat");

                WebOperation operation = state.Operation;

                if (!operation.Validate(login, "Не задан логин"))
                {
                    return;
                }
                if (!operation.Validate(email, "Не задана электронная почта"))
                {
                    return;
                }
                if (!operation.Validate(!email.Contains("@"), "Некорректный адрес электронной почты"))
                {
                    return;
                }
                if (!operation.Validate(name, "Не задано имя"))
                {
                    return;
                }
                if (!operation.Validate(password, "Не задан пароль"))
                {
                    return;
                }
                if (!operation.Validate(password != passwordRepeat, "Повтор не совпадает с паролем"))
                {
                    return;
                }

                foreach (LightObject userObj in context.UserStorage.All)
                {
                    if (!operation.Validate(userObj.Get(UserType.Email)?.ToLower() == email?.ToLower(),
                                            "Пользователь с такой электронной почтой уже существует"))
                    {
                        return;
                    }
                }

                ObjectBox box = new ObjectBox(context.UserConnection, "1=0");

                int?createUserId = box.CreateUniqueObject(UserType.User,
                                                          UserType.Login.CreateXmlIds("", login), null);
                if (!operation.Validate(createUserId == null,
                                        "Пользователь с таким логином уже существует"))
                {
                    return;
                }

                LightObject user = new LightObject(box, createUserId.Value);
                FabricHlp.SetCreateTime(user);
                user.Set(UserType.Email, email);
                user.Set(UserType.FirstName, name);
                user.Set(UserType.Password, password);
                user.Set(UserType.NotConfirmed, true);

                box.Update();

                SiteContext.Default.UserStorage.Update();

                Logger.AddMessage("Зарегистрирован пользователь: {0}, {1}, {2}", user.Id, login, email);

                try
                {
                    BasketballHlp.SendRegistrationConfirmation(user.Id, login, email);

                    Logger.AddMessage("Отправлено письмо с подтверждением регистрации.");
                }
                catch (Exception ex)
                {
                    Logger.WriteException(ex);

                    //operation.Validate(true, string.Format("Непредвиденная ошибка при отправке подтверждения: {0}", ex.Message));
                    //return;
                }

                //string xmlLogin = UserType.Login.CreateXmlIds("", login);
                //HttpContext.Current.SetUserAndCookie(xmlLogin);

                //operation.Complete("Вы успешно зарегистрированы!", "");

                state.RedirectUrl = "/confirmation";
            }
                                                                    )
                           )
                       ).EditContainer("registerData"));
        }
Ejemplo n.º 13
0
        public static IHtmlControl GetRestorePasswordView(SiteState state)
        {
            return(new HPanel(
                       Decor.Title("Восстановление пароля"),
                       Decor.AuthEdit("login", "Введите логин:"),
                       Decor.AuthEdit("email", "Или E-mail:"),
                       new HPanel(
                           Decor.Button("Выслать пароль на почту").Event("user_restore", "restoreData",
                                                                         delegate(JsonData json)
            {
                string login = json.GetText("login");
                string email = json.GetText("email");

                WebOperation operation = state.Operation;

                if (!operation.Validate(StringHlp.IsEmpty(login) && StringHlp.IsEmpty(email),
                                        "Введите логин или email"))
                {
                    return;
                }

                LightObject findUser = null;
                if (!StringHlp.IsEmpty(login))
                {
                    string xmlLogin = UserType.Login.CreateXmlIds("", login);
                    findUser = context.UserStorage.FindUser(xmlLogin);
                }
                else
                {
                    foreach (LightObject user in context.UserStorage.All)
                    {
                        if (user.Get(BasketballUserType.Email) == email)
                        {
                            findUser = user;
                            break;
                        }
                    }
                }

                if (!operation.Validate(findUser == null, "Пользователь не найден"))
                {
                    return;
                }

                try
                {
                    HElement answer = h.Div(
                        h.P(string.Format("Ваш логин: {0}", findUser.Get(BasketballUserType.Login))),
                        h.P(string.Format("Ваш пароль: {0}", findUser.Get(BasketballUserType.Password)))
                        );

                    SiteSettings settings = SiteContext.Default.SiteSettings;
                    SmtpClient smtpClient = AuthHlp.CreateSmtpClient(
                        settings.SmtpHost, settings.SmtpPort, settings.SmtpUserName, settings.SmtpPassword);
                    AuthHlp.SendMail(smtpClient, settings.MailFrom, findUser.Get(BasketballUserType.Email),
                                     "Восстановление пароля", answer.ToHtmlText()
                                     );
                }
                catch (Exception ex)
                {
                    Logger.WriteException(ex);

                    operation.Validate(true, string.Format("Непредвиденная ошибка при отправке заявки: {0}", ex.Message));
                    return;
                }

                operation.Message = "Пароль выслан вам на почту";
            }
                                                                         )
                           )
                       ).EditContainer("restoreData"));
        }