Esempio n. 1
0
 public FoundFMessage(FMessage message, int page, FSection section, FSubsection subsection, FTopic topic)
 {
     FMessage = message;
     FSection = section;
     FSubsection = subsection;
     FTopic = topic;
     Page = page;
 }
Esempio n. 2
0
        public void AddFMessage(FMessage fmessage, int topicId, int subsectionId, int sectionId)
        {
            GetFSectionById(sectionId).NumFMsgs++;

            FSubsection subsection = GetFSubsectionById(subsectionId);
            FTopic topic = GetFTopicById(topicId);

            subsection.NumFMsgs++;
            subsection.LastFMsgDate = fmessage.WriteDate;
            subsection.UserId = fmessage.UserId;

            topic.NumFMsgs++;
            topic.LastFMsgDate = fmessage.WriteDate;
            topic.UserId = fmessage.UserId;

            FMessages.Add(fmessage);
            SaveChanges();
        }
Esempio n. 3
0
        public ActionResult NewFMessage(string Text, int sectionId, int subsectionId, int topicId)
        {
            if ((Text != "") && (Text.Length < 3501) && (((context.GetFTopicById(topicId).Closed == 0) && (context.GetFSubsectionById(subsectionId).Closed == 0) && (context.GetFSectionById(sectionId).Closed == 0) ) || (GetCurrentUserRole() == 2)  ))
            {
                FMessage fmessage = new FMessage();
                fmessage.Text = Text;
                fmessage.FTopicId = topicId;
                User currentUser = context.GetUserByName(HttpContext.User.Identity.Name);
                fmessage.UserId = currentUser.Id;
                fmessage.WriteDate = DateTime.Now;

                context.AddFMessage(fmessage, topicId, subsectionId, sectionId);
            }

            return RedirectToAction("FMessages", new {topicId = topicId, subsectionId = subsectionId, sectionId = sectionId, NewMsg = 1});
        }