Search code examples
c#winformsdatagridview3-tier

Manipulate datagridview column in 3 tier architecture


I am currently on a project that does management of interns. Every intern has projects. Also every project has steps/points. If intern completes an step, project increases its progress. So basically, every project has a progress.

I'm using an custom DataGridViewProgressColumn. After adding this column to my datagridview, I can change it's value with just setting its value to something.

//Last index of datagridview is progresscolumn.
dataGridView1.Rows[i].Cells[dataGridView1.ColumnCount - 1].Value = value;

This value is coming from database, as far as I know, I shouldn't access to database from UI layer. But datagridview is at UI layer.

I have 2 solutions in my mind:

  1. Set every value of progresscolumn at data access layer: I dont think this is possible although I think this is best solution: I just cant change the value of -not placed- progressColumn.

  2. Set every value of progresscolumn at UI layer, probably "working but against of architecture" solution.

How can i solve this problem? Thank you.


Solution

  • Anyway, I just used a DAL function that returns an int value. That function calculates the value and returns it.

    dataGridView1.Rows[i].Cells[dataGridView1.ColumnCount - 1].Value = DAL.getValue(rowID);