예제 #1
0
        public Post[] GetDailyPosts(PostDate date)
        {
            if (date == null)
            {
                return null;
            }

            IList<Post> posts = postRepository.GetPostsByDay(date.Year, date.Month, date.Day);
            return posts != null ? posts.ToArray() : null;
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ (User != null ? User.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ PostDate.GetHashCode();
         hashCode = (hashCode * 397) ^ (Message != null ? Message.GetHashCode() : 0);
         return(hashCode);
     }
 }
 public bool Equals(Tweet other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Id == other.Id && string.Equals(User, other.User) && PostDate.Equals(other.PostDate) && string.Equals(Message, other.Message));
 }
예제 #4
0
 public override string ToString()
 {
     return
         (Environment.NewLine +
          new string('-', 10) +
          Environment.NewLine +
          "Title: " + Title + Environment.NewLine +
          "Content: " + Content + Environment.NewLine +
          "PostData: " + PostDate.ToString("dd.MM.yyyy HH:mm") + Environment.NewLine +
          "Author: " + Author +
          Environment.NewLine +
          new string('-', 10) +
          Environment.NewLine);
 }
        public CustomersPayments()
        {
            Id       = 0;
            Type     = new Types();
            PostDate = DateTime.Now;
            Date     = PostDate.ToString("dd/MM/yyyy");
            Receipt  = "";
            Cheque   = "";
            Notes    = "";
            Amount   = 0;

            Station  = new Stations();
            Customer = new Customers();
        }
예제 #6
0
 public override string ToString()
 {
     return(string.Format("\nID:{0}\nCategory:{10}\nTitle:{1}\nPrice:{2}\nPostDate:{3}\nLastChange:{4}\nLocation:{5}\nPhoneSaler:{7}\nQuality:{8}\nAddress:{9}\nContent:{6}",
                          ID.ToString()
                          , Title.ToString()
                          , Price.ToString()
                          , PostDate.ToString()
                          , LastChange.ToString()
                          , Location
                          , Content
                          , PhoneSaler
                          , Quality
                          , Address
                          , Category
                          ));
 }
예제 #7
0
 public override string ToString()
 {
     return
         (Environment.NewLine +
          new string('-', 10) +
          Environment.NewLine +
          "Title: " + Title + Environment.NewLine +
          "Content: " + Content + Environment.NewLine +
          "PostData: " + PostDate.ToString("dd.MM.yyyy") + Environment.NewLine +
          "Author: " + Author + Environment.NewLine +
          "Category: " + Category + Environment.NewLine +
          "Tags: " + string.Join(",", Tags) +
          Environment.NewLine +
          new string('-', 10) +
          Environment.NewLine);
 }
예제 #8
0
 public string ToCSVLine(string delimiter = "|")
 {
     return(string.Join("|", new[]
     {
         DateTime.Now.ToString("o"),
         Uri.ToString(),
         Title,
         PostDate.ToString("o"),
         UpdateDate.ToString("o"),
         Category,
         Price.ToString("c"),
         Location,
         Description.Replace("|", "/").Replace("\n", "\\n"),
         string.Join(",", Images.Select(i => i.ToString()))
     }
                        ));
 }
예제 #9
0
 public override string ToString()
 {
     return($"ID: {PostId}   Title: {Title}   PostDate: {PostDate.ToShortDateString()}");
 }
예제 #10
0
파일: Comment.cs 프로젝트: Arcuman/Borto_v1
 public string GetShortDate()
 {
     return(PostDate.ToShortDateString());
 }
예제 #11
0
        public Post[] GetYearlyPosts(PostDate date)
        {
            if (date == null)
            {
                return null;
            }

            IList<Post> posts = postRepository.GetPostsByYear(date.Year);
            return posts != null ? posts.ToArray() : null;
        }
예제 #12
0
 public MentorOffer()
 {
     PostDate       = DateTime.Today;
     ExpirationDate = PostDate.AddDays(3);
 }
예제 #13
0
        public void Render(HtmlTextWriter writer, DateTime lastVisited, Page page, string images, string document)
        {
            // Start row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Render post image
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRow");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "25");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "middle");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Src, images + "board_thread.gif");
            writer.RenderBeginTag(HtmlTextWriterTag.Img);
            writer.RenderEndTag();              // Img
            writer.RenderEndTag();              // Td

            // Post subject with hyperlink
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRow");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "middle");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "left");
            writer.AddAttribute(HtmlTextWriterAttribute.Height, "25");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}", PostID), "forumaction=&threadspage=&searchpage=&searchterms=") + string.Format("#{0}", PostID));
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            ForumText subjectForumText = new ForumText(Subject);

            writer.Write(subjectForumText.ProcessSingleLine(images));
            writer.RenderEndTag();              // A

            // Display new image if this post is new since last time user visited
            if (lastVisited < PostDate)
            {
                writer.Write(" ");
                writer.AddAttribute(HtmlTextWriterAttribute.Src, images + "new.gif");
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
            }
            writer.RenderEndTag();              // Span
            writer.RenderEndTag();              // Td

            // Posted by
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRowHighlight");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            ForumText aliasForumText = new ForumText(Alias);

            writer.Write(aliasForumText.ProcessSingleLine(images));
            writer.RenderEndTag();              // Span
            writer.RenderEndTag();              // Td

            // Date
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRowHighlight");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.Write(string.Format("{0}", PostDate.ToString("dd MMM yy")));
            writer.RenderEndTag();              // Span
            writer.RenderEndTag();              // Td

            // End row
            writer.RenderEndTag();              // Tr
        }
예제 #14
0
 public override string ToString()
 {
     return(string.Format("ID:{0}\nTitle:{1}\nPrice:{2}\nPostDate:{3}\nLastChange:{4}",
                          ID.ToString(), Title.ToString(), Price.ToString(), PostDate.ToString(), LastChange.ToString()));
 }
예제 #15
0
 public override string ToString()
 {
     return(string.Format("{0} - {1} [{2}]", PostDate.ToString("d"), Title, Id));
 }
예제 #16
0
        public void Render(HtmlTextWriter writer, bool displayActions, ForumUtils.ForumView forumView, bool selected, DateTime lastVisited, Page page, int loggedOnUserID, string avatar, string images, string document)
        {
            // New row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Left hand side contains user information (user alias, avatar, number of posts etc)
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRow");
            writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "nowrap");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "160");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            // We will put this user information in its own table in the first column
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "3");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "160");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            // User alias and number of posts
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderBeginTag(HtmlTextWriterTag.B);
            ForumText userAliasForumText = new ForumText(User.Alias);

            writer.Write(userAliasForumText.ProcessSingleLine(images));
            writer.RenderEndTag();              // B
            writer.RenderBeginTag(HtmlTextWriterTag.Br);
            writer.Write(string.Format("Posts: {0}", User.PostCount));
            writer.RenderEndTag();              // Br
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr

            // Avatar
            if (forumView == ForumUtils.ForumView.TreeViewDynamic)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, PostID.ToString() + "_avatarrow");
                if (!selected)
                {
                    writer.AddStyleAttribute("display", "none");
                }
            }
            if ((selected && forumView == ForumUtils.ForumView.TreeView) || forumView != ForumUtils.ForumView.TreeView)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                if (avatar != string.Empty)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                    writer.AddAttribute(HtmlTextWriterAttribute.Src, avatar);
                    writer.RenderBeginTag(HtmlTextWriterTag.Img);
                    writer.RenderEndTag();              // Img
                }
                writer.RenderEndTag();                  // Td
                writer.RenderEndTag();                  // Tr
            }

            // End user information table
            writer.RenderEndTag();              // Table
            writer.RenderEndTag();              // Td

            // Start row which will display subject, body and actions (reply, edit, etc)
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRow");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            if (forumView != ForumUtils.ForumView.FlatView && !selected)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Height, "100%");
            }
            if (forumView == ForumUtils.ForumView.TreeViewDynamic)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, PostID.ToString() + "_headercell");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            // Start a new table for this information
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "3");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            if (forumView != ForumUtils.ForumView.FlatView && !selected)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Height, "100%");
            }
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            if (forumView == ForumUtils.ForumView.TreeViewDynamic)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, PostID.ToString() + "_messagetable");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            // Highlighted row (subject and when posted information)
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            if (forumView != ForumUtils.ForumView.FlatView)
            {
                RenderLevelIndentCell(writer);
            }
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRowHighlight");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderBeginTag(HtmlTextWriterTag.B);
            writer.AddAttribute(HtmlTextWriterAttribute.Name, PostID.ToString());
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            writer.RenderEndTag();

            // Provide link to select a different post
            writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}", PostID), "forumaction=&searchpage=&threadspage=") + "#" + PostID);
            if (forumView == ForumUtils.ForumView.TreeViewDynamic)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, "DynMessLink");
                writer.AddAttribute(HtmlTextWriterAttribute.Name, PostID.ToString());
            }
            writer.RenderBeginTag(HtmlTextWriterTag.A);

            ForumText subjectForumText = new ForumText(Subject);

            writer.Write(subjectForumText.ProcessSingleLine(images));
            writer.RenderEndTag();              // A
            writer.RenderEndTag();              // B

            // Display new image if this post is new since last time user visited
            if (lastVisited < PostDate)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Src, images + "new.gif");
                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Br);
            writer.Write(string.Format("Posted: {0} {1}", PostDate.ToString("dd MMM yy"), PostDate.ToString("t")));
            writer.RenderEndTag();              // Br
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr

            // Message row
            if ((selected && forumView == ForumUtils.ForumView.TreeView) || forumView != ForumUtils.ForumView.TreeView)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
                if (forumView == ForumUtils.ForumView.TreeViewDynamic)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Id, PostID.ToString() + "_messagerow");
                    if (!selected)
                    {
                        writer.AddStyleAttribute("display", "none");
                    }
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                if (forumView != ForumUtils.ForumView.FlatView)
                {
                    RenderLevelIndentCell(writer);
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Td);

                ForumText bodyForumText = new ForumText(Body);
                writer.Write(bodyForumText.Process(images));

                writer.RenderEndTag();                  // Td
                writer.RenderEndTag();                  // Tr
            }

            // Reply, Quote, Edit, Get Link row
            if (displayActions && ((selected && forumView == ForumUtils.ForumView.TreeView) || forumView != ForumUtils.ForumView.TreeView))
            {
                if (forumView == ForumUtils.ForumView.TreeViewDynamic)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Id, PostID.ToString() + "_actionsrow");
                    if (!selected)
                    {
                        writer.AddStyleAttribute("display", "none");
                    }
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                if (forumView != ForumUtils.ForumView.FlatView)
                {
                    RenderLevelIndentCell(writer);
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Td);

                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
                writer.RenderBeginTag(HtmlTextWriterTag.Table);
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);

                writer.AddAttribute(HtmlTextWriterAttribute.Align, "Left");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);

                // Reply link
                writer.Write("[");
                writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}&forumaction=reply", PostID), "searchpage=&threadspage="));
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write("Reply");
                writer.RenderEndTag();                  // A
                writer.Write("]");

                // Quote link
                writer.Write("[");
                writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}&forumaction=quote", PostID), "searchpage=&threadspage="));
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write("Quote");
                writer.RenderEndTag();                  // A
                writer.Write("]");

                if (forumView == ForumUtils.ForumView.TreeViewDynamic)
                {
                    // Get Link
                    writer.Write("[");
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}", PostID), "forumaction=&searchpage=&threadspage=") + "#" + PostID);
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.Write("Get Link");
                    writer.RenderEndTag();                       // A
                    writer.Write("]");
                }

                writer.RenderEndTag();                  // Td

                writer.AddAttribute(HtmlTextWriterAttribute.Align, "Right");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);

                // Edit link (only allowed if this post by currently logged on user or an administrator)
                if (User.UserID == loggedOnUserID || page.User.IsInRole("ForumAdmin"))
                {
                    writer.Write("[");
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}&forumaction=edit", PostID), "searchpage=&threadspage="));
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.Write("Edit");
                    writer.RenderEndTag();                      // A
                    writer.Write("]");
                }

                writer.RenderEndTag();                  // Td
                writer.RenderEndTag();                  // Tr
                writer.RenderEndTag();                  // Table

                writer.RenderEndTag();                  // Td
                writer.RenderEndTag();                  // Tr
            }

            // Close out table and this row
            writer.RenderEndTag();              // Table
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr
        }
예제 #17
0
 public string TimeSincePost()
 {
     return(PostDate.TimeSince());
 }