Results 1 to 7 of 7

Thread: Need guru tips and ideas!!

  1. #1

    Thread Starter
    Addicted Member Halon's Avatar
    Join Date
    Oct 2002
    Location
    under desk choking on rage
    Posts
    228

    Talking Need guru tips and ideas!!

    Need to delve into the forum guru's knowledge base.

    I am looking to make a dispatch application. One that will graphically show, by day, where each of our employees are (client name, location etc). We do it now in excel, having the time down the left side, the employees along the top and then coloring in the cells corresponding to the time and employee.

    Dumb thing is we already capture all this information and store it in our database within an app i have already written. Seems stupid to have the info on hand and then have our project managers have to look over the data and make daily time sheets.

    What i want to do is access the data in SQL Server and display it over the web using an ASPX page for the front end (i am writing the rest of the app in c# so that will be the base).

    Does anybody have any ideas or tips to give? Should i use a datagrid or maybe a repeater? Are there any controls out there for this type of thing? Any help would be greatly appreciated before I get to deep into this and find out there is an easy way to present data this way.

    Thanks everybody!!
    Soylent Green tastes like chicken

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    If all you are doing is creating a colored cell that matches the employee up to a time, I wouldn't use a datagrid.

    From what I understand from your post, I would use a table control and add the rows and cells in the load event that way you can color the exact cell you wanted. I have examples of how to create the rows and cells programaticly in order to add to the table control if you need it.

    Can you post a screen shot of the app your currently using, or maybe an excel document to give us a further understanding of what it should look like? I might be able to figure out a better way to do it.

  3. #3

    Thread Starter
    Addicted Member Halon's Avatar
    Join Date
    Oct 2002
    Location
    under desk choking on rage
    Posts
    228
    You bet, thanks for the time hellswraith!!
    Soylent Green tastes like chicken

  4. #4

    Thread Starter
    Addicted Member Halon's Avatar
    Join Date
    Oct 2002
    Location
    under desk choking on rage
    Posts
    228
    I am not at work so I just whipped up an example in excel (basic but gets the idea across).
    Screenshot
    I want to be able to pull all values from our database to populate the table. The numbers within the colored cells are job numbers to allow us to get more detailed info, once I figure out how to display the info all will be dynamic based on the day etc.

    Hellswraith, what you are saying is perfect. Sounds like exactly what i am looking for. If you had examples it would be great.
    Soylent Green tastes like chicken

  5. #5

    Thread Starter
    Addicted Member Halon's Avatar
    Join Date
    Oct 2002
    Location
    under desk choking on rage
    Posts
    228
    Forgot screenshot
    Attached Images Attached Images  
    Soylent Green tastes like chicken

  6. #6
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Ok, first you need to add a table control onto the form.

    You will obviously need to develop the logic to actually figure out which cells to color and such. That seems like it will take some time to figure out, but I would probably use multidimensional arrays to figure out what cells are to be colored. What I would do is store the color values in the multidimensional array in the same way the table is supposed to look. (that is kind of hard to explain).

    Here is how you can add rows and cells dynamically.
    PHP Code:
    // Create the header row:
    TableRow headerRow = new TableRow();

    // Create the cells for the header row:
    TableCell headerCell1 = new TableCell();
    TableCell headerCell2 = new TableCell();

    // Create some literal controls to hold some html to put inside the cells:
    LiteralControl lc1 = new LiteralControl();
    LiteralControl lc2 = new LiteralControl();
                
    // Put the HTML inside the literal controls:
    lc1.Text "<b>First Column</b>";
    lc2.Text "<b>Second Column</b>";

    // Add the literal controls to the cells control collection:
    headerCell1.Controls.Add(lc1);
    headerCell2.Controls.Add(lc2);

    // Add the cells to the rows cell collection:
    headerRow.Cells.Add(headerCell1);
    headerRow.Cells.Add(headerCell2);

    // Now add the row to the table:
    Table1.Rows.Add(headerRow);

    // Now add the items.  This will probably be different for yours.
    // I am using a dataset to help populate the table, but you can use
    // an array or another datasource.
    foreach(DataRow dr in ds.Tables[0].Rows)
    {
       
    // Create a table row object:
       
    TableRow tr = new TableRow();
       
    // Create the cell objects for this row:
       
    TableCell tc1 = new TableCell();
       
    TableCell tc2 = new TableCell();

       
    // I am putting a literal control in the first column, then a hyperlink
       // in the second column.  Create those controls:
       
    LiteralControl litCont = new LiteralControl();
       
    HyperLink hl = new HyperLink();

       
    // Add the text to the literalcontrol, then add it to the first cell.
       
    litCont.Text dr["Column1"].ToString();
       
    tc1.Controls.Add(litCont);

       
    // Create the hyperlink, then add it to the second cell.
       
    hl.Text dr["Column2"].ToString();
       
    hl.NavigateUrl "http://www.myhyperlink.com/index.aspx?CatName=" dr["Column3"].ToString();
       
    tc2.Controls.Add(hl);

       
    // Add the newly created cells to the row:
       
    tr.Cells.Add(tc1);
       
    tr.Cells.Add(tc2);

       
    // Now add the table row to the table:
       
    Table1.Rows.Add(tr);

    You can modify the cell object and change the backcolor of it. That will get what you need. Something like:
    tc1.BackColor = Color.Blue;

    It will require some work on your part to get it right, but can be done. If I could see how and what the data is returned from the db is, I might be able to give some suggestions. Good luck.

  7. #7

    Thread Starter
    Addicted Member Halon's Avatar
    Join Date
    Oct 2002
    Location
    under desk choking on rage
    Posts
    228
    That code kicks ass hellswraith. I never knew there was a table control, glad i just didn't go ahead with my first ideas.

    I am not going to implement the color coding of job sites so it is a little easier now. Basically the values we suck from the Db are

    1. Site Name
    2. Job Number
    (the first twowill be within the colored cells)

    3. Employee
    (labelled along the top)
    4. TimeStart
    4. Time End
    (used to place the cell - labelled along left)
    6. Date of job
    7. Quadrant of city ( i will be coloring a map based on area of city working in)


    I am off to test some stuff. Thanks for your help and any other ideas you have would be greatly appreciated
    Soylent Green tastes like chicken

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width