|
From: <sv...@de...> - 2005-06-15 14:34:40
|
Author: pcamacho Date: 2005-06-15 10:34:11 -0400 (Wed, 15 Jun 2005) New Revision: 1330 Modified: humano2/trunk/components/webTools/interfacetools.cs humano2/trunk/web/builder/site/createreport.aspx.cs humano2/trunk/web/builder/site/viewmain.aspx.cs Log: CHANGE: factorization of the function that get the list of class for a us= er in report/view creation. 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-15 14:01:= 53 UTC (rev 1329) +++ humano2/trunk/components/webTools/interfacetools.cs 2005-06-15 14:34:= 11 UTC (rev 1330) @@ -10,10 +10,12 @@ // $Id$ =20 using System; +using System.Collections; +using System.ComponentModel; +using System.Data; using System.IO; using System.Web; using System.Xml.Xsl; -using System.Collections; using System.Collections.Specialized; using System.Net; using System.Text.RegularExpressions; @@ -195,6 +197,44 @@ Logger.Log("parseHavings=3D " + res,LogLevel.Trace); =20 return res; - } =20 + } + + ///<summary> + /// Returns an xml string as this: + /// <class> + /// <id> </id> + /// <name> </name> + /// </class> + /// Where the classes are the classes of the user + ///</summary> + public static string GetClassListForUser(SessionCredencial userC= red)=20 + { + string xmlString =3D ""; + + DataTable res =3D userCred.CoreAdapter.GetAllClassesOfDomain= (userCred); + DataRow startRow =3D res.NewRow(); + startRow["id_entity"] =3D 0; + startRow["name"] =3D "-- Classes --"; + res.Rows.InsertAt(startRow, 0); + =20 + //Parse the table and build the xml string + =20 + foreach(DataRow row in res.Rows) + { + //int classId =3D Convert.ToInt32(row["id_entity"]); + =20 + xmlString +=3D "<class>"; + xmlString +=3D "<id>"; + xmlString +=3D row["id_entity"]; + xmlString +=3D "</id>"; =20 + xmlString +=3D "<name>"; =20 + xmlString +=3D row["name"]; + xmlString +=3D "</name>";=20 + xmlString +=3D "</class>"; + } + //Logger.Log("ReportMain getClassList: " + xmlString, LogLev= el.Trace); + return xmlString; + } + =20 } } Modified: humano2/trunk/web/builder/site/createreport.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/builder/site/createreport.aspx.cs 2005-06-15 14:01:= 53 UTC (rev 1329) +++ humano2/trunk/web/builder/site/createreport.aspx.cs 2005-06-15 14:34:= 11 UTC (rev 1330) @@ -132,7 +132,7 @@ { strXml +=3D getXmlAttribListForClass(Convert.ToInt32(cla= ssId)); } - strXml +=3D getClassList(); + strXml +=3D Interface.GetClassListForUser(userCred= ); strXml +=3D "</classes>"; strXml +=3D "</report>"; =20 @@ -413,42 +413,8 @@ return xmlRes; } =20 - ///<summary> - /// Returns an xml string as this: - /// <class> - /// <id> </id> - /// <name> </name> - /// </class> - ///</summary> - private string getClassList()=20 - { - string xmlString =3D ""; - - DataTable res =3D userCred.CoreAdapter.GetAllClassesOfDomain= (userCred); - DataRow startRow =3D res.NewRow(); - startRow["id_entity"] =3D 0; - startRow["name"] =3D "-- Classes --"; - res.Rows.InsertAt(startRow, 0); - =20 - //Parse the table and build the xml string - =20 - foreach(DataRow row in res.Rows) - { - //int classId =3D Convert.ToInt32(row["id_entity"]); - =20 - xmlString +=3D "<class>"; - xmlString +=3D "<id>"; - xmlString +=3D row["id_entity"]; - xmlString +=3D "</id>"; =20 - xmlString +=3D "<name>"; =20 - xmlString +=3D row["name"]; - xmlString +=3D "</name>";=20 - xmlString +=3D "</class>"; - } - //Logger.Log("ReportMain getClassList: " + xmlString, LogLev= el.Trace); - return xmlString; - } =20 + =20 private void deleteReport() { Logger.Log("deleteReport called", LogLevel.Trace); Modified: humano2/trunk/web/builder/site/viewmain.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/builder/site/viewmain.aspx.cs 2005-06-15 14:01:53 U= TC (rev 1329) +++ humano2/trunk/web/builder/site/viewmain.aspx.cs 2005-06-15 14:34:11 U= TC (rev 1330) @@ -130,7 +130,7 @@ { strXml +=3D getXmlAttribListForClass(Convert.ToInt32(cla= ssId)); } - strXml +=3D getClassList(); + strXml +=3D Interface.GetClassListForUser(userCred= ); strXml +=3D "</classes>"; strXml +=3D "</view>"; =20 @@ -348,41 +348,6 @@ return xmlRes; } =20 - ///<summary> - /// Returns an xml string as this: - /// <class> - /// <id> </id> - /// <name> </name> - /// </class> - ///</summary> - private string getClassList()=20 - { - string xmlString =3D ""; - - DataTable res =3D userCred.CoreAdapter.GetAllClassesOfDomain= (userCred); - DataRow startRow =3D res.NewRow(); - startRow["id_entity"] =3D 0; - startRow["name"] =3D "-- Classes --"; - res.Rows.InsertAt(startRow, 0); - =20 - //Parse the table and build the xml string - =20 - foreach(DataRow row in res.Rows) - { - //int classId =3D Convert.ToInt32(row["id_entity"]); - =20 - xmlString +=3D "<class>"; - xmlString +=3D "<id>"; - xmlString +=3D row["id_entity"]; - xmlString +=3D "</id>"; =20 - xmlString +=3D "<name>"; =20 - xmlString +=3D row["name"]; - xmlString +=3D "</name>";=20 - xmlString +=3D "</class>"; - } - //Logger.Log("ViewMain getClassList: " + xmlString, LogLevel= .Trace); - return xmlString; - } =20 private void deleteView() { |