|
From: <sv...@de...> - 2005-06-23 17:16:30
|
Author: pcamacho
Date: 2005-06-23 13:16:33 -0400 (Thu, 23 Jun 2005)
New Revision: 1406
Modified:
humano2/trunk/components/webTools/interfacetools.cs
humano2/trunk/web/portal/site/showView.aspx.cs
Log:
CHANGE: factorization for preparing fixing #225.
Modified: humano2/trunk/components/webTools/interfacetools.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/components/webTools/interfacetools.cs 2005-06-23 16:59:=
14 UTC (rev 1405)
+++ humano2/trunk/components/webTools/interfacetools.cs 2005-06-23 17:16:=
33 UTC (rev 1406)
@@ -258,11 +258,6 @@
public static string GetXmlAttribListForClass(int classId,SessionCrede=
ncial userCred, bool fullPert)=20
{
string salida=3D"";
- int attlogin =3D 0;
- int idatt =3D 0;
- DataTable dtpert;
- DataTable dtrel;
- int idClassRel =3D 0;
string className =3D "";
=20
DataTable dt =3D userCred.CoreAdapter.GetAttributesFromClass(classId)=
;
@@ -276,6 +271,8 @@
salida +=3D "<name>" + className + "</name>";
salida +=3D "<attributes>";
=09
+ /*
+ =20
foreach(DataRow row in dt.Rows)=20
{
string attName =3D Convert.ToString(row["attName"]);
@@ -310,12 +307,80 @@
salida +=3D "</attribute>";
}
}
+ =20
+ */
+ =20
+ DataTable DtListAtt =3D getAttribListForClass(classId, userC=
red,fullPert);
+ foreach(DataRow row in DtListAtt.Rows)
+ {
+ salida +=3D "<attribute>";
+ salida +=3D "<id>";
+ salida +=3D Convert.ToString(row["id"]);
+ salida +=3D "</id>";
+ salida +=3D "<name>";
+ salida +=3D Convert.ToString(row["name"]);
+ salida +=3D "</name>";
+ =20
+ salida +=3D "</attribute>";
+ }
+ =20
salida +=3D "</attributes>";
salida +=3D "</class>";
=20
return salida;
}
=20
+ =20
+ private static DataTable getAttribListForClass(int classId, Sess=
ionCredencial userCred,bool fullPert)
+ {
+ int attlogin =3D 0;
+ int idatt =3D 0;
+ DataTable dtpert;
+ DataTable dtrel;
+ int idClassRel =3D 0;
+ DataTable dt =3D userCred.CoreAdapter.GetAttributesFromClass=
(classId);
+ DataTable res =3D new DataTable();
+ DataColumn colName;
+ colName =3D new DataColumn("name",typeof(string));
+ res.Columns.Add(colName);
+ DataColumn colId;
+ colId =3D new DataColumn("id",typeof(string));
+ res.Columns.Add(colId);
+ =20
+ foreach(DataRow row in dt.Rows)=20
+ {
+ DataRow resRow =3D res.NewRow();
+ string attName =3D Convert.ToString(row["attName"]);
+ string attType =3D Convert.ToString(row["attType"]);
+ if((attType=3D=3D"pertinence") && fullPert)
+ {
+ idatt =3D Convert.ToInt32(row["id_entity"]);
+ dtpert =3D userCred.CoreAdapter.GetClassesFromPertinence(idatt);
+ DataRow dr2 =3D dtpert.Rows[0];
+ idClassRel =3D Convert.ToInt32(dr2["to"].ToString());
+ =09
+ //For each attribute of pertinence put the id with t=
ogo and=20
+ // the pertname.attname
+ int [] listAttId =3D GetAttributeIdListForClass(idCl=
assRel,userCred);
+ string [] listAttName =3D getAttributeNameListForCla=
ss(idClassRel,userCred);
+ int size =3D listAttId.Length;
+ for(int i=3D0;i<size;i++)
+ {
+ attlogin =3D listAttId[i];
+ resRow["id"] =3D idatt + "^" + attlogin;
+ resRow["name"] =3D attName + "." + listAttName[=
i];
+ }
+ }
+ else
+ {
+ resRow["id"] =3D row["id_entity"].ToString();
+ resRow["name"] =3D attName;
+ } =20
+ res.Rows.Add(resRow);
+ }
+ return res;
+ }
+ =20
///<summary> The list of all attributes id for a class</summary>
public static int[] GetAttributeIdListForClass(int classId, Sess=
ionCredencial userCred)
{
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-23 16:59:14 UT=
C (rev 1405)
+++ humano2/trunk/web/portal/site/showView.aspx.cs 2005-06-23 17:16:33 UT=
C (rev 1406)
@@ -75,7 +75,6 @@
}
override protected string createXml()
{
-
string xmlString =3D""; //the result string
=20
adapter dbAdapter =3D userCred.CoreAdapter;
@@ -84,7 +83,6 @@
=20
iniClass =3D 0;
=20
-
iniClass =3D Convert.ToInt32(Request["classId"]);
//Logger.Log("classId" + iniClass.ToString(),LogLevel.Trace)=
;
=20
|