How to create Task Lister in C#

No.of Views655
Bookmarked1 times
Downloads 
Votes0
By  ninethsense   On  14 Jun 2010 10:06:07
Tag : CSharp , Utilities
An article about builing a task tracker software.
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Introduction

This piece of software can be used for the following:

  • Tracking the project work flow - a Task Lister.
  • Track the issues reported by the client.
  • Project estimation etc.

The features I have integrated, presently, are:

  • Export to HTML and Excel Worksheet.
  • Simple interface.
  • No database used - XML file for storing data.
  • Always-on-top feature.

  

Image Loading

Background

I was using an Excel sheet for a long time for tracking issues reported by the client. Once I got some free time, I made a small utility for this purpose. That means, I made this tool as per my requirements. Not sure how much this will be useful for you. Well, you can create more fields, features etc., if you wish. Also, if you suggest, I can make it for you.

Using the code

First, the application reads the TaskLister.xml file to a DataSet, and then it fills a DataGridView. The DataGridview gives the users option to add, remove, edit, set priority, set status etc.

ds.ReadXml(XMLfile);
dataGridView1.DataSource = ds.Tables["table1"];

 For saving the data, a simple line is used:

ds.WriteXml(XMLfile, XmlWriteMode.WriteSchema);

 Exporting to HTML and Excel Worksheets uses the below code - you can see here that the export to Excel is a trick.

private void exportToHTMLToolStripMenuItem_Click(object sender, EventArgs e)
{
    saveFileDialog1.Filter ="HTML Files|*.htm*|Excel Worksheet files|*.xls";if (saveFileDialog1.ShowDialog() == DialogResult.OK)
    {
      FileInfo fi = new FileInfo(saveFileDialog1.FileName);
      StreamWriter sw = fi.CreateText();
      sw.WriteLine("<html><head><title>" +"TaskLister Export</title>"); 
      sw.WriteLine("<style>th, td {border-bottom:solid 1px" +" brown;border-right:solid 1px brown;}" +" table {font:normal 12px arial}" +"</style></head><body>");
      sw.WriteLine("<table cellpadding=0 cellspacing=0 " +"style='border:solid 1px brown'>");
      sw.Write("<tr bgcolor='#FF9933'><th align='center' " +"width='30px'>No.</th><th align='center' " +"width='50px'>Priority</th><th align='center' " +"width='100px'>Ref.</th><th align='center'" +" width='250px'>Task</th><th align='center' " +"width='70px'>Status</th><th align='center' " +"width='30px'>Hrs.</th><th align='center' " +"width='200px'>Comments</th></tr>");foreach (DataRow dr in ds.Tables["table1"].Rows)
      {
          sw.Write("<tr><td align='center'> " + dr[0] +"</td><td align='center'> " + dr[1] +"</td><td> " + dr[2] +"</td><td width='250px'> " + dr[3] +"</td><td align='center'> " + dr[4] +"</td><td width='30px'> " + dr[5] +"</td><td width='200px'> " + dr[6] +"</td></tr>");
      }
      sw.WriteLine("</table>");
      sw.WriteLine("<span style='font:italic 8px times new roman'>" +"Created with TaskLister1.0 from Praveen." +"</span></body></html>");
      sw.Close();
    }
}

 Sample Project Source

Download source files -267 kb

Download demo files -9 kb

 
Sign Up to vote for this article
 
About Author
 
ninethsense
Occupation-
Company-
Member Type-Junior
Location-Not Provided
Joined date-21 Jul 2009
Home Page-http://blog.ninethsense.com/
Blog Page-http://blog.ninethsense.com/
 
 
Other popularSectionarticles
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top