You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(146) |
Jun
(188) |
Jul
(11) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|
|
From: <sv...@de...> - 2005-05-25 21:16:12
|
Author: pcamacho
Date: 2005-05-25 17:16:05 -0400 (Wed, 25 May 2005)
New Revision: 1149
Modified:
humano2/trunk/web/portal/site/js/commonfunctions.js
humano2/trunk/web/portal/site/xsl/HTML.xsl
humano2/trunk/web/portal/site/xsl/RUT.xsl
humano2/trunk/web/portal/site/xsl/URL.xsl
humano2/trunk/web/portal/site/xsl/boolean.xsl
humano2/trunk/web/portal/site/xsl/dateTime.xsl
humano2/trunk/web/portal/site/xsl/password.xsl
humano2/trunk/web/portal/site/xsl/pertinence.xsl
humano2/trunk/web/portal/site/xsl/text.xsl
humano2/trunk/web/portal/site/xsl/textline.xsl
Log:
FIX: a few attributes (containing pertinence) had not the two lines of ja=
vascript that allows to do checks of the=20
value entered. Although some attributes are not checked. Theses lines hav=
e to appear (InputToCheck).
Modified: humano2/trunk/web/portal/site/js/commonfunctions.js
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/js/commonfunctions.js 2005-05-25 19:54:=
05 UTC (rev 1148)
+++ humano2/trunk/web/portal/site/js/commonfunctions.js 2005-05-25 21:16:=
05 UTC (rev 1149)
@@ -67,7 +67,6 @@
=20
for(i=3D0;i < divArray.length;i++)
{
-
div =3D divArray[i];
var nameDiv =3D div.getAttribute("name");
var j=3D0;
@@ -77,25 +76,28 @@
for (j=3D0;j < div.childNodes.length;j++)
{ =20
childElem =3D div.childNodes[j];
- =20
+ =20
//Here we need to put every tag name which has to be filled =
by the user
- if(childElem.tagName =3D=3D 'INPUT' || childElem.tagName =3D=
=3D 'TEXTAREA') //the child is an input or a textarea ie is not a text
+ if((childElem.tagName =3D=3D 'INPUT' || childElem.tagName =3D=
=3D 'TEXTAREA')) //the child is an input or a textarea ie is not a text
{
- divRefArray =3D fn_getElemntsByTagName("div","divListasL=
eft");
- //alert("allInputsToCheck.Get(" + i + "):" + allInputsTo=
Check.Get(i));
- allInputsToCheck.SetValue(i,childElem.value); //Get the =
choosen value
- divOk =3D alertUserWhenEmptyField(isObligatoryArray[=
i],childElem,attNameArray[i]) //Obligatory field
- && allInputsToCheck.Get(i).Check(); //Other che=
cks ()allInputsToCheck is a global variable defined in readXslt.aspx
- //If an attribute is not well filled, then put its name =
color to red
- // else put it to black (normal)
- if(!divOk)
+ if(childElem.getAttribute("type") !=3D "hidden") //Don't=
take hidden input
{
- divRefArray[i].style.color=3D"red";
- }else
- {
- divRefArray[i].style.color=3D"black";
+ divRefArray =3D fn_getElemntsByTagName("div","divLis=
tasLeft");
+ //alert("allInputsToCheck.Get(" + i + "):" + allInpu=
tsToCheck.Get(i));
+ allInputsToCheck.SetValue(i,childElem.value); //Get =
the choosen value
+ divOk =3D alertUserWhenEmptyField(isObligatoryAr=
ray[i],childElem,attNameArray[i]) //Obligatory field
+ && allInputsToCheck.Get(i).Check(); //Other=
checks ()allInputsToCheck is a global variable defined in readXslt.aspx
+ //If an attribute is not well filled, then put its n=
ame color to red
+ // else put it to black (normal)
+ if(!divOk)
+ {
+ divRefArray[i].style.color=3D"red";
+ }else
+ {
+ divRefArray[i].style.color=3D"black";
+ }
+ formOk =3D divOk && formOk; //Check if all the form =
is well filled
}
- formOk =3D divOk && formOk; //Check if all the form is w=
ell filled
}
} =20
} =20
Modified: humano2/trunk/web/portal/site/xsl/HTML.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/HTML.xsl 2005-05-25 19:54:05 UTC (r=
ev 1148)
+++ humano2/trunk/web/portal/site/xsl/HTML.xsl 2005-05-25 21:16:05 UTC (r=
ev 1149)
@@ -21,5 +21,11 @@
<textarea name=3D"{$sysAttName}" value=3D"{$defaultText}" maxlength=3D=
"{$maxLength}" size=3D"{dispSize}"><xsl:if test=3D"not(string($isEditable=
)=3D'true')"><xsl:attribute name=3D"disabled" /></xsl:if></textarea>
</xsl:when>
</xsl:choose>
+ <xsl:if test=3D"/page/flagaction!=3D'Read'"> <!-- Only for creat=
e and update -->
+ <script language=3D"Javascript">
+ var aInputToCheck =3D new InputToCheck('TEXT',''); //By =
default, does no verification
+ allInputsToCheck.Add(aInputToCheck);
+ </script>
+ </xsl:if>
</xsl:template>
</xsl:stylesheet>
Modified: humano2/trunk/web/portal/site/xsl/RUT.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/RUT.xsl 2005-05-25 19:54:05 UTC (re=
v 1148)
+++ humano2/trunk/web/portal/site/xsl/RUT.xsl 2005-05-25 21:16:05 UTC (re=
v 1149)
@@ -27,5 +27,13 @@
</input>
</xsl:when>
</xsl:choose>
+ =20
+ <xsl:if test=3D"/page/flagaction!=3D'Read'"> <!-- Only for creat=
e and update -->
+ <script language=3D"Javascript">
+ var aInputToCheck =3D new InputToCheck('TEXT',''); //By =
default, does no verification
+ allInputsToCheck.Add(aInputToCheck);
+ </script>
+ </xsl:if>
+ =20
</xsl:template>
</xsl:stylesheet>
Modified: humano2/trunk/web/portal/site/xsl/URL.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/URL.xsl 2005-05-25 19:54:05 UTC (re=
v 1148)
+++ humano2/trunk/web/portal/site/xsl/URL.xsl 2005-05-25 21:16:05 UTC (re=
v 1149)
@@ -29,5 +29,9 @@
</input>
</xsl:when>
</xsl:choose>
+ <script>
+ var aInputToCheck =3D new InputToCheck('TEXT'); //TEXT by de=
fault for the moment as there's no verification
+ allInputsToCheck.Add(aInputToCheck);
+ </script>
</xsl:template>
</xsl:stylesheet>
Modified: humano2/trunk/web/portal/site/xsl/boolean.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/boolean.xsl 2005-05-25 19:54:05 UTC=
(rev 1148)
+++ humano2/trunk/web/portal/site/xsl/boolean.xsl 2005-05-25 21:16:05 UTC=
(rev 1149)
@@ -49,5 +49,12 @@
</xsl:if>
</xsl:when>
</xsl:choose>
+ =20
+ <xsl:if test=3D"/page/flagaction!=3D'Read'"> <!-- Only for creat=
e and update -->
+ <script language=3D"Javascript">
+ var aInputToCheck =3D new InputToCheck('TEXT',''); //By =
default, does no verification
+ allInputsToCheck.Add(aInputToCheck);
+ </script>
+ </xsl:if>
</xsl:template>
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
Modified: humano2/trunk/web/portal/site/xsl/dateTime.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/dateTime.xsl 2005-05-25 19:54:05 UT=
C (rev 1148)
+++ humano2/trunk/web/portal/site/xsl/dateTime.xsl 2005-05-25 21:16:05 UT=
C (rev 1149)
@@ -76,5 +76,13 @@
</xsl:if>
</xsl:when>
</xsl:choose>
+ =20
+ <xsl:if test=3D"/page/flagaction!=3D'Read'"> <!-- Only for creat=
e and update -->
+ <script language=3D"Javascript">
+ var aInputToCheck =3D new InputToCheck('TEXT',''); //By =
default, does no verification
+ allInputsToCheck.Add(aInputToCheck);
+ </script>
+ </xsl:if>
+ =20
</xsl:template>
</xsl:stylesheet>
Modified: humano2/trunk/web/portal/site/xsl/password.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/password.xsl 2005-05-25 19:54:05 UT=
C (rev 1148)
+++ humano2/trunk/web/portal/site/xsl/password.xsl 2005-05-25 21:16:05 UT=
C (rev 1149)
@@ -27,5 +27,11 @@
</input>
</xsl:when>
</xsl:choose>
+ <xsl:if test=3D"/page/flagaction!=3D'Read'"> <!-- Only for creat=
e and update -->
+ <script language=3D"Javascript">
+ var aInputToCheck =3D new InputToCheck('TEXT',''); //By =
default, does no verification
+ allInputsToCheck.Add(aInputToCheck);
+ </script>
+ </xsl:if>
</xsl:template>
</xsl:stylesheet>
Modified: humano2/trunk/web/portal/site/xsl/pertinence.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/pertinence.xsl 2005-05-25 19:54:05 =
UTC (rev 1148)
+++ humano2/trunk/web/portal/site/xsl/pertinence.xsl 2005-05-25 21:16:05 =
UTC (rev 1149)
@@ -18,22 +18,16 @@
=09
<xsl:when test=3D"/page/flagaction=3D'Update'">
<xsl:if test=3D"string($isEditable)=3D'true'">
- <table border=3D"0" cellSpacing=3D"0" cellPaddin=
g=3D"0" >
- <tr>
- <td valign=3D"top">
- <input type=3D"text" name=3D"{concat('txt_',$sysAttName)}" value=
=3D"{$refData}" onfocus=3D"hideIFrame('{concat('frame_',$idEntity)}')" re=
adonly=3D"readonly"/>
- </td>
- <td valign=3D"center">
- <xsl:if test=3D"not($filterView)">
- <img src=3D"img/arrowDown.gif" border=3D"0" onclick=3D"toggleIF=
rame('{concat('frame_',$idEntity)}','viewpertinencelist.aspx?idClass=3D{$=
idClass}&idEntity=3D{$idEntity}&sysAttName=3D{$sysAttName}');"></=
img>
- </xsl:if>=20
- <xsl:if test=3D"$filterView">
- <img src=3D"img/arrowDown.gif" border=3D"0" onclick=3D"toggleIF=
rameWithFilter('{concat('frame_',$idEntity)}','viewpertinencelist.aspx?id=
Class=3D{$idClass}&idEntity=3D{$idEntity}&sysAttName=3D{$sysAttNa=
me}', '{$filterView}');"></img>
- </xsl:if>=20
- <img src=3D"img/1x1.gif" border=3D"0" width=3D"22" heigth=3D"22=
"></img>
- </td>
- </tr>
- </table>=09
+ <input type=3D"text" name=3D"{concat('txt_',=
$sysAttName)}" value=3D"{$refData}" onfocus=3D"hideIFrame('{concat('frame=
_',$idEntity)}')" readonly=3D"readonly"/>
+ =20
+ <xsl:if test=3D"not($filterView)">
+ <img src=3D"img/arrowDown.gif" border=3D=
"0" onclick=3D"toggleIFrame('{concat('frame_',$idEntity)}','viewpertinenc=
elist.aspx?idClass=3D{$idClass}&idEntity=3D{$idEntity}&sysAttName=
=3D{$sysAttName}');"></img>
+ </xsl:if>=20
+ <xsl:if test=3D"$filterView">
+ <img src=3D"img/arrowDown.gif" border=3D=
"0" onclick=3D"toggleIFrameWithFilter('{concat('frame_',$idEntity)}','vie=
wpertinencelist.aspx?idClass=3D{$idClass}&idEntity=3D{$idEntity}&=
sysAttName=3D{$sysAttName}', '{$filterView}');"></img>
+ </xsl:if>=20
+ <img src=3D"img/1x1.gif" border=3D"0" width=
=3D"22" heigth=3D"22"></img>
+ =20
<!--<input type=3D"button" name=3D"aaa" value=3D"Ver" onclick=3D"=
toggleIFrame('{concat('frame_',$idEntity)}','viewpertinencelist.aspx?idCl=
ass=3D{$idClass}&idEntity=3D{$idEntity}&sysAttName=3D{$sysAttName=
}');" />-->
<input type=3D"hidden" name=3D"{$sysAttName}" value=3D"{$data}" r=
eadonly=3D"readonly"/>
<iframe id=3D"{concat('frame_',$idEntity)}" src=3D"" style=3D"vis=
ibility: hidden; position:absolute;" width=3D"190" height=3D"165" framebo=
rder=3D"0" scrolling=3D"no" align=3D"middle"></iframe>
@@ -44,30 +38,29 @@
</xsl:when>
=09
<xsl:when test=3D"/page/flagaction=3D'Create'">
- <xsl:if test=3D"string($isEditable)=3D'true'"> =20
+ <xsl:if test=3D"string($isEditable)=3D'true'"> =20
=20
- <table border=3D"0" cellSpacing=3D"0" cellPaddin=
g=3D"0" >
- <tr>
- <td valign=3D"top">
- <input type=3D"text" name=3D"{concat('txt_',$sysAttName)}" value=
=3D"{$refData}" onfocus=3D"hideIFrame('{concat('frame_',$idEntity)}')" re=
adonly=3D"readonly"/>
- </td>
- <td valign=3D"center">
- <xsl:if test=3D"not($filterView)">
- <img src=3D"img/arrowDown.gif" border=3D"0" onclick=3D"toggleIF=
rame('{concat('frame_',$idEntity)}','viewpertinencelist.aspx?idClass=3D{$=
idClass}&idEntity=3D{$idEntity}&sysAttName=3D{$sysAttName}');"></=
img>
- </xsl:if>=20
- <xsl:if test=3D"$filterView">
- <img src=3D"img/arrowDown.gif" border=3D"0" onclick=3D"toggleIF=
rameWithFilter('{concat('frame_',$idEntity)}','viewpertinencelist.aspx?id=
Class=3D{$idClass}&idEntity=3D{$idEntity}&sysAttName=3D{$sysAttNa=
me}', '{$filterView}');"></img>
- </xsl:if>=20
- <img src=3D"img/1x1.gif" border=3D"0" width=3D"22" heigth=3D"22=
"></img>
- </td>
- </tr>
- </table>=09
+ <input type=3D"text" name=3D"{concat('txt_',$sys=
AttName)}" value=3D"{$refData}" onfocus=3D"hideIFrame('{concat('frame_',$=
idEntity)}')" readonly=3D"readonly"/>
+ =20
+ <xsl:if test=3D"not($filterView)">
+ <img src=3D"img/arrowDown.gif" border=3D"0" =
onclick=3D"toggleIFrame('{concat('frame_',$idEntity)}','viewpertinencelis=
t.aspx?idClass=3D{$idClass}&idEntity=3D{$idEntity}&sysAttName=3D{=
$sysAttName}');"></img>
+ </xsl:if>=20
+ <xsl:if test=3D"$filterView">
+ <img src=3D"img/arrowDown.gif" border=3D"0" =
onclick=3D"toggleIFrameWithFilter('{concat('frame_',$idEntity)}','viewper=
tinencelist.aspx?idClass=3D{$idClass}&idEntity=3D{$idEntity}&sysA=
ttName=3D{$sysAttName}', '{$filterView}');"></img>
+ </xsl:if>=20
+ <img src=3D"img/1x1.gif" border=3D"0" width=3D"=
22" heigth=3D"22"></img>
+ =20
<!--<input type=3D"button" name=3D"aaa" value=3D"Ver" onclick=3D"t=
oggleIFrame('{concat('frame_',$idEntity)}','viewpertinencelist.aspx?idCla=
ss=3D{$idClass}&idEntity=3D{$idEntity}&sysAttName=3D{$sysAttName}=
');"/>-->
<input type=3D"hidden" name=3D"{$sysAttName}" />
<iframe id=3D"{concat('frame_',$idEntity)}" src=3D"" style=3D"visi=
bility: hidden; position:absolute;" width=3D"190" height=3D"165" framebor=
der=3D"0" scrolling=3D"no" align=3D"middle" ></iframe>
- </xsl:if>
+ </xsl:if>
</xsl:when>
</xsl:choose>
- =09
+ <xsl:if test=3D"/page/flagaction!=3D'Read'"> <!-- Only for create and =
update -->
+ <script language=3D"Javascript">
+ var aInputToCheck =3D new InputToCheck('TEXT',''); //By =
default, does no verification
+ allInputsToCheck.Add(aInputToCheck);
+ </script>
+ </xsl:if>
</xsl:template>
</xsl:stylesheet>
Modified: humano2/trunk/web/portal/site/xsl/text.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/text.xsl 2005-05-25 19:54:05 UTC (r=
ev 1148)
+++ humano2/trunk/web/portal/site/xsl/text.xsl 2005-05-25 21:16:05 UTC (r=
ev 1149)
@@ -7,11 +7,6 @@
<xsl:variable name=3D"sysAttName" select=3D"/page/classInstance/structur=
e/attribute[id_entity=3D$idEntity]/sysAttName"/>
<xsl:variable name=3D"isEditable" select=3D"/page/classInstance/structur=
e/attribute[id_entity=3D$idEntity]/isEditable"/>
=20
-<script>
- var aInputToCheck =3D new InputToCheck('TEXT');
- allInputsToCheck.Add(aInputToCheck);
-</script>
-
<xsl:choose>=09
<xsl:when test=3D"/page/flagaction=3D'Read'"> =09
<xsl:value-of select=3D"/page/classInstance/data/text[id_entity=3D$idEnt=
ity]/data"/>
@@ -27,6 +22,14 @@
<textarea name=3D"{$sysAttName}" cols=3D"{$cols}" rows=3D"{$rows}" ><xs=
l:if test=3D"not(string($isEditable)=3D'true')"><xsl:attribute name=3D"di=
sabled" /></xsl:if></textarea>
</xsl:when>
<xsl:when test=3D"/page/flagaction=3D'Create' and string($isEditable)=3D=
'true'"><textarea name=3D"{$sysAttName}" cols=3D"{$cols}" rows=3D"{$rows=
}" martest=3D"2a"></textarea></xsl:when>
-</xsl:choose> =09
+</xsl:choose>
+
+<xsl:if test=3D"/page/flagaction!=3D'Read'"> <!-- Only for create and up=
date -->
+ <script language=3D"Javascript">
+ var aInputToCheck =3D new InputToCheck('TEXT',''); //By default,=
does no verification
+ allInputsToCheck.Add(aInputToCheck);
+ </script>
+</xsl:if>
+
</xsl:template>
</xsl:stylesheet>
Modified: humano2/trunk/web/portal/site/xsl/textline.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/textline.xsl 2005-05-25 19:54:05 UT=
C (rev 1148)
+++ humano2/trunk/web/portal/site/xsl/textline.xsl 2005-05-25 21:16:05 UT=
C (rev 1149)
@@ -8,11 +8,6 @@
<xsl:variable name=3D"sysAttName" select=3D"/page/classInstance/struct=
ure/attribute[id_entity=3D$idEntity]/sysAttName"/>
<xsl:variable name=3D"isEditable" select=3D"/page/classInstance/struct=
ure/attribute[id_entity=3D$idEntity]/isEditable"/> =09
=09
- <script>
- var aInputToCheck =3D new InputToCheck('TEXT');
- allInputsToCheck.Add(aInputToCheck);
- </script>
- =20
<xsl:choose>=09
<xsl:when test=3D"/page/flagaction=3D'Read'">
<xsl:value-of select=3D"$data"/>
@@ -35,6 +30,12 @@
</input>
</xsl:when>
</xsl:choose>
- =09
+ =20
+ <xsl:if test=3D"/page/flagaction!=3D'Read'"> <!-- Only for create and =
update -->
+ <script language=3D"Javascript">
+ var aInputToCheck =3D new InputToCheck('TEXT',''); //By =
default, does no verification
+ allInputsToCheck.Add(aInputToCheck);
+ </script>
+ </xsl:if>
</xsl:template>
</xsl:stylesheet>
|
|
From: <sv...@de...> - 2005-05-25 19:54:05
|
Author: pcamacho
Date: 2005-05-25 15:54:05 -0400 (Wed, 25 May 2005)
New Revision: 1148
Modified:
humano2/trunk/core/db/mssql/mssqlComplex.cs
humano2/trunk/core/db/mssql/mssqlCrud.cs
Log:
ADD: implementation of to functions (GetBasicAttributeSysName and findSql=
TypeForAttribute) for MSSQL.
Modified: humano2/trunk/core/db/mssql/mssqlComplex.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/mssql/mssqlComplex.cs 2005-05-25 19:46:20 UTC (=
rev 1147)
+++ humano2/trunk/core/db/mssql/mssqlComplex.cs 2005-05-25 19:54:05 UTC (=
rev 1148)
@@ -1174,9 +1174,27 @@
=20
override public string GetBasicAttributeSysName(int classId)
{
- //FIXME: this method must be implemented
- throw new MetaModelException("Method GetBasicAttributeSysNam=
e must be implemented.");
- return null; =20
+ int parentId =3D classId;
+ int oldParentId =3D 0;
+ =20
+ while(parentId !=3D 5)
+ {
+ oldParentId =3D parentId;
+ Logger.Log("GetBasicAttributeSysName: parentId=3D " + pa=
rentId, LogLevel.Trace);
+ string queryParent =3D "select \"parentId\" from class w=
here id_entity=3D" + parentId;
+ object resParent =3D conn.doScalar(queryParent);
+ if(resParent =3D=3D null)
+ {
+ throw new MetaModelException("The attribute of class=
Id " + classId + " has a null parent ID.");
+ }
+ parentId =3D Convert.ToInt32(resParent);
+ }
+ //Now I look for the sysName of basic attribute
+ string querySysName =3D "select \"sysName\" from class where=
id_entity=3D" + oldParentId;
+ object resSysName =3D conn.doScalar(querySysName);
+ string sysName =3D resSysName.ToString();
+ =20
+ return sysName;
}
=20
}
Modified: humano2/trunk/core/db/mssql/mssqlCrud.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/mssql/mssqlCrud.cs 2005-05-25 19:46:20 UTC (rev=
1147)
+++ humano2/trunk/core/db/mssql/mssqlCrud.cs 2005-05-25 19:54:05 UTC (rev=
1148)
@@ -1757,9 +1757,32 @@
///</summary>
override protected string findSqlTypeForAttribute(StringDictiona=
ry attMap, string name)
{
- //FIXME: this method has to be implemented...=20
- throw new MetaModelException("The method findSqlTypeForAttri=
bute is not yet implemented...");
- return ""; =20
+ absCrud crud =3D Factory.Crud();
+ absComplex complex =3D crud.GetCore().Complex;
+ Logger.Log("finSqlTypeForAttribute: name=3D " + name,LogLeve=
l.Trace);
+ =20
+ string [] nameSplit =3D name.Split((".").ToCharArray());
+ string aux =3D nameSplit[1]; //The before last element of sp=
lit has got the good data (sysName of attribute)
+ aux =3D aux.Replace("\"",""); //Remove "
+ Logger.Log("findSqlTypeForAttribute: aux =3D " + aux, LogLe=
vel.Trace);
+ =20
+ int id_entity =3D complex.ConvertSysAttNameToIdAttName(aux);
+ =20
+ string res;
+ =20
+ if(id_entity =3D=3D -1)
+ {
+ Logger.Log("findSqlTypeForAttribute: id_entity =3D=3D -1=
",LogLevel.Trace);
+ res =3D null;
+ }
+ else
+ { =20
+ int classIdOfAttribute =3D complex.getClassIdofInstance(=
id_entity);=20
+ string basicAttributeSysName =3D complex.GetBasicAttribu=
teSysName(classIdOfAttribute);
+ Logger.Log("findSqlTypeForAttribute: basicAttributeSysNa=
me=3D " + basicAttributeSysName,LogLevel.Trace);
+ res =3DattMap[basicAttributeSysName];
+ }
+ return res;
}
}
}
|
|
From: <sv...@de...> - 2005-05-25 19:46:29
|
Author: pcamacho
Date: 2005-05-25 15:46:20 -0400 (Wed, 25 May 2005)
New Revision: 1147
Modified:
humano2/trunk/components/viewTools/ViewTools.cs
humano2/trunk/core/db/absComplex.cs
humano2/trunk/core/db/absCrud.cs
humano2/trunk/core/db/mssql/mssqlComplex.cs
humano2/trunk/core/db/mssql/mssqlCrud.cs
humano2/trunk/core/db/pgsql/pgsqlComplex.cs
humano2/trunk/core/db/pgsql/pgsqlCrud.cs
Log:
FIX:=20
* the view was crashing when trying to show instances with non basic att=
ributes (like email).
* the function GetBasicAttributeSysName was bugged: it was only returnin=
g "attribute" and not the name of the basic=20
attribute like "textline" or "numeric" etc...
Modified: humano2/trunk/components/viewTools/ViewTools.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/viewTools/ViewTools.cs 2005-05-25 19:08:00 U=
TC (rev 1146)
+++ humano2/trunk/components/viewTools/ViewTools.cs 2005-05-25 19:46:20 U=
TC (rev 1147)
@@ -447,7 +447,9 @@
foreach(DisplayOrder var2 in disp)
{
vars.Add(var2.Text + "," + var2.Type);
+ Logger.Log("ViewTools: vars[]=3D" + var2.Text + "," =
+ var2.Type,LogLevel.Trace);
}
+ Logger.Log("ViewTools: call of BuildTempTable",LogLevel.=
Trace);
Query.Append(Complex.BuildTempTable((string[])vars.ToArray(typeof(st=
ring)),ref tableName));
TempTable =3D tableName;
}
Modified: humano2/trunk/core/db/absComplex.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/absComplex.cs 2005-05-25 19:08:00 UTC (rev 1146=
)
+++ humano2/trunk/core/db/absComplex.cs 2005-05-25 19:46:20 UTC (rev 1147=
)
@@ -344,10 +344,10 @@
abstract public string ConvertSysAttNameToUserAttName(string sys=
AttName);
=20
/// <summary>
- /// Converts a system attribute name into a user attribute name
+ /// Converts a system attribute name into its id
/// </summary>
/// <param name=3D"sysAttName">system name for attribute </param>
- /// <return>user attribute name</returns>
+ /// <return>id of attribute</returns>
abstract public int ConvertSysAttNameToIdAttName(string sysAttName);
=20
/// <summary>
@@ -375,6 +375,13 @@
abstract public string [] GetParamsReport(int id);
=20
=20
+ ///<summary>
+ /// Returns the name of the basic attribute (numeric, textline..=
.) father of an attribute passed in param
+ /// <param name=3D"classId">The classId of an attribute</param>
+ /// <returns>the sys name of basic attribute</returns>
+ ///</summary>
+ abstract public string GetBasicAttributeSysName(int classId);
+ =20
#endregion
=20
public object doScalar(string query)
Modified: humano2/trunk/core/db/absCrud.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/absCrud.cs 2005-05-25 19:08:00 UTC (rev 1146)
+++ humano2/trunk/core/db/absCrud.cs 2005-05-25 19:46:20 UTC (rev 1147)
@@ -58,11 +58,30 @@
=09
virtual public string AttributeTypeMapping(string name)
{
- return attMap[name];
+ string res =3D "";
+ Logger.Log("AttributeTypeMapping. name=3D " + name, LogLevel=
.Trace);
+ if(attMap[name] =3D=3D null) //This is not a basic type
+ {
+ res =3D findSqlTypeForAttribute(attMap,name);
+ }
+ else
+ {
+ res =3D attMap[name]; =20
+ }
+ return res;
}
=09
- #endregion
- =09
+ #endregion
+ =20
+ ///<summary>
+ /// Finds the sql type of a non basic attribute (like textline, =
numeric, currency etc...)
+ ///<param name=3D"attMap">the dictionnary with basic attributes =
/ sql type</param>
+ ///<param name=3D"name">The name of the non basic attribute</par=
am>
+ ///<returns>The type of non basic attribute. If this type is not=
found, an exception is
+ /// raised (because every non basic type should derived from a b=
asic one)</returns>
+ ///</summary>
+ abstract protected string findSqlTypeForAttribute(StringDictiona=
ry attMap, string name);
+ =20
///<summary>Devuelve toda la estructura de una clase.</summary>
///<returns>Devuelve un DataSet con toda la estructura activa de una c=
lase.</returns>
///<param name=3D"idEntity">El ID del objeto que sea leido</param>
Modified: humano2/trunk/core/db/mssql/mssqlComplex.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/mssql/mssqlComplex.cs 2005-05-25 19:08:00 UTC (=
rev 1146)
+++ humano2/trunk/core/db/mssql/mssqlComplex.cs 2005-05-25 19:46:20 UTC (=
rev 1147)
@@ -71,7 +71,7 @@
return res;
}
=20
- public override DataTable getColsforView(int classId)
+ public override DataTable getColsforView(int classId)
{
string query =3D @"select top 1 ""id_entity"", ""columns"" from ""vie=
w"" where ""idClassView"" =3D "+classId+" order by id_entity";
return doSelect(query);
@@ -1170,7 +1170,14 @@
Logger.Log("ConvertSysAttName: there is no userAttName for sysAttNam=
e: " + sysAttName,LogLevel.Trace);
}
return res;
- } =20
+ }
+
+ override public string GetBasicAttributeSysName(int classId)
+ {
+ //FIXME: this method must be implemented
+ throw new MetaModelException("Method GetBasicAttributeSysNam=
e must be implemented.");
+ return null; =20
+ }
=20
}
}
Modified: humano2/trunk/core/db/mssql/mssqlCrud.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/mssql/mssqlCrud.cs 2005-05-25 19:08:00 UTC (rev=
1146)
+++ humano2/trunk/core/db/mssql/mssqlCrud.cs 2005-05-25 19:46:20 UTC (rev=
1147)
@@ -1471,17 +1471,17 @@
return res;
}
=09
- override protected string genClassSysName(int domainId, string classNa=
me)
+ override protected string genClassSysName(int domainId, string classNa=
me)
{
Boolean exists =3D false;
int loop =3D 0;
string baseSysName =3D String.Format("d{0}{1}", domainId, className);
string sysName =3D baseSysName;
- do
+ do
{
exists =3D false;
int id =3D Convert.ToInt32(conn.doScalar("select * from class where =
sysName =3D'" + sysName + "'"));
- if (id > 0 )
+ if (id > 0 )
{
exists =3D true;
loop +=3D 1;
@@ -1492,17 +1492,17 @@
return sysName;
}
=20
- override protected string genAttSysName(int classId, string attName)
+ override protected string genAttSysName(int classId, string attName)
{
Boolean exists =3D false;
int loop =3D 0;
string baseSysName =3D String.Format("c{0}{1}", classId, attName);
string sysName =3D baseSysName;
- do
+ do
{
exists =3D false;
int id =3D Convert.ToInt32(conn.doScalar("select id_entity from attr=
ibute where sysAttName =3D'" + sysName + "'"));
- if (id > 0 )
+ if (id > 0 )
{
exists =3D true;
loop +=3D 1;
@@ -1746,5 +1746,20 @@
/* + "foreign key id_entity references class (id_entity)" */
conn.doCommand( sqlCommand );
}
+ =20
+ =20
+ ///<summary>
+ /// Finds the sql type of a non basic attribute (like textline, =
numeric, currency etc...)
+ ///<param name=3D"attMap">the dictionnary with basic attributes =
/ sql type</param>
+ ///<param name=3D"name">The name of the non basic attribute</par=
am>
+ ///<returns>The type of non basic attribute. If this type is not=
found, an exception is
+ /// raised (because every non basic type should derived from a b=
asic one)</returns>
+ ///</summary>
+ override protected string findSqlTypeForAttribute(StringDictiona=
ry attMap, string name)
+ {
+ //FIXME: this method has to be implemented...=20
+ throw new MetaModelException("The method findSqlTypeForAttri=
bute is not yet implemented...");
+ return ""; =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-25 19:08:00 UTC (=
rev 1146)
+++ humano2/trunk/core/db/pgsql/pgsqlComplex.cs 2005-05-25 19:46:20 UTC (=
rev 1147)
@@ -371,7 +371,6 @@
where
entity.id_entity =3D " + colId + @" and
entity.class =3D class.id_entity");
-
=20
if(dt.Rows.Count>0)
{=09
@@ -381,7 +380,7 @@
}
else
{
- tName =3D InstanceType(Convert.ToInt32(dt.Rows[0]["id_entity"]));
+ tName =3D GetBasicAttributeSysName(Convert.ToInt32(dt.Rows[0]["id_e=
ntity"]));
}
}
else
@@ -394,6 +393,7 @@
}
dt.Dispose();
return tName;
+ =20
}
=20
///<summary>
@@ -401,11 +401,15 @@
/// <param name=3D"classId">The classId of an attribute</param>
/// <returns>the sys name of basic attribute</returns>
///</summary>
- private string getBasicAttributeSysName(int classId)
+ override public string GetBasicAttributeSysName(int classId)
{
int parentId =3D classId;
+ int oldParentId =3D 0;
+ =20
while(parentId !=3D 5)
{
+ oldParentId =3D parentId;
+ Logger.Log("GetBasicAttributeSysName: parentId=3D " + pa=
rentId, LogLevel.Trace);
string queryParent =3D "select \"parentId\" from class w=
here id_entity=3D" + parentId;
object resParent =3D conn.doScalar(queryParent);
if(resParent =3D=3D null)
@@ -415,7 +419,7 @@
parentId =3D Convert.ToInt32(resParent);
}
//Now I look for the sysName of basic attribute
- string querySysName =3D "select \"sysName\" from class where=
id_entity=3D" + parentId;
+ string querySysName =3D "select \"sysName\" from class where=
id_entity=3D" + oldParentId;
object resSysName =3D conn.doScalar(querySysName);
string sysName =3D resSysName.ToString();
=20
@@ -440,13 +444,24 @@
foreach(string col in args)
{
var =3D col.Split(",".ToCharArray());
+ Logger.Log("BuildTempTable: col[" + loop + "]=3D " + col=
,LogLevel.Trace);
name =3D var[0];
name =3D name.Substring(name.IndexOf(".")+1);
- if ((loop > 0) && (name =3D=3D "id_entity")) name =3D name + loop.To=
String();
+ if ((loop > 0) && (name =3D=3D "id_entity"))=20
+ {
+ name =3D name + loop.ToString();
+ }
//FIXME: This "AttributeTypeMapping" needs to change to support dyna=
mic derived types in view.
- type =3D core.Crud.AttributeTypeMapping(var[2].ToString());
- if (type =3D=3D null) type =3D var[2].ToString();
+ Logger.Log("BuildTempTable: var[2].ToString()=3D " + var[2].ToString=
(),LogLevel.Trace);
+ type =3D core.Crud.AttributeTypeMapping(var[0].ToString(=
)); //var[0] is of the form "d109cVerifAttribs"."c10007Text1" for example
+ =
//The data we need is c10007Text1
+ if (type =3D=3D null)=20
+ {
+ Logger.Log("BuildTempTable: type=3D=3Dnull",LogLevel=
.Trace);
+ type =3D var[2].ToString(); //FIXME ok but it is a b=
ig patch
+ }
table.Append(name + " " + type + ",");
+ Logger.Log("BuildTempTable. name=3D " + name + ", type=3D=
" + type,LogLevel.Trace);
loop++;
}
table.Append("\"row\" Serial);\n");
Modified: humano2/trunk/core/db/pgsql/pgsqlCrud.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/pgsqlCrud.cs 2005-05-25 19:08:00 UTC (rev=
1146)
+++ humano2/trunk/core/db/pgsql/pgsqlCrud.cs 2005-05-25 19:46:20 UTC (rev=
1147)
@@ -1742,5 +1742,45 @@
/* + "foreign key id_entity references class (id_entity)" */
conn.doCommand( sqlCommand );
}
+ =20
+ ///<summary>
+ /// Finds the sql type of a non basic attribute (like textline, =
numeric, currency etc...)
+ ///<param name=3D"attMap">the dictionnary with basic attributes =
/ sql type</param>
+ ///<param name=3D"name">The name of the non basic attribute</par=
am>
+ ///<returns>The type of non basic attribute. If this type is not=
found, an exception is
+ /// raised (because every non basic type should derived from a b=
asic one)</returns>
+ ///</summary>
+ ///FIXME: this function looks could use getBasicAttributeForType
+ override protected string findSqlTypeForAttribute(StringDictiona=
ry attMap, string name)
+ {
+ =20
+ absCrud crud =3D Factory.Crud();
+ absComplex complex =3D crud.GetCore().Complex;
+ Logger.Log("finSqlTypeForAttribute: name=3D " + name,LogLeve=
l.Trace);
+ =20
+ string [] nameSplit =3D name.Split((".").ToCharArray());
+ string aux =3D nameSplit[1]; //The before last element of sp=
lit has got the good data (sysName of attribute)
+ aux =3D aux.Replace("\"",""); //Remove "
+ Logger.Log("findSqlTypeForAttribute: aux =3D " + aux, LogLe=
vel.Trace);
+ =20
+ int id_entity =3D complex.ConvertSysAttNameToIdAttName(aux);
+ =20
+ =20
+ string res;
+ =20
+ if(id_entity =3D=3D -1)
+ {
+ Logger.Log("findSqlTypeForAttribute: id_entity =3D=3D -1=
",LogLevel.Trace);
+ res =3D null;
+ }
+ else
+ { =20
+ int classIdOfAttribute =3D complex.getClassIdofInstance(=
id_entity);=20
+ string basicAttributeSysName =3D complex.GetBasicAttribu=
teSysName(classIdOfAttribute);
+ Logger.Log("findSqlTypeForAttribute: basicAttributeSysNa=
me=3D " + basicAttributeSysName,LogLevel.Trace);
+ res =3DattMap[basicAttributeSysName];
+ }
+ return res;
+ }
}
}
|
|
From: <sv...@de...> - 2005-05-25 19:08:01
|
Author: marijn Date: 2005-05-25 15:08:00 -0400 (Wed, 25 May 2005) New Revision: 1146 Added: humano2/tests/alias/ humano2/tests/alias/Makefile humano2/tests/alias/alias.cs Modified: humano2/tests/fill/Makefile humano2/tests/fill/fill.cs Log: Adding Example of C# varialbe coping. Added: humano2/tests/alias/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/tests/alias/Makefile 2005-05-25 15:08:19 UTC (rev 1145) +++ humano2/tests/alias/Makefile 2005-05-25 19:08:00 UTC (rev 1146) @@ -0,0 +1,16 @@ +# Humano2 Core database drivers. +# +# The Humano2 Business solution +# Copyright (C) 2004,5 Humano2 Chile S.A. (http://www.humano2.com) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. =20 +# +# $Id: Makefile 1139 2005-05-24 20:04:24Z marijn $ + +all: alias.exe + +alias.exe: alias.cs + mcs /r:System,System.Data alias.cs Added: humano2/tests/alias/alias.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/tests/alias/alias.cs 2005-05-25 15:08:19 UTC (rev 1145) +++ humano2/tests/alias/alias.cs 2005-05-25 19:08:00 UTC (rev 1146) @@ -0,0 +1,38 @@ +// +// The Humano2 Business solution. +// Copyright (C) 2004,5 Humano2 Chile S.A. (http://www.humano2.com) +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// $Id: fill.cs 1138 2005-05-24 20:00:27Z marijn $ +// + +using System; +using System.Collections; + +namespace Humano2.Tests.Fill +{ + public class Runner=20 + { + public static void Main()=20 + { + + Console.WriteLine("-- ArrayList Test --"); + ArrayList al =3D new ArrayList(); + ArrayList al2 =3D al; + al.Add("Hola"); + Console.WriteLine("al.Count =3D "+ al.Count); + Console.WriteLine("al2.Count =3D "+ al2.Count); + + Console.WriteLine("-- Int Test --"); + int i1 =3D 23; + int i2 =3D i1; + i1 =3D 14; + Console.WriteLine("i1 =3D "+ i1); + Console.WriteLine("i2 =3D "+ i2); + } + } +} Modified: humano2/tests/fill/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/tests/fill/Makefile 2005-05-25 15:08:19 UTC (rev 1145) +++ humano2/tests/fill/Makefile 2005-05-25 19:08:00 UTC (rev 1146) @@ -12,5 +12,5 @@ =20 all: fill.exe =20 -fill.exe: fill.cs - mcs /r:System,System.Data,Npgsql fill.cs +fill.exe: fill3.cs + mcs /r:System,System.Data,Npgsql fill3.cs Modified: humano2/tests/fill/fill.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/tests/fill/fill.cs 2005-05-25 15:08:19 UTC (rev 1145) +++ humano2/tests/fill/fill.cs 2005-05-25 19:08:00 UTC (rev 1146) @@ -22,44 +22,29 @@ public static void Main()=20 { TestOkay(); - - TestError(); } =20 public static void TestOkay() { - string query =3D ""; -// query +=3D @"select ""to"".id_entity,""to"".""domainName"" from= ""entity"" as owner, ""domain"" as ""to"" where owner.""domainId"" =3D= ""to"".id_entity and owner.id_entity =3D 10003;" + "\n"; -// query +=3D @"select ""to"".id_entity,""to"".""name"" from ""ent= ity"" as owner, ""class"" as ""to"" where owner.""class"" =3D ""to"".i= d_entity and owner.id_entity =3D 10003;" + "\n"; - query +=3D @"select ""delDate"" from ""entity"" where ""id_ent= ity"" =3D 10003;" + "\n"; - query +=3D @"select ""status"" from ""entity"" where ""id_entit= y"" =3D 10003;" + "\n"; - query +=3D @"select ""createDate"" from ""entity"" where ""id_= entity"" =3D 10003;" + "\n"; - query +=3D @"select ""modDate"" from ""entity"" where ""id_ent= ity"" =3D 10003;" + "\n"; - query +=3D @"select ""columns"" from ""view"" where ""id_entit= y"" =3D 10003;" + "\n"; - query +=3D @"select ""where"" from ""view"" where ""id_entity"= " =3D 10003;" + "\n"; - query +=3D @"select ""groupby"" from ""view"" where ""id_entit= y"" =3D 10003;" + "\n"; - query +=3D @"select ""having"" from ""view"" where ""id_entity= "" =3D 10003;" + "\n"; - query +=3D @"select ""order"" from ""view"" where ""id_entity"= " =3D 10003;" + "\n"; - query +=3D @"select ""to"".id_entity,""to"".""name"" from ""view= "" as owner,""class"" as ""to"" where owner.""idClassView"" =3D ""to""= .id_entity and owner.id_entity =3D 10003;" + "\n"; - query +=3D @"select ""viewName"" from ""view"" where ""id_enti= ty"" =3D 10003"; + string query =3D @" ; select ""to"".id_entity,""to"".""domainName"" = from ""entity"" as owner, ""domain"" as ""to"" where owner.""do= mainId"" =3D ""to"".id_entity and owner.id_entity =3D 10003 + ; select ""to"".id_entity,""to"".""name"" from ""entity"" as owner,= ""class"" as ""to"" where owner.""class"" =3D ""to"".id_entity a= nd + owner.id_entity =3D 1000= 3 + ; select ""delDate"" from ""entity"" where ""id_entity"" =3D 10= 003 + ; select ""status"" from ""entity"" where ""id_entity"" =3D 10= 003 + ; select ""createDate"" from ""entity"" where ""id_entity"= " =3D 10003 + ; select ""modDate"" from ""entity"" where ""id_entity"" =3D 10= 003 + ; select ""columns"" from ""view"" where ""id_entity"" =3D 10= 003 + ; select ""where"" from ""view"" where ""id_entity"" =3D 10= 003 + ; select ""groupby"" from ""view"" where ""id_entity"" =3D 10= 003 + ; select ""having"" from ""view"" where ""id_entity"" =3D 10= 003 + ; select ""order"" from ""view"" where ""id_entity"" =3D 10= 003 + ; select ""to"".id_entity,""to"".""name"" from ""view"" as owner, "= "class"" as ""to"" where owner.""idClassView"" =3D ""to"".id_enti= ty and owner.id_entity =3D 10003 + ; select ""viewName"" from ""view"" where ""id_entity"" =3D 10= 003"; =20 FillTest fillTest =3D new FillTest(); fillTest.Connect(); fillTest.doSelect(query, new DataSet()); } - - public static void TestError() - { - string query =3D ""; - query +=3D @"select 'b', 'a';"; - query +=3D @"select 'a';"; - - FillTest fillTest =3D new FillTest(); - fillTest.Connect(); - fillTest.doSelect(query, new DataSet()); - } - - } =20 class FillTest=20 @@ -73,26 +58,165 @@ dbCon =3D c; } =20 - public DataSet doSelect(string query,DataSet ds) + public DataTable doSelectAsDataTable(string query) { - dbCon.Open(); NpgsqlConnection conn =3D ( (NpgsqlConnection) dbCon ); -=09 + =09 NpgsqlDataAdapter da =3D new NpgsqlDataAdapter(query,conn); + + DataTable dt =3D new DataTable(); + try { - da.Fill(ds); + da.Fill(dt); } catch(Exception ex) { dbCon.Close(); throw new Exception("Error executing query:\r\n" + query + "\n\r" +e= x.Message,ex.InnerException); } + da.Dispose(); + dbCon.Close(); + return dt; =20 + } + + public DataSet doSelect(string query,DataSet ds) + { + dbCon.Open(); + NpgsqlConnection conn =3D ( (NpgsqlConnection) dbCon ); + =09 + NpgsqlDataAdapter da =3D new NpgsqlDataAdapter(query,conn); + + string[] queries =3D query.Split(';'); + + int c =3D 0; + foreach(string q in queries) + { + if(q.IndexOf("select") =3D=3D -1) { + continue; + } + try + { + DataTable dt =3D doSelectAsDataTable(q); + da.Fill(dt); + Console.WriteLine(q + " -- No ERROR."); + } + catch(Exception ex) + { + dbCon.Close(); + throw new Exception("Error executing query:\r\n" + q + "\n\r" +ex.M= essage,ex.InnerException); + } + + } +=20 + Console.WriteLine("No ERROR"); =20 return ds; =09 } } + + ///<summary>Metodos utiles que no son directamente parte del crud.</sum= mary> + ///<remarks>Esta clase hereda de DbDataAdaptor solo porque DbDataAdpter= .fill es protected (!!!) :(.</remarks> + public class DbUtils : System.Data.Common.DbDataAdapter { + + ///<summary>Toma un IDataReader y lo convierte a un DataTable.</summar= y> + ///<remarks>Es un truco simple (sucio?) para hacer disponible el metod= o Protected fill()</remarks> + ///<param name=3D"dt">La DataTable que recibe el contenido de idr</par= am> + ///<param name=3D"idr">La IDataReader que contiene el resultado de un = query</param> + public int IDbReader2DataTable(System.Data.DataTable dt, System.Data.I= DataReader idr) { + return this.Fill(dt, idr); + } + =09 + ///<summary>Test simple para saber si un datatable es vacio o no</summ= ary> + ///<param name=3D"dt">El DataTalbe para testiar.</param> + ///<returns>Devuelve true cuando es vacio. False en todos los otros ca= sos.</returns> + public bool tableIsEmpty(System.Data.DataTable dt) { + if( dt.Rows.Count =3D=3D 0 ) { + return true; + } + return false; + } + + ///<summary>Agrupar un strings de para ser utilizado en un "in" de SQL= </summary> + ///<param name=3D"args">Lista de strings para ser concatenado</param> + public string ConcatForSqlIn(string[] args) + { + string res =3D ""; + foreach(string arg in args) + { + res +=3D "\'"+ arg +"\',"; + } + return res.Substring(0, res.Length-1); + =09 + } + + public static string DumpData(DataSet workSet) { + string res =3D ""; + foreach(DataTable dt in workSet.Tables) { + res +=3D ("\n\n------- " + dt.TableName + " -------\n"); + res +=3D DumpData(dt); + } + return res; + } + =09 + ///<summary>This dumps the content of a DataTable to console.</summary= > + ///<remarks>This method only makes sense for development purposes.</re= marks> + ///<param name=3D"workTable">The table to be dumped.</param> + public static string DumpData(DataTable workTable) { + string res =3D ""; + int padding =3D 12; + DataRow[] currRows =3D workTable.Select(null, null, DataViewRowState.= CurrentRows); + if(currRows.Length < 1 ) + res +=3D ("\nNo Current Rows Found\n"); + else { + Console.WriteLine(); + foreach (DataColumn myCol in workTable.Columns) { + res +=3D String.Format("{0}|", myCol.ColumnName.PadRight(padding= )); + } + res +=3D ("RowState \n"); + + foreach (DataRow myRow in currRows) { + foreach (DataColumn myCol in workTable.Columns) { + res +=3D String.Format("{0}|", Convert.ToString(myRow[myCol]).= PadRight(padding)); + } + res +=3D Convert.ToString(myRow.RowState).PadRight(padding); + res +=3D "\n"; + } + } + return res; + } + =09 + ///<summary>This dumps the content of a DataRow to console.</summary> + ///<remarks>This method only makes sense for development perposes.</re= marks> + ///<param name=3D"workRow">The row to be dumped.</param> + public static string DumpData(DataRow workRow) { + return DumpData(workRow.Table); + } + =09 + ///<summary>Metodo vacio para poder hacer un sub-clase de DbDataAdapte= r</summary> + protected override RowUpdatedEventArgs CreateRowUpdatedEvent( + DataRow dataRow, + IDbCommand command, + StatementType statementType, + DataTableMapping tableMapping + ){return null;} + ///<summary>Metodo vacio para poder hacer un sub-clase de DbDataAdapte= r</summary> + protected override RowUpdatingEventArgs CreateRowUpdatingEvent( + DataRow dataRow, + IDbCommand command, + StatementType statementType, + DataTableMapping tableMapping + ){return null;} + ///<summary>Metodo vacio para poder hacer un sub-clase de DbDataAdapte= r</summary> + protected override void OnRowUpdated( + RowUpdatedEventArgs value + ){} + ///<summary>Metodo vacio para poder hacer un sub-clase de DbDataAdapte= r</summary> + protected override void OnRowUpdating( + RowUpdatingEventArgs value + ){} + } } |
|
From: <sv...@de...> - 2005-05-25 15:08:42
|
Author: pcamacho
Date: 2005-05-25 11:08:19 -0400 (Wed, 25 May 2005)
New Revision: 1145
Modified:
humano2/trunk/web/portal/site/xsl/currency.xsl
humano2/trunk/web/portal/site/xsl/email.xsl
humano2/trunk/web/portal/site/xsl/numeric.xsl
Log:
FIX: when reading an instance (portal), a few javascript errors were rise=
n.
Modified: humano2/trunk/web/portal/site/xsl/currency.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/currency.xsl 2005-05-25 14:41:45 UT=
C (rev 1144)
+++ humano2/trunk/web/portal/site/xsl/currency.xsl 2005-05-25 15:08:19 UT=
C (rev 1145)
@@ -53,24 +53,24 @@
</input>
</xsl:when> =20
</xsl:choose>
- =20
- <script language=3D"JavaScript">
- var decimalsValue =3D '<xsl:value-of select=3D"$decimals" />=
';
- var minValue =3D '<xsl:value-of select=3D"$min" />';
- var maxValue =3D '<xsl:value-of select=3D"$max" />';
- =20
- var numParams =3D=20
- {
- decimals : decimalsValue,
- min : minValue,
- max : maxValue
- }
- var numData =3D document.getElementById('<xsl:value-of selec=
t=3D"$sysAttName"/>').value;
- //alert("numData: " + numData);
- var aInputToCheck =3D new InputToCheck('CURRENCY',numData,nu=
mParams);
- allInputsToCheck.Add(aInputToCheck);
- </script>
- =20
+ <xsl:if test=3D"/page/flagaction!=3D'Read'">
+ <script language=3D"JavaScript">
+ var decimalsValue =3D '<xsl:value-of select=3D"$decimals=
" />';
+ var minValue =3D '<xsl:value-of select=3D"$min" />';
+ var maxValue =3D '<xsl:value-of select=3D"$max" />';
+ =20
+ var numParams =3D=20
+ {
+ decimals : decimalsValue,
+ min : minValue,
+ max : maxValue
+ }
+ var numData =3D document.getElementById('<xsl:value-of s=
elect=3D"$sysAttName"/>').value;
+ //alert("numData: " + numData);
+ var aInputToCheck =3D new InputToCheck('CURRENCY',numDat=
a,numParams);
+ allInputsToCheck.Add(aInputToCheck);
+ </script>
+ </xsl:if>
</xsl:template>=09
</xsl:stylesheet>
=20
Modified: humano2/trunk/web/portal/site/xsl/email.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/email.xsl 2005-05-25 14:41:45 UTC (=
rev 1144)
+++ humano2/trunk/web/portal/site/xsl/email.xsl 2005-05-25 15:08:19 UTC (=
rev 1145)
@@ -22,10 +22,12 @@
</xsl:when>
</xsl:choose>
=20
- <script language=3D"Javascript">
- var aInputToCheck =3D new InputToCheck('EMAIL','');
- allInputsToCheck.Add(aInputToCheck);
- </script>
+ <xsl:if test=3D"/page/flagaction!=3D'Read'"> <!-- Only for creat=
e and update -->
+ <script language=3D"Javascript">
+ var aInputToCheck =3D new InputToCheck('EMAIL','');
+ allInputsToCheck.Add(aInputToCheck);
+ </script>
+ </xsl:if>
=20
</xsl:template>
</xsl:stylesheet>
Modified: humano2/trunk/web/portal/site/xsl/numeric.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/numeric.xsl 2005-05-25 14:41:45 UTC=
(rev 1144)
+++ humano2/trunk/web/portal/site/xsl/numeric.xsl 2005-05-25 15:08:19 UTC=
(rev 1145)
@@ -54,19 +54,20 @@
</xsl:when> =20
</xsl:choose>
=20
- <script language=3D"Javascript">
- var numParams =3D=20
- {
- decimals : <xsl:value-of select=3D"$decimals" />,
- min : <xsl:value-of select=3D"$min" />,
- max : <xsl:value-of select=3D"$max" />
- }
- var numData =3D document.getElementById('<xsl:value-of selec=
t=3D"$sysAttName"/>').value;
- var aInputToCheck =3D new InputToCheck('NUMERIC',numData,num=
Params);
- allInputsToCheck.Add(aInputToCheck);
- </script>
+ <xsl:if test=3D"/page/flagaction!=3D'Read'"> <!-- Only for creat=
e and update -->
+ <script language=3D"Javascript">
+ var numParams =3D=20
+ {
+ decimals : <xsl:value-of select=3D"$decimals" />,
+ min : <xsl:value-of select=3D"$min" />,
+ max : <xsl:value-of select=3D"$max" />
+ }
+ var numData =3D document.getElementById('<xsl:value-of s=
elect=3D"$sysAttName"/>').value;
+ var aInputToCheck =3D new InputToCheck('NUMERIC',numData=
,numParams);
+ allInputsToCheck.Add(aInputToCheck);
+ </script>
+ </xsl:if>
=20
- =20
</xsl:template>=09
</xsl:stylesheet>
=20
|
|
From: <sv...@de...> - 2005-05-25 14:41:50
|
Author: pcamacho
Date: 2005-05-25 10:41:45 -0400 (Wed, 25 May 2005)
New Revision: 1144
Modified:
humano2/trunk/web/portal/site/xsl/numeric.xsl
Log:
FIX: remove of $ before value of an attribute "numeric".
Modified: humano2/trunk/web/portal/site/xsl/numeric.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/numeric.xsl 2005-05-25 14:40:06 UTC=
(rev 1143)
+++ humano2/trunk/web/portal/site/xsl/numeric.xsl 2005-05-25 14:41:45 UTC=
(rev 1144)
@@ -11,7 +11,7 @@
=20
<xsl:choose>=09
<xsl:when test=3D"/page/flagaction=3D'Read'">
- $  <xsl:value-of select=3D"$data" />
+ <xsl:value-of select=3D"$data" />
</xsl:when>
<xsl:when test=3D"/page/flagaction=3D'Update'">
=20
|
|
From: <sv...@de...> - 2005-05-25 14:40:15
|
Author: pcamacho
Date: 2005-05-25 10:40:06 -0400 (Wed, 25 May 2005)
New Revision: 1143
Modified:
humano2/trunk/components/webTools/Adapter.cs
humano2/trunk/web/portal/site/leftbar.aspx.cs
humano2/trunk/web/portal/site/showView.aspx.cs
Log:
CHANGE: the function GetViewDataTableById has been reimplemented with Vie=
wTools.
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-25 00:05:37 UTC =
(rev 1142)
+++ humano2/trunk/components/webTools/Adapter.cs 2005-05-25 14:40:06 UTC =
(rev 1143)
@@ -275,19 +275,52 @@
/// <returns>A DataTable with the structure of the view referenced by =
the viewId.</returns>
public DataTable GetViewDataTableFromId(int viewId, out int iniClas=
s)
{
- iniClass =3D 0;
+ iniClass =3D 0;
=20
+ Humano2.Components.ViewTools.ViewTools vt =3D new ViewTools.ViewTo=
ols();
+ vt.Complex =3D complex;
+ =09
+ DataTable table =3D getViewToolsTable();
+
+ // Get the id_entity and the domainName of all the domains in the sys=
tem.
+ string columns =3D "1012,1013,1014,1015,1016,1017,1018";
+ string where =3D "0|4|'"+ viewId +"'|0|0";
+ //string[] fila =3D {"1011",columns,where,"","","","0"};
+ //table.Rows.Add(fila);
+ //vt.IdClass =3D Convert.ToInt32(ViewConsts.ViewClass);
+ //vt.KeyFlag =3D 1;
+
+ //DataTable resp =3D vt.GetSQLDataTable(table);
+ =20
+ DataTable resp =3D GenerateViewTools(1011,columns,where,"","","",0);
+ Logger.Log("GetViewDataTable : step1" + resp.Rows.Count ,Lo=
gLevel.Trace);
+ DataRow row =3D resp.Rows[0];
+ string idClassView =3D null;
+ if (row !=3D null)
+ {
+ idClassView =3D Convert.ToString(row["idClassView"]);
+ }
+ =20
+ string[] arInfo =3D new string[2]; =20
+ // define which character is seperating fields
+ char[] splitter =3D {'^'};
+ =20
+ arInfo =3D idClassView.Split(splitter);
+ =20
+ iniClass =3D Convert.ToInt32(arInfo[0]);
+
+ return resp;
+ =20
+ } =20
+ /* =20
//Variables para extraer las funciones de coliumnas de tipo "vista"
string columnValue=3D"";
=09
- // Create the table to invoke ViewTools with.
- DataTable vtTable =3D getViewToolsTable();
- DataRow vtInstance=3D vtTable.NewRow();
=20
DataSet myDataSet=3D new DataSet();
// Now we read the view via it's viewId, to recover it's values.
myDataSet =3D ReadDataWithName(viewId, "data");
- =09
+ Logger.Log(DbUtils.DumpData(myDataSet),LogLevel.Trace);
//FIXME: there has to be a way to not walk over all elements (three "=
for" loops!)
//FIXME: Maybe the best way is to use "viewTools" to get the view ele=
ments.
foreach(DataTable myTable in myDataSet.Tables)
@@ -301,8 +334,10 @@
catch(System.InvalidCastException ) { continue; }
catch(System.FormatException) { continue; }
=20
+ Logger.Log("columnName: " + columnName,LogLevel.=
Trace);
switch(columnName) // See if the entites are parts of the view tab=
le taht we need.
{
+ =20
case (int) ViewConsts.Columns: // If the row contains "columns" pa=
rt of the "view"
vtInstance["columns"] =3D myRow["data"].ToString();
break;
@@ -322,16 +357,8 @@
case (int) ViewConsts.Class:
=20
string info =3D myRow["data"].ToString();
+ Logger.Log("info: " + info,LogLevel.Trace);
=20
- string[] arInfo =3D new string[2];
- =20
- // define which character is seperating fields
- char[] splitter =3D {'^'};
- =20
- arInfo =3D info.Split(splitter);
- =20
- iniClass =3D Convert.ToInt32(arInfo[0]);
- =20
break;
}
}
@@ -342,7 +369,8 @@
=20
return vtTable;=20
}
- =20
+ */
+ =20
///<summary>Execute a View from a DataTable.</summary>
///<param name=3D"vtTable">A datatable with the data relevant to th=
e View.</param>
///<param name=3D"iniClass">The class that the DataTable's View sho=
uld act on.</param>
Modified: humano2/trunk/web/portal/site/leftbar.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/leftbar.aspx.cs 2005-05-25 00:05:37 UTC=
(rev 1142)
+++ humano2/trunk/web/portal/site/leftbar.aspx.cs 2005-05-25 14:40:06 UTC=
(rev 1143)
@@ -71,7 +71,7 @@
+ Dr1[1] =20
+ "</classId>"
+ "<href>"
- + ViewPages.showViewPage + Dr1["id_entity"] + "&=
amp;classId=3D" + Dr1[1]=20
+ + ViewPages.showViewPage + Dr1["id_entity"] + "&=
amp;iniClass=3D" + Dr1[1]=20
+ "</href>"
+ "<text>"
+ Dr1[2]
@@ -203,7 +203,7 @@
+ viewClassId[j] =20
+ "</classId>"
+ "<href>"
- + ViewPages.showViewPage + viewId[j] + "&clas=
sId=3D" + viewClassId[j] =20
+ + ViewPages.showViewPage + viewId[j] + "&iniC=
lass=3D" + viewClassId[j] =20
+ "</href>"
+ "<text>"
+ viewName[j]
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-25 00:05:37 UT=
C (rev 1142)
+++ humano2/trunk/web/portal/site/showView.aspx.cs 2005-05-25 14:40:06 UT=
C (rev 1143)
@@ -83,7 +83,9 @@
/************************
* Datos usados por Search SVERA 20052005
*/
- iniClass =3D Convert.ToInt32(Request["iniClass"]);
+ iniClass =3D Convert.ToInt32(Request["classId"]);
+ Logger.Log("classId" + iniClass.ToString(),LogLevel.Trace);
+ =20
string idAttributes=3D Request["idAttribute"]; //The attribu=
tes to filter with
string idOperators =3D Request["idOPerator"]; //The operator=
s (<=3D,=3D,>=3D etc...)
string valuesToSearch =3D Request["textToSearch"]; //The val=
ues to compare with
@@ -99,6 +101,7 @@
if (isSearch =3D=3D 0)
{
idEntity =3D Convert.ToInt32(Request.QueryString["id_entity"]);
+ Logger.Log("idEntity: " + idEntity,LogLevel.Trace);
}
else
{
@@ -116,6 +119,7 @@
//Logger.Log("showView createXml: currPage" + currPage, LogL=
evel.Trace);
if(isSearch =3D=3D 0)
{
+ Logger.Log("Before GetViewDataTableFromId: idEntity " +=
idEntity,LogLevel.Trace);
viewTable =3D dbAdapter.GetViewDataTableFromId(idEntity, out iniClas=
s);
}
else
@@ -125,7 +129,8 @@
=20
// If there are multiple "order" arguments, they should be s=
eperated by ",";
// The framework already puts a "," between multiple "order =
arguments.
- Logger.Log("Before ExecViewFromDataTabe",LogLevel.Trace);
+ Logger.Log("Before ExecViewFromDataTabe. iniClass=3D " + Con=
vert.ToString(iniClass),LogLevel.Trace);
+ Logger.Log("idEntity: " + idEntity,LogLevel.Trace);
DataTable viewRes =3D dbAdapter.ExecViewFromDataTable(iniCla=
ss, viewTable, idEntity, orderArr, currPage, 1);
=20
int pageCount=3D dbAdapter.NumberOfPagesInPagedView;
|
|
From: <sv...@de...> - 2005-05-25 00:05:44
|
Author: marijn
Date: 2005-05-24 20:05:37 -0400 (Tue, 24 May 2005)
New Revision: 1142
Modified:
humano2/trunk/core/db/pgsql/pgsqlConnection.cs
Log:
* Adding work around for mono framework limitations of Fill() method.
Modified: humano2/trunk/core/db/pgsql/pgsqlConnection.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/pgsqlConnection.cs 2005-05-24 21:10:33 UT=
C (rev 1141)
+++ humano2/trunk/core/db/pgsql/pgsqlConnection.cs 2005-05-25 00:05:37 UT=
C (rev 1142)
@@ -64,28 +64,37 @@
=20
}
=09
+ //FIXME: This does way many calls to the database, However it is neede=
d since the mono framework dies on us.
override public DataSet doSelect(string query,DataSet ds)
{
Open();
- NpgsqlConnection conn =3D ( (NpgsqlConnection) dbCon );
- =09
- NpgsqlDataAdapter da =3D new NpgsqlDataAdapter(query,conn);
- try
+ NpgsqlConnection conn =3D ( (NpgsqlConnection) dbCon ); =20
+ NpgsqlDataAdapter da =3D new NpgsqlDataAdapter();
+ query =3D query.Trim();
+ if (query.StartsWith(";"))
+ query =3D query.Substring(1);
+
+ string[] sqls =3D query.Split(';');
+ int counter =3D 0;
+ for (int i =3D0; i< sqls.Length;i++)
{
- da.Fill(ds);
+ da =3D new NpgsqlDataAdapter(sqls[i],conn);
+ try
+ {
+ da.Fill(ds,"tbl"+counter++);
+ }
+ catch(Exception ex)
+ {
+ Close();
+ Logger.Log("Error executing query:\r\n" + query, LogLevel.Trace);
+ throw new Exception("Error executing query:\r\n" + query + "\n\r" +=
ex.Message,ex.InnerException);
+ }
+ da.Dispose();
}
- catch(Exception ex)
- {
- Close();
- Logger.Log("Error executing query:\r\n" + query, LogLevel.Trace);
- throw new Exception("Error executing query:\r\n" + query + "\n\r" +e=
x.Message,ex.InnerException);
- }
- da.Dispose();
Close();
return ds;
+ }=20
=20
- }
-
///<summary>Realiza comandos en la base de datos que no retornen.</sum=
mary>
///<param name=3D"query">El SQL para la base de datos.</param>
///<returns>Cantidad de filas afectado por el comando.</returns>
|
|
From: <sv...@de...> - 2005-05-24 21:10:35
|
Author: pcamacho
Date: 2005-05-24 17:10:33 -0400 (Tue, 24 May 2005)
New Revision: 1141
Modified:
humano2/trunk/web/portal/site/leftbar.aspx.cs
Log:
FIX: the link in the leftbar of portal to create instances was bad: readX=
slt.aspx had to be replaced by=20
createXslt.apsx
Modified: humano2/trunk/web/portal/site/leftbar.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/leftbar.aspx.cs 2005-05-24 20:32:13 UTC=
(rev 1140)
+++ humano2/trunk/web/portal/site/leftbar.aspx.cs 2005-05-24 21:10:33 UTC=
(rev 1141)
@@ -86,7 +86,7 @@
foreach(DataRow Dr in dtResult.Rows) //Recorre Folders
{
=20
- string urlCreate =3D Html.genAbsoluteUrl("/portal/site/Data_structu=
red.aspx?action=3Dcreate&display=3DreadXslt.aspx&id_entity=3D" + =
Dr[0]);
+ string urlCreate =3D Html.genAbsoluteUrl("/portal/site/Data_structu=
red.aspx?action=3Dcreate&display=3DcreateXslt.aspx&id_entity=3D" =
+ Dr[0]);
=20
xmlString +=3D "<class>";
xmlString +=3D "<classId>" + Dr[0] +"</classId>";
@@ -218,7 +218,7 @@
{
=20
//string urlCreate =3D Html.genAbsoluteUrl("/portal/site/instance.a=
spx?action=3Dcreate&display=3DreadXslt.aspx&id_entity=3D" + viewC=
lassId[j]);
- string urlCreate =3D Html.genAbsoluteUrl("/portal/site/Data_structu=
red.aspx?action=3Dcreate&display=3DreadXslt.aspx&id_entity=3D" + =
viewClassId[j]);
+ string urlCreate =3D Html.genAbsoluteUrl("/portal/site/Data_structu=
red.aspx?action=3Dcreate&display=3DcreateXslt.aspx&id_entity=3D" =
+ viewClassId[j]);
=20
string className =3D dbAdapter.GetClassNameById(viewCla=
ssId[j]);
=20
|
|
From: <sv...@de...> - 2005-05-24 20:32:18
|
Author: pcamacho
Date: 2005-05-24 16:32:13 -0400 (Tue, 24 May 2005)
New Revision: 1140
Added:
humano2/trunk/web/portal/site/js/inputstocheck.js
humano2/trunk/web/portal/site/js/test.html
humano2/trunk/web/portal/site/js/test.js
Modified:
humano2/trunk/web/portal/site/js/commonfunctions.js
humano2/trunk/web/portal/site/readXslt.aspx
humano2/trunk/web/portal/site/xsl/currency.xsl
humano2/trunk/web/portal/site/xsl/email.xsl
humano2/trunk/web/portal/site/xsl/numeric.xsl
humano2/trunk/web/portal/site/xsl/text.xsl
humano2/trunk/web/portal/site/xsl/textline.xsl
Log:
FIX: when creating an instance, all values entered are check before=20
doing onsubmit (no more use of onblur).
Modified: humano2/trunk/web/portal/site/js/commonfunctions.js
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/js/commonfunctions.js 2005-05-24 20:04:=
24 UTC (rev 1139)
+++ humano2/trunk/web/portal/site/js/commonfunctions.js 2005-05-24 20:32:=
13 UTC (rev 1140)
@@ -1,6 +1,3 @@
-/*
-*
-*/
function fn_doCheckValidString(strCheck)
{
var chrArray =3D " abcdefghijklmn?opqrstuvwxyzABCDEFGHIJKLMN?OPQRSTUVWX=
YZ.,;:-_{}()??!\\/=3D+*#$%&\n\r0123456789";
@@ -25,7 +22,8 @@
{
alert(strError);
return false;
- }else{
+ }else
+ {
return true;
}
}
@@ -84,15 +82,17 @@
if(childElem.tagName =3D=3D 'INPUT' || childElem.tagName =3D=
=3D 'TEXTAREA') //the child is an input or a textarea ie is not a text
{
divRefArray =3D fn_getElemntsByTagName("div","divListasL=
eft");
- =20
- divOk =3D alertUserWhenEmptyField(isObligatoryArray[i],c=
hildElem,attNameArray[i]);
- =20
+ //alert("allInputsToCheck.Get(" + i + "):" + allInputsTo=
Check.Get(i));
+ allInputsToCheck.SetValue(i,childElem.value); //Get the =
choosen value
+ divOk =3D alertUserWhenEmptyField(isObligatoryArray[=
i],childElem,attNameArray[i]) //Obligatory field
+ && allInputsToCheck.Get(i).Check(); //Other che=
cks ()allInputsToCheck is a global variable defined in readXslt.aspx
//If an attribute is not well filled, then put its name =
color to red
// else put it to black (normal)
if(!divOk)
{
divRefArray[i].style.color=3D"red";
- }else{
+ }else
+ {
divRefArray[i].style.color=3D"black";
}
formOk =3D divOk && formOk; //Check if all the form is w=
ell filled
Added: humano2/trunk/web/portal/site/js/inputstocheck.js
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/js/inputstocheck.js 2005-05-24 20:04:24=
UTC (rev 1139)
+++ humano2/trunk/web/portal/site/js/inputstocheck.js 2005-05-24 20:32:13=
UTC (rev 1140)
@@ -0,0 +1,201 @@
+function checkDecimals(fieldValue,decallowed,min,max)=20
+{=09
+ var decimalsOk =3D true;
+ //alert('hola: ' + fieldValue);
+ if (isNaN(fieldValue))=20
+ {
+ alert ("Please enter a number.");
+ decimalsOk =3D false;
+ }=20
+ else=20
+ {
+ if (fieldValue.indexOf('.') =3D=3D -1)=20
+ {
+ fieldValue +=3D ".";
+ }
+ dectext =3D fieldValue.substring(fieldValue.indexOf('.')+1, fiel=
dValue.length);
+ if ( (dectext.length > decallowed)=20
+ && (decallowed !=3D null)=20
+ && (decallowed !=3D ''))=20
+ {
+ alert ("Please enter a number with up to " + decallowed + " =
decimal places. Please try again.");
+ decimalsOk =3D false;
+ }
+ else if (!isNaN(min) && min !=3D "" && fieldValue < parseFloat(m=
in))=20
+ {
+ alert ("Please enter a number which is higher than " + min +=
". Please try again.");
+ decimalsOk =3D false;
+ }
+ else if (!isNaN(max) && max !=3D "" && fieldValue > parseFloat(m=
ax))=20
+ {
+ alert ("Please enter a number which is lower than " + max + =
". Please try again.");
+ decimalsOk =3D false;
+ }
+ }
+ =20
+ return decimalsOk;
+}
+
+
+function verifyEmail(value)=20
+{
+ var checkEmail =3D value
+ var mailOk =3D true;
+ =20
+ if(checkEmail =3D=3D '' || checkEmail =3D=3D null)
+ {
+ return true;
+ }
+ =20
+ if ( (checkEmail.indexOf('@') < 0)=20
+ ||=20
+ ((checkEmail.charAt(checkEmail.length-4) !=3D '.') && (check=
Email.charAt(checkEmail.length-3) !=3D'.'))
+ ) =09
+ {
+ alert("You have entered an invalid email address( " + checkEmail=
+ "). Please try again.");
+ mailOk =3D false;
+ }=09
+ =20
+ return mailOk;
+}
+ =20
+function checkIsObligatory(isObligatory,value)
+{
+ var isObligatoryOk =3D true;
+ =20
+ if((isObligatory=3D=3Dtrue) && (value=3D=3D'')) =20
+ {
+ isObligatoryOk =3D false;
+ }
+ =20
+ return isObligatoryOk;
+}
+
+/**
+ * InputToCheck class
+ * datas for an input
+ */
+function InputToCheck(type,value,optionData)
+{
+ =20
+ //Fields
+ this.type =3D type;
+ this.value =3D value;
+ this.optionData =3D optionData;
+ =20
+ //Methods
+ this.Check =3D InputToCheckCheck;
+}
+
+
+/**
+ * Verifies if an input is well entered
+ */
+function InputToCheckCheck()
+{
+ var checkOk =3D true;
+ //alert('type' + this.type);
+ //Check according to the type of input
+ switch(this.type)
+ {
+ case 'NUMERIC':=20
+ case 'CURRENCY':
+ checkOk =3D checkDecimals( this.value,
+ this.optionData.decimals,
+ this.optionData.min,
+ this.optionData.max);
+ break;
+ case 'EMAIL':
+ checkOk =3D verifyEmail(this.value);
+ break;
+ }
+ =20
+ return checkOk; =20
+}
+
+
+/**
+ * Constructor
+ * Used to store the inputs and textareas that must be checked
+ */
+function InputsToCheck()
+{ =20
+ this.Inputs =3D new Array(); =20
+ this.Get =3D InputsToCheckGet;
+ this.Add =3D InputsToCheckAdd;
+ this.CheckAll =3D InputsToCheckCheckAll;
+ this.SetValue =3D InputsToCheckSetValue;
+ this.Length =3D InputsToCheckLength;
+}
+
+
+function InputsToCheckSetValue(index,value)
+{
+ this.Inputs[index].value =3D value; =20
+}
+
+function InputsToCheckAdd(aInput)
+{
+ var newIndex =3D this.Length();
+ this.Inputs[newIndex] =3D aInput;
+}
+
+function InputsToCheckLength()
+{
+ return this.Inputs.length; =20
+}
+
+
+function InputsToCheckGet(index)
+{
+ return this.Inputs[index]; =20
+}
+
+
+function InputsToCheckCheckAll()
+{
+ =20
+}
+
+function InputsToCheckTest()
+{
+ TestGroupWrite("InputsToCheck"); =20
+ =20
+ var numParams =3D=20
+ {
+ decimals : 2,
+ min : 0,
+ max : 100
+ }
+ aNewInput =3D new InputToCheck('NUMERIC','hola',numParams);
+ Test( "INPUTTOCHECK",
+ 'Verification of numeric (not a num)',
+ aNewInput.Check() =3D=3D false );
+ =20
+ ///
+ =20
+ numParams =3D=20
+ {
+ decimals : 2,
+ min : 0,
+ max : 100
+ }
+ aNewInput =3D new InputToCheck('NUMERIC','123.123'.value,numParams);
+ Test( "INPUTTOCHECK",
+ 'Verification of numeric (bad number of decimals)',=20
+ aNewInput.Check() =3D=3D false );
+ ///
+ =20
+ aNewInput =3D new InputToCheck('EMAIL','ti...@em...');
+ Test( "INPUTTOCHECK",
+ 'Verification of email (good syntax)',=20
+ aNewInput.Check() =3D=3D true );
+ ///
+ =20
+ aNewInput =3D new InputToCheck('EMAIL','titi');
+ Test( "INPUTTOCHECK",
+ 'Verification of email (bad syntax)',=20
+ aNewInput.Check() =3D=3D false );
+}
+
+
Added: humano2/trunk/web/portal/site/js/test.html
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/js/test.html 2005-05-24 20:04:24 UTC (r=
ev 1139)
+++ humano2/trunk/web/portal/site/js/test.html 2005-05-24 20:32:13 UTC (r=
ev 1140)
@@ -0,0 +1,29 @@
+<!--
+// The Humano2 Business solution.
+// Copyright (C) 2004,5 Humano2 Chile S.A. (http://www.humano2.com)
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version. =20
+//
+$Id $
+-->
+<html>
+ <head> =20
+ <script language=3D"javascript" src=3D"test.js"></script>
+ <script language=3D"Javascript" src=3D"inputstocheck.js"></scrip=
t>
+ </head>
+ <body>
+ <center>
+ <h1>
+ Tests
+ <h1> =20
+ </center>
+ <br>
+ <br>
+ <script language=3D"Javascript">
+ InputsToCheckTest();
+ </script>
+ </body>
+</html>
Added: humano2/trunk/web/portal/site/js/test.js
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/js/test.js 2005-05-24 20:04:24 UTC (rev=
1139)
+++ humano2/trunk/web/portal/site/js/test.js 2005-05-24 20:32:13 UTC (rev=
1140)
@@ -0,0 +1,17 @@
+function Test(group,message,condition)
+{
+ var str =3D "["+ group + "] " + message + ": ";
+ if (condition =3D=3D true)
+ str +=3D "<font color=3D\"green\">SUCCESS</font>";
+ else
+ str +=3D "<font color=3D\"red\">FAILED</font>";
+ str+=3D "<br>";
+ =20
+ document.write(str);
+}
+
+function TestGroupWrite(name)
+{
+ var str =3D "<br><br><hr><h3>"+ name + "</h3><hr>";
+ document.write(str);
+}
Modified: humano2/trunk/web/portal/site/readXslt.aspx
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/readXslt.aspx 2005-05-24 20:04:24 UTC (=
rev 1139)
+++ humano2/trunk/web/portal/site/readXslt.aspx 2005-05-24 20:32:13 UTC (=
rev 1140)
@@ -11,6 +11,7 @@
<head>
<script language=3D"Javascript" src=3D"js/isobligatory.j=
s"/>
<script language=3D"Javascript" src=3D"js/commonfunction=
s.js"/>
+ <script language=3D"Javascript" src=3D"js/inputstocheck.=
js"/>
<link href=3D"css/readxslt.css" rel=3D"stylesheet" type=3D=
"text/css" />
<!-- calendar stylesheet -->
<link rel=3D"stylesheet" type=3D"text/css" media=3D"all"=
href=3D"js/calendar/calendar-win2k-cold-1.css" title=3D"win2k-cold-1" />
@@ -159,7 +160,8 @@
/* Remark: Javascript always store the nodes in the same ord=
er: the order of creation */
var isObligatoryArray =3D new Array; /* array that stores th=
e booleans isObligatory for each attribute */
var attNameArray =3D new Array; /* array that stores the nam=
e of each attribute */
- var attNameDict =3D new Array; /* array (dictionary) that st=
ores the name, sysname relation. */
+ //var attNameDict =3D new Array; /* array (dictionary) that =
stores the name, sysname relation. */
+ var allInputsToCheck =3D new InputsToCheck();
var i=3D0; /* Counters */
var j=3D0;
</script>
@@ -177,7 +179,7 @@
<script language=3D"Javascript">
isObligatoryArray[i++]=3D'fa=
lse';
attNameArray[j++] =3D '<xsl:=
value-of select=3D"string($attributeName)"/>';
- attNameDict["<xsl:value-of s=
elect=3D"string($attributeName)"/>"] =3D '<xsl:value-of select=3D"string(=
$attributeSysName)"/>';
+ //attNameDict["<xsl:value-of=
select=3D"string($attributeName)"/>"] =3D '<xsl:value-of select=3D"strin=
g($attributeSysName)"/>';
</script>
<!-- If the field is obligatory =
add a star and put the JS variable isObligatory to false -->
<xsl:variable name=3D"isObligato=
ry" select=3D"/page/classInstance/structure/attribute[id_entity=3D$idAttr=
ibute]/isObligatory"/> =20
Modified: humano2/trunk/web/portal/site/xsl/currency.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/currency.xsl 2005-05-24 20:04:24 UT=
C (rev 1139)
+++ humano2/trunk/web/portal/site/xsl/currency.xsl 2005-05-24 20:32:13 UT=
C (rev 1140)
@@ -7,41 +7,15 @@
<xsl:variable name=3D"max" select=3D"/page/classInstance/structure/cur=
rency[id_entity=3D$idEntity]/max"/>
<xsl:variable name=3D"isEditable" select=3D"/page/classInstance/struct=
ure/attribute[id_entity=3D$idEntity]/isEditable"/>
<xsl:variable name=3D"data" select=3D"/page/classInstance/data/c=
urrency[id_entity=3D$idEntity]/data"/>
- =20
- <script language=3D"JavaScript">
- function checkDecimals(fieldValue, decallowed)=20
- {=09
- var min =3D "<xsl:value-of select=3D"$min"/>"
- var max =3D "<xsl:value-of select=3D"$max"/>"
- =09
- if (isNaN(fieldValue))=20
- {
- alert ("Please enter a number.");
- } else=20
- {
- if (fieldValue.indexOf('.') =3D=3D -1) fieldValue +=3D ".";
- dectext =3D fieldValue.substring(fieldValue.indexOf('.')+1, fieldVa=
lue.length);
- if (dectext.length > decallowed)=20
- {
- alert ("Please enter a number with up to " + decallowed + " decima=
l places. Please try again.");
- }
- else if (!isNaN(min) && min !=3D "" && fieldValu=
e < parseFloat(min))=20
- {
- alert ("Please enter a number which is higher than " + min + ". P=
lease try again.");
- }
- else if (!isNaN(max) && max !=3D "" && fieldValue &=
gt; parseFloat(max))=20
- {
- alert ("Please enter a number which is lower than " + max + ". Pl=
ease try again.");
- }
- }
- }
- </script>
+ <xsl:variable name=3D"decimals" select=3D"/page/classInstance/st=
ructure/currency[id_entity=3D$idEntity]/decimals" /> =20
+ =09
+ =20
<xsl:choose>=09
<xsl:when test=3D"/page/flagaction=3D'Read'">
- <xsl:value-of select=3D"$data" />$
+ $  <xsl:value-of select=3D"$data" />
</xsl:when>
<xsl:when test=3D"/page/flagaction=3D'Update'">
- <xsl:variable name=3D"decimals" select=3D"/page/classIns=
tance/structure/currency[id_entity=3D$idEntity]/decimals" /> =09
+ =20
<xsl:variable name=3D"decimalsToCheck"> <!-- If there no=
decimals specified put it to 0 -->
<xsl:choose>
<xsl:when test=3D"string-length($decimals)=3D0">
@@ -52,11 +26,10 @@
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
- <input type=3D"text" name=3D"{$sysAttName}" value=3D"{$d=
ata}"=20
- onblur=3D"checkDecimals(value,{$decimalsToCheck})" >
- <xsl:if test=3D"not(string($isEditable)=3D'true'=
)">
- <xsl:attribute name=3D"disabled"/>
- </xsl:if>
+ <input type=3D"text" name=3D"{$sysAttName}" id=3D"{$sysA=
ttName}" value=3D"{$data}">
+ <xsl:if test=3D"not(string($isEditable)=3D'true')">
+ <xsl:attribute name=3D"disabled"/>
+ </xsl:if>
</input>
</xsl:when>=09
<xsl:when test=3D"/page/flagaction=3D'Create'">
@@ -73,14 +46,31 @@
</xsl:choose>
</xsl:variable>
=20
- <input type=3D"text" name=3D"{$sysAttName}" value=3D"{$d=
ata}"=20
- onblur=3D"checkDecimals(value,{$decimalsToCheck})" >
+ <input type=3D"text" name=3D"{$sysAttName}" id=3D"{$sysA=
ttName}" value=3D"{$data}" >
<xsl:if test=3D"not(string($isEditable)=3D'true'=
)">
<xsl:attribute name=3D"disabled"/>
</xsl:if>
</input>
</xsl:when> =20
</xsl:choose>
+ =20
+ <script language=3D"JavaScript">
+ var decimalsValue =3D '<xsl:value-of select=3D"$decimals" />=
';
+ var minValue =3D '<xsl:value-of select=3D"$min" />';
+ var maxValue =3D '<xsl:value-of select=3D"$max" />';
+ =20
+ var numParams =3D=20
+ {
+ decimals : decimalsValue,
+ min : minValue,
+ max : maxValue
+ }
+ var numData =3D document.getElementById('<xsl:value-of selec=
t=3D"$sysAttName"/>').value;
+ //alert("numData: " + numData);
+ var aInputToCheck =3D new InputToCheck('CURRENCY',numData,nu=
mParams);
+ allInputsToCheck.Add(aInputToCheck);
+ </script>
+ =20
</xsl:template>=09
</xsl:stylesheet>
=20
Modified: humano2/trunk/web/portal/site/xsl/email.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/email.xsl 2005-05-24 20:04:24 UTC (=
rev 1139)
+++ humano2/trunk/web/portal/site/xsl/email.xsl 2005-05-24 20:32:13 UTC (=
rev 1140)
@@ -6,36 +6,27 @@
<xsl:variable name=3D"isEditable" select=3D"/page/classInstance/=
structure/attribute[id_entity=3D$idEntity]/isEditable"/> =
=09
<xsl:variable name=3D"sysAttName" select=3D"/page/classInstance/=
structure/attribute[id_entity=3D$idEntity]/sysAttName" />
=20
- <script language=3D"javascript">=09
- function verifyEmail<xsl:value-of select=3D"$sysAttName" />()=20
- {
- var checkEmail =3D document.getElementById("mail<xsl:value-of select=
=3D"$sysAttName" />").value;
- =20
- if ((checkEmail.indexOf('@') < 0)=20
- ||=20
- ((checkEmail.charAt(checkEmail.length-4) !=3D '.')=20
- &&=20
- (checkEmail.charAt(checkEmail.length-3) !=3D'.'))) =09
- {
- alert("You have entered an invalid email address( " + checkEmail + =
"). Please try again.");
- return false;
- } =20
- }
- </script>
-
+ =09
+ <!-- Create new input with all needed data -->
<xsl:choose>=09
<xsl:when test=3D"/page/flagaction=3D'Read'">
<a href=3D"mailto:{$data}"><xsl:value-of select=3D"$data"/></a>
</xsl:when>
=09
<xsl:when test=3D"/page/flagaction=3D'Update'">
- <input id=3D"mail{$sysAttName}" type=3D"text" name=3D"{$=
sysAttName}" onblur=3D"verifyEmail{$sysAttName}();" value=3D"{$data}"/>
+ <input id=3D"mail{$sysAttName}" type=3D"text" name=3D"{$=
sysAttName}" value=3D"{$data}"/>
</xsl:when>
=09
<xsl:when test=3D"/page/flagaction=3D'Create'">
- <input id=3D"mail{$sysAttName}" type=3D"text" name=3D"{$=
sysAttName}" onblur=3D"verifyEmail{$sysAttName}();"/>
+ <input id=3D"mail{$sysAttName}" type=3D"text" name=3D"{$=
sysAttName}" value=3D"" />
</xsl:when>
</xsl:choose>
+ =20
+ <script language=3D"Javascript">
+ var aInputToCheck =3D new InputToCheck('EMAIL','');
+ allInputsToCheck.Add(aInputToCheck);
+ </script>
+ =20
</xsl:template>
</xsl:stylesheet>
=20
Modified: humano2/trunk/web/portal/site/xsl/numeric.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/numeric.xsl 2005-05-24 20:04:24 UTC=
(rev 1139)
+++ humano2/trunk/web/portal/site/xsl/numeric.xsl 2005-05-24 20:32:13 UTC=
(rev 1140)
@@ -7,41 +7,14 @@
<xsl:variable name=3D"max" select=3D"/page/classInstance/structure/num=
eric[id_entity=3D$idEntity]/max"/>
<xsl:variable name=3D"isEditable" select=3D"/page/classInstance/struct=
ure/attribute[id_entity=3D$idEntity]/isEditable"/>
<xsl:variable name=3D"data" select=3D"/page/classInstance/data/n=
umeric[id_entity=3D$idEntity]/data"/>
- =20
- <script language=3D"JavaScript">
- function checkDecimals(fieldValue, decallowed)=20
- {=09
- var min =3D "<xsl:value-of select=3D"$min"/>"
- var max =3D "<xsl:value-of select=3D"$max"/>"
- =09
- if (isNaN(fieldValue))=20
- {
- alert ("Please enter a number.");
- } else=20
- {
- if (fieldValue.indexOf('.') =3D=3D -1) fieldValue +=3D ".";
- dectext =3D fieldValue.substring(fieldValue.indexOf('.')+1, fieldVa=
lue.length);
- if (dectext.length > decallowed)=20
- {
- alert ("Please enter a number with up to " + decallowed + " decima=
l places. Please try again.");
- }
- else if (!isNaN(min) && min !=3D "" && fieldValu=
e < parseFloat(min))=20
- {
- alert ("Please enter a number which is higher than " + min + ". P=
lease try again.");
- }
- else if (!isNaN(max) && max !=3D "" && fieldValue &=
gt; parseFloat(max))=20
- {
- alert ("Please enter a number which is lower than " + max + ". Pl=
ease try again.");
- }
- }
- }
- </script>
+ <xsl:variable name=3D"decimals" select=3D"/page/classInstance/st=
ructure/numeric[id_entity=3D$idEntity]/decimals" /> =20
+ =20
<xsl:choose>=09
<xsl:when test=3D"/page/flagaction=3D'Read'">
- <xsl:value-of select=3D"$data" />$
+ $  <xsl:value-of select=3D"$data" />
</xsl:when>
<xsl:when test=3D"/page/flagaction=3D'Update'">
- <xsl:variable name=3D"decimals" select=3D"/page/classIns=
tance/structure/numeric[id_entity=3D$idEntity]/decimals" /> =09
+ =20
<xsl:variable name=3D"decimalsToCheck"> <!-- If there no=
decimals specified put it to 0 -->
<xsl:choose>
<xsl:when test=3D"string-length($decimals)=3D0">
@@ -52,12 +25,12 @@
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
- <input type=3D"text" name=3D"{$sysAttName}" value=3D"{$d=
ata}"=20
- onblur=3D"checkDecimals(value,{$decimalsToCheck})" >
+ <input type=3D"text" name=3D"{$sysAttName}" id=3D"{$sysA=
ttName}" value=3D"{$data}" >
<xsl:if test=3D"not(string($isEditable)=3D'true'=
)">
<xsl:attribute name=3D"disabled"/>
</xsl:if>
</input>
+ <!-- FIXME: create new inputToCheck with all needed data=
s onblur=3D"checkDecimals(value,{$decimalsToCheck})" -->
</xsl:when>=09
<xsl:when test=3D"/page/flagaction=3D'Create'">
<xsl:variable name=3D"default" select=3D"/page/classInstance/structu=
re/numeric[id_entity=3D$idEntity]/default"/>
@@ -73,14 +46,27 @@
</xsl:choose>
</xsl:variable>
=20
- <input type=3D"text" name=3D"{$sysAttName}" value=3D"{$d=
ata}"=20
- onblur=3D"checkDecimals(value,{$decimalsToCheck})" >
+ <input type=3D"text" name=3D"{$sysAttName}" id=3D"{$sys=
AttName}" value=3D"{$data}" >
<xsl:if test=3D"not(string($isEditable)=3D'true'=
)">
<xsl:attribute name=3D"disabled"/>
</xsl:if>
</input>
</xsl:when> =20
</xsl:choose>
+ =20
+ <script language=3D"Javascript">
+ var numParams =3D=20
+ {
+ decimals : <xsl:value-of select=3D"$decimals" />,
+ min : <xsl:value-of select=3D"$min" />,
+ max : <xsl:value-of select=3D"$max" />
+ }
+ var numData =3D document.getElementById('<xsl:value-of selec=
t=3D"$sysAttName"/>').value;
+ var aInputToCheck =3D new InputToCheck('NUMERIC',numData,num=
Params);
+ allInputsToCheck.Add(aInputToCheck);
+ </script>
+ =20
+ =20
</xsl:template>=09
</xsl:stylesheet>
=20
Modified: humano2/trunk/web/portal/site/xsl/text.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/text.xsl 2005-05-24 20:04:24 UTC (r=
ev 1139)
+++ humano2/trunk/web/portal/site/xsl/text.xsl 2005-05-24 20:32:13 UTC (r=
ev 1140)
@@ -6,9 +6,15 @@
<xsl:variable name=3D"cols" select=3D"/page/classInstance/structure/text=
[id_entity=3D$idEntity]/cols"/>
<xsl:variable name=3D"sysAttName" select=3D"/page/classInstance/structur=
e/attribute[id_entity=3D$idEntity]/sysAttName"/>
<xsl:variable name=3D"isEditable" select=3D"/page/classInstance/structur=
e/attribute[id_entity=3D$idEntity]/isEditable"/>
+
+<script>
+ var aInputToCheck =3D new InputToCheck('TEXT');
+ allInputsToCheck.Add(aInputToCheck);
+</script>
+
<xsl:choose>=09
<xsl:when test=3D"/page/flagaction=3D'Read'"> =09
-<pre><xsl:value-of select=3D"/page/classInstance/data/text[id_entity=3D$=
idEntity]/data"/></pre>
+<xsl:value-of select=3D"/page/classInstance/data/text[id_entity=3D$idEnt=
ity]/data"/>
</xsl:when>
=20
<xsl:when test=3D"/page/flagaction=3D'Update'">
Modified: humano2/trunk/web/portal/site/xsl/textline.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/textline.xsl 2005-05-24 20:04:24 UT=
C (rev 1139)
+++ humano2/trunk/web/portal/site/xsl/textline.xsl 2005-05-24 20:32:13 UT=
C (rev 1140)
@@ -7,28 +7,34 @@
<xsl:variable name=3D"dispSize" select=3D"/page/classInstance/structur=
e/textline[id_entity=3D$idEntity]/dispSize"/>
<xsl:variable name=3D"sysAttName" select=3D"/page/classInstance/struct=
ure/attribute[id_entity=3D$idEntity]/sysAttName"/>
<xsl:variable name=3D"isEditable" select=3D"/page/classInstance/struct=
ure/attribute[id_entity=3D$idEntity]/isEditable"/> =09
- <xsl:choose>=09
+ =09
+ <script>
+ var aInputToCheck =3D new InputToCheck('TEXT');
+ allInputsToCheck.Add(aInputToCheck);
+ </script>
+ =20
+ <xsl:choose>=09
<xsl:when test=3D"/page/flagaction=3D'Read'">
<xsl:value-of select=3D"$data"/>
</xsl:when>
=09
<xsl:when test=3D"/page/flagaction=3D'Update'">
<input type=3D"text" name=3D"{$sysAttName}" value=3D"{$data}" maxlen=
gth=3D"{$maxLength}" size=3D"{dispSize}">
- <xsl:if test=3D"not(string($isEd=
itable)=3D'true')">
- <xsl:attribute name=3D"d=
isabled" />
- </xsl:if>=20
- </input>
+ <xsl:if test=3D"not(string($isEditable)=3D'true'=
)">
+ <xsl:attribute name=3D"disabled" />
+ </xsl:if>=20
+ </input>
</xsl:when>
=09
<xsl:when test=3D"/page/flagaction=3D'Create'">
<xsl:variable name=3D"defaultText" select=3D"/page/classInstance/str=
ucture/textline[id_entity=3D$idEntity]/defaultText"/>
<input type=3D"text" name=3D"{$sysAttName}" value=3D"{$defaultText}"=
maxlength=3D"{$maxLength}" size=3D"{dispSize}">
- <xsl:if test=3D"not(string($isEd=
itable)=3D'true')">
- <xsl:attribute name=3D"d=
isabled" />
- </xsl:if>=20
- </input>
+ <xsl:if test=3D"not(string($isEditable)=3D'true'=
)">
+ <xsl:attribute name=3D"disabled" />
+ </xsl:if>=20
+ </input>
</xsl:when>
</xsl:choose>
=09
</xsl:template>
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
|
|
From: <sv...@de...> - 2005-05-24 20:04:25
|
Author: marijn Date: 2005-05-24 16:04:24 -0400 (Tue, 24 May 2005) New Revision: 1139 Modified: humano2/tests/fill/Makefile Log: * Fixing makefile for fill test. Modified: humano2/tests/fill/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/tests/fill/Makefile 2005-05-24 20:00:27 UTC (rev 1138) +++ humano2/tests/fill/Makefile 2005-05-24 20:04:24 UTC (rev 1139) @@ -12,5 +12,5 @@ =20 all: fill.exe =20 -fill.exe: fill2.cs - mcs /r:System,System.Data,Npgsql fill2.cs +fill.exe: fill.cs + mcs /r:System,System.Data,Npgsql fill.cs |
|
From: <sv...@de...> - 2005-05-24 20:00:40
|
Author: marijn
Date: 2005-05-24 16:00:27 -0400 (Tue, 24 May 2005)
New Revision: 1138
Modified:
humano2/tests/fill/Makefile
humano2/tests/fill/fill.cs
Log:
* showing error.
Modified: humano2/tests/fill/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/tests/fill/Makefile 2005-05-24 18:55:20 UTC (rev 1137)
+++ humano2/tests/fill/Makefile 2005-05-24 20:00:27 UTC (rev 1138)
@@ -10,5 +10,7 @@
#
# $Id$
=20
-all:
- mcs /r:System,System.Data,Npgsql fill.cs
+all: fill.exe
+
+fill.exe: fill2.cs
+ mcs /r:System,System.Data,Npgsql fill2.cs
Modified: humano2/tests/fill/fill.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/tests/fill/fill.cs 2005-05-24 18:55:20 UTC (rev 1137)
+++ humano2/tests/fill/fill.cs 2005-05-24 20:00:27 UTC (rev 1138)
@@ -19,28 +19,47 @@
{
public class Runner=20
{
- public static void Main() {
- string query =3D @" ; select ""to"".id_entity,""to"".""domainName"" =
from ""entity"" as owner, ""domain"" as ""to"" where owner.""domain=
Id"" =3D ""to"".id_entity and owner.id_entity =3D 10003
- ; select ""to"".id_entity,""to"".""name"" from ""entity"" as owner,=
""class"" as ""to"" where owner.""class"" =3D ""to"".id_entity and ow=
ner.id_entity =3D 10003=20
- ; select ""delDate"" from ""entity"" where ""id_entity"" =3D 1000=
3
- ; select ""status"" from ""entity"" where ""id_entity"" =3D 10003
- ; select ""createDate"" from ""entity"" where ""id_entity"" =3D 1=
0003
- ; select ""modDate"" from ""entity"" where ""id_entity"" =3D 1000=
3
- ; select ""columns"" from ""view"" where ""id_entity"" =3D 10003
- ; select ""where"" from ""view"" where ""id_entity"" =3D 10003
- ; select ""groupby"" from ""view"" where ""id_entity"" =3D 10003
- ; select ""having"" from ""view"" where ""id_entity"" =3D 10003
- ; select ""order"" from ""view"" where ""id_entity"" =3D 10003
- ; select ""to"".id_entity,""to"".""name"" from ""view"" as owner,""=
class"" as ""to"" where owner.""idClassView"" =3D ""to"".id_entity and=
owner.id_entity =3D 10003
- ; select ""viewName"" from ""view"" where ""id_entity"" =3D 10003=
";
+ public static void Main()=20
+ {
+ TestOkay();
=20
+ TestError();
+ }
+
+ public static void TestOkay()
+ {
+ string query =3D "";
+// query +=3D @"select ""to"".id_entity,""to"".""domainName"" from=
""entity"" as owner, ""domain"" as ""to"" where owner.""domainId"" =3D=
""to"".id_entity and owner.id_entity =3D 10003;" + "\n";
+// query +=3D @"select ""to"".id_entity,""to"".""name"" from ""ent=
ity"" as owner, ""class"" as ""to"" where owner.""class"" =3D ""to"".i=
d_entity and owner.id_entity =3D 10003;" + "\n";
+ query +=3D @"select ""delDate"" from ""entity"" where ""id_ent=
ity"" =3D 10003;" + "\n";
+ query +=3D @"select ""status"" from ""entity"" where ""id_entit=
y"" =3D 10003;" + "\n";
+ query +=3D @"select ""createDate"" from ""entity"" where ""id_=
entity"" =3D 10003;" + "\n";
+ query +=3D @"select ""modDate"" from ""entity"" where ""id_ent=
ity"" =3D 10003;" + "\n";
+ query +=3D @"select ""columns"" from ""view"" where ""id_entit=
y"" =3D 10003;" + "\n";
+ query +=3D @"select ""where"" from ""view"" where ""id_entity"=
" =3D 10003;" + "\n";
+ query +=3D @"select ""groupby"" from ""view"" where ""id_entit=
y"" =3D 10003;" + "\n";
+ query +=3D @"select ""having"" from ""view"" where ""id_entity=
"" =3D 10003;" + "\n";
+ query +=3D @"select ""order"" from ""view"" where ""id_entity"=
" =3D 10003;" + "\n";
+ query +=3D @"select ""to"".id_entity,""to"".""name"" from ""view=
"" as owner,""class"" as ""to"" where owner.""idClassView"" =3D ""to""=
.id_entity and owner.id_entity =3D 10003;" + "\n";
+ query +=3D @"select ""viewName"" from ""view"" where ""id_enti=
ty"" =3D 10003";
+
FillTest fillTest =3D new FillTest();
+ fillTest.Connect();
+ fillTest.doSelect(query, new DataSet());
+ }
=20
+ public static void TestError()
+ {
+ string query =3D "";
+ query +=3D @"select 'b', 'a';";
+ query +=3D @"select 'a';";
+
+ FillTest fillTest =3D new FillTest();
fillTest.Connect();
- =09
fillTest.doSelect(query, new DataSet());
}
=20
+
}
=20
class FillTest=20
@@ -48,13 +67,10 @@
protected IDbConnection dbCon =3D null;
string ConnectionString =3D "Server=3D10.1.11.106;Database=3Dh2_marijn=
;User ID=3Dh2_dbase;Password=3Dh2_dbase!";
=20
- public IDbConnection Connect()
+ public void Connect()
{
IDbConnection c =3D new NpgsqlConnection( ConnectionString );
- c.Open( );
- c.Close( );
dbCon =3D c;
- return c;
}
=20
public DataSet doSelect(string query,DataSet ds)
@@ -64,17 +80,17 @@
=09
NpgsqlDataAdapter da =3D new NpgsqlDataAdapter(query,conn);
try
- {
- da.Fill(ds);
- }
+ {
+ da.Fill(ds);
+ }
catch(Exception ex)
{
dbCon.Close();
throw new Exception("Error executing query:\r\n" + query + "\n\r" +e=
x.Message,ex.InnerException);
}
- da.Dispose();
=20
- dbCon.Close();
+ Console.WriteLine("No ERROR");
+
return ds;
=09
}
|
|
From: <sv...@de...> - 2005-05-24 18:55:29
|
Author: marijn Date: 2005-05-24 14:55:20 -0400 (Tue, 24 May 2005) New Revision: 1137 Added: humano2/tests/fill/ humano2/tests/fill/Makefile humano2/tests/fill/fill.cs Log: * Adding small test program for database error. Added: humano2/tests/fill/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/tests/fill/Makefile 2005-05-24 17:09:29 UTC (rev 1136) +++ humano2/tests/fill/Makefile 2005-05-24 18:55:20 UTC (rev 1137) @@ -0,0 +1,14 @@ +# Humano2 Core database drivers. +# +# The Humano2 Business solution +# Copyright (C) 2004,5 Humano2 Chile S.A. (http://www.humano2.com) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. =20 +# +# $Id$ + +all: + mcs /r:System,System.Data,Npgsql fill.cs Property changes on: humano2/tests/fill/Makefile ___________________________________________________________________ Name: svn:keywords + Id Added: humano2/tests/fill/fill.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/tests/fill/fill.cs 2005-05-24 17:09:29 UTC (rev 1136) +++ humano2/tests/fill/fill.cs 2005-05-24 18:55:20 UTC (rev 1137) @@ -0,0 +1,82 @@ +// +// The Humano2 Business solution. +// Copyright (C) 2004,5 Humano2 Chile S.A. (http://www.humano2.com) +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// $Id$ +// + +using System; +using System.Data; +using System.Data.Common; +using Npgsql; + +namespace Humano2.Tests.Fill +{ + public class Runner=20 + { + public static void Main() { + string query =3D @" ; select ""to"".id_entity,""to"".""domainName"" = from ""entity"" as owner, ""domain"" as ""to"" where owner.""domain= Id"" =3D ""to"".id_entity and owner.id_entity =3D 10003 + ; select ""to"".id_entity,""to"".""name"" from ""entity"" as owner,= ""class"" as ""to"" where owner.""class"" =3D ""to"".id_entity and ow= ner.id_entity =3D 10003=20 + ; select ""delDate"" from ""entity"" where ""id_entity"" =3D 1000= 3 + ; select ""status"" from ""entity"" where ""id_entity"" =3D 10003 + ; select ""createDate"" from ""entity"" where ""id_entity"" =3D 1= 0003 + ; select ""modDate"" from ""entity"" where ""id_entity"" =3D 1000= 3 + ; select ""columns"" from ""view"" where ""id_entity"" =3D 10003 + ; select ""where"" from ""view"" where ""id_entity"" =3D 10003 + ; select ""groupby"" from ""view"" where ""id_entity"" =3D 10003 + ; select ""having"" from ""view"" where ""id_entity"" =3D 10003 + ; select ""order"" from ""view"" where ""id_entity"" =3D 10003 + ; select ""to"".id_entity,""to"".""name"" from ""view"" as owner,""= class"" as ""to"" where owner.""idClassView"" =3D ""to"".id_entity and= owner.id_entity =3D 10003 + ; select ""viewName"" from ""view"" where ""id_entity"" =3D 10003= "; + + FillTest fillTest =3D new FillTest(); + + fillTest.Connect(); + =09 + fillTest.doSelect(query, new DataSet()); + } + + } + + class FillTest=20 + { + protected IDbConnection dbCon =3D null; + string ConnectionString =3D "Server=3D10.1.11.106;Database=3Dh2_marijn= ;User ID=3Dh2_dbase;Password=3Dh2_dbase!"; + + public IDbConnection Connect() + { + IDbConnection c =3D new NpgsqlConnection( ConnectionString ); + c.Open( ); + c.Close( ); + dbCon =3D c; + return c; + } + + public DataSet doSelect(string query,DataSet ds) + { + dbCon.Open(); + NpgsqlConnection conn =3D ( (NpgsqlConnection) dbCon ); +=09 + NpgsqlDataAdapter da =3D new NpgsqlDataAdapter(query,conn); + try + { + da.Fill(ds); + } + catch(Exception ex) + { + dbCon.Close(); + throw new Exception("Error executing query:\r\n" + query + "\n\r" +e= x.Message,ex.InnerException); + } + da.Dispose(); + + dbCon.Close(); + return ds; +=09 + } + } +} Property changes on: humano2/tests/fill/fill.cs ___________________________________________________________________ Name: svn:keywords + Id |
|
From: <sv...@de...> - 2005-05-24 17:09:46
|
Author: marijn Date: 2005-05-24 13:09:29 -0400 (Tue, 24 May 2005) New Revision: 1136 Added: humano2/tests/ Log: * Adding directory for some smaller test programs |
|
From: <sv...@de...> - 2005-05-24 16:47:27
|
Author: marcelo
Date: 2005-05-24 12:45:57 -0400 (Tue, 24 May 2005)
New Revision: 1135
Modified:
humano2/trunk/core/db/pgsql/pgsqlConnection.cs
Log:
* Added try-catch to all commands that exeute SQL statements (doSelect, =
doScalar, doCommand)
Modified: humano2/trunk/core/db/pgsql/pgsqlConnection.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/pgsqlConnection.cs 2005-05-24 15:56:21 UT=
C (rev 1134)
+++ humano2/trunk/core/db/pgsql/pgsqlConnection.cs 2005-05-24 16:45:57 UT=
C (rev 1135)
@@ -70,7 +70,17 @@
NpgsqlConnection conn =3D ( (NpgsqlConnection) dbCon );
=09
NpgsqlDataAdapter da =3D new NpgsqlDataAdapter(query,conn);
- da.Fill(ds);
+ try
+ {
+ da.Fill(ds);
+ }
+ catch(Exception ex)
+ {
+ Close();
+ Logger.Log("Error executing query:\r\n" + query, LogLevel.Trace);
+ throw new Exception("Error executing query:\r\n" + query + "\n\r" +e=
x.Message,ex.InnerException);
+ }
+ da.Dispose();
Close();
return ds;
=20
@@ -87,7 +97,19 @@
NpgsqlConnection conn =3D ( (NpgsqlConnection) dbCon );
NpgsqlCommand dbCmd =3D conn.CreateCommand( );
dbCmd.CommandText =3D query;
- int res =3D dbCmd.ExecuteNonQuery( );
+ int res;
+ try=20
+ {
+ res =3D dbCmd.ExecuteNonQuery( );
+ }
+ catch(Exception ex)
+ {
+ dbCmd.Dispose();
+ Close();
+ Logger.Log("Error executing query:\r\n" + query, LogLevel.Trace);
+ throw new Exception("Error executing query:\r\n" + query + "\n\r" +e=
x.Message,ex.InnerException);
+ }
+ dbCmd.Dispose();
Close();
return res;
}
@@ -103,13 +125,30 @@
NpgsqlConnection conn =3D ( (NpgsqlConnection) dbCon );
NpgsqlCommand dbCmd =3D conn.CreateCommand( );
dbCmd.CommandText =3D query;
- IDataReader dr =3D dbCmd.ExecuteReader( );
- Close();
=09
+ IDataReader dr;
+ try
+ {
+ dr =3D dbCmd.ExecuteReader( );
+ Close();
+ }
+ catch(Exception ex)
+ {
+ dbCmd.Dispose();
+ Close();
+ Logger.Log("Error executing query:\r\n" + query, LogLevel.Trace);
+ throw new Exception("Error executing query:\r\n" + query + "\n\r" +e=
x.Message,ex.InnerException);
+ }
+
if( dr.Read( ) && !Convert.IsDBNull( dr[0] ) )
{
+ tmpObj =3D dr[0];
+ dr.Close();
+ dbCmd.Dispose();
return dr[0];
}
+ dr.Close();
+ dbCmd.Dispose();
return null;
}
=20
|
|
From: <sv...@de...> - 2005-05-24 15:56:35
|
Author: svera Date: 2005-05-24 11:56:21 -0400 (Tue, 24 May 2005) New Revision: 1134 Removed: humano2/trunk/web/builder/site/img/ Log: * merge with gfx |
|
From: <sv...@de...> - 2005-05-24 15:50:52
|
Author: svera
Date: 2005-05-24 11:50:43 -0400 (Tue, 24 May 2005)
New Revision: 1133
Modified:
humano2/trunk/web/builder/site/js/webfxtree.js
humano2/trunk/web/builder/site/xsl/functionindex.xsl
Log:
* merge img folder with gfx
Modified: humano2/trunk/web/builder/site/js/webfxtree.js
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/js/webfxtree.js 2005-05-24 15:49:57 UT=
C (rev 1132)
+++ humano2/trunk/web/builder/site/js/webfxtree.js 2005-05-24 15:50:43 UT=
C (rev 1133)
@@ -12,19 +12,19 @@
=20
=20
var webFXTreeConfig =3D {
- rootIcon : 'img/webfxtree/foldericon.png',
- openRootIcon : 'img/webfxtree/1x1.gif',
- folderIcon : 'img/webfxtree/foldericon.png',
- openFolderIcon : 'img/webfxtree/openfoldericon.png',
- fileIcon : 'img/webfxtree/file.png',
- iIcon : 'img/webfxtree/i.png',
- lIcon : 'img/webfxtree/l.png',
- lMinusIcon : 'img/webfxtree/lminus.png',
- lPlusIcon : 'img/webfxtree/lplus.png',
- tIcon : 'img/webfxtree/t.png',
- tMinusIcon : 'img/webfxtree/tminus.png',
- tPlusIcon : 'img/webfxtree/tplus.png',
- blankIcon : 'img/webfxtree/blank.png',
+ rootIcon : 'gfx/webfxtree/foldericon.png',
+ openRootIcon : 'gfx/webfxtree/1x1.gif',
+ folderIcon : 'gfx/webfxtree/foldericon.png',
+ openFolderIcon : 'gfx/webfxtree/openfoldericon.png',
+ fileIcon : 'gfx/webfxtree/file.png',
+ iIcon : 'gfx/webfxtree/i.png',
+ lIcon : 'gfx/webfxtree/l.png',
+ lMinusIcon : 'gfx/webfxtree/lminus.png',
+ lPlusIcon : 'gfx/webfxtree/lplus.png',
+ tIcon : 'gfx/webfxtree/t.png',
+ tMinusIcon : 'gfx/webfxtree/tminus.png',
+ tPlusIcon : 'gfx/webfxtree/tplus.png',
+ blankIcon : 'gfx/webfxtree/blank.png',
defaultText : '',
defaultAction : 'javascript:alert("hola");',=20
defaultBehavior : 'classic',
@@ -551,4 +551,4 @@
function addNode(typeentity) {
//document.frames['FrameTempLoad'].location.href=3D'Add_object_b=
arra_left.aspx?TypeEntity=3D'+typeentity
document.getElementById('FrameTempLoad').src=3D'Add_object_barra=
_left.aspx?TypeEntity=3D'+typeentity
-}
+}
\ No newline at end of file
Modified: humano2/trunk/web/builder/site/xsl/functionindex.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/functionindex.xsl 2005-05-24 15:49=
:57 UTC (rev 1132)
+++ humano2/trunk/web/builder/site/xsl/functionindex.xsl 2005-05-24 15:50=
:43 UTC (rev 1133)
@@ -51,7 +51,7 @@
<xsl:for-each select=3D"vffr/views/view">
var titleLink =3D '<xsl:value-of select=3D"name"=
/>';
var contentLink =3D 'viewmain.aspx?viewId=3D<xsl=
:value-of select=3D"id" />';
- viewBranch.add(new WebFXTreeItem(titleLink,conte=
ntLink,'','img/webfxtree/view.jpeg'));
+ viewBranch.add(new WebFXTreeItem(titleLink,conte=
ntLink,'','gfx/webfxtree/view.jpeg'));
</xsl:for-each>
=20
//Folders
@@ -60,7 +60,7 @@
<xsl:for-each select=3D"/vffr/folders/folder">
var titleLink =3D '<xsl:value-of select=3D"name"=
/>';
var contentLink =3D 'foldermanagement.aspx?modfo=
lderId=3D<xsl:value-of select=3D"id" />';
- folderBranch.add(new WebFXTreeItem(titleLink,con=
tentLink,'','img/webfxtree/view.jpeg'));
+ folderBranch.add(new WebFXTreeItem(titleLink,con=
tentLink,'','gfx/webfxtree/view.jpeg'));
</xsl:for-each>
=20
//Forms
@@ -71,7 +71,7 @@
var child_<xsl:value-of select=3D"id" /> =3D new=
WebFXTreeItem('<xsl:value-of select=3D"name" />',
=
'formmanagement.aspx?modformid=3D<xsl:value-of select=3D"id" =
/>&modclassId=3D<xsl:value-of select=3D"classId" />',
=
'',
- =
'img/webfxtree/view.jpeg');
+ =
'gfx/webfxtree/view.jpeg');
formBranch.add(child_<xsl:value-of select=3D"id"=
/>);
</xsl:if> =09
</xsl:for-each>=09
@@ -85,7 +85,7 @@
var child_<xsl:value-of select=3D"id" /> =3D new=
WebFXTreeItem('<xsl:value-of select=3D"name" />',
=
'createreport.aspx?reportId=3D<xsl:value-of select=3D"id" />',
=
'',
- =
'img/webfxtree/view.jpeg');
+ =
'gfx/webfxtree/view.jpeg');
reportBranch.add(child_<xsl:value-of select=3D"i=
d"/>);
</xsl:if> =09
</xsl:for-each>=09
|
|
From: <sv...@de...> - 2005-05-24 15:50:00
|
Author: marijn Date: 2005-05-24 11:49:57 -0400 (Tue, 24 May 2005) New Revision: 1132 Added: humano2/trunk/web/builder/site/gfx/webfxtree/ Removed: humano2/trunk/web/builder/site/img/webfxtree/ humano2/trunk/web/builder/site/jscript/ Log: * Ordering of support files for the builder application. Copied: humano2/trunk/web/builder/site/gfx/webfxtree (from rev 1131, huma= no2/trunk/web/builder/site/img/webfxtree) |
|
From: <sv...@de...> - 2005-05-24 15:10:26
|
Author: marcelo
Date: 2005-05-24 11:10:23 -0400 (Tue, 24 May 2005)
New Revision: 1131
Modified:
humano2/trunk/core/db/pgsql/pgsqlCrud.cs
Log:
* Fixed crash due to not escaping upper case in class names
Modified: humano2/trunk/core/db/pgsql/pgsqlCrud.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/pgsqlCrud.cs 2005-05-24 14:15:54 UTC (rev=
1130)
+++ humano2/trunk/core/db/pgsql/pgsqlCrud.cs 2005-05-24 15:10:23 UTC (rev=
1131)
@@ -1726,7 +1726,7 @@
override protected void createAttributeInDatabase(string tableName, st=
ring columnName, string columnType)
{
//System.Console.WriteLine(Name + " : " + dataType);
- string sqlCommand =3D String.Format( "alter table {0} add \"{1}\" {2}=
",
+ string sqlCommand =3D String.Format( "alter table \"{0}\" add \"{1}\"=
{2}",
tableName, columnName, columnType );
conn.doCommand( sqlCommand );
}
|
|
From: <sv...@de...> - 2005-05-24 14:16:09
|
Author: svera
Date: 2005-05-24 10:15:54 -0400 (Tue, 24 May 2005)
New Revision: 1130
Modified:
humano2/trunk/web/builder/site/foldermanagement.aspx.cs
Log:
* Fix bug #114
Modified: humano2/trunk/web/builder/site/foldermanagement.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/foldermanagement.aspx.cs 2005-05-24 13=
:25:06 UTC (rev 1129)
+++ humano2/trunk/web/builder/site/foldermanagement.aspx.cs 2005-05-24 14=
:15:54 UTC (rev 1130)
@@ -521,8 +521,10 @@
{
if (((strct_folderNode)arrFolder[pos]).idParent =3D=3D folderId)
{
- //((strct_folderNode)arrFolder[pos]).isListable. =3D false;
- flag =3D 1;
+ if(((strct_folderNode)arrFolder[pos]).idNode =3D=3D id_entity)
+ {
+ flag =3D 1;
+ }
}
}
}
|
|
From: <sv...@de...> - 2005-05-24 13:25:10
|
Author: pcamacho
Date: 2005-05-24 09:25:06 -0400 (Tue, 24 May 2005)
New Revision: 1129
Added:
humano2/trunk/web/builder/site/html/createfolderok.html
humano2/trunk/web/builder/site/html/createformok.html
humano2/trunk/web/builder/site/html/deletefolderok.html
humano2/trunk/web/builder/site/html/deleteformok.html
humano2/trunk/web/builder/site/html/updatefolderok.html
humano2/trunk/web/builder/site/html/updateformok.html
Modified:
humano2/trunk/components/webTools/basePage.cs
humano2/trunk/web/builder/site/createreport.aspx.cs
humano2/trunk/web/builder/site/foldermanagement.aspx.cs
humano2/trunk/web/builder/site/formmanagement.aspx.cs
humano2/trunk/web/builder/site/viewmain.aspx.cs
Log:
CHANGE: warning message and leftbar refresh for creation of forms and fol=
ders.
Modified: humano2/trunk/components/webTools/basePage.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/basePage.cs 2005-05-23 19:57:53 UTC=
(rev 1128)
+++ humano2/trunk/components/webTools/basePage.cs 2005-05-24 13:25:06 UTC=
(rev 1129)
@@ -35,7 +35,13 @@
UPDATEVIEWOK,
CREATEREPORTOK,
DELETEREPORTOK,
- UPDATEREPORTOK
+ UPDATEREPORTOK,
+ CREATEFORMOK,
+ UPDATEFORMOK,
+ DELETEFORMOK,
+ CREATEFOLDEROK,
+ UPDATEFOLDEROK,
+ DELETEFOLDEROK
} =20
=20
public basePage()
@@ -155,7 +161,31 @@
case UserMessage.CREATEREPORTOK:
messagePage =3D "createreportok.html";
break;
+ =20
+ case UserMessage.DELETEFORMOK:
+ messagePage =3D "deleteformok.html";
+ break;
=20
+ case UserMessage.UPDATEFORMOK:
+ messagePage =3D "updateformok.html";
+ break;
+ =20
+ case UserMessage.CREATEFORMOK:
+ messagePage =3D "createformok.html";
+ break;
+ =20
+ case UserMessage.DELETEFOLDEROK:
+ messagePage =3D "deletefolderok.html";
+ break;
+ =20
+ case UserMessage.UPDATEFOLDEROK:
+ messagePage =3D "updatefolderok.html";
+ break;
+ =20
+ case UserMessage.CREATEFOLDEROK:
+ messagePage =3D "createfolderok.html";
+ break;
+ =20
default:
messagePage =3D "noexistingmessage.html";
break;
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-05-23 19:57:=
53 UTC (rev 1128)
+++ humano2/trunk/web/builder/site/createreport.aspx.cs 2005-05-24 13:25:=
06 UTC (rev 1129)
@@ -450,11 +450,10 @@
=20
private void deleteReport()
{
- Logger.Log("deleteReport called", LogLevel.Trace);
- userCred.CoreAdapter.DeleteInstance(reportId, userCred);
- sendMessageToUser(UserMessage.DELETEREPORTOK);
- this.MyRedirect();
- return;
+ Logger.Log("deleteReport called", LogLevel.Trace);
+ userCred.CoreAdapter.DeleteInstance(reportId, userCred);
+ sendMessageToUser(UserMessage.DELETEREPORTOK);
+ return;
}
=20
private DataTable createReportTable()
@@ -769,16 +768,9 @@
sendMessageToUser(UserMessage.UPDATEREPORTOK); //Cha=
nge
}
}=09
- this.MyRedirect();
+ =09
}
=20
- public void MyRedirect()
- {
- Response.Write("<script language=3D\"Javascript\">\n");
- Response.Write("top.frames[1].mainframe.location =3D \"" + Html.genAb=
soluteUrl("/builder/site/functionindex.aspx") + "\";");
- Response.Write("</script>\n");
- }
-
// Funcion agregada por negro que solo traera la informacion necesaria=
...
private string formAttribList(int classId)=20
{
Modified: humano2/trunk/web/builder/site/foldermanagement.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/foldermanagement.aspx.cs 2005-05-23 19=
:57:53 UTC (rev 1128)
+++ humano2/trunk/web/builder/site/foldermanagement.aspx.cs 2005-05-24 13=
:25:06 UTC (rev 1129)
@@ -157,10 +157,12 @@
if(action =3D=3D CNS_CREATE )
{
folderId =3D userCred.CoreAdapter.CreateForm (1400,dt, userCred);
+ sendMessageToUser(UserMessage.CREATEFOLDEROK);
}
if (action =3D=3D CNS_UPDATE )
{
UpdateDbFolder(folderId,dt,userCred);
+ sendMessageToUser(UserMessage.UPDATEFOLDEROK);
}
} =09
}
@@ -168,6 +170,7 @@
private void deleteDbFolder(int folderId)
{
userCred.CoreAdapter.DeleteInstance(folderId,userCred);
+ sendMessageToUser(UserMessage.DELETEFOLDEROK);
}
=20
private void UpdateDbFolder(int folderId, DataTable dt,SessionCredenci=
al userCred)
@@ -552,4 +555,4 @@
=20
#endregion=20
}
-}
\ No newline at end of file
+}
Modified: humano2/trunk/web/builder/site/formmanagement.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/formmanagement.aspx.cs 2005-05-23 19:5=
7:53 UTC (rev 1128)
+++ humano2/trunk/web/builder/site/formmanagement.aspx.cs 2005-05-24 13:2=
5:06 UTC (rev 1129)
@@ -156,17 +156,23 @@
if(action =3D=3D CNS_CREATE )
{
formId =3D userCred.CoreAdapter.CreateForm (1200,dt, userCred);
+ sendMessageToUser(UserMessage.CREATEFORMOK);
}
if (action =3D=3D CNS_UPDATE )
{
UpdateDbForm(formId,dt,userCred);
+ sendMessageToUser(UserMessage.UPDATEFORMOK);
}
+ =20
+ RefreshLeftBuilderTree();
} =09
}
=20
private void deleteDbForm(int folderId)
{
userCred.CoreAdapter.DeleteInstance(folderId,userCred);
+ sendMessageToUser(UserMessage.DELETEFORMOK);
+ RefreshLeftBuilderTree();
}
=20
private void UpdateDbForm(int formId, DataTable dt,SessionCredencial u=
serCred)
@@ -370,8 +376,17 @@
}
}
=20
+ ///<summary>
+ ///Used to refresh the left tree that contains reports,forms,vie=
ws and folders
+ ///</summary>
+ public void RefreshLeftBuilderTree()
+ {
+ Response.Write("<script language=3D\"Javascript\">\n");
+ Response.Write("top.frames[\"mainFrame\"].location =3D \"" +=
Html.genAbsoluteUrl("/builder/site/functionindex.aspx") + "\";");
+ Response.Write("</script>\n");
+ }
#endregion=20
=09
=20
}
-}
\ No newline at end of file
+}
Added: humano2/trunk/web/builder/site/html/createfolderok.html
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/html/createfolderok.html 2005-05-23 19=
:57:53 UTC (rev 1128)
+++ humano2/trunk/web/builder/site/html/createfolderok.html 2005-05-24 13=
:25:06 UTC (rev 1129)
@@ -0,0 +1,18 @@
+<html>
+ <head>
+ <link href=3D"css/left.css" rel=3D"stylesheet" type=3D"text/css"=
/>=09
+ <script language=3D"javascript">
+ function reloadlist()
+ {
+ self.parent.frames[1].location =3D "../functionclasses.aspx";
+ }
+ </script>
+ </head>
+ <body onload=3D"reloadlist()">
+ <center>
+ <span class=3D"message">
+ The folder was successfully created.
+ </span>
+ </center>
+ </body>
+</html>
Added: humano2/trunk/web/builder/site/html/createformok.html
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/html/createformok.html 2005-05-23 19:5=
7:53 UTC (rev 1128)
+++ humano2/trunk/web/builder/site/html/createformok.html 2005-05-24 13:2=
5:06 UTC (rev 1129)
@@ -0,0 +1,18 @@
+<html>
+ <head>
+ <link href=3D"css/left.css" rel=3D"stylesheet" type=3D"text/css"=
/>=09
+ <script language=3D"javascript">
+ function reloadlist()
+ {
+ self.parent.frames[1].location =3D "../functionclasses.aspx";
+ }
+ </script>
+ </head>
+ <body onload=3D"reloadlist()">
+ <center>
+ <span class=3D"message">
+ The form was successfully created.
+ </span>
+ </center>
+ </body>
+</html>
Added: humano2/trunk/web/builder/site/html/deletefolderok.html
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/html/deletefolderok.html 2005-05-23 19=
:57:53 UTC (rev 1128)
+++ humano2/trunk/web/builder/site/html/deletefolderok.html 2005-05-24 13=
:25:06 UTC (rev 1129)
@@ -0,0 +1,18 @@
+<html>
+ <head>
+ <link href=3D"css/left.css" rel=3D"stylesheet" type=3D"text/css"=
/>=09
+ <script language=3D"javascript">
+ function reloadlist()
+ {
+ self.parent.frames[1].location =3D "../functionclasses.aspx";
+ }
+ </script>
+ </head>
+ <body onload=3D"reloadlist()">
+ <center>
+ <span class=3D"message">
+ The folder was successfully deleted.
+ </span>
+ </center>
+ </body>
+</html>
Added: humano2/trunk/web/builder/site/html/deleteformok.html
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/html/deleteformok.html 2005-05-23 19:5=
7:53 UTC (rev 1128)
+++ humano2/trunk/web/builder/site/html/deleteformok.html 2005-05-24 13:2=
5:06 UTC (rev 1129)
@@ -0,0 +1,18 @@
+<html>
+ <head>
+ <link href=3D"css/left.css" rel=3D"stylesheet" type=3D"text/css"=
/>=09
+ <script language=3D"javascript">
+ function reloadlist()
+ {
+ self.parent.frames[1].location =3D "../functionclasses.aspx";
+ }
+ </script>
+ </head>
+ <body onload=3D"reloadlist()">
+ <center>
+ <span class=3D"message">
+ The form was successfully deleted.
+ </span>
+ </center>
+ </body>
+</html>
Added: humano2/trunk/web/builder/site/html/updatefolderok.html
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/html/updatefolderok.html 2005-05-23 19=
:57:53 UTC (rev 1128)
+++ humano2/trunk/web/builder/site/html/updatefolderok.html 2005-05-24 13=
:25:06 UTC (rev 1129)
@@ -0,0 +1,18 @@
+<html>
+ <head>
+ <link href=3D"css/left.css" rel=3D"stylesheet" type=3D"text/css"=
/>=09
+ <script language=3D"javascript">
+ function reloadlist()
+ {
+ self.parent.frames[1].location =3D "../functionclasses.aspx";
+ }
+ </script>
+ </head>
+ <body onload=3D"reloadlist()">
+ <center>
+ <span class=3D"message">
+ The folder was successfully updated.
+ </span>
+ </center>
+ </body>
+</html>
Added: humano2/trunk/web/builder/site/html/updateformok.html
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/html/updateformok.html 2005-05-23 19:5=
7:53 UTC (rev 1128)
+++ humano2/trunk/web/builder/site/html/updateformok.html 2005-05-24 13:2=
5:06 UTC (rev 1129)
@@ -0,0 +1,18 @@
+<html>
+ <head>
+ <link href=3D"css/left.css" rel=3D"stylesheet" type=3D"text/css"=
/>=09
+ <script language=3D"javascript">
+ function reloadlist()
+ {
+ self.parent.frames[1].location =3D "../functionclasses.aspx";
+ }
+ </script>
+ </head>
+ <body onload=3D"reloadlist()">
+ <center>
+ <span class=3D"message">
+ The form was successfully updated.
+ </span>
+ </center>
+ </body>
+</html>
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-05-23 19:57:53 U=
TC (rev 1128)
+++ humano2/trunk/web/builder/site/viewmain.aspx.cs 2005-05-24 13:25:06 U=
TC (rev 1129)
@@ -388,7 +388,6 @@
Logger.Log("deleteView called", LogLevel.Trace);
userCred.CoreAdapter.DeleteInstance(viewId, userCred);
sendMessageToUser(UserMessage.DELETEVIEWOK);
- this.MyRedirect();
return;
}
=20
@@ -522,16 +521,8 @@
sendMessageToUser(UserMessage.UPDATEVIEWOK);
}
}=09
- this.MyRedirect();
}
=20
- public void MyRedirect()
- {
- Response.Write("<script language=3D\"Javascript\">\n");
- Response.Write("top.frames[1].mainframe.location =3D \"" + Html.genAb=
soluteUrl("/builder/site/functionindex.aspx") + "\";");
- Response.Write("</script>\n");
- }
-
// Funcion agregada por negro que solo traera la informacion necesaria=
...
private string formAttribList(int classId)=20
{
|
|
From: <sv...@de...> - 2005-05-23 19:58:14
|
Author: marcelo
Date: 2005-05-23 15:57:53 -0400 (Mon, 23 May 2005)
New Revision: 1128
Modified:
humano2/trunk/components/viewTools/ViewTools.cs
humano2/trunk/components/webTools/Adapter.cs
humano2/trunk/core/db/absComplex.cs
humano2/trunk/core/db/absConnection.cs
humano2/trunk/core/db/absCrud.cs
humano2/trunk/core/db/mssql/mssqlComplex.cs
humano2/trunk/core/db/mssql/mssqlConnection.cs
humano2/trunk/core/db/mssql/mssqlCrud.cs
humano2/trunk/core/db/pgsql/pgsqlComplex.cs
humano2/trunk/core/db/pgsql/pgsqlConnection.cs
humano2/trunk/core/db/pgsql/pgsqlCrud.cs
humano2/trunk/core/schema/mssql/mssql-1-metadata.sql
humano2/trunk/web/builder/site/buildattribute.aspx.cs
humano2/trunk/web/portal/site/viewpertinencelist.aspx.cs
Log:
* commit del MERGE entre el branch DATAREADER y el trunk. Cambiando las=
funcciones que retornan datareader a datatable.=20
Tambien se tuvo que cambiar la logica en partes para que esta sea=
compatible con varios BDs.
El driver MsSQL presenta problemas en la paginacion.
Modified: humano2/trunk/components/viewTools/ViewTools.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/viewTools/ViewTools.cs 2005-05-21 20:02:10 U=
TC (rev 1127)
+++ humano2/trunk/components/viewTools/ViewTools.cs 2005-05-23 19:57:53 U=
TC (rev 1128)
@@ -698,7 +698,7 @@
int inicio =3D this.RowsView * (this.PageView - 1) + 1;
int limite =3D this.RowsView * (this.PageView);
=20
- Query.Append(");\n");
+ Query.Append(";\n");
Query.Append("SELECT * FROM " + TempTable + " where row between "+ i=
nicio.ToString() + " and " + limite.ToString());
}
//Logger.Log("Query=3D" + Query.ToString(),LogLevel.Trace);
@@ -891,18 +891,22 @@
tableName =3D Complex.TableName(IdClass);
columnName =3D "id_entity";
}
+ int classtype =3D Complex.getClassIdofInstance(columnIndex);
+ if (classtype !=3D 13)
+ {
+ order.Append("upper(" + tableName + "." + columnName + ") ");
=20
- order.Append("upper(" + tableName + "." + columnName + ") ");
- parameter =3D parameters[1].ToString();
- if(parameter =3D=3D "0")
- {
- order.Append("asc ");
+ parameter =3D parameters[1].ToString();
+ if(parameter =3D=3D "0")
+ {
+ order.Append("asc ");
+ }
+ else
+ {
+ order.Append("desc ");
+ }
+ order.Append(", ");
}
- else
- {
- order.Append("desc ");
- }
- order.Append(", ");
}
order.Remove(order.Length-2,2);
order.Append(" ");
@@ -1256,6 +1260,7 @@
{
ViewColumns aux =3D new ViewColumns(0,"id_entity");
aux.Position =3D i;
+ aux.Type =3D "int"; =20
Table.AddColumn(aux);
i++;
}
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-21 20:02:10 UTC =
(rev 1127)
+++ humano2/trunk/components/webTools/Adapter.cs 2005-05-23 19:57:53 UTC =
(rev 1128)
@@ -1150,7 +1150,7 @@
=09
string[] fila =3D {"0,66", // get id_entity and the names of the colu=
mns.
("34|4|'" + domainId.ToString() + "'|1|0;" + // Where the class is p=
art of the domain.
- "125|4|'f'|0|0"), // The class is not hidden (isHidden is false)
+ "125|4|'0'|0|0"), // The class is not hidden (isHidden is false) /=
/changed to BIT "125|4|'f'|0|0"
"", // No group by
"", // No Havings
"", // No order by
@@ -1432,16 +1432,17 @@
public void SetAttributeAsPrimary(int primaryId, int classId, int d=
omainId)
{
// Remove the isPrimary label from all attributes. =20
- complex.SetNoAttributesAsPrimary(classId);
+ complex.SetAttributeAsPrimary(classId,primaryId);
=20
- DataTable dt =3D new DataTable();
- dt.Columns.Add("isPrimary");
- DataRow dr =3D dt.NewRow();
- dr["isPrimary"] =3D true;
- dt.Rows.Add(dr);
-
- crud.Domain =3D domainId;
- crud.Update(primaryId, dt);
+//
+// DataTable dt =3D new DataTable();
+// dt.Columns.Add("isPrimary");
+// DataRow dr =3D dt.NewRow();
+// dr["isPrimary"] =3D "1";
+// dt.Rows.Add(dr);
+//
+// crud.Domain =3D domainId;
+// crud.Update(primaryId, dt);
}
=20
public bool ClassHasView(int classId)
@@ -1532,8 +1533,8 @@
Logger.Log("ChangeAttributesOfView: ", LogLevel.Trace);
DataTable dt =3D new DataTable();
crud.Domain =3D idDomain;
- string query =3D @"select ""id_entity"", ""columns"" from ""view"" wh=
ere ""idClassView"" =3D "+classId+" order by id_entity limit 1";
- DataTable view =3D complex.doSelect(query);
+
+ DataTable view =3D complex.getColsforView(classId);
=09
string[] row;
string col1=3D"";
Modified: humano2/trunk/core/db/absComplex.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/absComplex.cs 2005-05-21 20:02:10 UTC (rev 1127=
)
+++ humano2/trunk/core/db/absComplex.cs 2005-05-23 19:57:53 UTC (rev 1128=
)
@@ -46,7 +46,8 @@
///<param name=3D"names">The 'name' of classes in the meta model.</par=
am>
abstract public string[] convertAttribSysNameToName(int idEntity=
, string[] names);
=20
- =20
+ abstract public DataTable getColsforView(int classid);
+
/// <summary>
/// Crea una tabla temporal para realizar el paginado de una consulta =
por ViewTools
/// </summary>
@@ -73,7 +74,7 @@
/// Set all of the attributes of the class to isPrimary =3D false.
/// </summary>
/// <param name=3D"classId">The instance Id of the class.</param>
- abstract public void SetNoAttributesAsPrimary(int classId);
+ abstract public void SetAttributeAsPrimary(int classId, int primary=
Id);
=20
/// <summary>
/// Returns the Id of the view that is the default view for this class=
.
@@ -388,7 +389,7 @@
=20
public DataTable doSelect(string query){
DataTable dt =3D new DataTable();
- utils.IDbReader2DataTable(dt,conn.doSelect(query));
+ dt =3D conn.doSelect(query);
return dt;
}
=20
Modified: humano2/trunk/core/db/absConnection.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/absConnection.cs 2005-05-21 20:02:10 UTC (rev 1=
127)
+++ humano2/trunk/core/db/absConnection.cs 2005-05-23 19:57:53 UTC (rev 1=
128)
@@ -51,19 +51,37 @@
{
return dbCon;
}
+
+ public IDbTransaction getTransactionObj()
+ {
+ if ( dbTransRefCount > 0 )
+ return dbTrans;
+ else=20
+ return null;
+ }
=09
///<summary>Hace un select en la base de datos.</summary>
///<param name=3D"query">El SQL a ejecutarse</param>
///<returns>Los resultado del select</returns>
- virtual public IDataReader doSelect(string query)
+ virtual public DataTable doSelect(string query)
{
Open();
+ Humano2.Core.Db.DbUtils du =3D new DbUtils();
+ DataTable dt =3D new DataTable();
+
IDbCommand dbCmd =3D dbCon.CreateCommand();
dbCmd.CommandText =3D query;
IDataReader res =3D dbCmd.ExecuteReader();
+ du.IDbReader2DataTable(dt, res);
Close();
- return res;
+
+ return dt;
}
+
+ virtual public DataSet doSelect(string query, DataSet ds)
+ {
+ return ds;
+ }
=09
///<summary>Realiza comandos en la base de datos que no retornen.</sum=
mary>
///<param name=3D"query">El SQL para la base de datos.</param>
Modified: humano2/trunk/core/db/absCrud.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/absCrud.cs 2005-05-21 20:02:10 UTC (rev 1127)
+++ humano2/trunk/core/db/absCrud.cs 2005-05-23 19:57:53 UTC (rev 1128)
@@ -135,7 +135,6 @@
///<exception cref=3D"DataTableException">El datatable es en formato i=
ncorrecto.</exception>
virtual public int Create(int idEntityType, DataTable data)
{
- conn.BeginTransaction();
checkDataTableSingleRow(data);
DataSet structure =3D readTypeStructure(idEntityType);
=09
@@ -143,6 +142,7 @@
DataSet dataset =3D new DataSet();
dataset.Tables.Add(data);
=09
+ conn.BeginTransaction();
ArrayList idEntities =3D createAccordingToType(idEntityType, structur=
e, "main", dataset);
conn.Commit();
return Convert.ToInt32(idEntities[0]);
@@ -206,13 +206,10 @@
///<exception cref=3D"Humano2.Core.Db.SystemDataImmutableException">Cu=
ando un ID es parte del modelo base y no puede ser eliminado.</exception>
virtual public int Update(int idEntity, DataSet data, bool allowDelete=
d)
{
- conn.BeginTransaction();
=09
checkDataSet(data);
=20
int changedColNr =3D updateAccordingToType(idEntity, data);
-
- conn.Commit();
return changedColNr;
}
=09
@@ -474,7 +471,7 @@
///<exception cref=3D"DataTableException">El datatable es en formato i=
ncorrecto.</exception>
protected DataSet createAttributeSetDefaults(DataRow workRow, DataSet =
typeStr, string baseAttributeType)
{
- int newAttribId =3D getUniqueId();
+ //int newAttribId =3D getUniqueId();
=09
if(!workRow.Table.Columns.Contains("classId"))
{
@@ -489,12 +486,12 @@
//Si no tiene attibutos, por defecto isPrimary deber ser true.
if(numberOfAttributesInClass(ds, classId) =3D=3D 0)
{
- addMissingColumnToDataTable(workRow, "isPrimary", true);
+ addMissingColumnToDataTable(workRow, "isPrimary", "1");
} else {
- addMissingColumnToDataTable(workRow, "isPrimary", false);
+ addMissingColumnToDataTable(workRow, "isPrimary", "0");
}
//Agrega el nombre fisico de la columna al DataTable.
- addMissingColumnToDataTable(workRow, "sysAttName", genColumnSysName(n=
ewAttribId));
+ addMissingColumnToDataTable(workRow, "sysAttName", genColumnSysName(c=
lassId,workRow["attName"].ToString()));
=20
// Switch sobre los diferentes tipos de datos basicos.
// Si no dan algunas valores, setealos al por defecto.
@@ -534,7 +531,7 @@
///<summary>Setup autogenerated values and test for data concistency f=
or a </summary>
///<exception cref=3D"DataTableException">El datatable es en formato i=
ncorrecto.</exception>
protected void createClassSetup(DataRow workRow) {
- int newClassId =3D getUniqueId();
+ //int newClassId =3D getUniqueId();
=09
if(!workRow.Table.Columns.Contains("parentId"))
{
@@ -547,7 +544,7 @@
=09
//Agregar datos que son fijos/generado por el systema.
addMissingColumnToDataTable(workRow, "classType", (int) MetaModelCons=
ts.classTypeSolucionData);
- addMissingColumnToDataTable(workRow, "sysName", genTableSysName(Domai=
n, newClassId));
+ addMissingColumnToDataTable(workRow, "sysName", genTableSysName(Domai=
n, workRow["name"].ToString()));
}
=20
///<summary>Agrega una columna a un datatable</summary>
@@ -624,6 +621,8 @@
}
=09
int idEntity =3D createEntity(idEntityType);
+
+ // call addMissingColumnToDataTable(workRow, "sysName", genTableSysNam=
e(Domain, idEntity));
for(int t =3D 0; t < instNames.Count; t++)
{
=09
@@ -740,6 +739,7 @@
=09
//System.Console.WriteLine("WorkRow Selected");
=09
+ conn.BeginTransaction();
if( isAttribute(structure) )
{
updateAttribute(idEntity, workRow, currentData, clsId, structure);
@@ -750,7 +750,7 @@
changedColsNr =3D updateInstance(idEntity, workRow, data, currentData=
, clsId, structure);
=20
//System.Console.WriteLine("Post update instance.");
- =09
+ conn.Commit();
return changedColsNr;
}
=09
@@ -1162,7 +1162,7 @@
instValues.Add(new ArrayList());
}
=09
- // See if the column modDate exists. if it is not set, set it to now(=
)
+ // See if the column modDate exists. if it is not set, set it to getd=
ate()
string delDateName =3D escapeColumn("modDate");
int delDateIndex =3D ((ArrayList) instColumns[entityIndex]).IndexOf(d=
elDateName);
if( delDateIndex =3D=3D -1)
@@ -1532,17 +1532,21 @@
}
=09
///<summary>generate the fisical table sysName in the database</summar=
y>
- protected string genTableSysName(int domainId, int idEntity)
+ protected string genTableSysName(int domainId, string className)
{
+ string classSysName;
+ classSysName =3D genClassSysName(domainId, className);
//Mas uno para cuadrar idEntity con tableName.
- return String.Format("d{0}c{1}", domainId, idEntity+1);
+ return classSysName;
}
=20
///<summary>generate the fisical column sysName in the database</summa=
ry>
- protected string genColumnSysName(int idEntity)
+ protected string genColumnSysName(int classID, string attName)
{
+ string attSysName;
+ attSysName =3D genAttSysName(classID, attName);
//Mas uno para cuadrar idEntity con la nombre de column fisica.
- return String.Format("col{0}", idEntity+1);
+ return attSysName;
}
=09
///<summary>generate the column name for a temporary column.</summary>
@@ -1577,6 +1581,10 @@
///<returns>A unique Id.</returns>
abstract protected int getUniqueId();
=20
+ abstract protected string genClassSysName(int domainId, string classNa=
me);
+
+ abstract protected string genAttSysName(int classId, string attName);
+
///<summary>Create a new instance in the MetaModel.</summary>
///<remarks>This is a support function, use create to properly create =
an instance.</remarks>
///<param name=3D"clsId">The entityId of the class of the to be create=
d instance.</param>
Modified: humano2/trunk/core/db/mssql/mssqlComplex.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/mssql/mssqlComplex.cs 2005-05-21 20:02:10 UTC (=
rev 1127)
+++ humano2/trunk/core/db/mssql/mssqlComplex.cs 2005-05-23 19:57:53 UTC (=
rev 1128)
@@ -53,7 +53,6 @@
a.""classId"" =3D " + classId.ToString() + @" order by a.""order"=
", a.""attName""";
=09
res =3D this.doSelect(query);
-
return res;
}
=20
@@ -69,10 +68,14 @@
=09
query =3D @"select name from class where id_entity =3D " + classId.To=
String(); =09
res =3D this.doSelect(query);
-
return res;
}
=20
+ public override DataTable getColsforView(int classId)
+ {
+ string query =3D @"select top 1 ""id_entity"", ""columns"" from ""vie=
w"" where ""idClassView"" =3D "+classId+" order by id_entity";
+ return doSelect(query);
+ }
///<summary>Get the structure of a view.</summary>
///<param name=3D"viewId">The id of the view.</param>
///<returns>a datatable with the information about the view.</returns>
@@ -81,7 +84,6 @@
string query =3D "select id_entity, \"columns\", \"where\", \"groupby=
\", \"having\", \"order\", \"idClassView\", \"viewName\" "+=20
"from \"view\" where id_entity =3D " + viewId;
DataTable res =3D this.doSelect(query);
-
return res; =09
}
=20
@@ -173,7 +175,7 @@
from class c, entity e
where
c.id_entity =3D e.id_entity and
- c.""isHidden"" =3D 'f' and
+ c.""isHidden"" =3D '0' and
e.""delDate"" is null and
e.""domainId"" in (" + domain.ToString() + @", 10) order by c.""c=
lassType"" DESC, c.name";
=09
@@ -262,14 +264,16 @@
"where a.\"classId\" in ("+ padreIds +") " +
"and e.\"domainId\" =3D "+domainId;
=09
- IDataReader data =3D conn.doSelect(query);
+ DataTable data =3D conn.doSelect(query);
=09
NameValueCollection res =3D new NameValueCollection();
=09
- while(data.Read()) {
- string key =3D data[0].ToString();
- string value =3D data[1].ToString();
+ foreach (DataRow tblRow in data.Rows)
+ {
+ string key =3D tblRow[0].ToString();
+ string value =3D tblRow[1].ToString();
res[key] =3D value;
+
}
return res;
}
@@ -281,7 +285,7 @@
/// <returns>number of views. 0 if no views are asociated.</returns>
public override int NumberOfViewsForClass(int classId)
{
- string query =3D "select count(id_entity) from view where \"idClassVi=
ew\" =3D " + classId;
+ string query =3D "select count(id_entity) from [view] where \"idClass=
View\" =3D " + classId;
return Convert.ToInt32( doScalar( query ) );
}
=09
@@ -289,11 +293,16 @@
/// Set all of the attributes of the class to isPrimary =3D false.
/// </summary>
/// <param name=3D"classId">The instance Id of the class.</param>
- public override void SetNoAttributesAsPrimary(int classId)
+ public override void SetAttributeAsPrimary(int classId, int primary=
Id)
{
- string query =3D "update attribute set \"isPrimary\" =3D 'f' where=
\"classId\" =3D "+classId;
- conn.doCommand(query);
- }
+ string query =3D "update attribute set \"isPrimary\" =3D '0' where \"=
classId\" =3D "+classId;
+ conn.doCommand(query);
+ if (primaryId !=3D 0)
+ {
+ query =3D "update attribute set \"isPrimary\" =3D '1' where \"id_en=
tity\" =3D "+primaryId;
+ conn.doCommand(query);
+ }
+ }
=20
/// <summary>
/// Returns the Id of the view that is the default view for this class=
.
@@ -302,7 +311,7 @@
/// <returns>the id of the view that should be shown.</returns>
public override int getDefaultViewId(int classId)
{
- string query =3D "select \"id_entity\" from view where \"where\" is n=
ull and \"idClassView\" =3D " + classId;
+ string query =3D "select \"id_entity\" from [view] where \"where\" is=
null and \"idClassView\" =3D " + classId;
return Convert.ToInt32( doScalar( query ) );
}
=09
@@ -348,21 +357,25 @@
}
=20
string tName;
- string strSql =3D "SELECT c.sysName, c.id_entity, c.parentId " +
- "FROM entity e, class c " +=20
- "WHERE e.id_entity=3D" + colId + " " +
- "AND e.class=3Dc.id_entity";
- System.Data.IDataReader dr =3D conn.doSelect(strSql);
+ DataTable dt =3D this.doSelect(
+ @"select
+ class.""sysName"",
+ class.id_entity,
+ class.""parentId""
+ from entity, class
+ where
+ entity.id_entity =3D " + colId + @" and
+ entity.class =3D class.id_entity");
=09
- if(dr.Read())
- {
- if(Convert.ToInt32(dr["parentId"]) =3D=3D 5)
+ if(dt.Rows.Count>0)
+ {=09
+ if(Convert.ToInt32(dt.Rows[0]["parentId"].ToString()) =3D=3D 5)
{
- tName =3D dr["sysName"].ToString();
+ tName =3D dt.Rows[0]["sysName"].ToString();
}
else
{
- tName =3D InstanceType(Convert.ToInt32(dr["id_entity"]));
+ tName =3D InstanceType(Convert.ToInt32(dt.Rows[0]["parentId"]));
}
}
else
@@ -374,33 +387,45 @@
Logger.Log("InstanceType Add("+colId+","+tName+")", LogLevel.Trace);
cache.InstanceTypeCache.Add(colId,tName);
}
+ dt.Dispose();
return tName;
}
=20
public override string BuildTempTable(string[] args, ref string tableN=
ame)
{
+
StringBuilder table =3D new StringBuilder();
string[] var;
string name;
string type;
+ int loop;
=09
tableName =3D "tempTable" + System.Guid.NewGuid().ToString();
tableName =3D tableName.Replace("-","");
=09
table.Append("drop table "+ tableName + ";");
- =09
- table.Append("create temp table "+ tableName +" (");
+ table.Append("select max(\"row\") from "+ tableName + ";");
+ table.Append("create table dbo."+ tableName +" (");
+ loop =3D 0;
foreach(string col in args)
{
var =3D col.Split(",".ToCharArray());
- name =3D var[0].Replace(".","_");
- name =3D name.Replace("\"","");
- name =3D "\"" + name + "\"";
+ name =3D var[0];
+ name =3D name.Substring(name.IndexOf(".")+1);
+ if ((loop > 0) && (name =3D=3D "id_entity")) name =3D name + loop.To=
String();
+ //name =3D var[0].Replace(".","_");
+ //name =3D name.Replace("\"","");
+ //name =3D "\"" + name + "\"";
type =3D core.Crud.AttributeTypeMapping(var[2].ToString());
+ // FIXME: Get ols sizes from db
+ if (type =3D=3D "varchar") type =3D type + " (50)";
+ //string coDef =3D getColDef();
+ if (type =3D=3D null) type =3D var[2].ToString();
table.Append(name + " " + type + ",");
+ loop++;
}
- table.Append("row serial);\n");
- table.Append("insert into " + tableName + " (" );
+ table.Append("\"row\" integer IDENTITY);\n");
+ table.Append("insert into " + tableName + " " );
=09
return table.ToString();
}
@@ -422,19 +447,13 @@
}
=09
string tName;
-// tName =3Dconn.doScalar(
-// @"select c."sysName"
-// from class c,attribute a
-// where (c.id_entity =3D a."classId"" and
-// a.id_entity =3D " + id + @") or
-// c.id_entity =3D " + id + @"
-// GROUP BY c.""sysName""").ToString();
- string strSql =3D "SELECT c.sysName " +=20
- "FROM class c, attribute a " +=20
- "WHERE (c.id_entity=3Da.classId AND a.id_entity=3D" + id + ") " +
- "OR c.id_entity=3D" + id + " " +=20
- "GROUP BY c.sysName";
- tName =3D conn.doScalar(strSql).ToString();
+ tName =3Dconn.doScalar(
+ @"select c.""sysName""
+ from class c,attribute a
+ where (c.id_entity =3D a.""classId"" and
+ a.id_entity =3D " + id + @") or
+ c.id_entity =3D " + id + @"
+ GROUP BY c.""sysName""").ToString();
=20
//Logger.Log("TableNameClean Add("+id+","+tName+")", LogLevel.Trace);
cache.TableNameCache.Add(id,tName);
@@ -546,7 +565,7 @@
/// <returns>A DataTable</returns>
public override DataTable GetNMRelations(int idColumn)
{
- IDataReader dt =3D conn.doSelect(
+ DataTable dt =3D conn.doSelect(
@"select
p.""owner"",
p.""to"",
@@ -568,9 +587,9 @@
res.Columns.Add(col);
=20
int i =3D 1;
- while(dt.Read())
+ foreach(DataRow dbRow in dt.Rows)
{
- string[] row =3D {i.ToString(),dt.GetValue(0).ToString(),dt.GetValue=
(1).ToString(),dt.GetValue(2).ToString()};
+ string[] row =3D {i.ToString(),dbRow[0].ToString(),dbRow[1].ToString=
(),dbRow[2].ToString()};
res.Rows.Add(row);
i++;
}
@@ -583,12 +602,11 @@
""pertinence"" p
where
p.""id_entity"" =3D " + idColumn.ToString());
- if(dt.Read())
+ if(dt.Rows.Count>0)
{
- res =3D GetNMRelations(Convert.ToInt32(dt.GetValue(0)));
+ res =3D GetNMRelations(Convert.ToInt32(dt.Rows[0][0]));
}
}
-
return res;
}
=20
@@ -603,9 +621,7 @@
{
string query =3D String.Format("select * from \"{0}\" x, entity e whe=
re \"{1}\" =3D {2} and x.id_entity =3D e.id_entity and e.\"delDate\" is n=
ull", tableSysName,
colSysName, valor);
- =09
- DataTable dt =3D doSelect(query);=20
- return dt;
+ return doSelect(query);
}
=09
///<summary>Testea si es una clase definicio</summary>
@@ -621,42 +637,55 @@
return false;
}
=09
- ///<summary>Convierta los 'attName' a los 'sysAttName' de un class</su=
mmary>
- ///<param name=3D"idEntity">Id del class cual contiene los columnnames=
</param>
- ///<param name=3D"names">Nombres con 'attName' de las columnas.</param=
>
- ///<returns>Las nombres 'attSysName' en el mismo orden que se ingreso =
'attName'.</returns>
+ ///<summary>Converts the 'attName' to the 'sysAttName' of a class</sum=
mary>
+ ///<param name=3D"idEntity">Id of class that contains the columnnames<=
/param>
+ ///<param name=3D"names">Names with 'attName' of the columns.</param>
+ ///<returns>The names 'attSysName' in the same order than the order of=
insertion in 'attName'.</returns>
override public string[] convertAttribNameToSysName(int idEntity, stri=
ng[] names)
{
- string namesList =3D utils.ConcatForSqlIn(names);
- string query =3D String.Format("select \"attName\", \"sysAttName\" fr=
om attribute where \"classId\" =3D {0} and \"attName\" in ({1})",
- idEntity, namesList);
- =09
- IDataReader res =3D conn.doSelect(query);
- =09
- string[] sysNames =3D new string[names.Length];
- // camina sobre los resultados, y devuelve los "sysName" en el mismo =
orden de cual recibimos los "name"
- while(res.Read())
- {
- for(int i =3D 0; i < names.Length; i++)
- {
- if( names[i] =3D=3D Convert.ToString(res["attName"]) )
- {
- sysNames[i] =3D Convert.ToString(res["sysAttName"]);
- break;
- }
- }
- }
-=20
- return sysNames;
+ return convertAttrib(idEntity, names, "attName", "sysAttName");
}
- =20
- =20
- //TODO look at pgsql version
- override public string[] convertAttribSysNameToName(int =
idEntity, string[] names)
- {
- return null;
- }
+ =20
+ ///<summary>Converts the 'sysAttName' to the 'attName' o=
f a class</summary>
+ override public string[] convertAttribSysNameToName(int idEntity, stri=
ng[] names)
+ {
+ return convertAttrib(idEntity, names, "sysAttName", "attName");
+ }
=20
+ ///<summary>Convert the 'from' to the 'to' (name of attr=
ibute ) in the class.</summary>
+ ///<param name=3D"idEntity">Id of class that contains the columnnames<=
/param>
+ ///<param name=3D"names">Names with 'from' of the columns.</param>
+ ///<returns>The names 'to' in the same order than the order of inserti=
on in 'from'.</returns>
+ private string [] convertAttrib(int idEntity, string [] names, =
string from, string to)
+ {
+ string namesList =3D utils.ConcatForSqlIn(names);
+ string query =3D String.Format( "select \""=20
+ + to =20
+ + "\",\""
+ + from=20
+ + "\" from attribute where =
\""=20
+ + from + "\" in ({0})",
+ namesList);
+ =20
+ //Console.Write("query: " + query +"\n");
+ DataTable res =3D conn.doSelect(query);
+ =20
+ string[] resNames =3D new string[names.Length];
+ // camina sobre los resultados, y devuelve los "sysName" en=
el mismo orden de cual recibimos los "name"
+ foreach(DataRow dbRow in res.Rows)
+ {
+ for(int i =3D 0; i < names.Length; i++)
+ {
+ if( names[i] =3D=3D Convert.ToString(dbRow[from]) )
+ {
+ resNames[i] =3D Convert.ToString(dbRow[to]);
+ break;
+ }
+ }
+ }
+ return resNames;
+ }
+
///<summary>Devuelve la nombre de la tabla donde se guarde los datos.<=
/summary>
///<param name=3D"idEntity">El id del entity</param>
///<returns>Nombre de la tabla.</returns>
@@ -675,6 +704,7 @@
}
=20
#region Import flat file functions
+
/// <summary>creates the table which will be used to red from for the =
import process.</summary>
/// <param name=3D"colDefs">2 dimensional array wich contains Column n=
ame/Column definition.</param>
/// <param name=3D"tableName">The name of the table to be created.</pa=
ram>
@@ -682,7 +712,7 @@
{
string sql;
int i;
- sql =3D "create table \"" + tableName +"\" (\r\n";
+ sql =3D "create table dbo.\"" + tableName +"\" (\r\n";
for (i=3D0;i<colDefs.Length/3;i++)
{
sql =3D sql + "\"" + colDefs[i,1] + "\" " + colDefs[i,0] +",\r\n";
@@ -701,7 +731,7 @@
string sql =3D "update \"" + tableName +"\" set id_entity =3D null";
conn.doCommand(sql);
=20
- sql =3D "alter table \"" + tableName +"\" add column h2anchor Varchar=
(36) null";
+ sql =3D "alter table \"" + tableName +"\" add h2anchor Varchar(36) n=
ull";
conn.doCommand(sql);
}
=20
@@ -711,10 +741,10 @@
/// <param name=3D"tableName">A string</param>
override public void addIDCol(string tableName)
{
- string sql =3D "alter table \"" + tableName +"\" add column id_entity=
numeric null";
+ string sql =3D "alter table \"" + tableName +"\" add id_entity numer=
ic null";
conn.doCommand(sql);
=20
- sql =3D "alter table \"" + tableName +"\" add column h2anchor Varchar=
(36) null";
+ sql =3D "alter table \"" + tableName +"\" add h2anchor Varchar(36) n=
ull";
conn.doCommand(sql);
}
=20
@@ -750,7 +780,7 @@
override public void resolveSimplePertinence(string tableName, string =
tblCol, string classTableName, string attDisp)
{
string sql =3D "BEGIN;\r\n";
- sql =3D sql + "alter table \"" + tableName + "\" add column \"" + tbl=
Col +"h2ID\" integer null;\r\n";
+ sql =3D sql + "alter table \"" + tableName + "\" add \"" + tblCol +"=
h2ID\" integer null;\r\n";
sql =3D sql + "update \"" + tableName + "\" set \"" + tblCol +"h2ID\"=
=3D \"" + classTableName +"\".id_entity "
+ " from \"" + classTableName +"\" where \"" + tableName + "\".\"" +=
tblCol+"\" =3D \"" + classTableName +"\"." +attDisp+";\r\n";
sql =3D sql + "COMMIT;\r\n";
@@ -816,13 +846,11 @@
conn.BeginTransaction();
=20
string sql =3D "insert into entity (\"domainId\", class, \"createDate=
\", \"modDate\",status) " +
- " select " + domainId + "," + classId +", now(),now(), h2anchor from=
\"" +tableName +"\"; \r\n";
+ " select " + domainId + "," + classId +", getdate(),getdate(), h2anc=
hor from \"" +tableName +"\"; \r\n";
=20
sql =3D sql + "update \"" + tableName + "\" set id_entity =3D entity.=
id_entity " +
"from entity where \"" + tableName + "\".h2anchor =3D entity.status;=
\r\n";
=09
-
-
for (int i=3D0;i<clasesArr.Length/2;i++)
{
sql =3D sql + clasesArr[i,0] + "\r\n\t" + clasesArr[i,1] + "\r\n" ;
@@ -878,7 +906,17 @@
/// <return>The attribute of the pertinence attribute or "" if a=
ttributeId is not a pertinence attribute</returns>
override public string GetPertinenceForAttribute(string attribut=
eId)
{
- return "";
+ string req =3D "select \"id_entity\" from attribute where \"=
classId\" in (select \"to\" from pertinence where id_entity =3D " + Conve=
rt.ToInt32(attributeId) + ")";
+ =20
+ DataTable dt =3D doSelect(req);
+ if( (dt =3D=3D null) || (dt.Rows.Count =3D=3D 0))
+ {
+ return ""; =20
+ }
+ else
+ {
+ return Convert.ToString(dt.Rows[0]["id_entity"]); //Get =
the pertinence attribute
+ }
}
=20
/// <summary>
@@ -888,7 +926,18 @@
/// <return>user attribute name</returns>
override public string ConvertSysAttNameToUserAttName(string sys=
AttName)
{
- return "";
+ string req =3D "select \"attName\" from attribute where \"sy=
sAttName\" =3D '" + sysAttName +"'";
+ string res =3D "";
+ DataTable dt =3D doSelect(req);
+ try
+ {
+ res =3D Convert.ToString(dt.Rows[0]["attName"]);
+ }
+ catch
+ {
+ Logger.Log("ConvertSysAttName: there is no userAttName f=
or sysAttName: " + sysAttName,LogLevel.Trace);
+ }
+ return res;
}
=20
/// <summary>
@@ -898,14 +947,42 @@
/// <return>true if attribute is primary</returns>
override public bool IsPrimary(string sysAttName)
{
- return false; =20
+ string req =3D "select \"isPrimary\" from attribute where \"=
sysAttName\" =3D '" + sysAttName + "'";
+ string res =3D "";
+ DataTable dt =3D doSelect(req);
+ try
+ {
+ res =3D Convert.ToString(dt.Rows[0]["isPrimary"]);
+ }
+ catch
+ {
+ //Logger.Log("IsPrimary: problem when executing query fo=
r isPrimary flag ",LogLevel.Trace);
+ }
+ =20
+ //Logger.Log("IsPrimary: res=3D " + res,LogLevel.Trace);
+ bool isPrimary =3D (res =3D=3D "1");
+ =20
+ return isPrimary;
}
=20
override public bool IsSelfLookUp(string sysAttName)
{
- bool isPrimary =3D true;
+ string req =3D "select \"isSelfLookup\" from attribute where \"sysAtt=
Name\" =3D '" + sysAttName + "'";
+ string res =3D "";
+ DataTable dt =3D doSelect(req);
+ try
+ {
+ res =3D Convert.ToString(dt.Rows[0]["isSelfLookup"]);
+ }
+ catch
+ {
+ //Logger.Log("isSelfLookup: problem when executing query for isSelfL=
ookup flag ",LogLevel.Trace);
+ }
=20
- return isPrimary;
+ //Logger.Log("isSelfLookup: res=3D " + res,LogLevel.Trace);
+ bool IsSelfLookUp =3D (res =3D=3D "True");
+ =20
+ return IsSelfLookUp;
}
=20
/// <summary>
@@ -915,7 +992,24 @@
/// <return>true if attribute is primary</returns>
override public string [] GetParamsView(int id)
{
- return null; =20
+ string idStr =3D Convert.ToString(id);
+ string req =3D "select \"groupby\", \"columns\",\"where\",\"=
order\" from [view] where id_entity=3D" + idStr;
+ string [] res =3D new string[4];
+ =20
+ DataTable dt =3D doSelect(req);
+ try
+ {
+ res[0] =3D Convert.ToString(dt.Rows[0]["columns"]);
+ res[1] =3D Convert.ToString(dt.Rows[0]["where"]);
+ res[2] =3D Convert.ToString(dt.Rows[0]["order"]);
+ res[3] =3D Convert.ToString(dt.Rows[0]["groupby"]);
+ }
+ catch
+ {
+ Logger.Log("GetParamsView: failed query ",LogLevel.Trac=
e);
+ }
+ =20
+ return res;
}
=20
/// <summary>
@@ -925,7 +1019,25 @@
/// <return>params of the report</returns>
override public string [] GetParamsReport(int id)
{
- return null; =20
+ string idStr =3D Convert.ToString(id);
+ string req =3D "select \"columns\",\"where\",\"order\",\"gr=
oupby\",\"having\",\"idClassReport\" from report where id_entity=3D" + id=
Str;
+ string [] res =3D new string[6];
+ =20
+ DataTable dt =3D doSelect(req);
+ try
+ {
+ res[0] =3D Convert.ToString(dt.Rows[0]["columns"]);
+ res[1] =3D Convert.ToString(dt.Rows[0]["where"]);
+ res[2] =3D Convert.ToString(dt.Rows[0]["order"]);
+ res[3] =3D Convert.ToString(dt.Rows[0]["groupby"]);
+ res[4] =3D Convert.ToString(dt.Rows[0]["having"]);
+ res[5] =3D Convert.ToString(dt.Rows[0]["idClassReport"])=
;
+ }
+ catch
+ {
+ Logger.Log("GetParams Report: failed query ",LogLevel.T=
race);
+ }
+ return res;
}
=20
/// <summary>
@@ -940,22 +1052,22 @@
//SE esta importando attributos, por lo tanto tenemos que recorrer ca=
da fila y ver a que clase
// pertenece, que tipo de attributo es y crearlo
=09
- IDataReader tmpReader =3D conn.doSelect("select \"" + classIdCol[0] +=
"\",\"" + classIdCol[1] + "\" from \"" + tableName + "\" where \"" + cl=
assIdCol[0] + "\" is not null order by \"" + classIdCol[0] + "\"");
+ DataTable tmpTable =3D conn.doSelect("select \"" + classIdCol[0] + "\=
",\"" + classIdCol[1] + "\" from \"" + tableName + "\" where \"" + class=
IdCol[0] + "\" is not null order by \"" + classIdCol[0] + "\"");
=20
ArrayList alterSql =3D new ArrayList();
=20
int i =3D0;
- while (tmpReader.Read())
+ foreach(DataRow dRow in tmpTable.Rows)
{
- int attribClass =3D Convert.ToInt32(tmpReader[classIdCol[0]]);
- string colname =3D tmpReader[classIdCol[0]].ToString();
+ int attribClass =3D Convert.ToInt32(dRow[classIdCol[0]]);
+ string colname =3D dRow[classIdCol[0]].ToString();
string classTable =3D getTableName(attribClass);
switch (classId)
{
case(8): //attribute
//this atribute should be obtained from the tmpReader
int max =3D 50;
- alterSql.Add("alter table \"" + classTable +"\" add column \"" + t=
mpReader[classIdCol[1]] + "\" Varchar(" + max + ") null");
+ alterSql.Add("alter table \"" + classTable +"\" add \"" + dRow[cl=
assIdCol[1]] + "\" Varchar(" + max + ") null");
break;
case(87): //currency:
case(9): //numeric
@@ -964,9 +1076,9 @@
int rightSide =3D 2;
int ttlSize =3D leftSide + rightSide;
if (rightSide =3D=3D 0)
- alterSql.Add("alter table \"" + classTable +"\" add column \"" + =
tmpReader[classIdCol[1]] + "\" Integer null");
+ alterSql.Add("alter table \"" + classTable +"\" add \"" + dRow[c=
lassIdCol[1]] + "\" Integer null");
else
- alterSql.Add("alter table \"" + classTable +"\" add column \"" + =
tmpReader[classIdCol[1]] + "\" Numeric("+ttlSize+","+rightSide+") null");
+ alterSql.Add("alter table \"" + classTable +"\" add \"" + dRow[c=
lassIdCol[1]] + "\" Numeric("+ttlSize+","+rightSide+") null");
break;
}
=20
@@ -974,11 +1086,12 @@
}
=20
// always call Close when done reading.
- tmpReader.Close();
+ tmpTable.Dispose();
return alterSql;
}
=20
#endregion=09
+
/// <summary>
/// Method buildTable
/// </summary>
@@ -1005,12 +1118,17 @@
return dt;
}
=20
+ /// <summary>
+ /// Get all class depending for the class
+ /// </summary>
+ /// <param name=3D"id_entity"></param>
+ /// <returns></returns>
public override DataTable getPertinenceByIdClass(int id_entity)
{
string query;
DataTable res;
=09
- query =3D @"select=20
+ query =3D @"select distinct
c.id_entity,c.name=20
from=20
pertinence p=20
@@ -1028,10 +1146,10 @@
string query;
DataTable res;
=09
- query =3D @"select * from attribute a
+ query =3D @"select a.id_entity from attribute a
inner join class c on c.""id_entity"" =3D a.""classId""
inner join pertinence p on p.""owner""=3Da.""id_entity""
- where a.""classId""=3D" + id_entity.ToString();
+ where a.""classId""=3D" + id_entity.ToString() + @" and p.""to"" =3D=
" + from ;
=09
res =3D this.doSelect(query);
return res;
@@ -1040,9 +1158,19 @@
=20
public override int ConvertSysAttNameToIdAttName(string sysAttName)
{
- return -1;
- }
+ string req =3D "select \"id_entity\" from attribute where \"sysAttNam=
e\" =3D '" + sysAttName +"'";
+ int res =3D -1;
+ DataTable dt =3D doSelect(req);
+ try
+ {
+ res =3D Convert.ToInt32(dt.Rows[0]["id_entity"]);
+ }
+ catch
+ {
+ Logger.Log("ConvertSysAttName: there is no userAttName for sysAttNam=
e: " + sysAttName,LogLevel.Trace);
+ }
+ return res;
+ } =20
=20
- =20
}
}
Modified: humano2/trunk/core/db/mssql/mssqlConnection.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/mssql/mssqlConnection.cs 2005-05-21 20:02:10 UT=
C (rev 1127)
+++ humano2/trunk/core/db/mssql/mssqlConnection.cs 2005-05-23 19:57:53 UT=
C (rev 1128)
@@ -21,6 +21,9 @@
public class mssqlConnection: absConnection
{
public mssqlConnection() : base() { }
+
+// protected SqlTransaction dbTrans =3D null;
+
///<summary>
///Conecta con la base de datos. Esta funcion deja dbCon con
///una connection a la base datos lista para ser utilizada.
@@ -33,21 +36,70 @@
return c;
}
=09
+// override public void BeginTransaction()
+// {
+// if(dbTransRefCount =3D=3D 0)
+// {
+// Open();
+// //System.Console.WriteLine( "Beginning transaccion." );
+// dbTrans =3D dbCon.BeginTransaction();
+// }
+// dbTransRefCount++;
+// }
+//
///<summary>Hace un select en la base de datos.</summary>
///<param name=3D"query">El SQL a ejecutarse</param>
///<returns>Los resultado del select</returns>
- override public IDataReader doSelect(string query)
+ override public DataTable doSelect(string query)
{
Open();
// Cast-down a tipo mas potente.
SqlConnection conn =3D ( (SqlConnection ) dbCon );
SqlCommand dbCmd =3D conn.CreateCommand( );
- dbCmd.CommandText =3D query;
- IDataReader res =3D dbCmd.ExecuteReader( );
+
+ Humano2.Core.Db.DbUtils du =3D new DbUtils();
+ DataTable dt =3D new DataTable();
+ =09
+ try=20
+ {
+ dbCmd.CommandText =3D query;
+ if (dbTransRefCount > 0 )
+ {
+ dbCmd.Transaction =3D ( (SqlTransaction) dbTrans) ;
+ }
+ SqlDataReader res =3D dbCmd.ExecuteReader( );
+ du.IDbReader2DataTable(dt, res);
+ res.Close();
+ dbCmd.Dispose();
+ Close();
+ return dt;
+ }
+ catch(Exception ex)
+ {
+ Close();
+ Logger.Log("Error executing query:\r\n" + query, LogLevel.Trace);
+ throw new Exception("Error executing query:\r\n" + query + "\n\r" +e=
x.Message,ex.InnerException);
+ }
+
+ }
+ =09
+ override public DataSet doSelect(string query,DataSet ds)
+ {
+ Open();
+ SqlConnection conn =3D ( (SqlConnection) dbCon );
+ =09
+ SqlDataAdapter da =3D new SqlDataAdapter(query,conn);
+ if (dbTransRefCount > 0 )
+ {
+ da.SelectCommand.Transaction =3D ( (SqlTransaction) dbTrans) ;
+ }
+ da.Fill(ds);
+ da.Dispose();
Close();
- return res;
+ return ds;
+
}
- =09
+
///<summary>Realiza comandos en la base de datos que no retornen.</sum=
mary>
///<param name=3D"query">El SQL para la base de datos.</param>
///<returns>Cantidad de filas afectado por el comando.</returns>
@@ -59,7 +111,22 @@
SqlConnection conn =3D ( (SqlConnection) dbCon );
SqlCommand dbCmd =3D conn.CreateCommand( );
dbCmd.CommandText =3D query;
- int res =3D dbCmd.ExecuteNonQuery( );
+ if (dbTransRefCount > 0 )
+ {
+ dbCmd.Transaction =3D ( (SqlTransaction) dbTrans) ;
+ }
+ int res ;
+ try=20
+ {
+ res =3D dbCmd.ExecuteNonQuery( );
+ }
+ catch(Exception ex)
+ {
+ Logger.Log("Error executing query:\r\n" + query, LogLevel.Trace);
+ throw new Exception("Error executing query:\r\n" + query + "\n\r" +e=
x.Message,ex.InnerException);
+ }
+
+ dbCmd.Dispose();
Close();
return res;
}
@@ -74,16 +141,34 @@
Open();
SqlConnection conn =3D ( (SqlConnection) dbCon );
SqlCommand dbCmd =3D conn.CreateCommand( );
+ =09
dbCmd.CommandText =3D query;
- IDataReader dr =3D dbCmd.ExecuteReader( );
+ if (dbTransRefCount > 0 )
+ {
+ dbCmd.Transaction =3D ( (SqlTransaction) dbTrans) ;
+ }
+ SqlDataReader dr ;
+ try=20
+ {
+ dr =3D dbCmd.ExecuteReader( );
+ }
+ catch(Exception ex)
+ {
+ Logger.Log("Error executing query:\r\n" + query, LogLevel.Trace);
+ throw new Exception("Error executing query:\r\n" + query + "\n\r" +e=
x.Message,ex.InnerException);
+ }
//Close();
=09
if( dr.Read( ) && !Convert.IsDBNull( dr[0] ) )
{
tmpObj =3D dr[0];
+ dr.Close();
+ dbCmd.Dispose();
Close();
return tmpObj;
}
+ dr.Close();
+ dbCmd.Dispose();
Close();
return null;
}
@@ -93,7 +178,7 @@
/// </summary>
/// <param name=3D"query">La query a ejecutar</param>
/// <returns>El resultado del select</returns>
- public IDataReader doMssqlSelect(string query)
+ public DataTable doMssqlSelect(string query)
{
return doSelect( query );
}
@@ -125,8 +210,8 @@
/// <param name=3D"attsArr">A string[,]</param>
virtual public void fillTable(DataTable srcTable, string fillTable, Da=
taSet dsAtts, string[,] attsArr)
{
- SqlConnection conn =3D ( (SqlConnection) dbCon );
- =09
+ Open();
+ SqlConnection conn =3D ( (SqlConnection) dbCon );=09
SqlDataAdapter da =3D new SqlDataAdapter ( );
DataTable tgtTable =3D new DataTable( );
DataSet ds =3D new DataSet( );
@@ -170,10 +255,13 @@
=09
tgtTable.TableName =3D fillTable;
tgtTable =3D srcTable.Copy( );
+ SqlCommandBuilder SqlCB =3D new SqlCommandBuilder( da );
da.Fill( tgtTable );
tgtTable =3D srcTable.Copy( );
ds.Tables.Add( tgtTable );
+ string strXml =3D ds.GetXml( );
da.Update( tgtTable );
+ Close();
}
=09
///<summary>Recibe las opciones de Config y genera el connection strin=
g.</summary>
Modified: humano2/trunk/core/db/mssql/mssqlCrud.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/mssql/mssqlCrud.cs 2005-05-21 20:02:10 UTC (rev=
1127)
+++ humano2/trunk/core/db/mssql/mssqlCrud.cs 2005-05-23 19:57:53 UTC (rev=
1128)
@@ -45,7 +45,7 @@
map.Add( "pertinence", "integer" );
map.Add( "numeric", "numeric" );
map.Add( "boolean", "boolean" );
- map.Add( "dateTime", "timestamp" );
+ map.Add( "dateTime", "datetime" );
return map;
}
=09
@@ -70,7 +70,7 @@
throw new NoExistException( "The id_entity " + idEntity + " doesn't =
exist for read." );
}
=09
- conn.BeginTransaction();
+ conn.Open();
=09
//Estructuras y variables usadas en la funcion
DataSet ds =3D new DataSet( ); //El DataSet a retornar
@@ -118,6 +118,9 @@
query =3D String.Format( "select * from entity where id_entity =3D ({=
0})", idEntity );
dbCmd.CommandText =3D query;
da.SelectCommand =3D dbCmd;
+ =09
+ da.SelectCommand.Transaction =3D (SqlTransaction) conn.getTransaction=
Obj() ;
+ =09
da.Fill( ds, "entity" );
=09
//Devuelve la informacion sobre los clases cual esta en la tabla "cla=
ss".
@@ -297,19 +300,268 @@
dt.PrimaryKey =3D dc;
}
=09
- conn.Commit();
+ conn.Close();
=09
return ds;
=09
}
=09
+ /// <summary>
+ /// FIXME Modular funcion generica
+ /// </summary>
+ /// <param name=3D"idEntity"></param>
+ /// <param name=3D"withDeletes"></param>
+ /// <param name=3D"idAttributes"></param>
+ /// <returns></returns>
override public DataSet ReadStructure(int idEntity, bool withDeletes,s=
tring idAttributes)
{
- DataSet ds =3D new DataSet( );//El DataSet a retornar
+ if( !IsActive( idEntity ) )
+ {
+ throw new NoExistException( "The id_entity " + idEntity + " doesn't =
exist for read." );
+ }
+ conn.Open();
+ // conn.BeginTransaction();
+ =09
+ //Estructuras y variables usadas en la funcion
+ DataSet ds =3D new DataSet( ); //El DataSet a retornar
+ SqlCommand dbCmd =3D null; //
+ SqlDataAdapter da =3D new SqlDataAdapter( ); //Esttructuras para la c=
onexion con la BD
+ dbCmd =3D new SqlCommand( ); //
+ string query =3D null;
+ =09
+ // Cast-down a tipo mas potente.
+ SqlConnection msConn =3D ( (SqlConnection) conn.getConnObj() );
+ //Inicializo el command
+ dbCmd.Connection =3D msConn;
+ =09
+ //Buscar todos los attributos del tipo y sus padres.
+ //Para ello hay que considerar los casos en la idEntity pertenece a u=
na clase o una instancia
+ =09
+ //Lista de id's de herencia de la clase.
+ ArrayList idList =3D new ArrayList( );
+ string idListStr =3D "";
+ int[] Inh =3D getInheritanceIfIsInstance( idEntity );
+ idList.AddRange( Inh );
+ =09
+ //Verifico cual es el id de la clase base.
+ int idParent;
+ if( Inh.Length =3D=3D 0 )
+ {
+ idParent =3D idEntity;
+ idList.AddRange( getInheritanceOfType( idEntity ) );
+ }
+ else
+ {
+ idParent =3D Inh[0];
+ }
+ =09
+ =09
+ //Lo transformo a string en formato para poder usarlo en los select's
+ foreach( Object id in idList )
+ {
+ idListStr +=3D "," + id.ToString( );
+ }
+ idListStr =3D idListStr.Remove( 0, 1 );
+ =09
+ //Ingreso las tablas base
+ //Devuelve la informacion basica sobre el idEntity.
+ query =3D String.Format( "select * from entity where id_entity =3D ({=
0})", idEntity );
+ dbCmd.CommandText =3D query;
+ da.SelectCommand =3D dbCmd;
+ da.Fill( ds, "entity" );
+ =09
+ //Devuelve la informacion sobre los clases cual esta en la tabla "cla=
ss".
+ query =3D String.Format( "select * from class where id_entity in ({0}=
)", idListStr );
+ dbCmd.CommandText =3D query;
+ da.Fill( ds, "class" );
+ =09
+ string addQuery=3D"";
+ if(idAttributes.Length !=3D 0 )
+ {
+ =09
+ addQuery+=3D" and a.id_entity in(" + idAttributes + ")";
+ }=09
+
+ //Ahora obtengo la tabla arttribute con una fila para cada uno de mis=
attributos
+ //Pero recordar que es necesario buscar la herencia de cada uno de lo=
s attributos
+ //en el for de mas abajo.
+ if(withDeletes)
+ {
+ query =3D String.Format(@"select a.*,c.""sysName"" as ""refClassSysN=
ame"" ,d.""xslt"" as ""refXslt"" " +
+ @"from attribute a
+ INNER JOIN entity e ON a.id_entity =3D e.id_entity
+ INNER JOIN class c ON e.class =3D c.id_entity
+ LEFT JOIN ""displayAttribute"" d ON d.id_entity =3D a.""dis=
play""" +
+ @"where a.""classId"" in ({0})" + addQuery,
+ idListStr);
+ }=20
+ else=20
+ {
+ query =3D String.Format(@"select a.*,c.""sysName"" as ""refClassSysN=
ame"" ,d.""xslt"" as ""refXslt"" " +
+ @"from attribute a
+ INNER JOIN entity e ON a.id_entity =3D e.id_entity
+ INNER JOIN class c ON e.class =3D c.id_entity and e.""d=
elDate"" is null
+ LEFT JOIN ""displayAttribute"" d ON d.id_entity =3D a.""dis=
play""" +
+ @"where a.""classId"" in ({0})" + addQuery + @"
+ order by a.""order"", a.""attName""",
+ idListStr);
+ =09
+ }
+ =09
+ //Realizo la query y el llenado del DataSet
+ dbCmd.CommandText =3D query;
+ da.Fill( ds, "attribute" );
+ =09
+ //Son bastante autoexplicativas estas variables.
+ int index;
+ string attIds =3D null, attClassName;
+ ArrayList attInheritance;
+ DataRowCollection drc =3D ds.Tables["attribute"].Copy( ).Rows;
+ =09
+ //Una array con todos los atributos y sFillus herencias
+ ArrayList attList =3D new ArrayList( );
+ =09
+ // Camina por todos los tablas atributo buscando su herencia
+ while( drc.Count > 0 )
+ {
+ //La info sobre a el atributo
+ attClassName =3D (String)drc[0]["refClassSysName"];
+ attInheritance =3D getInheritanceByName( attClassName, "attribute" )=
;
+ =09
+ //Agrego la herencia a la lista a buscar
+ for( index =3D drc.Count - 1; index >=3D 0; index-- )
+ {
+ if( (String)drc[index]["refClassSysName"] =3D=3D attClassName )
+ {
+ string[] att =3D new string[2];
+ att[0] =3D Convert.ToString( drc[index]["id_entity"] );
+ att[1] =3D attClassName;
+ //Lo grego a la lista
+ attList.Add( att );
+ =09
+ //Agrego su herencia
+ foreach( object table in attInheritance )
+ {
+ string[] inh =3D new string[2];
+ inh[0] =3D att[0];
+ inh[1] =3D (String)table;
+ attList.Add( inh );
+ }
+ drc.RemoveAt( index );
+ }
+ }
+ }
+ =09
+ =09
+ //Creo el select para la consulta
+ string[] attTable;
+ while( attList.Count > 0 )
+ {
+ //La info sobre a el atributo
+ attTable =3D (string[])attList[0];
+ attIds =3D attTable[0];
+ attClassName =3D attTable[1];
+ attList.RemoveAt( 0 );
+ =09
+ for( index =3D attList.Count - 1; index >=3D 0; index-- )
+ {
+ attTable =3D (string[])attList[index];
+ if( attTable[1] =3D=3D attClassName )
+ {
+ attIds +=3D "," + attTable[0];
+ attList.RemoveAt( index );
+ }
+ }
+ =09
+ query =3D String.Format( @"select * from ""{0}"" where id_entity in =
({1})", attClassName, attIds );
+ dbCmd.CommandText =3D query;
+ da.Fill( ds, attClassName );
+ }
+ =09
+ //Ahora recuperamos las option para los choice y para los atributos c=
hoice de cada atributo
+ {
+ ArrayList optionGroups =3D new ArrayList( );
+ =09
+ if( ds.Tables.Contains( "choice" ) )
+ {
+ DataTable choice =3D ds.Tables["choice"];
+ =09
+ //Para los attributos choice de la tabla
+ for( int i=3D0;i < choice.Rows.Count;i++ )
+ {
+ if( !optionGroups.Contains( (Int32)choice.Rows[i]["groupType"] ) )
+ {
+ optionGroups.Add( (Int32)choice.Rows[i]["groupType"] );
+ }
+ }
+ }
+ =09
+ //-_-
+ //Para los attributos choice de los attributos de la tabla pedida
+ =09
+ //Obtenemos las tablas que se descuelgan de la tabla pedida
+ string sysNameTables =3D "";
+ for( int i=3D0;i < ds.Tables.Count;i++ )
+ {
+ if( sysNameTables =3D=3D "" )
+ {
+ sysNameTables =3D "'" + ds.Tables[i].TableName + "'";
+ }
+ else
+ {
+ sysNameTables +=3D ",'" + ds.Tables[i].TableName + "'";
+ }
+ }
+ =09
+ //La query para optener los option
+ query =3D @"select ch.""groupType""
+ from ""attribute"" as a,
+ ""class"" as c,
+ ""choice"" as ch
+ where c.""sysName"" in (" + sysNameTables + @") and
+ a.""classId"" =3D c.id_entity and
+ ch.id_entity =3D a.id_entity
+ group by ch.""groupType""";
+ =09
+ =09
+ string groups =3D "";
+ //Creamos la query
+ foreach( int group in optionGroups )
+ {
+ if( groups =3D=3D "" )
+ {
+ groups =3D group.ToString( );
+ }
+ else
+ {
+ groups +=3D "," + group.ToString( );
+ }
+ }
+ =09
+ if( groups =3D=3D "" )
+ {
+ groups =3D "null";
+ }
+ =09
+ query =3D String.Format( @"select * from ""option"" where ""group"" i=
n ({0}) or ""group"" in ({1})", groups, query );
+ dbCmd.CommandText =3D query;
+ da.Fill( ds, "option" );
+ }
+ =09
+ DataColumn[] dc;
+ foreach( DataTable dt in ds.Tables )
+ {
+ dc =3D new DataColumn[1];
+ dc[0] =3D dt.Columns["id_entity"];
+ dt.PrimaryKey =3D dc;
+ }
+ =09
+ //conn.Commit();
+ conn.Close();
+ =09
return ds;
}
=20
-
/// <summary>
/// Method ReadData
/// </summary>
@@ -344,9 +596,9 @@
inheritanceToString( idEntity ) );
=09
//Realizo la consulta
- SqlDataReader drAtt =3D ( (SqlDataReader) conn.doSelect( query ) );
+ DataTable dtAtt =3D conn.doSelect( query ); // NpgsqlDataReader drA=
tt =3D ( (NpgsqlDataReader) conn.doSelect( query ) );
//Reader para almacenar los valores de cada at tributo obtenido
- SqlDataReader drData;
+ DataSet dsData; //NpgsqlDataReader drData;
=09
//ToDel: dbLog.WriteToLog(query,"Init Query");
=09
@@ -354,12 +606,12 @@
StringCollection attType =3D new StringCollection( );
ArrayList attId =3D new ArrayList( );
query =3D "";
- while( drAtt.Read( ) )
+ foreach(DataRow drAtt in dtAtt.Rows) // while( drAtt.Read( ) )
{
//Para verificar si un atribito hereda de pertinence
bool isParentPertinence =3D false;
//Si el atributo tiene herencia, verifico si hereda de un pertinence
- if( !drAtt.IsDBNull( 5 ) && (Int32)drAtt["inheritance"] !=3D (Int32)=
MetaModelConsts.EntitiesAttribute )
+ if( drAtt[5] !=3D DBNull.Value && (Int32)drAtt["inheritance"] !=3D (=
Int32)MetaModelConsts.EntitiesAttribute ) //( !drAtt.IsDBNull( 5 ) && (In=
t32)drAtt["inheritance"] !=3D (Int32)MetaModelConsts.EntitiesAttribute )
{
ArrayList idParentList =3D new ArrayList( getInheritance( (Int32)dr=
Att["id"] ) );
if( idParentList.Contains( (Int32)MetaModelConsts.EntitiesPertinenc=
e ) )
@@ -372,10 +624,10 @@
//verifico si el attributo es virtual, si no lo es lo agrego a la co=
nsulta
if( (String)drAtt["typeName"] =3D=3D "pertinence" || isParentPertine=
nce )
{
- SqlDataReader drMetaData;
+ DataTable dtMetaData; // NpgsqlDataReader drMetaData;
//Busco la relacion y donde se encuentra.
string metaQuery =3D (
- @" select co.""sysName"" as ""classOwnerName"",
+ @" select co.""sysName"" as ""classOwnerName"",
co.""id_entity"" as ""classOwnerId"",
a.""sysAttName"" as ""ownerName"",
a.""id_entity"" as ""ownerId"",
@@ -389,59 +641,60 @@
p.id_entity =3D " + drAtt["id"].ToString( ) );
=09
//ToDel: dbLog.c(metaQuery,"pertenence");
- drMetaData =3D (SqlDataReader)conn.doSelect( metaQuery );
- drMetaData.Read( );
+ dtMetaData =3D conn.doSelect( metaQuery ); //(NpgsqlDataReader)con=
n.doSelect( metaQuery );
+ // drMetaData.Read( );
//Recuperamos las tablas con sus respectivos link
- string ownerName =3D drMetaData["ownerName"].ToString( );
- string ownerId =3D drMetaData["ownerId"].ToString( );
- string className =3D drMetaData["classOwnerName"].ToString( );
- string classId =3D drMetaData["classOwnerId"].ToString( );
- string classDName =3D drMetaData["classDestinyName"].ToString( );
- string classDId =3D drMetaData["classDestinyId"].ToString( );
+ string ownerName =3D dtMetaData.Rows[0]["ownerName"].ToString( );
+ string ownerId =3D dtMetaData.Rows[0]["ownerId"].ToString( );
+ string className =3D dtMetaData.Rows[0]["classOwnerName"].ToStrin=
g( );
+ string classId =3D dtMetaData.Rows[0]["classOwnerId"].ToString(=
);
+ string classDName =3D dtMetaData.Rows[0]["classDestinyName"].ToStr=
ing( );
+ string classDId =3D dtMetaData.Rows[0]["classDestinyId"].ToStrin=
g( );
=09
- drMetaData.Close();
+ //dtMetaData.Dispose( );
=09
+ =09
//Obtengo los datos segun el tipo de ralacion.
#region n:m
//Caso n:m
//dbLog.WriteToLog("|"+(String)drMetaData["ratio"]+"|","ratio");
=09
- if( (String)drMetaData["ratio"] =3D=3D "n:m" )
+ if( (String)dtMetaData.Rows[0]["ratio"] =3D=3D "n:m" )
{
//Obtengo las tablas a las cuales se hace referencia
metaQuery =3D mnInfoQuery( classId, ownerId );
=09
//dbLog.WriteToLog(metaQuery,"n:m");
- drMetaData =3D (SqlDataReader)conn.doSelect( metaQuery );
+ dtMetaData =3D conn.doSelect(metaQuery); //drMetaData =3D (Npgsql=
DataReader)conn.doSelect( metaQuery );
=09
- while( drMetaData.Read( ) )
+ foreach(DataRow drMetaData in dtMetaData.Rows) //while( drMetaDat=
a.Read( ) )
{
// Recupero el valor para el atributo
query +=3D ( @" ; select cd.id_entity , cd.""" + drMetaData["disp=
layColumn"] + @"""" +
- @" from """ + drMetaData["classDestinyName"] +
- @"""cd, """ + className + @""" p" +
- @" where p.""" + ownerName + @""" =3D " + idEntity + @" and
+ @" from """ + drMetaData["classDestinyName"] +
+ @"""cd, """ + className + @""" p" +
+ @" where p.""" + ownerName + @""" =3D " + idEntity + @" and
p.""" + drMetaData["attName"] + @""" =3D cd.id_entity" + "\n" );
attType.Add( (String)drAtt["typeName"] );
attId.Add( drAtt["id"] );
}
}
- #endregion
- #region n:1
+ #endregion
+ #region n:1
else // Caso n:1
{
//Obtengo la informacion sobre la tabla a desplegar
string DisplayColumn =3D (String)conn.doScalar(
@"select ""sysAttName""
from attribute
- where ""isPrimary"" =3D true and
+ where ""isPrimary"" =3D 1 and
""classId"" =3D " + classDId );
=09
// Recupero el valor para el atributo
query +=3D ( @" ; select ""to"".id_entity,""to"".""" + DisplayColu=
mn + @"""" +
- @" from """ + className + @""" as owner,
+ @" from """ + className + @""" as owner,
""" + classDName + @""" as ""to"" " +
- @" where owner.""" + ownerName + @""" =3D ""to"".id_entity and
+ @" where owner.""" + ownerName + @""" =3D ""to"".id_entity and
owner.id_entity =3D " + idEntity + "\n" );
attType.Add( (String)drAtt["typeName"] );
attId.Add( drAtt["id"] );
@@ -455,8 +708,8 @@
{
// Recupero el valor para el atributo
query +=3D ( @" ; select """ + drAtt["attName"] + @"""" +
- @" from """ + drAtt["className"] + @"""" +
- @" where ""id_entity"" =3D " + idEntity ...
[truncated message content] |
|
From: <sv...@de...> - 2005-05-21 20:02:22
|
Author: marcelo
Date: 2005-05-21 16:02:10 -0400 (Sat, 21 May 2005)
New Revision: 1127
Modified:
humano2/branches/datareader/core/db/pgsql/pgsqlComplex.cs
Log:
* changes in pgsql/pgsqlComplex.cs to make merge less painfull
Modified: humano2/branches/datareader/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/branches/datareader/core/db/pgsql/pgsqlComplex.cs 2005-05-21 =
00:14:53 UTC (rev 1126)
+++ humano2/branches/datareader/core/db/pgsql/pgsqlComplex.cs 2005-05-21 =
20:02:10 UTC (rev 1127)
@@ -16,12 +16,12 @@
using System.Data;
using System.Text;
=20
-
-
namespace Humano2.Core.Db {
public class pgsqlComplex: absComplex
{
+
public pgsqlComplex(Core c):base(c) { }
+
/// <summary>
/// Entrega un DataTable con los atributos de una clase
/// </summary>
@@ -71,7 +71,7 @@
return res;
}
=20
- public override DataTable getColsforView(int classId)
+ public override DataTable getColsforView(int classId)
{
string query =3D @"select ""id_entity"", ""columns"" from ""view"" wh=
ere ""idClassView"" =3D "+classId+" order by id_entity limit 1";
return doSelect(query);
@@ -98,6 +98,7 @@
return res; =09
}
=09
+
/// <summary>
/// Cambia variables de una clase.
/// </summary>
@@ -610,6 +611,7 @@
{
string query =3D String.Format("select * from \"{0}\" x, entity e whe=
re \"{1}\" =3D {2} and x.id_entity =3D e.id_entity and e.\"delDate\" is n=
ull", tableSysName,
colSysName, valor); =09
+
return doSelect(query);
}
=09
@@ -737,6 +739,7 @@
conn.doCommand(sql);
}
=20
+
/// <summary>
/// Method dumpImportTable
/// </summary>
@@ -953,7 +956,6 @@
=20
return isPrimary;
}
-
override public bool IsSelfLookUp(string sysAttName)
{
string req =3D "select \"isSelfLookup\" from attribute where \"sysAtt=
Name\" =3D '" + sysAttName + "'";
@@ -973,7 +975,6 @@
=20
return IsSelfLookUp;
} =20
-
/// <summary>
/// Get the params (where, orderby etc...) of a view
/// </summary>
@@ -981,6 +982,7 @@
/// <return>params of view in a array</returns>
override public string [] GetParamsView(int id)
{ =20
+
string idStr =3D Convert.ToString(id);
string req =3D "select \"groupby\", \"columns\",\"where\",\"=
order\" from view where id_entity=3D" + idStr;
string [] res =3D new string[4];
@@ -1001,6 +1003,7 @@
return res;
}
=20
+
/// <summary>
/// Get the params (where, orderby etc...) of a report
/// </summary>
@@ -1147,6 +1150,7 @@
=20
public override int ConvertSysAttNameToIdAttName(string sysAttName)
{ =09
+
string req =3D "select \"id_entity\" from attribute where \"sysAttNam=
e\" =3D '" + sysAttName +"'";
int res =3D -1;
DataTable dt =3D doSelect(req);
@@ -1159,6 +1163,7 @@
Logger.Log("ConvertSysAttName: there is no userAttName for sysAttNam=
e: " + sysAttName,LogLevel.Trace);
}
return res; =09
+
}
=20
}
|
|
From: <sv...@de...> - 2005-05-21 00:15:16
|
Author: marcelo
Date: 2005-05-20 20:14:53 -0400 (Fri, 20 May 2005)
New Revision: 1126
Modified:
humano2/branches/datareader/core/db/mssql/mssqlConnection.cs
humano2/branches/datareader/core/db/mssql/mssqlCrud.cs
humano2/branches/datareader/web/portal/site/viewpertinencelist.aspx.cs
Log:
* Fixed bugs in creating pertinence and simplyfied isPrimary functions
Modified: humano2/branches/datareader/core/db/mssql/mssqlConnection.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/branches/datareader/core/db/mssql/mssqlConnection.cs 2005-05-=
20 23:38:39 UTC (rev 1125)
+++ humano2/branches/datareader/core/db/mssql/mssqlConnection.cs 2005-05-=
21 00:14:53 UTC (rev 1126)
@@ -89,6 +89,10 @@
SqlConnection conn =3D ( (SqlConnection) dbCon );
=09
SqlDataAdapter da =3D new SqlDataAdapter(query,conn);
+ if (dbTransRefCount > 0 )
+ {
+ da.SelectCommand.Transaction =3D ( (SqlTransaction) dbTrans) ;
+ }
da.Fill(ds);
da.Dispose();
Close();
Modified: humano2/branches/datareader/core/db/mssql/mssqlCrud.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/branches/datareader/core/db/mssql/mssqlCrud.cs 2005-05-20 23:=
38:39 UTC (rev 1125)
+++ humano2/branches/datareader/core/db/mssql/mssqlCrud.cs 2005-05-21 00:=
14:53 UTC (rev 1126)
@@ -1730,7 +1730,7 @@
override protected void createAttributeInDatabase(string tableName, st=
ring columnName, string columnType)
{
//System.Console.WriteLine(Name + " : " + dataType);
- string sqlCommand =3D String.Format( "alter table {0} add {1} {2}",
+ string sqlCommand =3D String.Format( "alter table {0} add \"{1}\" {2}=
",
tableName, columnName, columnType );
conn.doCommand( sqlCommand );
}
Modified: humano2/branches/datareader/web/portal/site/viewpertinencelist.=
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/branches/datareader/web/portal/site/viewpertinencelist.aspx.c=
s 2005-05-20 23:38:39 UTC (rev 1125)
+++ humano2/branches/datareader/web/portal/site/viewpertinencelist.aspx.c=
s 2005-05-21 00:14:53 UTC (rev 1126)
@@ -164,7 +164,7 @@
//Explicacion de los filtros...
//atributo 67|4|'true' =3D> isPrimary=3D'true'
//atributo 40|4|idClass =3D> classId=3DidClass
- dr["filtros"] =3D "67|4|'true'|1|0;40|4|'"+idClass+"'|0|0";
+ dr["filtros"] =3D "67|4|'1'|1|0;40|4|'"+idClass+"'|0|0";
=09
dtParam.Rows.Add(dr);
=20
|
|
From: <sv...@de...> - 2005-05-20 23:38:56
|
Author: marcelo
Date: 2005-05-20 19:38:39 -0400 (Fri, 20 May 2005)
New Revision: 1125
Modified:
humano2/branches/datareader/components/viewTools/ViewTools.cs
humano2/branches/datareader/components/webTools/Adapter.cs
humano2/branches/datareader/core/db/absComplex.cs
humano2/branches/datareader/core/db/absConnection.cs
humano2/branches/datareader/core/db/absCrud.cs
humano2/branches/datareader/core/db/mssql/mssqlComplex.cs
humano2/branches/datareader/core/db/mssql/mssqlConnection.cs
humano2/branches/datareader/core/db/mssql/mssqlCrud.cs
humano2/branches/datareader/core/db/pgsql/pgsqlComplex.cs
humano2/branches/datareader/core/db/pgsql/pgsqlConnection.cs
humano2/branches/datareader/core/db/pgsql/pgsqlCrud.cs
humano2/branches/datareader/core/schema/mssql/mssql-1-metadata.sql
humano2/branches/datareader/web/builder/site/buildattribute.aspx.cs
Log:
* First mayor commit in making the platform multi DB compliant. not done,=
just commiting in case HD dies
Modified: humano2/branches/datareader/components/viewTools/ViewTools.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/branches/datareader/components/viewTools/ViewTools.cs 2005-05=
-20 23:38:32 UTC (rev 1124)
+++ humano2/branches/datareader/components/viewTools/ViewTools.cs 2005-05=
-20 23:38:39 UTC (rev 1125)
@@ -19,7 +19,6 @@
=20
using Humano2.Core;
using Humano2.Core.Db;
-using Humano2.Core;
=20
namespace Humano2.Components.ViewTools
{
@@ -889,18 +888,22 @@
tableName =3D Complex.TableName(IdClass);
columnName =3D "id_entity";
}
+ int classtype =3D Complex.getClassIdofInstance(columnIndex);
+ if (classtype !=3D 13)
+ {
+ order.Append("upper(" + tableName + "." + columnName + ") ");
=20
- order.Append("upper(" + tableName + "." + columnName + ") ");
- parameter =3D parameters[1].ToString();
- if(parameter =3D=3D "0")
- {
- order.Append("asc ");
+ parameter =3D parameters[1].ToString();
+ if(parameter =3D=3D "0")
+ {
+ order.Append("asc ");
+ }
+ else
+ {
+ order.Append("desc ");
+ }
+ order.Append(", ");
}
- else
- {
- order.Append("desc ");
- }
- order.Append(", ");
}
order.Remove(order.Length-2,2);
order.Append(" ");
Modified: humano2/branches/datareader/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/branches/datareader/components/webTools/Adapter.cs 2005-05-20=
23:38:32 UTC (rev 1124)
+++ humano2/branches/datareader/components/webTools/Adapter.cs 2005-05-20=
23:38:39 UTC (rev 1125)
@@ -1143,7 +1143,7 @@
=09
string[] fila =3D {"0,66", // get id_entity and the names of the colu=
mns.
("34|4|'" + domainId.ToString() + "'|1|0;" + // Where the class is p=
art of the domain.
- "125|4|'f'|0|0"), // The class is not hidden (isHidden is false)
+ "125|4|'0'|0|0"), // The class is not hidden (isHidden is false) /=
/changed to BIT "125|4|'f'|0|0"
"", // No group by
"", // No Havings
"", // No order by
@@ -1414,16 +1414,17 @@
public void SetAttributeAsPrimary(int primaryId, int classId, int d=
omainId)
{
// Remove the isPrimary label from all attributes. =20
- complex.SetNoAttributesAsPrimary(classId);
+ complex.SetAttributeAsPrimary(classId,primaryId);
=20
- DataTable dt =3D new DataTable();
- dt.Columns.Add("isPrimary");
- DataRow dr =3D dt.NewRow();
- dr["isPrimary"] =3D true;
- dt.Rows.Add(dr);
-
- crud.Domain =3D domainId;
- crud.Update(primaryId, dt);
+//
+// DataTable dt =3D new DataTable();
+// dt.Columns.Add("isPrimary");
+// DataRow dr =3D dt.NewRow();
+// dr["isPrimary"] =3D "1";
+// dt.Rows.Add(dr);
+//
+// crud.Domain =3D domainId;
+// crud.Update(primaryId, dt);
}
=20
public bool ClassHasView(int classId)
@@ -1514,8 +1515,8 @@
Logger.Log("ChangeAttributesOfView: ", LogLevel.Trace);
DataTable dt =3D new DataTable();
crud.Domain =3D idDomain;
- string query =3D @"select ""id_entity"", ""columns"" from ""view"" wh=
ere ""idClassView"" =3D "+classId+" order by id_entity limit 1";
- DataTable view =3D complex.doSelect(query);
+
+ DataTable view =3D complex.getColsforView(classId);
=09
string[] row;
string col1=3D"";
Modified: humano2/branches/datareader/core/db/absComplex.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/branches/datareader/core/db/absComplex.cs 2005-05-20 23:38:32=
UTC (rev 1124)
+++ humano2/branches/datareader/core/db/absComplex.cs 2005-05-20 23:38:39=
UTC (rev 1125)
@@ -46,7 +46,8 @@
///<param name=3D"names">The 'name' of classes in the meta model.</par=
am>
abstract public string[] convertAttribSysNameToName(int idEntity=
, string[] names);
=20
- =20
+ abstract public DataTable getColsforView(int classid);
+
/// <summary>
/// Crea una tabla temporal para realizar el paginado de una consulta =
por ViewTools
/// </summary>
@@ -73,7 +74,7 @@
/// Set all of the attributes of the class to isPrimary =3D false.
/// </summary>
/// <param name=3D"classId">The instance Id of the class.</param>
- abstract public void SetNoAttributesAsPrimary(int classId);
+ abstract public void SetAttributeAsPrimary(int classId, int primary=
Id);
=20
/// <summary>
/// Returns the Id of the view that is the default view for this class=
.
Modified: humano2/branches/datareader/core/db/absConnection.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/branches/datareader/core/db/absConnection.cs 2005-05-20 23:38=
:32 UTC (rev 1124)
+++ humano2/branches/datareader/core/db/absConnection.cs 2005-05-20 23:38=
:39 UTC (rev 1125)
@@ -51,6 +51,14 @@
{
return dbCon;
}
+
+ public IDbTransaction getTransactionObj()
+ {
+ if ( dbTransRefCount > 0 )
+ return dbTrans;
+ else=20
+ return null;
+ }
=09
///<summary>Hace un select en la base de datos.</summary>
///<param name=3D"query">El SQL a ejecutarse</param>
@@ -69,6 +77,11 @@
=20
return dt;
}
+
+ virtual public DataSet doSelect(string query, DataSet ds)
+ {
+ return ds;
+ }
=09
///<summary>Realiza comandos en la base de datos que no retornen.</sum=
mary>
///<param name=3D"query">El SQL para la base de datos.</param>
Modified: humano2/branches/datareader/core/db/absCrud.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/branches/datareader/core/db/absCrud.cs 2005-05-20 23:38:32 UT=
C (rev 1124)
+++ humano2/branches/datareader/core/db/absCrud.cs 2005-05-20 23:38:39 UT=
C (rev 1125)
@@ -135,7 +135,6 @@
///<exception cref=3D"DataTableException">El datatable es en formato i=
ncorrecto.</exception>
virtual public int Create(int idEntityType, DataTable data)
{
- conn.BeginTransaction();
checkDataTableSingleRow(data);
DataSet structure =3D readTypeStructure(idEntityType);
=09
@@ -143,6 +142,7 @@
DataSet dataset =3D new DataSet();
dataset.Tables.Add(data);
=09
+ conn.BeginTransaction();
ArrayList idEntities =3D createAccordingToType(idEntityType, structur=
e, "main", dataset);
conn.Commit();
return Convert.ToInt32(idEntities[0]);
@@ -206,13 +206,10 @@
///<exception cref=3D"Humano2.Core.Db.SystemDataImmutableException">Cu=
ando un ID es parte del modelo base y no puede ser eliminado.</exception>
virtual public int Update(int idEntity, DataSet data, bool allowDelete=
d)
{
- conn.BeginTransaction();
=09
checkDataSet(data);
=20
int changedColNr =3D updateAccordingToType(idEntity, data);
-
- conn.Commit();
return changedColNr;
}
=09
@@ -474,7 +471,7 @@
///<exception cref=3D"DataTableException">El datatable es en formato i=
ncorrecto.</exception>
protected DataSet createAttributeSetDefaults(DataRow workRow, DataSet =
typeStr, string baseAttributeType)
{
- int newAttribId =3D getUniqueId();
+ //int newAttribId =3D getUniqueId();
=09
if(!workRow.Table.Columns.Contains("classId"))
{
@@ -489,12 +486,12 @@
//Si no tiene attibutos, por defecto isPrimary deber ser true.
if(numberOfAttributesInClass(ds, classId) =3D=3D 0)
{
- addMissingColumnToDataTable(workRow, "isPrimary", true);
+ addMissingColumnToDataTable(workRow, "isPrimary", "1");
} else {
- addMissingColumnToDataTable(workRow, "isPrimary", false);
+ addMissingColumnToDataTable(workRow, "isPrimary", "0");
}
//Agrega el nombre fisico de la columna al DataTable.
- addMissingColumnToDataTable(workRow, "sysAttName", genColumnSysName(n=
ewAttribId));
+ addMissingColumnToDataTable(workRow, "sysAttName", genColumnSysName(c=
lassId,workRow["attName"].ToString()));
=20
// Switch sobre los diferentes tipos de datos basicos.
// Si no dan algunas valores, setealos al por defecto.
@@ -534,7 +531,7 @@
///<summary>Setup autogenerated values and test for data concistency f=
or a </summary>
///<exception cref=3D"DataTableException">El datatable es en formato i=
ncorrecto.</exception>
protected void createClassSetup(DataRow workRow) {
- int newClassId =3D getUniqueId();
+ //int newClassId =3D getUniqueId();
=09
if(!workRow.Table.Columns.Contains("parentId"))
{
@@ -547,7 +544,7 @@
=09
//Agregar datos que son fijos/generado por el systema.
addMissingColumnToDataTable(workRow, "classType", (int) MetaModelCons=
ts.classTypeSolucionData);
- addMissingColumnToDataTable(workRow, "sysName", genTableSysName(Domai=
n, newClassId));
+ addMissingColumnToDataTable(workRow, "sysName", genTableSysName(Domai=
n, workRow["name"].ToString()));
}
=20
///<summary>Agrega una columna a un datatable</summary>
@@ -624,6 +621,8 @@
}
=09
int idEntity =3D createEntity(idEntityType);
+
+ // call addMissingColumnToDataTable(workRow, "sysName", genTableSysNam=
e(Domain, idEntity));
for(int t =3D 0; t < instNames.Count; t++)
{
=09
@@ -740,6 +739,7 @@
=09
//System.Console.WriteLine("WorkRow Selected");
=09
+ conn.BeginTransaction();
if( isAttribute(structure) )
{
updateAttribute(idEntity, workRow, currentData, clsId, structure);
@@ -750,7 +750,7 @@
changedColsNr =3D updateInstance(idEntity, workRow, data, currentData=
, clsId, structure);
=20
//System.Console.WriteLine("Post update instance.");
- =09
+ conn.Commit();
return changedColsNr;
}
=09
@@ -1161,7 +1161,7 @@
instValues.Add(new ArrayList());
}
=09
- // See if the column modDate exists. if it is not set, set it to now(=
)
+ // See if the column modDate exists. if it is not set, set it to getd=
ate()
string delDateName =3D escapeColumn("modDate");
int delDateIndex =3D ((ArrayList) instColumns[entityIndex]).IndexOf(d=
elDateName);
if( delDateIndex =3D=3D -1)
@@ -1531,17 +1531,21 @@
}
=09
///<summary>generate the fisical table sysName in the database</summar=
y>
- protected string genTableSysName(int domainId, int idEntity)
+ protected string genTableSysName(int domainId, string className)
{
+ string classSysName;
+ classSysName =3D genClassSysName(domainId, className);
//Mas uno para cuadrar idEntity con tableName.
- return String.Format("d{0}c{1}", domainId, idEntity+1);
+ return classSysName;
}
=20
///<summary>generate the fisical column sysName in the database</summa=
ry>
- protected string genColumnSysName(int idEntity)
+ protected string genColumnSysName(int classID, string attName)
{
+ string attSysName;
+ attSysName =3D genAttSysName(classID, attName);
//Mas uno para cuadrar idEntity con la nombre de column fisica.
- return String.Format("col{0}", idEntity+1);
+ return attSysName;
}
=09
///<summary>generate the column name for a temporary column.</summary>
@@ -1576,6 +1580,10 @@
///<returns>A unique Id.</returns>
abstract protected int getUniqueId();
=20
+ abstract protected string genClassSysName(int domainId, string classNa=
me);
+
+ abstract protected string genAttSysName(int classId, string attName);
+
///<summary>Create a new instance in the MetaModel.</summary>
///<remarks>This is a support function, use create to properly create =
an instance.</remarks>
///<param name=3D"clsId">The entityId of the class of the to be create=
d instance.</param>
Modified: humano2/branches/datareader/core/db/mssql/mssqlComplex.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/branches/datareader/core/db/mssql/mssqlComplex.cs 2005-05-20 =
23:38:32 UTC (rev 1124)
+++ humano2/branches/datareader/core/db/mssql/mssqlComplex.cs 2005-05-20 =
23:38:39 UTC (rev 1125)
@@ -53,7 +53,6 @@
a.""classId"" =3D " + classId.ToString() + @" order by a.""order"=
", a.""attName""";
=09
res =3D this.doSelect(query);
-
return res;
}
=20
@@ -69,10 +68,14 @@
=09
query =3D @"select name from class where id_entity =3D " + classId.To=
String(); =09
res =3D this.doSelect(query);
-
return res;
}
=20
+ public override DataTable getColsforView(int classId)
+ {
+ string query =3D @"select top 1 ""id_entity"", ""columns"" from ""vie=
w"" where ""idClassView"" =3D "+classId+" order by id_entity";
+ return doSelect(query);
+ }
///<summary>Get the structure of a view.</summary>
///<param name=3D"viewId">The id of the view.</param>
///<returns>a datatable with the information about the view.</returns>
@@ -81,7 +84,6 @@
string query =3D "select id_entity, \"columns\", \"where\", \"groupby=
\", \"having\", \"order\", \"idClassView\", \"viewName\" "+=20
"from \"view\" where id_entity =3D " + viewId;
DataTable res =3D this.doSelect(query);
-
return res; =09
}
=09
@@ -165,7 +167,7 @@
from class c, entity e
where
c.id_entity =3D e.id_entity and
- c.""isHidden"" =3D 'f' and
+ c.""isHidden"" =3D '0' and
e.""delDate"" is null and
e.""domainId"" in (" + domain.ToString() + @", 10) order by c.""c=
lassType"" DESC, c.name";
=09
@@ -258,7 +260,7 @@
=09
NameValueCollection res =3D new NameValueCollection();
=09
- foreach (DataRow tblRow in data.Rows)
+ foreach (DataRow tblRow in data.Rows)
{
string key =3D tblRow[0].ToString();
string value =3D tblRow[1].ToString();
@@ -275,7 +277,7 @@
/// <returns>number of views. 0 if no views are asociated.</returns>
public override int NumberOfViewsForClass(int classId)
{
- string query =3D "select count(id_entity) from view where \"idClassVi=
ew\" =3D " + classId;
+ string query =3D "select count(id_entity) from [view] where \"idClass=
View\" =3D " + classId;
return Convert.ToInt32( doScalar( query ) );
}
=09
@@ -283,11 +285,16 @@
/// Set all of the attributes of the class to isPrimary =3D false.
/// </summary>
/// <param name=3D"classId">The instance Id of the class.</param>
- public override void SetNoAttributesAsPrimary(int classId)
+ public override void SetAttributeAsPrimary(int classId, int primary=
Id)
{
- string query =3D "update attribute set \"isPrimary\" =3D 'f' where=
\"classId\" =3D "+classId;
- conn.doCommand(query);
- }
+ string query =3D "update attribute set \"isPrimary\" =3D '0' where \"=
classId\" =3D "+classId;
+ conn.doCommand(query);
+ if (primaryId !=3D 0)
+ {
+ query =3D "update attribute set \"isPrimary\" =3D '1' where \"id_en=
tity\" =3D "+primaryId;
+ conn.doCommand(query);
+ }
+ }
=20
/// <summary>
/// Returns the Id of the view that is the default view for this class=
.
@@ -296,7 +303,7 @@
/// <returns>the id of the view that should be shown.</returns>
public override int getDefaultViewId(int classId)
{
- string query =3D "select \"id_entity\" from view where \"where\" is n=
ull and \"idClassView\" =3D " + classId;
+ string query =3D "select \"id_entity\" from [view] where \"where\" is=
null and \"idClassView\" =3D " + classId;
return Convert.ToInt32( doScalar( query ) );
}
=09
@@ -342,11 +349,15 @@
}
=20
string tName;
- string strSql =3D "SELECT c.sysName, c.id_entity, c.parentId " +
- "FROM entity e, class c " +=20
- "WHERE e.id_entity=3D" + colId + " " +
- "AND e.class=3Dc.id_entity";
- DataTable dt =3D conn.doSelect(strSql);
+ DataTable dt =3D this.doSelect(
+ @"select
+ class.""sysName"",
+ class.id_entity,
+ class.""parentId""
+ from entity, class
+ where
+ entity.id_entity =3D " + colId + @" and
+ entity.class =3D class.id_entity");
=09
if(dt.Rows.Count>0)
{=09
@@ -356,7 +367,7 @@
}
else
{
- tName =3D InstanceType(Convert.ToInt32(dt.Rows[0]["id_entity"]));
+ tName =3D InstanceType(Convert.ToInt32(dt.Rows[0]["parentId"]));
}
}
else
@@ -368,6 +379,7 @@
Logger.Log("InstanceType Add("+colId+","+tName+")", LogLevel.Trace);
cache.InstanceTypeCache.Add(colId,tName);
}
+ dt.Dispose();
return tName;
}
=20
@@ -377,23 +389,30 @@
string[] var;
string name;
string type;
+ int loop;
=09
tableName =3D "tempTable" + System.Guid.NewGuid().ToString();
tableName =3D tableName.Replace("-","");
=09
table.Append("drop table "+ tableName + ";");
- =09
- table.Append("create temp table "+ tableName +" (");
+ table.Append("select max(\"row\") from "+ tableName + ";");
+ table.Append("create table dbo."+ tableName +" (");
+ loop =3D 0;
foreach(string col in args)
{
var =3D col.Split(",".ToCharArray());
- name =3D var[0].Replace(".","_");
- name =3D name.Replace("\"","");
- name =3D "\"" + name + "\"";
+ name =3D var[0];
+ name =3D name.Substring(name.IndexOf(".")+1);
+ if ((loop > 0) && (name =3D=3D "id_entity")) name =3D name + loop.To=
String();
+ //name =3D var[0].Replace(".","_");
+ //name =3D name.Replace("\"","");
+ //name =3D "\"" + name + "\"";
type =3D core.Crud.AttributeTypeMapping(var[2].ToString());
+ if (type =3D=3D null) type =3D var[2].ToString();
table.Append(name + " " + type + ",");
+ loop++;
}
- table.Append("row serial);\n");
+ table.Append("\"row\" Serial);\n");
table.Append("insert into " + tableName + " (" );
=09
return table.ToString();
@@ -416,19 +435,13 @@
}
=09
string tName;
-// tName =3Dconn.doScalar(
-// @"select c."sysName"
-// from class c,attribute a
-// where (c.id_entity =3D a."classId"" and
-// a.id_entity =3D " + id + @") or
-// c.id_entity =3D " + id + @"
-// GROUP BY c.""sysName""").ToString();
- string strSql =3D "SELECT c.sysName " +=20
- "FROM class c, attribute a " +=20
- "WHERE (c.id_entity=3Da.classId AND a.id_entity=3D" + id + ") " +
- "OR c.id_entity=3D" + id + " " +=20
- "GROUP BY c.sysName";
- tName =3D conn.doScalar(strSql).ToString();
+ tName =3Dconn.doScalar(
+ @"select c.""sysName""
+ from class c,attribute a
+ where (c.id_entity =3D a.""classId"" and
+ a.id_entity =3D " + id + @") or
+ c.id_entity =3D " + id + @"
+ GROUP BY c.""sysName""").ToString();
=20
//Logger.Log("TableNameClean Add("+id+","+tName+")", LogLevel.Trace);
cache.TableNameCache.Add(id,tName);
@@ -551,7 +564,6 @@
a.id_entity =3D p.id_entity and
p.""parentPertinence"" =3D " + idColumn.ToString() + @" and
a.""classId"" =3D (select ""to"" from ""pertinence"" where ""perti=
nence"".id_entity =3D " + idColumn.ToString() + @")");
-
DataTable res =3D new DataTable();
DataColumn col =3D new DataColumn("index");
res.Columns.Add(col);
@@ -563,9 +575,9 @@
res.Columns.Add(col);
=20
int i =3D 1;
- foreach (DataRow tblRow in dt.Rows)
+ foreach(DataRow dbRow in dt.Rows)
{
- string[] row =3D {i.ToString(),tblRow[0].ToString(),tblRow[1].ToStri=
ng(),tblRow[2].ToString()};
+ string[] row =3D {i.ToString(),dbRow[0].ToString(),dbRow[1].ToString=
(),dbRow[2].ToString()};
res.Rows.Add(row);
i++;
}
@@ -583,7 +595,6 @@
res =3D GetNMRelations(Convert.ToInt32(dt.Rows[0][0]));
}
}
-
return res;
}
=20
@@ -598,9 +609,7 @@
{
string query =3D String.Format("select * from \"{0}\" x, entity e whe=
re \"{1}\" =3D {2} and x.id_entity =3D e.id_entity and e.\"delDate\" is n=
ull", tableSysName,
colSysName, valor);
- =09
- DataTable dt =3D doSelect(query);=20
- return dt;
+ return doSelect(query);
}
=09
///<summary>Testea si es una clase definicio</summary>
@@ -616,42 +625,55 @@
return false;
}
=09
- ///<summary>Convierta los 'attName' a los 'sysAttName' de un class</su=
mmary>
- ///<param name=3D"idEntity">Id del class cual contiene los columnnames=
</param>
- ///<param name=3D"names">Nombres con 'attName' de las columnas.</param=
>
- ///<returns>Las nombres 'attSysName' en el mismo orden que se ingreso =
'attName'.</returns>
+ ///<summary>Converts the 'attName' to the 'sysAttName' of a class</sum=
mary>
+ ///<param name=3D"idEntity">Id of class that contains the columnnames<=
/param>
+ ///<param name=3D"names">Names with 'attName' of the columns.</param>
+ ///<returns>The names 'attSysName' in the same order than the order of=
insertion in 'attName'.</returns>
override public string[] convertAttribNameToSysName(int idEntity, stri=
ng[] names)
{
- string namesList =3D utils.ConcatForSqlIn(names);
- string query =3D String.Format("select \"attName\", \"sysAttName\" fr=
om attribute where \"classId\" =3D {0} and \"attName\" in ({1})",
- idEntity, namesList);
- =09
- DataTable data =3D conn.doSelect(query);
- =09
- string[] sysNames =3D new string[names.Length];
- // camina sobre los resultados, y devuelve los "sysName" en el mismo =
orden de cual recibimos los "name"
- foreach (DataRow tblRow in data.Rows)
- {
- for(int i =3D 0; i < names.Length; i++)
- {
- if( names[i] =3D=3D Convert.ToString(tblRow["attName"]) )
- {
- sysNames[i] =3D Convert.ToString(tblRow["sysAttName"]);
- break;
- }
- }
- }
-=20
- return sysNames;
+ return convertAttrib(idEntity, names, "attName", "sysAttName");
}
- =20
- =20
- //TODO look at pgsql version
- override public string[] convertAttribSysNameToName(int =
idEntity, string[] names)
- {
- return null;
- }
+ =20
+ ///<summary>Converts the 'sysAttName' to the 'attName' o=
f a class</summary>
+ override public string[] convertAttribSysNameToName(int idEntity, stri=
ng[] names)
+ {
+ return convertAttrib(idEntity, names, "sysAttName", "attName");
+ }
=20
+ ///<summary>Convert the 'from' to the 'to' (name of attr=
ibute ) in the class.</summary>
+ ///<param name=3D"idEntity">Id of class that contains the columnnames<=
/param>
+ ///<param name=3D"names">Names with 'from' of the columns.</param>
+ ///<returns>The names 'to' in the same order than the order of inserti=
on in 'from'.</returns>
+ private string [] convertAttrib(int idEntity, string [] names, =
string from, string to)
+ {
+ string namesList =3D utils.ConcatForSqlIn(names);
+ string query =3D String.Format( "select \""=20
+ + to =20
+ + "\",\""
+ + from=20
+ + "\" from attribute where =
\""=20
+ + from + "\" in ({0})",
+ namesList);
+ =20
+ //Console.Write("query: " + query +"\n");
+ DataTable res =3D conn.doSelect(query);
+ =20
+ string[] resNames =3D new string[names.Length];
+ // camina sobre los resultados, y devuelve los "sysName" en=
el mismo orden de cual recibimos los "name"
+ foreach(DataRow dbRow in res.Rows)
+ {
+ for(int i =3D 0; i < names.Length; i++)
+ {
+ if( names[i] =3D=3D Convert.ToString(dbRow[from]) )
+ {
+ resNames[i] =3D Convert.ToString(dbRow[to]);
+ break;
+ }
+ }
+ }
+ return resNames;
+ }
+
///<summary>Devuelve la nombre de la tabla donde se guarde los datos.<=
/summary>
///<param name=3D"idEntity">El id del entity</param>
///<returns>Nombre de la tabla.</returns>
@@ -670,6 +692,7 @@
}
=20
#region Import flat file functions
+
/// <summary>creates the table which will be used to red from for the =
import process.</summary>
/// <param name=3D"colDefs">2 dimensional array wich contains Column n=
ame/Column definition.</param>
/// <param name=3D"tableName">The name of the table to be created.</pa=
ram>
@@ -677,7 +700,7 @@
{
string sql;
int i;
- sql =3D "create table \"" + tableName +"\" (\r\n";
+ sql =3D "create table dbo.\"" + tableName +"\" (\r\n";
for (i=3D0;i<colDefs.Length/3;i++)
{
sql =3D sql + "\"" + colDefs[i,1] + "\" " + colDefs[i,0] +",\r\n";
@@ -696,7 +719,7 @@
string sql =3D "update \"" + tableName +"\" set id_entity =3D null";
conn.doCommand(sql);
=20
- sql =3D "alter table \"" + tableName +"\" add column h2anchor Varchar=
(36) null";
+ sql =3D "alter table \"" + tableName +"\" add h2anchor Varchar(36) n=
ull";
conn.doCommand(sql);
}
=20
@@ -706,10 +729,10 @@
/// <param name=3D"tableName">A string</param>
override public void addIDCol(string tableName)
{
- string sql =3D "alter table \"" + tableName +"\" add column id_entity=
numeric null";
+ string sql =3D "alter table \"" + tableName +"\" add id_entity numer=
ic null";
conn.doCommand(sql);
=20
- sql =3D "alter table \"" + tableName +"\" add column h2anchor Varchar=
(36) null";
+ sql =3D "alter table \"" + tableName +"\" add h2anchor Varchar(36) n=
ull";
conn.doCommand(sql);
}
=20
@@ -745,7 +768,7 @@
override public void resolveSimplePertinence(string tableName, string =
tblCol, string classTableName, string attDisp)
{
string sql =3D "BEGIN;\r\n";
- sql =3D sql + "alter table \"" + tableName + "\" add column \"" + tbl=
Col +"h2ID\" integer null;\r\n";
+ sql =3D sql + "alter table \"" + tableName + "\" add \"" + tblCol +"=
h2ID\" integer null;\r\n";
sql =3D sql + "update \"" + tableName + "\" set \"" + tblCol +"h2ID\"=
=3D \"" + classTableName +"\".id_entity "
+ " from \"" + classTableName +"\" where \"" + tableName + "\".\"" +=
tblCol+"\" =3D \"" + classTableName +"\"." +attDisp+";\r\n";
sql =3D sql + "COMMIT;\r\n";
@@ -811,13 +834,11 @@
conn.BeginTransaction();
=20
string sql =3D "insert into entity (\"domainId\", class, \"createDate=
\", \"modDate\",status) " +
- " select " + domainId + "," + classId +", now(),now(), h2anchor from=
\"" +tableName +"\"; \r\n";
+ " select " + domainId + "," + classId +", getdate(),getdate(), h2anc=
hor from \"" +tableName +"\"; \r\n";
=20
sql =3D sql + "update \"" + tableName + "\" set id_entity =3D entity.=
id_entity " +
"from entity where \"" + tableName + "\".h2anchor =3D entity.status;=
\r\n";
=09
-
-
for (int i=3D0;i<clasesArr.Length/2;i++)
{
sql =3D sql + clasesArr[i,0] + "\r\n\t" + clasesArr[i,1] + "\r\n" ;
@@ -873,7 +894,17 @@
/// <return>The attribute of the pertinence attribute or "" if a=
ttributeId is not a pertinence attribute</returns>
override public string GetPertinenceForAttribute(string attribut=
eId)
{
- return "";
+ string req =3D "select \"id_entity\" from attribute where \"=
classId\" in (select \"to\" from pertinence where id_entity =3D " + Conve=
rt.ToInt32(attributeId) + ")";
+ =20
+ DataTable dt =3D doSelect(req);
+ if( (dt =3D=3D null) || (dt.Rows.Count =3D=3D 0))
+ {
+ return ""; =20
+ }
+ else
+ {
+ return Convert.ToString(dt.Rows[0]["id_entity"]); //Get =
the pertinence attribute
+ }
}
=20
/// <summary>
@@ -883,7 +914,18 @@
/// <return>user attribute name</returns>
override public string ConvertSysAttNameToUserAttName(string sys=
AttName)
{
- return "";
+ string req =3D "select \"attName\" from attribute where \"sy=
sAttName\" =3D '" + sysAttName +"'";
+ string res =3D "";
+ DataTable dt =3D doSelect(req);
+ try
+ {
+ res =3D Convert.ToString(dt.Rows[0]["attName"]);
+ }
+ catch
+ {
+ Logger.Log("ConvertSysAttName: there is no userAttName f=
or sysAttName: " + sysAttName,LogLevel.Trace);
+ }
+ return res;
}
=20
/// <summary>
@@ -893,14 +935,42 @@
/// <return>true if attribute is primary</returns>
override public bool IsPrimary(string sysAttName)
{
- return false; =20
+ string req =3D "select \"isPrimary\" from attribute where \"=
sysAttName\" =3D '" + sysAttName + "'";
+ string res =3D "";
+ DataTable dt =3D doSelect(req);
+ try
+ {
+ res =3D Convert.ToString(dt.Rows[0]["isPrimary"]);
+ }
+ catch
+ {
+ //Logger.Log("IsPrimary: problem when executing query fo=
r isPrimary flag ",LogLevel.Trace);
+ }
+ =20
+ //Logger.Log("IsPrimary: res=3D " + res,LogLevel.Trace);
+ bool isPrimary =3D (res =3D=3D "1");
+ =20
+ return isPrimary;
}
=20
override public bool IsSelfLookUp(string sysAttName)
{
- bool isPrimary =3D true;
+ string req =3D "select \"isSelfLookup\" from attribute where \"sysAtt=
Name\" =3D '" + sysAttName + "'";
+ string res =3D "";
+ DataTable dt =3D doSelect(req);
+ try
+ {
+ res =3D Convert.ToString(dt.Rows[0]["isSelfLookup"]);
+ }
+ catch
+ {
+ //Logger.Log("isSelfLookup: problem when executing query for isSelfL=
ookup flag ",LogLevel.Trace);
+ }
=20
- return isPrimary;
+ //Logger.Log("isSelfLookup: res=3D " + res,LogLevel.Trace);
+ bool IsSelfLookUp =3D (res =3D=3D "True");
+ =20
+ return IsSelfLookUp;
}
=20
/// <summary>
@@ -910,7 +980,24 @@
/// <return>true if attribute is primary</returns>
override public string [] GetParamsView(int id)
{
- return null; =20
+ string idStr =3D Convert.ToString(id);
+ string req =3D "select \"groupby\", \"columns\",\"where\",\"=
order\" from [view] where id_entity=3D" + idStr;
+ string [] res =3D new string[4];
+ =20
+ DataTable dt =3D doSelect(req);
+ try
+ {
+ res[0] =3D Convert.ToString(dt.Rows[0]["columns"]);
+ res[1] =3D Convert.ToString(dt.Rows[0]["where"]);
+ res[2] =3D Convert.ToString(dt.Rows[0]["order"]);
+ res[3] =3D Convert.ToString(dt.Rows[0]["groupby"]);
+ }
+ catch
+ {
+ Logger.Log("GetParamsView: failed query ",LogLevel.Trac=
e);
+ }
+ =20
+ return res;
}
=20
/// <summary>
@@ -920,7 +1007,25 @@
/// <return>params of the report</returns>
override public string [] GetParamsReport(int id)
{
- return null; =20
+ string idStr =3D Convert.ToString(id);
+ string req =3D "select \"columns\",\"where\",\"order\",\"gr=
oupby\",\"having\",\"idClassReport\" from report where id_entity=3D" + id=
Str;
+ string [] res =3D new string[6];
+ =20
+ DataTable dt =3D doSelect(req);
+ try
+ {
+ res[0] =3D Convert.ToString(dt.Rows[0]["columns"]);
+ res[1] =3D Convert.ToString(dt.Rows[0]["where"]);
+ res[2] =3D Convert.ToString(dt.Rows[0]["order"]);
+ res[3] =3D Convert.ToString(dt.Rows[0]["groupby"]);
+ res[4] =3D Convert.ToString(dt.Rows[0]["having"]);
+ res[5] =3D Convert.ToString(dt.Rows[0]["idClassReport"])=
;
+ }
+ catch
+ {
+ Logger.Log("GetParams Report: failed query ",LogLevel.T=
race);
+ }
+ return res;
}
=20
/// <summary>
@@ -940,17 +1045,17 @@
ArrayList alterSql =3D new ArrayList();
=20
int i =3D0;
- foreach (DataRow tblRow in tmpTable.Rows)
+ foreach(DataRow dRow in tmpTable.Rows)
{
- int attribClass =3D Convert.ToInt32(tblRow[classIdCol[0]]);
- string colname =3D tblRow[classIdCol[0]].ToString();
+ int attribClass =3D Convert.ToInt32(dRow[classIdCol[0]]);
+ string colname =3D dRow[classIdCol[0]].ToString();
string classTable =3D getTableName(attribClass);
switch (classId)
{
case(8): //attribute
//this atribute should be obtained from the tmpReader
int max =3D 50;
- alterSql.Add("alter table \"" + classTable +"\" add column \"" + t=
blRow[classIdCol[1]] + "\" Varchar(" + max + ") null");
+ alterSql.Add("alter table \"" + classTable +"\" add \"" + dRow[cl=
assIdCol[1]] + "\" Varchar(" + max + ") null");
break;
case(87): //currency:
case(9): //numeric
@@ -959,9 +1064,9 @@
int rightSide =3D 2;
int ttlSize =3D leftSide + rightSide;
if (rightSide =3D=3D 0)
- alterSql.Add("alter table \"" + classTable +"\" add column \"" + =
tblRow[classIdCol[1]] + "\" Integer null");
+ alterSql.Add("alter table \"" + classTable +"\" add \"" + dRow[c=
lassIdCol[1]] + "\" Integer null");
else
- alterSql.Add("alter table \"" + classTable +"\" add column \"" + =
tblRow[classIdCol[1]] + "\" Numeric("+ttlSize+","+rightSide+") null");
+ alterSql.Add("alter table \"" + classTable +"\" add \"" + dRow[c=
lassIdCol[1]] + "\" Numeric("+ttlSize+","+rightSide+") null");
break;
}
=20
@@ -974,6 +1079,7 @@
}
=20
#endregion=09
+
/// <summary>
/// Method buildTable
/// </summary>
@@ -1000,12 +1106,17 @@
return dt;
}
=20
+ /// <summary>
+ /// Get all class depending for the class
+ /// </summary>
+ /// <param name=3D"id_entity"></param>
+ /// <returns></returns>
public override DataTable getPertinenceByIdClass(int id_entity)
{
string query;
DataTable res;
=09
- query =3D @"select=20
+ query =3D @"select distinct
c.id_entity,c.name=20
from=20
pertinence p=20
@@ -1023,10 +1134,10 @@
string query;
DataTable res;
=09
- query =3D @"select * from attribute a
+ query =3D @"select a.id_entity from attribute a
inner join class c on c.""id_entity"" =3D a.""classId""
inner join pertinence p on p.""owner""=3Da.""id_entity""
- where a.""classId""=3D" + id_entity.ToString();
+ where a.""classId""=3D" + id_entity.ToString() + @" and p.""to"" =3D=
" + from ;
=09
res =3D this.doSelect(query);
return res;
@@ -1035,9 +1146,19 @@
=20
public override int ConvertSysAttNameToIdAttName(string sysAttName)
{
- return -1;
- }
+ string req =3D "select \"id_entity\" from attribute where \"sysAttNam=
e\" =3D '" + sysAttName +"'";
+ int res =3D -1;
+ DataTable dt =3D doSelect(req);
+ try
+ {
+ res =3D Convert.ToInt32(dt.Rows[0]["id_entity"]);
+ }
+ catch
+ {
+ Logger.Log("ConvertSysAttName: there is no userAttName for sysAttNam=
e: " + sysAttName,LogLevel.Trace);
+ }
+ return res;
+ } =20
=20
- =20
}
}
Modified: humano2/branches/datareader/core/db/mssql/mssqlConnection.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/branches/datareader/core/db/mssql/mssqlConnection.cs 2005-05-=
20 23:38:32 UTC (rev 1124)
+++ humano2/branches/datareader/core/db/mssql/mssqlConnection.cs 2005-05-=
20 23:38:39 UTC (rev 1125)
@@ -21,6 +21,9 @@
public class mssqlConnection: absConnection
{
public mssqlConnection() : base() { }
+
+// protected SqlTransaction dbTrans =3D null;
+
///<summary>
///Conecta con la base de datos. Esta funcion deja dbCon con
///una connection a la base datos lista para ser utilizada.
@@ -33,6 +36,17 @@
return c;
}
=09
+// override public void BeginTransaction()
+// {
+// if(dbTransRefCount =3D=3D 0)
+// {
+// Open();
+// //System.Console.WriteLine( "Beginning transaccion." );
+// dbTrans =3D dbCon.BeginTransaction();
+// }
+// dbTransRefCount++;
+// }
+//
///<summary>Hace un select en la base de datos.</summary>
///<param name=3D"query">El SQL a ejecutarse</param>
///<returns>Los resultado del select</returns>
@@ -46,11 +60,17 @@
Humano2.Core.Db.DbUtils du =3D new DbUtils();
DataTable dt =3D new DataTable();
=09
- try=20
+ try=20
{
dbCmd.CommandText =3D query;
+ if (dbTransRefCount > 0 )
+ {
+ dbCmd.Transaction =3D ( (SqlTransaction) dbTrans) ;
+ }
SqlDataReader res =3D dbCmd.ExecuteReader( );
du.IDbReader2DataTable(dt, res);
+ res.Close();
+ dbCmd.Dispose();
Close();
return dt;
}
@@ -63,6 +83,19 @@
=20
}
=09
+ override public DataSet doSelect(string query,DataSet ds)
+ {
+ Open();
+ SqlConnection conn =3D ( (SqlConnection) dbCon );
+ =09
+ SqlDataAdapter da =3D new SqlDataAdapter(query,conn);
+ da.Fill(ds);
+ da.Dispose();
+ Close();
+ return ds;
+
+ }
+
///<summary>Realiza comandos en la base de datos que no retornen.</sum=
mary>
///<param name=3D"query">El SQL para la base de datos.</param>
///<returns>Cantidad de filas afectado por el comando.</returns>
@@ -74,7 +107,22 @@
SqlConnection conn =3D ( (SqlConnection) dbCon );
SqlCommand dbCmd =3D conn.CreateCommand( );
dbCmd.CommandText =3D query;
- int res =3D dbCmd.ExecuteNonQuery( );
+ if (dbTransRefCount > 0 )
+ {
+ dbCmd.Transaction =3D ( (SqlTransaction) dbTrans) ;
+ }
+ int res ;
+ try=20
+ {
+ res =3D dbCmd.ExecuteNonQuery( );
+ }
+ catch(Exception ex)
+ {
+ Logger.Log("Error executing query:\r\n" + query, LogLevel.Trace);
+ throw new Exception("Error executing query:\r\n" + query + "\n\r" +e=
x.Message,ex.InnerException);
+ }
+
+ dbCmd.Dispose();
Close();
return res;
}
@@ -89,16 +137,34 @@
Open();
SqlConnection conn =3D ( (SqlConnection) dbCon );
SqlCommand dbCmd =3D conn.CreateCommand( );
+ =09
dbCmd.CommandText =3D query;
- IDataReader dr =3D dbCmd.ExecuteReader( );
+ if (dbTransRefCount > 0 )
+ {
+ dbCmd.Transaction =3D ( (SqlTransaction) dbTrans) ;
+ }
+ SqlDataReader dr ;
+ try=20
+ {
+ dr =3D dbCmd.ExecuteReader( );
+ }
+ catch(Exception ex)
+ {
+ Logger.Log("Error executing query:\r\n" + query, LogLevel.Trace);
+ throw new Exception("Error executing query:\r\n" + query + "\n\r" +e=
x.Message,ex.InnerException);
+ }
//Close();
=09
if( dr.Read( ) && !Convert.IsDBNull( dr[0] ) )
{
tmpObj =3D dr[0];
+ dr.Close();
+ dbCmd.Dispose();
Close();
return tmpObj;
}
+ dr.Close();
+ dbCmd.Dispose();
Close();
return null;
}
@@ -140,8 +206,8 @@
/// <param name=3D"attsArr">A string[,]</param>
virtual public void fillTable(DataTable srcTable, string fillTable, Da=
taSet dsAtts, string[,] attsArr)
{
- SqlConnection conn =3D ( (SqlConnection) dbCon );
- =09
+ Open();
+ SqlConnection conn =3D ( (SqlConnection) dbCon );=09
SqlDataAdapter da =3D new SqlDataAdapter ( );
DataTable tgtTable =3D new DataTable( );
DataSet ds =3D new DataSet( );
@@ -185,10 +251,13 @@
=09
tgtTable.TableName =3D fillTable;
tgtTable =3D srcTable.Copy( );
+ SqlCommandBuilder SqlCB =3D new SqlCommandBuilder( da );
da.Fill( tgtTable );
tgtTable =3D srcTable.Copy( );
ds.Tables.Add( tgtTable );
+ string strXml =3D ds.GetXml( );
da.Update( tgtTable );
+ Close();
}
=09
///<summary>Recibe las opciones de Config y genera el connection strin=
g.</summary>
Modified: humano2/branches/datareader/core/db/mssql/mssqlCrud.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/branches/datareader/core/db/mssql/mssqlCrud.cs 2005-05-20 23:=
38:32 UTC (rev 1124)
+++ humano2/branches/datareader/core/db/mssql/mssqlCrud.cs 2005-05-20 23:=
38:39 UTC (rev 1125)
@@ -45,7 +45,7 @@
map.Add( "pertinence", "integer" );
map.Add( "numeric", "numeric" );
map.Add( "boolean", "boolean" );
- map.Add( "dateTime", "timestamp" );
+ map.Add( "dateTime", "datetime" );
return map;
}
=09
@@ -70,7 +70,7 @@
throw new NoExistException( "The id_entity " + idEntity + " doesn't =
exist for read." );
}
=09
- conn.BeginTransaction();
+ conn.Open();
=09
//Estructuras y variables usadas en la funcion
DataSet ds =3D new DataSet( ); //El DataSet a retornar
@@ -118,6 +118,9 @@
query =3D String.Format( "select * from entity where id_entity =3D ({=
0})", idEntity );
dbCmd.CommandText =3D query;
da.SelectCommand =3D dbCmd;
+ =09
+ da.SelectCommand.Transaction =3D (SqlTransaction) conn.getTransaction=
Obj() ;
+ =09
da.Fill( ds, "entity" );
=09
//Devuelve la informacion sobre los clases cual esta en la tabla "cla=
ss".
@@ -297,19 +300,268 @@
dt.PrimaryKey =3D dc;
}
=09
- conn.Commit();
+ conn.Close();
=09
return ds;
=09
}
=09
+ /// <summary>
+ /// FIXME Modular funcion generica
+ /// </summary>
+ /// <param name=3D"idEntity"></param>
+ /// <param name=3D"withDeletes"></param>
+ /// <param name=3D"idAttributes"></param>
+ /// <returns></returns>
override public DataSet ReadStructure(int idEntity, bool withDeletes,s=
tring idAttributes)
{
- DataSet ds =3D new DataSet( );//El DataSet a retornar
+ if( !IsActive( idEntity ) )
+ {
+ throw new NoExistException( "The id_entity " + idEntity + " doesn't =
exist for read." );
+ }
+ conn.Open();
+ // conn.BeginTransaction();
+ =09
+ //Estructuras y variables usadas en la funcion
+ DataSet ds =3D new DataSet( ); //El DataSet a retornar
+ SqlCommand dbCmd =3D null; //
+ SqlDataAdapter da =3D new SqlDataAdapter( ); //Esttructuras para la c=
onexion con la BD
+ dbCmd =3D new SqlCommand( ); //
+ string query =3D null;
+ =09
+ // Cast-down a tipo mas potente.
+ SqlConnection msConn =3D ( (SqlConnection) conn.getConnObj() );
+ //Inicializo el command
+ dbCmd.Connection =3D msConn;
+ =09
+ //Buscar todos los attributos del tipo y sus padres.
+ //Para ello hay que considerar los casos en la idEntity pertenece a u=
na clase o una instancia
+ =09
+ //Lista de id's de herencia de la clase.
+ ArrayList idList =3D new ArrayList( );
+ string idListStr =3D "";
+ int[] Inh =3D getInheritanceIfIsInstance( idEntity );
+ idList.AddRange( Inh );
+ =09
+ //Verifico cual es el id de la clase base.
+ int idParent;
+ if( Inh.Length =3D=3D 0 )
+ {
+ idParent =3D idEntity;
+ idList.AddRange( getInheritanceOfType( idEntity ) );
+ }
+ else
+ {
+ idParent =3D Inh[0];
+ }
+ =09
+ =09
+ //Lo transformo a string en formato para poder usarlo en los select's
+ foreach( Object id in idList )
+ {
+ idListStr +=3D "," + id.ToString( );
+ }
+ idListStr =3D idListStr.Remove( 0, 1 );
+ =09
+ //Ingreso las tablas base
+ //Devuelve la informacion basica sobre el idEntity.
+ query =3D String.Format( "select * from entity where id_entity =3D ({=
0})", idEntity );
+ dbCmd.CommandText =3D query;
+ da.SelectCommand =3D dbCmd;
+ da.Fill( ds, "entity" );
+ =09
+ //Devuelve la informacion sobre los clases cual esta en la tabla "cla=
ss".
+ query =3D String.Format( "select * from class where id_entity in ({0}=
)", idListStr );
+ dbCmd.CommandText =3D query;
+ da.Fill( ds, "class" );
+ =09
+ string addQuery=3D"";
+ if(idAttributes.Length !=3D 0 )
+ {
+ =09
+ addQuery+=3D" and a.id_entity in(" + idAttributes + ")";
+ }=09
+
+ //Ahora obtengo la tabla arttribute con una fila para cada uno de mis=
attributos
+ //Pero recordar que es necesario buscar la herencia de cada uno de lo=
s attributos
+ //en el for de mas abajo.
+ if(withDeletes)
+ {
+ query =3D String.Format(@"select a.*,c.""sysName"" as ""refClassSysN=
ame"" ,d.""xslt"" as ""refXslt"" " +
+ @"from attribute a
+ INNER JOIN entity e ON a.id_entity =3D e.id_entity
+ INNER JOIN class c ON e.class =3D c.id_entity
+ LEFT JOIN ""displayAttribute"" d ON d.id_entity =3D a.""dis=
play""" +
+ @"where a.""classId"" in ({0})" + addQuery,
+ idListStr);
+ }=20
+ else=20
+ {
+ query =3D String.Format(@"select a.*,c.""sysName"" as ""refClassSysN=
ame"" ,d.""xslt"" as ""refXslt"" " +
+ @"from attribute a
+ INNER JOIN entity e ON a.id_entity =3D e.id_entity
+ INNER JOIN class c ON e.class =3D c.id_entity and e.""d=
elDate"" is null
+ LEFT JOIN ""displayAttribute"" d ON d.id_entity =3D a.""dis=
play""" +
+ @"where a.""classId"" in ({0})" + addQuery + @"
+ order by a.""order"", a.""attName""",
+ idListStr);
+ =09
+ }
+ =09
+ //Realizo la query y el llenado del DataSet
+ dbCmd.CommandText =3D query;
+ da.Fill( ds, "attribute" );
+ =09
+ //Son bastante autoexplicativas estas variables.
+ int index;
+ string attIds =3D null, attClassName;
+ ArrayList attInheritance;
+ DataRowCollection drc =3D ds.Tables["attribute"].Copy( ).Rows;
+ =09
+ //Una array con todos los atributos y sFillus herencias
+ ArrayList attList =3D new ArrayList( );
+ =09
+ // Camina por todos los tablas atributo buscando su herencia
+ while( drc.Count > 0 )
+ {
+ //La info sobre a el atributo
+ attClassName =3D (String)drc[0]["refClassSysName"];
+ attInheritance =3D getInheritanceByName( attClassName, "attribute" )=
;
+ =09
+ //Agrego la herencia a la lista a buscar
+ for( index =3D drc.Count - 1; index >=3D 0; index-- )
+ {
+ if( (String)drc[index]["refClassSysName"] =3D=3D attClassName )
+ {
+ string[] att =3D new string[2];
+ att[0] =3D Convert.ToString( drc[index]["id_entity"] );
+ att[1] =3D attClassName;
+ //Lo grego a la lista
+ attList.Add( att );
+ =09
+ //Agrego su herencia
+ foreach( object table in attInheritance )
+ {
+ string[] inh =3D new string[2];
+ inh[0] =3D att[0];
+ inh[1] =3D (String)table;
+ attList.Add( inh );
+ }
+ drc.RemoveAt( index );
+ }
+ }
+ }
+ =09
+ =09
+ //Creo el select para la consulta
+ string[] attTable;
+ while( attList.Count > 0 )
+ {
+ //La info sobre a el atributo
+ attTable =3D (string[])attList[0];
+ attIds =3D attTable[0];
+ attClassName =3D attTable[1];
+ attList.RemoveAt( 0 );
+ =09
+ for( index =3D attList.Count - 1; index >=3D 0; index-- )
+ {
+ attTable =3D (string[])attList[index];
+ if( attTable[1] =3D=3D attClassName )
+ {
+ attIds +=3D "," + attTable[0];
+ attList.RemoveAt( index );
+ }
+ }
+ =09
+ query =3D String.Format( @"select * from ""{0}"" where id_entity in =
({1})", attClassName, attIds );
+ dbCmd.CommandText =3D query;
+ da.Fill( ds, attClassName );
+ }
+ =09
+ //Ahora recuperamos las option para los choice y para los atributos c=
hoice de cada atributo
+ {
+ ArrayList optionGroups =3D new ArrayList( );
+ =09
+ if( ds.Tables.Contains( "choice" ) )
+ {
+ DataTable choice =3D ds.Tables["choice"];
+ =09
+ //Para los attributos choice de la tabla
+ for( int i=3D0;i < choice.Rows.Count;i++ )
+ {
+ if( !optionGroups.Contains( (Int32)choice.Rows[i]["groupType"] ) )
+ {
+ optionGroups.Add( (Int32)choice.Rows[i]["groupType"] );
+ }
+ }
+ }
+ =09
+ //-_-
+ //Para los attributos choice de los attributos de la tabla pedida
+ =09
+ //Obtenemos las tablas que se descuelgan de la tabla pedida
+ string sysNameTables =3D "";
+ for( int i=3D0;i < ds.Tables.Count;i++ )
+ {
+ if( sysNameTables =3D=3D "" )
+ {
+ sysNameTables =3D "'" + ds.Tables[i].TableName + "'";
+ }
+ else
+ {
+ sysNameTables +=3D ",'" + ds.Tables[i].TableName + "'";
+ }
+ }
+ =09
+ //La query para optener los option
+ query =3D @"select ch.""groupType""
+ from ""attribute"" as a,
+ ""class"" as c,
+ ""choice"" as ch
+ where c.""sysName"" in (" + sysNameTables + @") and
+ a.""classId"" =3D c.id_entity and
+ ch.id_entity =3D a.id_entity
+ group by ch.""groupType""";
+ =09
+ =09
+ string groups =3D "";
+ //Creamos la query
+ foreach( int group in optionGroups )
+ {
+ if( groups =3D=3D "" )
+ {
+ groups =3D group.ToString( );
+ }
+ else
+ {
+ groups +=3D "," + group.ToString( );
+ }
+ }
+ =09
+ if( groups =3D=3D "" )
+ {
+ groups =3D "null";
+ }
+ =09
+ query =3D String.Format( @"select * from ""option"" where ""group"" i=
n ({0}) or ""group"" in ({1})", groups, query );
+ dbCmd.CommandText =3D query;
+ da.Fill( ds, "option" );
+ }
+ =09
+ DataColumn[] dc;
+ foreach( DataTable dt in ds.Tables )
+ {
+ dc =3D new DataColumn[1];
+ dc[0] =3D dt.Columns["id_entity"];
+ dt.PrimaryKey =3D dc;
+ }
+ =09
+ //conn.Commit();
+ conn.Close();
+ =09
return ds;
}
=20
-
/// <summary>
/// Method ReadData
/// </summary>
@@ -344,9 +596,9 @@
inheritanceToString( idEntity ) );
=09
//Realizo la consulta
- DataTable dtAtt =3D conn.doSelect( query ) ;
+ DataTable dtAtt =3D conn.doSelect( query ); // NpgsqlDataReader drA=
tt =3D ( (NpgsqlDataReader) conn.doSelect( query ) );
//Reader para almacenar los valores de cada at tributo obtenido
- DataTable dtData;
+ DataSet dsData; //NpgsqlDataReader drData;
=09
//ToDel: dbLog.WriteToLog(query,"Init Query");
=09
@@ -354,26 +606,25 @@
StringCollection attType =3D new StringCollection( );
ArrayList attId =3D new ArrayList( );
query =3D "";
- foreach (DataRow attRow in dtAtt.Rows)
+ foreach(DataRow drAtt in dtAtt.Rows) // while( drAtt.Read( ) )
{
- =09
//Para verificar si un atribito hereda de pertinence
bool isParentPertinence =3D false;
//Si el atributo tiene herencia, verifico si hereda de un pertinence
- if( attRow[5] !=3D "" && (Int32)attRow["inheritance"] !=3D (Int32)Me=
taModelConsts.EntitiesAttribute )
+ if( drAtt[5] !=3D DBNull.Value && (Int32)drAtt["inheritance"] !=3D (=
Int32)MetaModelConsts.EntitiesAttribute ) //( !drAtt.IsDBNull( 5 ) && (In=
t32)drAtt["inheritance"] !=3D (Int32)MetaModelConsts.EntitiesAttribute )
{
- ArrayList idParentList =3D new ArrayList( getInheritance( (Int32)at=
tRow["id"] ) );
+ ArrayList idParentList =3D new ArrayList( getInheritance( (Int32)dr=
Att["id"] ) );
if( idParentList.Contains( (Int32)MetaModelConsts.EntitiesPertinenc=
e ) )
{
isParentPertinence =3D true;
}
}
=09
- //ToDel: dbLog.WriteToLog(attRow.ToString(),"Init Query");
+ //ToDel: dbLog.WriteToLog(drAtt.ToString(),"Init Query");
//verifico si el attributo es virtual, si no lo es lo agrego a la co=
nsulta
- if( (String)attRow["typeName"] =3D=3D "pertinence" || isParentPertin=
ence )
+ if( (String)drAtt["typeName"] =3D=3D "pertinence" || isParentPertine=
nce )
{
- DataTable drMetaData;
+ DataTable dtMetaData; // NpgsqlDataReader drMetaData;
//Busco la relacion y donde se encuentra.
string metaQuery =3D (
@" select co.""sysName"" as ""classOwnerName"",
@@ -387,45 +638,45 @@
where co.id_entity =3D a.""classId"" and
a.id_entity =3D p.owner and
p.""to"" =3D ct.id_entity and
- p.id_entity =3D " + attRow["id"].ToString( ) );
+ p.id_entity =3D " + drAtt["id"].ToString( ) );
=09
//ToDel: dbLog.c(metaQuery,"pertenence");
- drMetaData =3D conn.doSelect( metaQuery );
-
- //drMetaData.Read( );
+ dtMetaData =3D conn.doSelect( metaQuery ); //(NpgsqlDataReader)con=
n.doSelect( metaQuery );
+ // drMetaData.Read( );
//Recuperamos las tablas con sus respectivos link
- string ownerName =3D drMetaData.Rows[0]["ownerName"].ToString( );
- string ownerId =3D drMetaData.Rows[0]["ownerId"].ToString( );
- string className =3D drMetaData.Rows[0]["classOwnerName"].ToStrin=
g( );
- string classId =3D drMetaData.Rows[0]["classOwnerId"].ToString(=
);
- string classDName =3D drMetaData.Rows[0]["classDestinyName"].ToStr=
ing( );
- string classDId =3D drMetaData.Rows[0]["classDestinyId"].ToStrin=
g( );
+ string ownerName =3D dtMetaData.Rows[0]["ownerName"].ToString( );
+ string ownerId =3D dtMetaData.Rows[0]["ownerId"].ToString( );
+ string className =3D dtMetaData.Rows[0]["classOwnerName"].ToStrin=
g( );
+ string classId =3D dtMetaData.Rows[0]["classOwnerId"].ToString(=
);
+ string classDName =3D dtMetaData.Rows[0]["classDestinyName"].ToStr=
ing( );
+ string classDId =3D dtMetaData.Rows[0]["classDestinyId"].ToStrin=
g( );
=09
- drMetaData.Dispose();
+ //dtMetaData.Dispose( );
=09
+ =09
//Obtengo los datos segun el tipo de ralacion.
#region n:m
//Caso n:m
//dbLog.WriteToLog("|"+(String)drMetaData["ratio"]+"|","ratio");
=09
- if( (String)drMetaData.Rows[0]["ratio"] =3D=3D "n:m" )
+ if( (String)dtMetaData.Rows[0]["ratio"] =3D=3D "n:m" )
{
//Obtengo las tablas a las cuales se hace referencia
metaQuery =3D mnInfoQuery( classId, ownerId );
=09
//dbLog.WriteToLog(metaQuery,"n:m");
- drMetaData =3D conn.doSelect( metaQuery );
+ dtMetaData =3D conn.doSelect(metaQuery); //drMetaData =3D (Npgsql=
DataReader)conn.doSelect( metaQuery );
=09
- foreach(DataRow drow in drMetaData.Rows)
+ foreach(DataRow drMetaData in dtMetaData.Rows) //while( drMetaDat=
a.Read( ) )
{
// Recupero el valor para el atributo
- query +=3D ( @" ; select cd.id_entity , cd.""" + drow["displayCol=
umn"] + @"""" +
- @" from """ + drow["classDestinyName"] +
+ query +=3D ( @" ; select cd.id_entity , cd.""" + drMetaData["disp=
layColumn"] + @"""" +
+ @" from """ + drMetaData["classDestinyName"] +
@"""cd, """ + className + @""" p" +
@" where p.""" + ownerName + @""" =3D " + idEntity + @" and
- p.""" + drow["attName"] + @""" =3D cd.id_entity" + "\n" );
- attType.Add( (String)attRow["typeName"] );
- attId.Add( attRow["id"] );
+ p.""" + drMetaData["attName"] + @""" =3D cd.id_entity" + "\n" );
+ attType.Add( (String)drAtt["typeName"] );
+ attId.Add( drAtt["id"] );
}
}
#endregion
@@ -436,7 +687,7 @@
string DisplayColumn =3D (String)conn.doScalar(
@"select ""sysAttName""
from attribute
- where ""isPrimary"" =3D true and
+ where ""isPrimary"" =3D 1 and
""classId"" =3D " + classDId );
=09
// Recupero el valor para el atributo
@@ -445,35 +696,37 @@
""" + classDName + @""" as ""to"" " +
@" where owner.""" + ownerName + @""" =3D ""to"".id_entity and
owner.id_entity =3D " + idEntity + "\n" );
- attType.Add( (String)attRow["typeName"] );
- attId.Add( attRow["id"] );
+ attType.Add( (String)drAtt["typeName"] );
+ attId.Add( drAtt["id"] );
=09
}
#endregion
}
- else if( (Boolean)attRow["isVirtual"] )
+ else if( (Boolean)drAtt["isVirtual"] )
{/* Solo para capturar los virtuals*/}
else
{
// Recupero el valor para el atributo
- query +=3D ( @" ; select """ + attRow["attName"] + @"""" +
- @" from """ + attRow["className"] + @"""" +
+ query +=3D ( @" ; select """ + drAtt["attName"] + @"""" +
+ @" from """ + drAtt["className"] + @"""" +
@" where ""id_entity"" =3D " + idEntity + "\n" );
- attType.Add( (String)attRow["typeName"] );
- attId.Add( attRow["id"] );
+ attType.Add( (String)drAtt["typeName"] );
+ attId.Add( drAtt["id"] );
}
}
=09
//ToDel: dbLog.WriteToLog(query,"Big query");
=09
//realizo la consulta
- dtData =3D conn.doSelect( query );
+ query =3D query.Substring(2);
+ dsData =3D conn.doSelect( query,new DataSet() );
=09
- foreach (DataRow drow in dtData.Rows)
+ foreach(DataTable dTable in dsData.Tables)
+ {
+ foreach(DataRow drData in dTable.Rows) // while( drData.Read( ) )
{
- =09
//Recupero el valor a menos que sea nulo
- if( drow[0].ToString() =3D=3D null )
+ if(drData[0] !=3D DBNull.Value) // ( !drData.IsDBNull( 0 ) )
{
=09
//Si no existe la tabla para el tipo la creo
@@ -481,26 +734,28 @@
{
dt =3D new DataTable( attType[0] );
dt.Columns.Add( "id_entity", typeof(int) );
- dt.Columns.Add( "data", drow[0].GetType( ) );
+ dt.Columns.Add( "data", drData[0].GetType( ) );
if( attType[0] =3D=3D "pertinence" )
{
- dt.Columns.Add( "refData", drow[1].GetType( ) );
+ dt.Columns.Add( "refData", drData[1].GetType( ) );
}
ds.Tables.Add( dt );
}
=09
dr =3D ds.Tables[attType[0]].NewRow( );
dr[0] =3D attId[0];
- dr[1] =3D drow[0];
+ dr[1] =3D drData[0];
if( attType[0] =3D=3D "pertinence" )
{
- dr[2] =3D dr[1];
+ dr[2] =3D drData[1];
}
ds.Tables[attType[0]].Rows.Add( dr );
}
}
attId.RemoveAt( 0 );
attType.RemoveAt( 0 );
+ }//while(drData.NextResult( ));
+
return ds;
}
=09
@@ -521,9 +776,202 @@
/// <param name=3D"idEntity">An int</param>
/// <param name=3D"withDeletes">A bool</param>
/// <returns>A DataSet</returns>
- override public DataSet ReadData(int idEntity,bool withDeletes,string =
idsAtt)
+ override public DataSet ReadData(int idEntity, bool withDeletes,string=
idsAtt)
{
- throw new DriverException( "Not Implemented" );
+ //Verifico si existe el tipo, sino retorno una exeption
+ if( !IsActive( idEntity ) )
+ {
+ throw new NoExistException( "The id_entity " + idEntity + " doesn't =
exist for read." );
+ }
+ =09
+ //Containers de Datos
+ DataSet ds =3D new DataSet( "DataRead" );
+ DataTable dt;
+ DataRow dr;
+ string queryInAtt=3D"";
+ if (idsAtt !=3D"")
+ {
+ queryInAtt=3D "and a.id_entity in("+idsAtt+")";
+ }
+ =09
+
+ // Buscar todos los attributos del tipo.
+ string query =3D String.Format( @"select a.""id_entity"" as ""id"",
+ a.""sysAttName"" as ""attName"",
+ a.""isVirtual"" as ""isVirtual"",
+ ca.""sysName"" as ""typeName"",
+ cp.""sysName"" as ""className"",
+ cd.""parentId"" as ""inheritance""
...
[truncated message content] |