|
From: <sv...@de...> - 2005-05-26 16:31:00
|
Author: pcamacho
Date: 2005-05-26 12:30:59 -0400 (Thu, 26 May 2005)
New Revision: 1152
Modified:
humano2/trunk/components/webTools/Adapter.cs
humano2/trunk/core/db/pgsql/pgsqlComplex.cs
humano2/trunk/web/portal/site/addOption.aspx.cs
humano2/trunk/web/portal/site/showView.aspx.cs
Log:
CHANGE: factorization: the GetPrimaryAttributeIdForClass has migrated to =
Adapter.
Modified: humano2/trunk/components/webTools/Adapter.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/Adapter.cs 2005-05-26 16:17:12 UTC =
(rev 1151)
+++ humano2/trunk/components/webTools/Adapter.cs 2005-05-26 16:30:59 UTC =
(rev 1152)
@@ -1754,20 +1754,9 @@
{
=09
if (id_entity =3D=3D "")
+ {
return "";
-// Humano2.Components.ViewTools.ViewTools vt =3D new ViewTools.ViewToo=
ls();
-// vt.Complex =3D complex;
-// DataTable table =3D getViewToolsTable();
-//
-// if(type_relation =3D=3D "")
-// type_relation =3D "f";
-//
-// // Get the id_entity and the domainName of all the domains in the s=
ystem.
-// string[] fila =3D {"70","71|4|'" + id_entity + "'|0|0","","","",""}=
;
-// table.Rows.Add(fila);
-// vt.IdClass =3D 81; // This is the pertinece table.
-// XmlDocument objXmlDocument=3Dnew XmlDocument();
-// objXmlDocument =3D vt.GetSQLXML(table);
+ }
DataTable dt =3D new DataTable();
dt =3D complex.getPertinenceByIdClass(Convert.ToInt32(id_entity));
=20
@@ -1784,11 +1773,9 @@
}
=20
//return objXmlDocument.InnerXml;
- return strxml ;
-
- =09
- =09
+ return strxml ;=09
}
+ =20
public int GetClassByID(int id_entity)
{
return complex.getClassIdofInstance(id_entity);
@@ -1818,8 +1805,29 @@
{
return id_attribute;
}
-
}
+ =20
+ ///<summary>Finds the id of the primary attribute of a class</su=
mmary>
+ ///<param name=3D"classId">the id of class</param>
+ ///<returns>The id of primary attribute</returns>
+ public int GetPrimaryAttributeIdForClass(int classId)
+ {
+ absCrud crud =3D Factory.Crud();
+ absComplex complex =3D crud.GetCore().Complex;
+ =20
+ DataTable res =3D GetAttributesFromClass(classId);
+ int idAtt =3D 0;
+ int i=3D0;
+ foreach(DataRow row in res.Rows)
+ {
+ if(complex.IsPrimary(Convert.ToInt32(row["id_entity"])))
+ {
+ idAtt =3D Convert.ToInt32(row["id_entity"]);
+ break; =20
+ }
+ }
+ return idAtt;
+ }
=20
public DataTable GenerateViewTools(int classId, string columns, string=
filters,=20
string groupby, string havings,=20
Modified: humano2/trunk/core/db/pgsql/pgsqlComplex.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/core/db/pgsql/pgsqlComplex.cs 2005-05-26 16:17:12 UTC (=
rev 1151)
+++ humano2/trunk/core/db/pgsql/pgsqlComplex.cs 2005-05-26 16:30:59 UTC (=
rev 1152)
@@ -1241,6 +1241,5 @@
return res; =09
=20
}
-
}
}
Modified: humano2/trunk/web/portal/site/addOption.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/addOption.aspx.cs 2005-05-26 16:17:12 U=
TC (rev 1151)
+++ humano2/trunk/web/portal/site/addOption.aspx.cs 2005-05-26 16:30:59 U=
TC (rev 1152)
@@ -49,7 +49,7 @@
int idClassRel =3D Convert.ToInt32(dr2["to"].ToString());
=09
//For each attribute of pertinence put the id with t=
ogo
- int relAttId =3D getPrimaryAttributeIdForClass(idCla=
ssRel);
+ int relAttId =3D dbAdapter.GetPrimaryAttributeIdForC=
lass(idClassRel);
strXml +=3D "parent.AddAtt('" + idAtt + "^" + relAtt=
Id;
}
=20
@@ -62,27 +62,6 @@
Response.Write(strXml);
}
=20
- private int getPrimaryAttributeIdForClass(int classId)
- {
- Logger.Log("getPrimaryAttributeIdForClass (before)",LogLevel=
.Trace);
- absCrud crud =3D Factory.Crud();
- absComplex complex =3D crud.GetCore().Complex;
- =20
- DataTable res =3D dbAdapter.GetAttributesFromClass(classId);
- int idAtt =3D 0;
- int i=3D0;
- foreach(DataRow row in res.Rows)
- {
- if(complex.IsPrimary(Convert.ToInt32(row["id_entity"])))
- {
- idAtt =3D Convert.ToInt32(row["id_entity"]);
- break; =20
- }
- }
- Logger.Log("getPrimaryAttributeIdForClass (after)",LogLevel.=
Trace);
- return idAtt;
- }
- =20
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
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-05-26 16:17:12 UT=
C (rev 1151)
+++ humano2/trunk/web/portal/site/showView.aspx.cs 2005-05-26 16:30:59 UT=
C (rev 1152)
@@ -240,7 +240,7 @@
DataRow dr2 =3D dtpert.Rows[0];
int idClassRel =3D Convert.ToInt32(dr2["to"].ToString());
//For each attribute of pertinence put the id with t=
ogo
- int relAttId =3D getPrimaryAttributeIdForClass(idCla=
ssRel);
+ int relAttId =3D userCred.CoreAdapter.GetPrimaryAttr=
ibuteIdForClass(idClassRel);
columnsList +=3D idAtt + "^" + relAttId;
}
columnsList +=3D ",";
@@ -252,27 +252,6 @@
}
=20
=20
- private int getPrimaryAttributeIdForClass(int classId)
- {
- Logger.Log("getPrimaryAttributeIdForClass (before)",LogLevel=
.Trace);
- absCrud crud =3D Factory.Crud();
- absComplex complex =3D crud.GetCore().Complex;
- =20
- DataTable res =3D userCred.CoreAdapter.GetAttributesFromClas=
s(classId);
- int idAtt =3D 0;
- int i=3D0;
- foreach(DataRow row in res.Rows)
- {
- if(complex.IsPrimary(Convert.ToInt32(row["id_entity"])))
- {
- idAtt =3D Convert.ToInt32(row["id_entity"]);
- break; =20
- }
- }
- Logger.Log("getPrimaryAttributeIdForClass (after)",LogLevel.=
Trace);
- return idAtt;
- }
- =20
private string getFilters(string idAttributes, string idOperators, str=
ing valuesToCompare, char separator)
{
string filter =3D"";
|