Solved

Display a color-coded project status

Posted on 2007-11-29
10
609 Views
Last Modified: 2008-02-01
Dear .net Gurus,

I need your urgent assistance.

I have been tasked with building a so-called "Simple" project tracker.

I would like Projects grouped like this:

Department HR     Status              Color
Project A         Unassiged         Gainsboro
Project B         Pending           Yellow
Project C         Completed         Green
Project D         Past Due          Red
Prject F             Closed            Purple

Department IT       Status           Color
Project A           Unassiged         Gainsboro
Project B             Pending           Yellow
Project C             Completed         Green
Project D             Past Due          Red
Prject F              Closed            Purple

This will list all departments with all of its projects and status and color-coded status.

To get the details, a user would click on the particular project view such details as startdate, completion date, requestedcompletion date, actual completition date, status, priority, etc.

Can I get some help with how to code this please?
0
Comment
Question by:nigerman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 
LVL 3

Expert Comment

by:PierreBeukes
ID: 20380008
Hi,

In the table you are going to store your projects - you will have a status field. this will be numeric..
0 = Unassiged
1 = Pending
2 = Completed
3 = Past Due
4 = Closed

You can also have a table called something like app_status..
Where you can store the numeric value and the text value ... like above .... - you can also put a column in there for colour...

So when you load your projects  - you will be able to pickup the text value of the status and assign the appropriate colour...
What is nice is that if you store the colour in the table like that - if you want to change it - you change it in the Database and it will show the new colour all over (You can build a settings page to select the colours per status).

Thanks,
P
0
 

Author Comment

by:nigerman
ID: 20382505
Thanks very much for your response.

What we don't want to do is have a user select colors by themselves.

I love your idea of having a fieldname called Color in status table but I needed, if possible, the syntax for displaying this info.

For instance:

Select projectName, Status, color from Project, Status where project.statusid = status.statusid

Can you please help me with the .net syntax? I use vb but c# is ok too.
0
 

Author Comment

by:nigerman
ID: 20383572
Here is an example of what I am talking about.

The following code works as fars retrieving info and displaying.

On the summary page, StatusColor is displaying as Red, or White, Blue, depending on the status.

What I am having problem accomplishing is changing the color from text to the background color.

In other words, instead of reading Red, I want to see background color of Red displayed.

Can you please assist?

here is what I have so far:

        Private Function GetTasks() As DataSet
            Dim SQLStatement As String = "SELECT Project_ID,projName, DepartmentName, StatusName, StatusColor FROM tblProjects, tblStatus, tblDepartments Where tblProjects.statusID = tblStatus.StatusID and tblProjects.DeptID = tblDepartments.DepartmentID GROUP BY DepartmentName,ProjName,StatusName,project_id,statusColor ORDER BY DepartmentName"

            'instantiate sql connection and command object
            Dim myConnection As New SqlConnection("data source = Localhost;initial catalog = TaskList;Integrated Security=SSPI;")
            Dim myCommand As SqlDataAdapter = New SqlDataAdapter(SQLStatement, myConnection)

            '/declare myDataSet as DataSet
            Dim myDataSet As DataSet
            Dim RcdCount As Integer

            ' mark the Command as s Text
            myCommand.SelectCommand.CommandType = CommandType.Text

            '/create an instance of dataset
            myDataSet = New DataSet

            '/fill the dataset with returned records
            myCommand.Fill(myDataSet, "Contact")
            RcdCount = myDataSet.Tables("Contact").Rows.Count.ToString()
            'MyDataGrid.PageSize = CInt(ps.SelectedItem.Value)
            ResultCount = RcdCount
            RecordCount.Text = "<b><font color=red>" & RcdCount & "</font> records found"

            '/finally return dataset
            Return myDataSet
        End Function
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:nigerman
ID: 20386035
Can anyone please jump in and help???
0
 
LVL 3

Expert Comment

by:PierreBeukes
ID: 20393751
Hi,

Sorry for replying so late.
Ok - I see you created a function GetTasks() to return a Dataset to you.
Do you want to show the details in a gridview (I will assume this for now)...
so after you get the dataset...
you will bind it to a gridview

        GridView1.DataSource = GridDs
        GridView1.DataBind()

Add the RowDataBound event to the gridview

This is how mine looks like

    Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound

        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim c As System.Drawing.Color
            c = System.Drawing.ColorTranslator.FromHtml(e.Row.DataItem("StatusColour"))
            e.Row.BackColor = c
        End If
    End Sub



I have a column called StatusColour in my table with the values in html format  -> #b3424a

This works as it colours the entire row the colour which is specified in the database ... you can apply it to a column only if you wish...

Let me know if this works for you :)

Ciao
0
 

Author Comment

by:nigerman
ID: 20441011
Thanks a lot and sorry for late response.

I wanted it for datagrid, Can it be changed for datagrid?
0
 
LVL 3

Expert Comment

by:PierreBeukes
ID: 20447718
Are you working with Vb.NET  or ASP.NET?????
0
 

Author Comment

by:nigerman
ID: 20449206
asp.net, vb flavor
0
 
LVL 3

Accepted Solution

by:
PierreBeukes earned 100 total points
ID: 20455480
Then my above solution should work for you -> Just drag on a gridview
0
 

Author Comment

by:nigerman
ID: 20486651
thanks
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question