protected void sendBlogBtn_Click(object sender, EventArgs e)
    {
        // When the new blog text box has changed, we need to update the characters left label which is what the function below calculates
        this.changeCharacterLeftLabel();
        // Declares an int that calcualuates how many characters are left
        int charsLeft = newBlogTextBox.MaxLength - newBlogTextBox.Text.Length;
        // checks if charsLeft is within the character limit
        if (charsLeft >= 0)
        {
             // if it is, we write the blog to the user entry file

            // Declares a BlogReaderWriter object that allows to save to the user entry file
            BlogReaderWriter blogWriter = new BlogReaderWriter(Path.GetFullPath(Server.MapPath("~\\files\\KMartUserEntry.txt")));
            // Declares a int32 variable that gets and stores the current unix time
            Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
            // Writes the new blog entry information to the new user entry file
            blogWriter.writeBlogToEntryFile("KMart", (String)Session["loginID"], unixTimestamp.ToString(), newBlogTextBox.Text);
            // redirects the users to a success page to confirm that there blog entry is awaiting moderation
            Response.Redirect("Post_Success.aspx");
        }
    }
    private void getNextFiveBlogsFromList()
    {
        //create a BlogReaderWriter object that is used to read the store's entry file
        BlogReaderWriter blogReader = new BlogReaderWriter(Path.GetFullPath(Server.MapPath("~\\files\\FarmersUserEntry.txt")));
        //create a an arraylist object that holds the the blog entries is a formatted string
        ArrayList blogListData = blogReader.getBlogListInformation();

        // clears the blogListTable
        blogListTable.Rows.Clear();
        // add 5 to numberOfBlogsToShow (so it will show the next 5 blogs)
        numberOfBlogsToShow += 5;
        // check if the above actually goes over the length of the blog entries
        if (numberOfBlogsToShow > blogListData.Count)
        {
            // if it does, set it to the maximum possible number (which will be the number of elements in the arraylist)
            numberOfBlogsToShow = blogListData.Count;
        }
        // Declares a temporary int counter that is used for the loop (that initalised with numberOfBlogsToShow)
        // This declares how many blogs will be shown
        int numberOfBlogsToShowCounter = numberOfBlogsToShow;

        // loop until numberOfBlogsToShowCounter is zero
        while (numberOfBlogsToShowCounter > 0)
        {
            // create a new table row
            TableRow tr = new TableRow();
            // create a new table cell
            TableCell tc = new TableCell();
            // set the cell's text to the arraylist's first element
            tc.Text = (String)blogListData[0];
            // remove the arraylist's first element as its no longer needed
            blogListData.RemoveAt(0);
            // Add the cell to the table row
            tr.Cells.Add(tc);
            // add the table row to the table
            blogListTable.Rows.Add(tr);
            // decrease the counter by one
            numberOfBlogsToShowCounter--;
        }
    }
    protected void sendBlogBtn_Click(object sender, EventArgs e)
    {
        // When the new blog text box has changed, we need to update the characters left label which is what the function below calculates
        this.changeCharacterLeftLabel();
        // Declares an int that calcualuates how many characters are left
        int charsLeft = newBlogTextBox.MaxLength - newBlogTextBox.Text.Length;

        // checks if charsLeft is within the character limit
        if (charsLeft >= 0)
        {
            // if it is, we write the blog to the user entry file

            // Declares a BlogReaderWriter object that allows to save to the user entry file
            BlogReaderWriter blogWriter = new BlogReaderWriter(Path.GetFullPath(Server.MapPath("~\\files\\FarmersUserEntry.txt")));
            // Declares a int32 variable that gets and stores the current unix time
            Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
            // Writes the new blog entry information to the new user entry file
            blogWriter.writeBlogToEntryFile("Farmers", (String)Session["loginID"], unixTimestamp.ToString(), newBlogTextBox.Text);
            // redirects the users to a success page to confirm that there blog entry is awaiting moderation
            Response.Redirect("Post_Success.aspx");
        }
    }
 private void getNextFiveBlogsFromList()
 {
     //create a BlogReaderWriter object that is used to read the store's entry file
     BlogReaderWriter blogReader = new BlogReaderWriter(Path.GetFullPath(Server.MapPath("~\\files\\KMartUserEntry.txt")));
     //create a an arraylist object that holds the the blog entries is a formatted string
     ArrayList blogListData = blogReader.getBlogListInformation();
     // clears the blogListTable
     blogListTable.Rows.Clear();
     // add 5 to numberOfBlogsToShow (so it will show the next 5 blogs)
     numberOfBlogsToShow += 5;
     // check if the above actually goes over the length of the blog entries
     if (numberOfBlogsToShow > blogListData.Count)
     {
         // if it does, set it to the maximum possible number (which will be the number of elements in the arraylist)
         numberOfBlogsToShow = blogListData.Count;
     }
     // Declares a temporary int counter that is used for the loop (that initalised with numberOfBlogsToShow)
     // This declares how many blogs will be shown
     int numberOfBlogsToShowCounter = numberOfBlogsToShow;
     // loop until numberOfBlogsToShowCounter is zero
     while (numberOfBlogsToShowCounter > 0)
     {
         // create a new table row
         TableRow tr = new TableRow();
         // create a new table cell
         TableCell tc = new TableCell();
         // set the cell's text to the arraylist's first element
         tc.Text = (String)blogListData[0];
         // remove the arraylist's first element as its no longer needed
         blogListData.RemoveAt(0);
         // Add the cell to the table row
         tr.Cells.Add(tc);
         // add the table row to the table
         blogListTable.Rows.Add(tr);
         // decrease the counter by one
         numberOfBlogsToShowCounter--;
     }
 }