Пример #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 NewFTopic(string tName, int subsectionId, int sectionId)
        {
            if ((tName != "") && (tName.Length < 51) && (((context.GetFSubsectionById(subsectionId).Closed == 0) && (context.GetFSectionById(sectionId).Closed == 0))  || (GetCurrentUserRole() == 2)  ))
            {
                FTopic topic = new FTopic();
                topic.FSubsectionId = subsectionId;
                topic.Name = tName;
                topic.Closed = 0;
                topic.Fix = 0;
                topic.LastFMsgDate = DateTime.Now;
                topic.UserId = 0;
                topic.NumFMsgs = 0;
                topic.NumViews = 0;

                context.AddFTopic(topic, subsectionId, sectionId);
                context.SaveChanges();
            }

            return RedirectToAction("FTopics", new { subsectionId = subsectionId, sectionId = sectionId });
        }
Пример #3
0
 public void AddFTopic(FTopic topic, int subsectionId, int sectionId)
 {
     GetFSectionById(sectionId).NumFTopics++;
     GetFSubsectionById(subsectionId).NumFTopics++;
     FTopics.Add(topic);
     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 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));
            }
        }