예제 #1
0
 public FoundFMessage(FMessage message, int page, FSection section, FSubsection subsection, FTopic topic)
 {
     FMessage = message;
     FSection = section;
     FSubsection = subsection;
     FTopic = topic;
     Page = page;
 }
예제 #2
0
        public ActionResult NewFSubsection(string sName, int sectionId)
        {
            if ((sName != "") && (sName.Length < 51))
            {
                FSubsection subsection = new FSubsection();
                subsection.FSectionId = sectionId;
                subsection.Name = sName;
                subsection.Closed = 0;
                subsection.LastFMsgDate = DateTime.Now;
                subsection.FTopicId = 0;
                subsection.UserId = 0;
                subsection.NumFMsgs = 0;
                subsection.NumFTopics = 0;
                subsection.OrderNum = 0;

                context.AddFSubsection(subsection, sectionId);
            }

            ViewData["Role"] = GetCurrentUserRole();
            ViewData["FSectionId"] = sectionId;

            return RedirectToAction("FSubsections", new { sectionId = sectionId});
        }
예제 #3
0
 public void AddFSubsection(FSubsection subsection, int sectionId)
 {
     GetFSectionById(sectionId).NumFSubsections++;
     FSubsections.Add(subsection);
     SaveChanges();
 }
예제 #4
0
 public FoundFTopic(FTopic topic, int page, FSection section, FSubsection subsection)
 {
     FTopic = topic;
     Page = page;
     FSection = section;
     FSubsection = subsection;
 }
예제 #5
0
        public void FindFMessages(FTopic topic, FSubsection subsection, FSection section)
        {
            List<FMessage> FMessages = context.GetFMessagesByFTopicId(topic.Id);
            for (int MsgNum = 0; MsgNum < FMessages.Count; MsgNum++)
            {
                FMessage message = FMessages[MsgNum];
                if (HasAnswer(message.Text))
                {
                    double a = (double)(FoundFMessages.Count + 1) / (double)MsgsPerPage;
                    int Page = (int)Math.Ceiling(a);

                    FoundFMessages.Add(new FoundFMessage(message, Page, section, subsection, topic));
                }
            }
        }
예제 #6
0
        public void CheckFTopics(FSection section, FSubsection subsection)
        {
            List<FTopic> FTopics = context.GetFTopicsByFSubsectionId(subsection.Id);
            for (int TpcNum = 0; TpcNum < FTopics.Count; TpcNum++)
            {
                FTopic topic = FTopics[TpcNum];

                CheckFTopic(topic, TpcNum, section, subsection); //Проверка темы и добавление в случае совпадения
                FindFMessages(topic, subsection, section); //Добавление подходящих сообщений
            }
        }
예제 #7
0
        public void CheckFTopic(FTopic topic, int TpcNum, FSection section, FSubsection subsection)
        {
            if (HasAnswer(topic.Name))
            {
                double a = (double)(FoundFMessages.Count + 1) / (double)TpcsPerPage;
                int Page = (int)Math.Ceiling(a);

                FoundFTopics.Add(new FoundFTopic(topic, Page, section, subsection));
            }
        }