|
From: <sv...@de...> - 2005-06-20 15:08:01
|
Author: pcamacho
Date: 2005-06-20 11:08:00 -0400 (Mon, 20 Jun 2005)
New Revision: 1367
Modified:
humano2/trunk/web/portal/site/showView.aspx.cs
Log:
FIX: big big and ugly patch for #206.
Modified: humano2/trunk/web/portal/site/showView.aspx.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- humano2/trunk/web/portal/site/showView.aspx.cs 2005-06-20 13:48:08 UT=
C (rev 1366)
+++ humano2/trunk/web/portal/site/showView.aspx.cs 2005-06-20 15:08:00 UT=
C (rev 1367)
@@ -644,32 +644,87 @@
patchedTable.Columns.Add(newPatchedCol);
}
=20
- //Now change the lines with good values
- =20
+ //Now change the lines with good values =20
+ //Builds the empty rows
for(int i=3D0;i<viewRes.Rows.Count;i++)
{
- DataRow myRow =3D patchedTable.NewRow(); //Create the li=
ne once
+ DataRow myRow =3D patchedTable.NewRow(); =20
+ patchedTable.Rows.Add(myRow);
+ }
+ =20
+ indexColumns =3D 0;
+ for(int i=3D0;i<viewRes.Columns.Count;i++)
+ {
+ string [] colsArr =3D null;
+ string colName =3D viewRes.Columns[i].ColumnName;
+ bool specialCol =3D false;
+ if((colName.StartsWith("id_entity"))=20
+ || (colName=3D=3D"id_entity")
+ || (colName=3D=3D"row"))
+ {
+ if(colName=3D=3D"id_entity") //The first column must=
be always 0
+ {
+ indexColumns++; =20
+ }
+ specialCol =3D false;
+ }
+ else
+ {
+ string col =3D columnsList[indexColumns];
+ if(col.Split("^".ToCharArray()).Length=3D=3D2) //Per=
t attribute
+ {
+ colsArr =3D buildPertinenceColumn(viewTable,col,=
iniClass,idEntity);
+ specialCol =3D true; =20
+ }
+ else
+ {
+ specialCol =3D false; =20
+ }
+ indexColumns++;
+ }
+ =20
//Fill the row
- for(int j =3D 0; j< viewRes.Columns.Count; j++)
+ for(int j =3D 0; j< viewRes.Rows.Count; j++)
{
- myRow[j] =3D Convert.ToString(viewRes.Rows[i][j]);
- Console.Write(myRow[j] + " ");
+ if(specialCol)
+ {
+ patchedTable.Rows[j][i] =3D colsArr[j];//Conver=
t.ToString(viewRes.Rows[j][i]); =20
+ }
+ else
+ {
+ patchedTable.Rows[j][i] =3D Convert.ToString(vie=
wRes.Rows[j][i]); =20
+ }
}
- patchedTable.Rows.Add(myRow); =20
- Console.Write("\n");
}
return patchedTable;
} =20
=20
- /*
- private string buildPertinenceColumn(DataTable viewTable, string=
col, int iniClass, int idEntity)
+ ///<summary>
+ /// Due to a bug in viewtools, for every pertinence attribute of=
a class, we have to=20
+ /// do a request to viewtools to get the values of every column.=
Doing the one request=20
+ /// with viewtools for all columns does not work because only th=
e first column of pertinence is
+ /// is brought.
+ ///<summary>
+ private string [] buildPertinenceColumn(DataTable viewTable, str=
ing col, int iniClass, int idEntity)
{
- viewTable["columns"] =3D "0" + col;
+ Logger.Log("<<buildPertinenceColumn>>",LogLevel.Trace);
+ Logger.Log("column: " + col,LogLevel.Trace);
+ viewTable.Rows[0]["columns"] =3D "0," + col;
=20
adapter dbAdapter =3D userCred.CoreAdapter;
DataTable res =3D dbAdapter.ExecViewFromDataTable(iniClass, =
viewTable, idEntity, "", 0, 1);
+ =20
+ //Build the column
+ int size =3D res.Rows.Count;
+ string [] resArr =3D new string [size];
+ =20
+ for(int i=3D0; i< size; i++)
+ {
+ resArr[i] =3D Convert.ToString(res.Rows[i][2]); //col 0=
: id_entity of instance, col 1: id_entity of pert, col2 value of pert =20
+ }
+ return resArr;
}
- */
+ =20
=20
/////////////////////////////////////////////////////////////////=
//////////////////////////////////=20
///////////////////////////////////// END OF UGLY PATCH /////////=
//////////////////////////////////
|