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-07-14 21:17:00
|
Author: marcelo Date: 2005-07-14 17:16:38 -0400 (Thu, 14 Jul 2005) New Revision: 1472 Modified: humano2/trunk/components/viewTools/ViewTools.cs humano2/trunk/web/builder/Builder.csproj humano2/trunk/web/builder/site/domainmain.aspx humano2/trunk/web/builder/site/domainmain.aspx.cs humano2/trunk/web/builder/site/userdelete.aspx humano2/trunk/web/builder/site/userdelete.aspx.cs humano2/trunk/web/builder/site/usermain.aspx humano2/trunk/web/builder/site/usermain.aspx.cs Log: * Fixed tickets #240, #239, #238 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-07-14 20:25:54 U= TC (rev 1471) +++ humano2/trunk/components/viewTools/ViewTools.cs 2005-07-14 21:16:38 U= TC (rev 1472) @@ -357,6 +357,12 @@ =09 public object GetSQLScalar(DataTable parametros) { + while (parametros.Columns.Count < 6) + { + DataColumn dc =3D new DataColumn("filler " + parametros.Columns.Coun= t,typeof(string)); + parametros.Columns.Add(dc); + } + string sql =3D ParseQuery(parametros); object resp =3D Complex.doScalar(sql); =20 Modified: humano2/trunk/web/builder/Builder.csproj =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/Builder.csproj 2005-07-14 20:25:54 UTC (rev= 1471) +++ humano2/trunk/web/builder/Builder.csproj 2005-07-14 21:16:38 UTC (rev= 1472) @@ -547,6 +547,16 @@ BuildAction =3D "Compile" /> <File + RelPath =3D "site\userdelete.aspx" + BuildAction =3D "Content" + /> + <File + RelPath =3D "site\userdelete.aspx.cs" + DependentUpon =3D "userdelete.aspx" + SubType =3D "ASPXCodeBehind" + BuildAction =3D "Compile" + /> + <File RelPath =3D "site\useredit.aspx" BuildAction =3D "Content" /> @@ -583,6 +593,11 @@ BuildAction =3D "Compile" /> <File + RelPath =3D "site\usermain.aspx.resx" + DependentUpon =3D "usermain.aspx.cs" + BuildAction =3D "EmbeddedResource" + /> + <File RelPath =3D "site\useroperationbar.aspx" BuildAction =3D "Content" /> Modified: humano2/trunk/web/builder/site/domainmain.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/builder/site/domainmain.aspx 2005-07-14 20:25:54 UT= C (rev 1471) +++ humano2/trunk/web/builder/site/domainmain.aspx 2005-07-14 21:16:38 UT= C (rev 1472) @@ -7,7 +7,7 @@ <script language=3D"javascript"> function DeleteDomain(domainId) { if(confirm("Are you sure you want to delete this domain?")) { - window.location.href =3D "domaindelete.aspx?domainId=3D" + domainId= ; + window.location.href =3D "userdelete.aspx?returnTo=3Ddomainmain.asp= x&entityID=3D" + domainId; } } </script> Modified: humano2/trunk/web/builder/site/domainmain.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/domainmain.aspx.cs 2005-07-14 20:25:54= UTC (rev 1471) +++ humano2/trunk/web/builder/site/domainmain.aspx.cs 2005-07-14 21:16:38= UTC (rev 1472) @@ -57,16 +57,27 @@ foreach(DataRow row in list.Rows) { int domainId =3D Convert.ToInt32(row["id_entity"]); string domainName =3D Convert.ToString(row["domainName"]); - DomainList.Text +=3D "<li><a href=3D\"domainedit.aspx?domainId=3D"+ = domainId +"\">"+domainName+"</a> "; - if(domainId !=3D 10)=20 + if (userCred.DomainIds[userCred.CurrentDomainIndex] =3D=3D domainId = || userCred.UserId =3D=3D 11)=20 { - DomainList.Text +=3D "(<a href=3D\"#\" onClick=3D\"DeleteDomain("+d= omainId+")\">Delete</a>)"; - }=20 - else=20 + DomainList.Text +=3D "<li><a href=3D\"domainedit.aspx?domainId=3D"+= domainId +"\">"+domainName+"</a> "; + } + else { - DomainList.Text +=3D "(Not Deletable)"; + DomainList.Text +=3D "<li>"+domainName; } =20 + if (userCred.DomainIds[userCred.CurrentDomainIndex] =3D=3D 10) + { + if(domainId !=3D 10)=20 + { + DomainList.Text +=3D "(<a href=3D\"#\" onClick=3D\"DeleteDomain("+= domainId+")\">Delete</a>)"; + }=20 + else=20 + { + DomainList.Text +=3D "(Not Deletable)"; + } + } + DomainList.Text +=3D "</li>"; } } Modified: humano2/trunk/web/builder/site/userdelete.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/builder/site/userdelete.aspx 2005-07-14 20:25:54 UT= C (rev 1471) +++ humano2/trunk/web/builder/site/userdelete.aspx 2005-07-14 21:16:38 UT= C (rev 1472) @@ -1 +1 @@ -<%@ Page language=3D"c#" Codebehind=3D"dataclasscreate.aspx.cs" AutoEven= tWireup=3D"false" Inherits=3D"Builder.site.UserDelete" %> \ No newline at end of file +<%@ Page language=3D"c#" Codebehind=3D"userdelete.aspx.cs" AutoEventWire= up=3D"false" Inherits=3D"Builder.site.UserDelete" %> \ No newline at end of file Modified: humano2/trunk/web/builder/site/userdelete.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/userdelete.aspx.cs 2005-07-14 20:25:54= UTC (rev 1471) +++ humano2/trunk/web/builder/site/userdelete.aspx.cs 2005-07-14 21:16:38= UTC (rev 1472) @@ -45,12 +45,14 @@ =09 private void Page_Load(object sender, System.EventArgs e) { - int userId =3D Convert.ToInt32(Request.QueryString["userId"]);=09 + int userId =3D Convert.ToInt32(Request.QueryString["entityID"]); + string returnTo =3D Request.QueryString["returnTo"]; + adapter dbAdapter =3D new adapter(); Logger.Log("Deleting User : " + userId, LogLevel.Trace); dbAdapter.DeleteInstance(userId, userCred); Logger.Log("Deleting User Done", LogLevel.Trace); - Response.Redirect(Html.genAbsoluteUrl("/builder/site/usermain.aspx"))= ;=09 + Response.Redirect(Html.genAbsoluteUrl("/builder/site/" + returnTo));=09 } =09 } } Modified: humano2/trunk/web/builder/site/usermain.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/builder/site/usermain.aspx 2005-07-14 20:25:54 UTC = (rev 1471) +++ humano2/trunk/web/builder/site/usermain.aspx 2005-07-14 21:16:38 UTC = (rev 1472) @@ -7,7 +7,7 @@ <script language=3D"javascript"> function DeleteUser(userId) { if(confirm("Are you sure you want to remove this user?")) { - window.location.href =3D "userdelete.aspx?userId=3D" + userId; + window.location.href =3D "userdelete.aspx?returnTo=3Dusermain.aspx&= entityID=3D" + userId; } } </script> Modified: humano2/trunk/web/builder/site/usermain.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/usermain.aspx.cs 2005-07-14 20:25:54 U= TC (rev 1471) +++ humano2/trunk/web/builder/site/usermain.aspx.cs 2005-07-14 21:16:38 U= TC (rev 1472) @@ -58,7 +58,20 @@ foreach(DataRow row in list.Rows) { int userId =3D Convert.ToInt32(row["id_entity"]); string userName =3D Convert.ToString(row["email"]); - UserList.Text +=3D "<li><a href=3D\"useredit.aspx?userId=3D"+ userId= +"\">"+userName+"</a> (<a href=3D\"#\" onClick=3D\"DeleteUser("+userId+")= \">Delete</a>)</li>"; + + if (userCred.UserId =3D=3D userId || userCred.UserId =3D=3D 11)=20 + { + UserList.Text +=3D "<li><a href=3D\"useredit.aspx?userId=3D"+ userI= d+"\">"+userName+"</a>"; + } + else + { + UserList.Text +=3D "<li>"+userName+"</li>"; + } + =09 + if(userCred.DomainIds[userCred.CurrentDomainIndex] =3D=3D 10)=20 + { + UserList.Text +=3D "(<a href=3D\"#\" onClick=3D\"DeleteUser("+userI= d+")\">Delete</a>)</li>"; + } } } =09 |
From: <sv...@de...> - 2005-07-13 01:49:49
|
Author: marcelo Date: 2005-07-12 21:49:21 -0400 (Tue, 12 Jul 2005) New Revision: 1460 Modified: humano2/trunk/web/start_xsp.sh Log: * Changed the shell to /bin/sh due to popular demand! Modified: humano2/trunk/web/start_xsp.sh =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/start_xsp.sh 2005-07-13 01:40:04 UTC (rev 1459) +++ humano2/trunk/web/start_xsp.sh 2005-07-13 01:49:21 UTC (rev 1460) @@ -1,4 +1,4 @@ -#!/usr/bin/env bash=20 +#!//bin/sh=20 # $Id$ =20 curdir=3D`pwd` |
From: <sv...@de...> - 2005-07-13 01:40:12
|
Author: marcelo Date: 2005-07-12 21:40:04 -0400 (Tue, 12 Jul 2005) New Revision: 1459 Modified: humano2/trunk/INSTALL-LINUX.es.txt humano2/trunk/web/start_xsp.sh Log: * The command /bin/bash was changed to /usr/bin/env bash since not all s= ystems have /bin/bash * Spelling mistake was fixed in INSTALL-LINUX.es.txt Modified: humano2/trunk/INSTALL-LINUX.es.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/INSTALL-LINUX.es.txt 2005-07-11 15:08:57 UTC (rev 1458) +++ humano2/trunk/INSTALL-LINUX.es.txt 2005-07-13 01:40:04 UTC (rev 1459) @@ -76,7 +76,7 @@ <clientPath> El directorio cual mantendra los archivos subido en la plataforma. Notace que el servidor debe tener derechos de ESCRITURA y lectura en este directorio.=20 - <webbase> El URL completo donde estara accesible el systema. El system= a=20 + <webbase> El URL completo donde estara accesible el sistema. El sistem= a=20 utilizara ese direccion para redirecionamiento y otras operaciones cu= al=20 necesitan la direccion completa.=20 =20 Modified: humano2/trunk/web/start_xsp.sh =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/start_xsp.sh 2005-07-11 15:08:57 UTC (rev 1458) +++ humano2/trunk/web/start_xsp.sh 2005-07-13 01:40:04 UTC (rev 1459) @@ -1,4 +1,4 @@ -#!/bin/bash=20 +#!/usr/bin/env bash=20 # $Id$ =20 curdir=3D`pwd` |
From: <sv...@de...> - 2005-07-08 17:30:14
|
Author: marcelo Date: 2005-07-08 13:30:10 -0400 (Fri, 08 Jul 2005) New Revision: 1455 Added: humano2/tags/5.0.beta8/ Log: Relase of Beta8 Copied: humano2/tags/5.0.beta8 (from rev 1454, humano2/trunk) |
From: <sv...@de...> - 2005-07-08 17:20:58
|
Author: marcelo Date: 2005-07-08 13:21:00 -0400 (Fri, 08 Jul 2005) New Revision: 1454 Modified: humano2/trunk/changelog.txt Log: * updated changelog.txt Modified: humano2/trunk/changelog.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/changelog.txt 2005-07-08 15:27:14 UTC (rev 1453) +++ humano2/trunk/changelog.txt 2005-07-08 17:21:00 UTC (rev 1454) @@ -1,5 +1,16 @@ $Id$ =20 +=3D=3D 5.0.beta8 - 2005-07-08 Revision: 1454 =3D=3D =20 + + * Core + * Viewtools had mayor fixes. All had to do with different methods in = which=20 + pertinene attribute could be used. + =20 +=20 + * Other + * pgsqlCrud was refactored. + =20 + =3D=3D 5.0.beta7 - 2005-06-24 Revision: 1426 =3D=3D =20 =20 * Builder |
From: <sv...@de...> - 2005-07-08 15:27:16
|
Author: marcelo Date: 2005-07-08 11:27:14 -0400 (Fri, 08 Jul 2005) New Revision: 1453 Modified: humano2/trunk/core/config.cs humano2/trunk/web/portal/site/topbar.aspx.cs Log: * User can now, not so easily though, opt not to send statistics to cent= ral server. Modified: humano2/trunk/core/config.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/config.cs 2005-07-08 14:39:29 UTC (rev 1452) +++ humano2/trunk/core/config.cs 2005-07-08 15:27:14 UTC (rev 1453) @@ -81,14 +81,13 @@ } =09 private DataSet configSet =3D new DataSet(); - =09 /// <summary> /// Returns the value of the option. /// </summary> /// <param name=3D"part">The section</param> /// <param name=3D"key">The Item</param> /// <returns>The value defined.</returns> - public string GetOption(string part, string key) + public string GetOption(string part, string key, bool obligatory) { if( OptionExists( part, key ) ) { @@ -97,9 +96,21 @@ } else { - throw( new ConfigException( "Missing <" + part + "><" + key + "> in = config." ) ); + if (obligatory) + { + throw( new ConfigException( "Missing <" + part + "><" + key + "> in= config." ) ); + } + else + { + return ""; + } } } + + public string GetOption(string part, string key) + { + return GetOption(part, key, true); + } =09 /// <summary> /// Tests if the selected option is defined in the configuration and c= ontains any values. @@ -109,9 +120,11 @@ /// <returns>True if defined, false otherwise.</returns> public bool OptionExists(string part, string key) { + string res; try { - string res =3D configSet.Tables[part].Rows[0][key].ToString( ); + res =3D configSet.Tables[part].Rows[0][key].ToString( ); + if( res.Length > 0 ) { return true; @@ -120,15 +133,21 @@ { return false; } - } + } catch(System.IndexOutOfRangeException) { - return false; - } + return false; + } catch(System.NullReferenceException) { - return false; - } + return false; + } + catch(System.ArgumentException) + { + return false; + } + + =09 } =09 /// <summary> Modified: humano2/trunk/web/portal/site/topbar.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/topbar.aspx.cs 2005-07-08 14:39:29 UTC = (rev 1452) +++ humano2/trunk/web/portal/site/topbar.aspx.cs 2005-07-08 15:27:14 UTC = (rev 1453) @@ -61,13 +61,16 @@ =20 =09 xmlString +=3D "<Page>"; - xmlString +=3D "<Current-Info>"; - xmlString +=3D "<UserName><![CDATA[" + userCred.UserName + "]]></User= Name>"; - xmlString +=3D "<DomainName><![CDATA[" + userCred.DomainNames[userCre= d.CurrentDomainIndex] + "]]></DomainName>"; - xmlString +=3D "<Session><![CDATA[" + Cookies.Get(WebConst.SessionCoo= kie) + "]]></Session>"; - xmlString +=3D "<Version><![CDATA[" + Humano2.Core.Config.Instance().= GetVersion() + "]]></Version>"; - xmlString +=3D "</Current-Info>"; =20 + if(Humano2.Core.Config.Instance().GetOption("log", "statistics", fals= e) !=3D "no")=20 + { + xmlString +=3D "<Current-Info>"; + xmlString +=3D "<UserName><![CDATA[" + userCred.UserName + "]]></Use= rName>"; + xmlString +=3D "<DomainName><![CDATA[" + userCred.DomainNames[userCr= ed.CurrentDomainIndex] + "]]></DomainName>"; + xmlString +=3D "<Session><![CDATA[" + Cookies.Get(WebConst.SessionCo= okie) + "]]></Session>"; + xmlString +=3D "<Version><![CDATA[" + Humano2.Core.Config.Instance()= .GetVersion() + "]]></Version>"; + xmlString +=3D "</Current-Info>"; + } xmlString+=3D"<classes>"; =20 for(int c =3D 0; c < classNames.Length; c++) |
From: <sv...@de...> - 2005-07-08 14:39:33
|
Author: marcelo Date: 2005-07-08 10:39:29 -0400 (Fri, 08 Jul 2005) New Revision: 1452 Modified: humano2/trunk/core/db/pgsql/pgsqlCrud.cs Log: * Applying Marijns patch for pgsqlCrud which refactors ReadData() and Re= adStructure(). 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-07-08 14:29:43 UTC (rev= 1451) +++ humano2/trunk/core/db/pgsql/pgsqlCrud.cs 2005-07-08 14:39:29 UTC (rev= 1452) @@ -63,256 +63,20 @@ ///<summary>Devuelve la estructura completa de una entidad.</summary> ///<param name=3D"idEntity">El ID del objecto cual se quiere leer su e= structura.</param> ///<param name=3D"withDeletes">Si es True tambien muestre los valores= borrados. Si es false no.</param> + /// <returns>Devuelve la estructura de una entidad.</returns> ///<remarks>El read estructural es independiente si se le sumimistra e= l id /// de una clase o de una instancia de esta</remarks> override public DataSet ReadStructure(int idEntity, bool withDeletes) { - if( !IsActive( idEntity ) ) - { - throw new NoExistException( "The id_entity " + idEntity + " doesn't = exist for read." ); - } - =09 - conn.BeginTransaction(); - =09 - //Estructuras y variables usadas en la funcion - DataSet ds =3D new DataSet( ); //El DataSet a retornar - NpgsqlCommand dbCmd =3D null; // - NpgsqlDataAdapter da =3D new NpgsqlDataAdapter( ); //Esttructuras par= a la conexion con la BD - dbCmd =3D new NpgsqlCommand( ); // - string query =3D null; - =09 - // Cast-down a tipo mas potente. - NpgsqlConnection pgConn =3D ( (NpgsqlConnection) conn.getConnObj() ); - //Inicializo el command - dbCmd.Connection =3D pgConn; - =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 - //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})", - idListStr); - } else { - 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}) - 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"" = in ({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(); - =09 - return ds; - =09 + return ReadStructure(idEntity, withDeletes, ""); } =20 - /// <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) + ///<summary>Devuelve la estructura de cierta attributos de una entidad= .</summary> + /// <param name=3D"idEntity">El ID del objecto cual se quiere leer su = estructura.</param> + /// <param name=3D"withDeletes">Si es True tambien muestre los valore= s borrados. Si es false no.</param> + /// <param name=3D"idAttributes">Los attributos para devolver. Por def= ecto devuelve todos los attributos.</param> + /// <returns>Devuelve la estructura de una entidad.</returns> + override public DataSet ReadStructure(int idEntity, bool withDeletes, = string idAttributes) { if( !IsActive( idEntity ) ) { @@ -478,7 +242,7 @@ } =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" ) ) @@ -545,7 +309,7 @@ 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 ) @@ -559,221 +323,36 @@ =09 return ds; } - =09 + =20 /// <summary> - /// Method ReadData + /// Obtener los datos de una entidad. /// </summary> - /// <param name=3D"idEntity">An int</param> - /// <returns>A DataSet</returns> + /// <param name=3D"idEntity">Id id_entity de la entidad</param> + /// <returns>Devuele un data structure con los datos de la entidad.</r= eturns> override public DataSet ReadData(int idEntity) { - //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; - =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"" - from attribute a,class cp,class ca,entity e,class cd - where a.""classId"" in ({0}) and - a.""classId"" =3D cp.""id_entity"" and - a.""id_entity"" =3D e.""id_entity"" and - e.""class"" =3D ca.""id_entity"" and - cd.""id_entity"" =3D ca.""parentId""", - inheritanceToString( idEntity ) ); - =09 - //Realizo la consulta - DataTable dtAtt =3D conn.doSelect( query ); // NpgsqlDataReader drA= tt =3D ( (NpgsqlDataReader) conn.doSelect( query ) ); - //Reader para almacenar los valores de cada at tributo obtenido - DataSet dsData; //NpgsqlDataReader drData; - =09 - //ToDel: dbLog.WriteToLog(query,"Init Query"); - =09 - //Cada fila del read corresponde a un atributo del cual debo recupera= r su valor. - StringCollection attType =3D new StringCollection( ); - ArrayList attId =3D new ArrayList( ); - query =3D ""; - 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[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 ) ) - { - isParentPertinence =3D true; - } - } - =09 - //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)drAtt["typeName"] =3D=3D "pertinence" || isParentPertine= nce ) - { - DataTable dtMetaData; // NpgsqlDataReader drMetaData; - //Busco la relacion y donde se encuentra. - string metaQuery =3D ( - @" select co.""sysName"" as ""classOwnerName"", - co.""id_entity"" as ""classOwnerId"", - a.""sysAttName"" as ""ownerName"", - a.""id_entity"" as ""ownerId"", - p.""ratio"" as ""ratio"", - ct.""sysName"" as ""classDestinyName"", - ct.""id_entity"" as ""classDestinyId"" - from attribute a,class co,class ct,pertinence p - 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 " + drAtt["id"].ToString( ) ); - =09 - //ToDel: dbLog.c(metaQuery,"pertenence"); - dtMetaData =3D conn.doSelect( metaQuery ); //(NpgsqlDataReader)con= n.doSelect( metaQuery ); - // drMetaData.Read( ); - //Recuperamos las tablas con sus respectivos link - 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 - //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)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"); - dtMetaData =3D conn.doSelect(metaQuery); //drMetaData =3D (Npgsql= DataReader)conn.doSelect( metaQuery ); - =09 - 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 - p.""" + drMetaData["attName"] + @""" =3D cd.id_entity" + "\n" ); - attType.Add( (String)drAtt["typeName"] ); - attId.Add( drAtt["id"] ); - } - } - #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 - ""classId"" =3D " + classDId ); - =09 - // Recupero el valor para el atributo - query +=3D ( @" ; select ""to"".id_entity,""to"".""" + DisplayColu= mn + @"""" + - @" from """ + className + @""" as owner, - """ + classDName + @""" as ""to"" " + - @" where owner.""" + ownerName + @""" =3D ""to"".id_entity and - owner.id_entity =3D " + idEntity + "\n" ); - attType.Add( (String)drAtt["typeName"] ); - attId.Add( drAtt["id"] ); - =09 - } - #endregion - } - else if( (Boolean)drAtt["isVirtual"] ) - {/* Solo para capturar los virtuals*/} - else - { - // Recupero el valor para el atributo - query +=3D ( @" ; select """ + drAtt["attName"] + @"""" + - @" from """ + drAtt["className"] + @"""" + - @" where ""id_entity"" =3D " + idEntity + "\n" ); - attType.Add( (String)drAtt["typeName"] ); - attId.Add( drAtt["id"] ); - } - } - =09 - //ToDel: dbLog.WriteToLog(query,"Big query"); - =09 - //realizo la consulta - dsData =3D conn.doSelect( query,new DataSet() ); - =09 - foreach(DataTable dTable in dsData.Tables) - { - foreach(DataRow drData in dTable.Rows) // while( drData.Read( ) ) - { - //Recupero el valor a menos que sea nulo - if(drData[0] !=3D DBNull.Value) // ( !drData.IsDBNull( 0 ) ) - { - =09 - //Si no existe la tabla para el tipo la creo - if( !ds.Tables.Contains( attType[0] ) ) - { - dt =3D new DataTable( attType[0] ); - dt.Columns.Add( "id_entity", typeof(int) ); - dt.Columns.Add( "data", drData[0].GetType( ) ); - if( attType[0] =3D=3D "pertinence" ) - { - 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 drData[0]; - if( attType[0] =3D=3D "pertinence" ) - { - dr[2] =3D drData[1]; - } - ds.Tables[attType[0]].Rows.Add( dr ); - } - } - attId.RemoveAt( 0 ); - attType.RemoveAt( 0 ); - }//while(drData.NextResult( )); - =09 - return ds; + return ReadData(idEntity, false, ""); } =09 /// <summary> - /// Method ReadData + /// Obtener los datos de una entidad.=20 /// </summary> - /// <param name=3D"idEntity">An int</param> - /// <param name=3D"withDeletes">A bool</param> - /// <returns>A DataSet</returns> + /// <param name=3D"idEntity">Id id_entity de la entidad</param> + /// <param name=3D"withDeletes">si es TRUE devuelve los datos, incluso= cuando estan marcado como borrados</param> + /// <returns>Devuele un data structure con los datos de la entidad.</r= eturns> override public DataSet ReadData(int idEntity, bool withDeletes) { - throw new DriverException( "Not Implemented" ); + return ReadData(idEntity, withDeletes, ""); } =20 /// <summary> - /// Method ReadData + /// Obtener los datos de algunas attributos de una entidad.=20 /// </summary> - /// <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) + /// <param name=3D"idEntity">Id id_entity de la entidad</param> + /// <param name=3D"withDeletes">si es TRUE devuelve los datos, incluso= cuando estan marcado como borrados</param> + /// <param name=3D"attributeIds">Los Id de los attributos cuale= s son devueltas. Por defecto devuelven todas los attributos.</param> + /// <returns>Devuele un data structure con los datos de la entidad.</r= eturns> + override public DataSet ReadData(int idEntity, bool withDeletes, strin= g attributeIds) { //Verifico si existe el tipo, sino retorno una exeption if( !IsActive( idEntity ) ) @@ -785,27 +364,33 @@ DataSet ds =3D new DataSet( "DataRead" ); DataTable dt; DataRow dr; - string queryInAtt=3D""; - if (idsAtt !=3D"") + + string deleteString =3D "and e.\"delDate\" is null"; + if ( withDeletes =3D=3D true )=20 { - queryInAtt=3D "and a.id_entity in("+idsAtt+")"; - } - =09 + deleteString =3D ""; + } =09 =20 + string queryInAtt =3D ""; + if (attributeIds !=3D "") + { + queryInAtt =3D "and a.id_entity in("+ attributeIds +")"; + } + =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"" - from attribute a,class cp,class ca,entity e,class cd - where a.""classId"" in ({0}) and - a.""classId"" =3D cp.""id_entity"" and - a.""id_entity"" =3D e.""id_entity"" and - e.""class"" =3D ca.""id_entity"" and - cd.""id_entity"" =3D ca.""parentId""" + queryInAtt , - inheritanceToString( idEntity ) ); + a.""sysAttName"" as ""attName"", + a.""isVirtual"" as ""isVirtual"", + ca.""sysName"" as ""typeName"", + cp.""sysName"" as ""className"", + cd.""parentId"" as ""inheritance"" + from attribute a, class cp, class ca, entity e, class cd + where a.""classId"" in ({0}) and + a.""classId"" =3D cp.""id_entity"" and + a.""id_entity"" =3D e.""id_entity"" and + e.""class"" =3D ca.""id_entity"" and + cd.""id_entity"" =3D ca.""parentId"" {1} {2}", + inheritanceToString( idEntity ), deleteString, queryInAtt ); =09 //Realizo la consulta DataTable dtAtt =3D conn.doSelect( query ); @@ -832,7 +417,6 @@ } } =09 - //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)drAtt["typeName"] =3D=3D "pertinence" || isParentPertine= nce ) { |
Author: marcelo Date: 2005-07-08 10:29:43 -0400 (Fri, 08 Jul 2005) New Revision: 1451 Modified: humano2/trunk/apps/import/ProcessDir.cs humano2/trunk/components/import/Import.cs humano2/trunk/components/rules/Rules.cs humano2/trunk/components/tests/xmltools.cs humano2/trunk/components/viewTools/ViewTools.cs humano2/trunk/components/webTools/Adapter.cs humano2/trunk/components/webTools/Html.cs humano2/trunk/components/webTools/basePage.cs humano2/trunk/components/webTools/interfacetools.cs humano2/trunk/components/webTools/session.cs humano2/trunk/components/webTools/xmltools.cs humano2/trunk/core/db/absComplex.cs humano2/trunk/core/db/absCrud.cs humano2/trunk/web/builder/site/buildattribute.aspx.cs humano2/trunk/web/builder/site/combobox_type_entity.aspx.cs humano2/trunk/web/builder/site/createInstanceRule.aspx.cs humano2/trunk/web/builder/site/dataoperationbar.aspx.cs humano2/trunk/web/builder/site/foldermanagement.aspx.cs humano2/trunk/web/portal/site/downloadView.aspx.cs Log: * Included Marijns patches to remove compiler warnings. Went with the fl= ow and I removed some aswell. Modified: humano2/trunk/apps/import/ProcessDir.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/apps/import/ProcessDir.cs 2005-07-08 14:08:25 UTC (rev = 1450) +++ humano2/trunk/apps/import/ProcessDir.cs 2005-07-08 14:29:43 UTC (rev = 1451) @@ -20,7 +20,7 @@ //string baseDir =3D Environment.CurrentDirectory + "import\\toBeProc= esed\\"; string baseDir =3D @"D:\H250-Trunk\upload\import\toBeProcesed\"; =09 - string sAttr =3D ConfigurationSettings.AppSettings["configFile"]; + //string sAttr =3D ConfigurationSettings.AppSettings["configFile"]; =20 DirectoryInfo di =3D new DirectoryInfo(baseDir); FileInfo[] fi =3D di.GetFiles(); Modified: humano2/trunk/components/import/Import.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/import/Import.cs 2005-07-08 14:08:25 UTC (re= v 1450) +++ humano2/trunk/components/import/Import.cs 2005-07-08 14:29:43 UTC (re= v 1451) @@ -448,10 +448,10 @@ } catch(Exception e) { - throw(new ImportException("Basic information in XML file missing")); + throw(new ImportException("Basic information in XML file missing : "= +e.Message)); } if (userId =3D=3D 0 || domainId =3D=3D 0 || classId =3D=3D 0 || delim= itator =3D=3D '0' || dbAttsStr =3D=3D null || fileAttsStr =3D=3D null) - throw(new ImportException("Basic information in XML file is corrupt/= wrong")); + throw(new ImportException("Basic information in XML file is corrupt/= wrong" )); =20 if (qualifierStr !=3D "") qualifier =3D Convert.ToChar(qualifierStr); Modified: humano2/trunk/components/rules/Rules.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/rules/Rules.cs 2005-07-08 14:08:25 UTC (rev = 1450) +++ humano2/trunk/components/rules/Rules.cs 2005-07-08 14:29:43 UTC (rev = 1451) @@ -13,7 +13,7 @@ { public ProcessFormulas theFormH2 =3D new ProcessFormulas(); =09 - private absComplex complex =3D null; + private absComplex complex =3D null; private absCrud crud =3D null; =20 #region CONSTRUCTOR @@ -22,7 +22,7 @@ // // TODO: Add constructor logic here // - complex =3D Factory.Complex(); + complex =3D Factory.Complex(); crud =3D complex.GetCore().Crud; } #endregion @@ -40,21 +40,21 @@ =20 #region METODOS =20 - ///<summary>Creates an empty DataTable with the formula structure.</su= mmary> - ///<returns>a datatable with one row and the correct column names</ret= urns> - public static DataTable getEmptyRuleDataTable() - { - DataTable dt =3D new DataTable(); - dt.Columns.Add("attributeIdRule"); - dt.Columns.Add("operatorRule"); - dt.Columns.Add("elementRule"); - dt.Columns.Add("setTo"); - dt.Columns.Add("valueRule"); - dt.Columns.Add("orderRule"); - dt.Columns.Add("nameRule"); - dt.Columns.Add("descRule"); - dt.Rows.Add(dt.NewRow()); - return dt; + ///<summary>Creates an empty DataTable with the formula structure.</su= mmary> + ///<returns>a datatable with one row and the correct column names</ret= urns> + public static DataTable getEmptyRuleDataTable() + { + DataTable dt =3D new DataTable(); + dt.Columns.Add("attributeIdRule"); + dt.Columns.Add("operatorRule"); + dt.Columns.Add("elementRule"); + dt.Columns.Add("setTo"); + dt.Columns.Add("valueRule"); + dt.Columns.Add("orderRule"); + dt.Columns.Add("nameRule"); + dt.Columns.Add("descRule"); + dt.Rows.Add(dt.NewRow()); + return dt; } =20 /// <summary> @@ -235,7 +235,6 @@ { string attributes,operators,elements; string[] arrAttributes,arrOperators,arrElements; - int attrib; string str_attrib=3D""; int operatorId; //,setToId,idRel; string elementRule,setTo; @@ -343,7 +342,6 @@ { string attributes,operators,elements; string[] arrAttributes,arrOperators,arrElements; - int attrib; string str_attrib =3D ""; int operatorId; //,setToId,idRel; string elementRule,setTo; @@ -579,7 +577,7 @@ =20 //dt1 =3D vt.GetSQLDataTable(dtParam); =20 - + } =20 ///<sumary>funcion que recorre el DT y actualiza la columna en la DB</= sumary> Modified: humano2/trunk/components/tests/xmltools.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/tests/xmltools.cs 2005-07-08 14:08:25 UTC (r= ev 1450) +++ humano2/trunk/components/tests/xmltools.cs 2005-07-08 14:29:43 UTC (r= ev 1451) @@ -27,7 +27,7 @@ char[] buf =3D new char[FileSize]; // lets define an array o= f type char field (i.e. variable) buf // for more help please see .net sdk StreamReader sr =3D new StreamReader(new FileStream(FileName= , FileMode.Open, FileAccess.Read)); - int retval =3D sr.ReadBlock(buf, 0, FileSize); // no. of byt= es read + sr.ReadBlock(buf, 0, FileSize); // no. of bytes read //Console.Write ("Total Bytes Read =3D " + retval + "\n"); filereadbuf =3D new string(buf); // store it in our field =20 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-07-08 14:08:25 U= TC (rev 1450) +++ humano2/trunk/components/viewTools/ViewTools.cs 2005-07-08 14:29:43 U= TC (rev 1451) @@ -480,7 +480,7 @@ foreach(ViewTable table in affectedTables) { affectedColumns =3D table.Columns; - int index =3D 0; + =09 foreach(ViewColumns Col in affectedColumns) { aux =3D new DisplayOrder(); @@ -1737,8 +1737,6 @@ Relation.IdFK =3D toColumnIndex; Relation.RelationType =3D rel; =20 - int position =3D 0; - int pos =3D -1; =20 //Logger.Log("fromColumnIndex=3D " + fromColumnIndex, LogLev= el.Trace); //Logger.Log("toColumnIndex=3D " + toColumnIndex, LogLevel.T= race); 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-07-08 14:08:25 UTC = (rev 1450) +++ humano2/trunk/components/webTools/Adapter.cs 2005-07-08 14:29:43 UTC = (rev 1451) @@ -536,7 +536,7 @@ } =20 ///<summary>Says if the name of a domain already exists</summary= > - ///<param name=3D"name">The name of domain to check</summary> + ///<param name=3D"name">The name of domain to check</param> ///<returns>True: the name of domain exists, else returns false<= /returns> public bool DomainNameExists(string name) { @@ -1719,10 +1719,10 @@ return (int[]) res.ToArray(typeof(int)); } =20 - /// <summary> - /// Busca las reglas de una clase y las ejecuta... - /// </summary> - /// <param name=3D"classId"></param> + /// <summary> + /// Busca las reglas de una clase y las ejecuta... + /// </summary> + /// <param name=3D"classId"></param> /// <param name=3D"id_entity"></param> public void RulesForClass(int classId, int id_entity) { Modified: humano2/trunk/components/webTools/Html.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/Html.cs 2005-07-08 14:08:25 UTC (re= v 1450) +++ humano2/trunk/components/webTools/Html.cs 2005-07-08 14:29:43 UTC (re= v 1451) @@ -87,9 +87,9 @@ =20 ///<summary> ///Returns the path used to store client datas/files (uploaded f= iles for example). - ///This path is taken from the config.xml <clientPath> tag which= is concatenated to the current domainId - ///<returns>The path of client</return> + ///This path is taken from the config.xml <clientPath> tag= which is concatenated to the current domainId ///</summary> + ///<returns>The path of client</returns> public static string GetClientPath(SessionCredencial userCred) { int domainId =3D userCred.DomainIds[userCred.CurrentDomainIn= dex]; 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-07-08 14:08:25 UTC= (rev 1450) +++ humano2/trunk/components/webTools/basePage.cs 2005-07-08 14:29:43 UTC= (rev 1451) @@ -131,7 +131,7 @@ =20 ///<summary> ///To get the filename that will be used to store files uploaded= by the user - ///<summary> + ///</summary> protected string buildFileName(int idEntity, string attId, strin= g filename) { string res =3D idEntity + "_" + attId + "_" + filename; Modified: humano2/trunk/components/webTools/interfacetools.cs =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- humano2/trunk/components/webTools/interfacetools.cs 2005-07-08 14:08:= 25 UTC (rev 1450) +++ humano2/trunk/components/webTools/interfacetools.cs 2005-07-08 14:29:= 43 UTC (rev 1451) @@ -253,7 +253,7 @@ ///<param name=3D"classId">The id of class</param> ///<param name=3D"userCred">Session object of user</param> ///<param name=3D"fullPert">True: the id of pertinence att will = be idatt^destAtt. False only idAtt (used in forms)</param> - ///<return>A xml string with the list of attributes for a class<= /returns> + ///<returns>A xml string with the list of attributes for a class= </returns> ///</summary> public static string GetXmlAttribListForClass(int classId,SessionCrede= ncial userCred, bool fullPert)=20 { @@ -292,10 +292,9 @@ public static DataTable GetAttribListForClass(int classId, Sessi= onCredencial userCred,bool fullPert) { int attlogin =3D 0; - int idatt =3D 0; - DataTable dtpert; - DataTable dtrel; - int idClassRel =3D 0; + int idatt =3D 0; + DataTable dtpert; + int idClassRel =3D 0; DataTable dt =3D userCred.CoreAdapter.GetAttributesFromClass= (classId); DataTable res =3D new DataTable(); DataColumn colName; Modified: humano2/trunk/components/webTools/session.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/session.cs 2005-07-08 14:08:25 UTC = (rev 1450) +++ humano2/trunk/components/webTools/session.cs 2005-07-08 14:29:43 UTC = (rev 1451) @@ -273,7 +273,7 @@ } csc.lastAccess =3D DateTime.Now; } - catch(System.Exception e) + catch { csc =3D null; } Modified: humano2/trunk/components/webTools/xmltools.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/xmltools.cs 2005-07-08 14:08:25 UTC= (rev 1450) +++ humano2/trunk/components/webTools/xmltools.cs 2005-07-08 14:29:43 UTC= (rev 1451) @@ -73,7 +73,7 @@ System.Xml.XPath.XPathDocument oXPath =3D new Syste= m.Xml.XPath.XPathDocument(oXR); xsl.Transform(oXPath,null,oSW); } - catch (System.Exception e) + catch=20 { //Put in custom error handler here... //string x =3D e.ToString(); @@ -138,7 +138,7 @@ ///Takes a xml string representing a structure of a form with cl= ass and attributes. ///The objective is to reorder the tags "attribute" using a list= of attributes (that comes from the table [form]) ///</summary> - ///<param name=3D"xmlStructure"></param> + ///<param name=3D"xmlDataStructure"></param> ///<param name=3D"attributesList">The list of id of attributes: = we want this order for the xml struture string</param> ///<returns>the xml datastruture with the tags "attributes" in s= ame order as in attributesList</returns> public static string OrderAttributesInDataStructure( string xmlD= ataStructure, string attributesList, string xslPath) 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-07-08 14:08:25 UTC (rev 1450= ) +++ humano2/trunk/core/db/absComplex.cs 2005-07-08 14:29:43 UTC (rev 1451= ) @@ -51,7 +51,7 @@ /// <summary> /// Crea una tabla temporal para realizar el paginado de una consulta = por ViewTools /// </summary> - /// <param name=3D"args">columnas de la tabla temporal</param> + /// <param name=3D"tableName">columnas de la tabla temporal</param> /// <returns>la consulta que crea la tabla temporal</returns> abstract public string BuildTempTable(ref string tableName); =20 @@ -118,7 +118,7 @@ ///<returns>Devuele un true si una clase. Si no, false.</returns> abstract public bool IsClass(int idEntity); =20 - ///<sumaray>Returns the sysName of a class given the classId</su= mmary> + ///<summary>Returns the sysName of a class given the classId</su= mmary> ///<param name=3D"classId">The id of the class</param> ///<returns>The sysName of the class</returns> abstract public string GetClassSysName(string classId); @@ -343,7 +343,7 @@ =20 ///<summary> ///Returns the class a pertinence attribute points to - ///<summary> + ///</summary>summary> ///<param name=3D"attributeId">the pertinence attribute</param> ///<returns>The id_entity of the class pointed by the attribute.= If the att is not a pert att, returns ""</returns> abstract public string GetPertinenceClassForAttribute(string att= ributeId); 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-07-08 14:08:25 UTC (rev 1450) +++ humano2/trunk/core/db/absCrud.cs 2005-07-08 14:29:43 UTC (rev 1451) @@ -117,7 +117,7 @@ =20 /// <summary>Devuelve los valores no nulos de una instancia</summary> /// <param name=3D"idEntity">El ID del objeto del cual se desea los va= lores</param> - ///<param name=3D"">si True tambien muestra los elementos marcados bor= rados.</param> + ///<param name=3D"withDeletes">si True tambien muestra los elementos m= arcados borrados.</param> /// <returns>Un DataSet con los valores, una tabla por tipo de dato</r= eturns> abstract public DataSet ReadData(int idEntity, bool withDeletes,string= idsAtt); =20 @@ -266,7 +266,7 @@ ///<summary>Elimina una lista de atributos de una clase.</summary> ///<remarks>Este metodo solo marca los objetos como borrados pero no l= os borra fisicamente de la base de datos.</remarks> ///<returns>La cantidad de elementos borraros.</returns> - ///<param name=3D"idEntities">Los Id_Entity's de los objetos para elim= inar</param> + ///<param name=3D"structure">La estructura con el objeto para eliminar= </param> ///<exception cref=3D"Humano2.Core.Db.NoExistException">Cuando un ID n= o existe en el sistema.</exception> virtual public int deleteClassAttributes(DataSet structure)=20 { Modified: humano2/trunk/web/builder/site/buildattribute.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/buildattribute.aspx.cs 2005-07-08 14:0= 8:25 UTC (rev 1450) +++ humano2/trunk/web/builder/site/buildattribute.aspx.cs 2005-07-08 14:2= 9:43 UTC (rev 1451) @@ -1,4 +1,4 @@ -// + // // The Humano2 Business solution. // Copyright (C) 2004,5 Humano2 Chile S.A. (http://www.humano2.com) // @@ -41,7 +41,7 @@ protected System.Web.UI.WebControls.Label lblTablas; =20 private bool isNewAttribute =3D true; - private string selectedVisibleTabName; + // private string selectedVisibleTabName; private string tmpAttName =3D ""; =20 override protected void OnInit(EventArgs e) @@ -969,7 +969,7 @@ foreach(DataRow row2 in dtrel.Rows)=20 { string attName =3D Convert.ToString(row2["attName"]); - string className =3D Convert.ToString(dr["name"]); + //string className =3D Convert.ToString(dr["name"]); //attrNameList[Convert.ToString(className+":"+attName)] =3D Conve= rt.ToString(idatt.ToString()+"^"+row2["id_entity"]); attrNameList[Convert.ToString(attNamePert+"."+attName)] =3D Conve= rt.ToString(idatt.ToString()+"^"+row2["id_entity"]); if(row2["isPrimary"].ToString()=3D=3D"1") @@ -1016,7 +1016,7 @@ foreach(DataRow row2 in dtrel.Rows)=20 { string attName =3D Convert.ToString(row2["attName"]); - string className =3D Convert.ToString(dr["name"]); + //string className =3D Convert.ToString(dr["name"]); //attrIdList[Convert.ToString(idatt.ToString()+"^"+row2["id_entit= y"])] =3D Convert.ToString(className+":"+attName); attrIdList[Convert.ToString(idatt.ToString()+"^"+row2["id_entity"= ])] =3D Convert.ToString(attNamePert+"."+attName); if(row2["isPrimary"].ToString()=3D=3D"1") Modified: humano2/trunk/web/builder/site/combobox_type_entity.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/combobox_type_entity.aspx.cs 2005-07-0= 8 14:08:25 UTC (rev 1450) +++ humano2/trunk/web/builder/site/combobox_type_entity.aspx.cs 2005-07-0= 8 14:29:43 UTC (rev 1451) @@ -33,8 +33,8 @@ public class combobox_type_entity : basePage { protected System.Web.UI.WebControls.ListBox sel_cache; - private absComplex complex =3D null; - private absCrud crud =3D null; + //private absComplex complex =3D null; + //private absCrud crud =3D null; =20 string[] classNames; // Nombres de las clases. int[] classIds; // Ids de las classes. Modified: humano2/trunk/web/builder/site/createInstanceRule.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/createInstanceRule.aspx.cs 2005-07-08 = 14:08:25 UTC (rev 1450) +++ humano2/trunk/web/builder/site/createInstanceRule.aspx.cs 2005-07-08 = 14:29:43 UTC (rev 1451) @@ -10,8 +10,8 @@ using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; =20 -using Humano2.Core; -using Humano2.Core.Db; +using Humano2.Core; +using Humano2.Core.Db; using Humano2.Components.WebTools; using Humano2.Components.Rules; =20 @@ -22,17 +22,17 @@ /// </summary> public class createInstanceRule : basePage { - =20 - private string ruleName; - private string ruleDesc; - private string attributeIdRule; - private string operatorRule; - private string elementRule; - private string setTo; - private string valueRule; - private string orderRule; - - + =20 + private string ruleName; + private string ruleDesc; + private string attributeIdRule; + private string operatorRule; + private string elementRule; + private string setTo; + private string valueRule; + private string orderRule; + + private int ruleId; private int classId; private int domainId; @@ -55,12 +55,12 @@ foreach(DataRow dr in dt1.Rows) { ruleName =3D dr["nameRule"].ToString(); - ruleDesc =3D dr["descRule"].ToString(); - attributeIdRule =3D dr["attributeIdRule"].ToString(); - operatorRule =3D dr["operatorRule"].ToString(); - elementRule =3D dr["elementRule"].ToString(); - setTo =3D dr["setTo"].ToString(); - valueRule =3D dr["valueRule"].ToString(); + ruleDesc =3D dr["descRule"].ToString(); + attributeIdRule =3D dr["attributeIdRule"].ToString(); + operatorRule =3D dr["operatorRule"].ToString(); + elementRule =3D dr["elementRule"].ToString(); + setTo =3D dr["setTo"].ToString(); + valueRule =3D dr["valueRule"].ToString(); orderRule =3D dr["orderRule"].ToString(); } } @@ -82,46 +82,46 @@ =20 } =20 - override protected string createXml() - { - int index =3D userCred.CurrentDomainIndex; - classId =3D Convert.ToInt32(Request["classId"]); - ruleId =3D Convert.ToInt32(Request["ruleId"]); - domainId =3D userCred.DomainIds[index]; - - if(ruleId>0) - { + override protected string createXml() + { + int index =3D userCred.CurrentDomainIndex; + classId =3D Convert.ToInt32(Request["classId"]); + ruleId =3D Convert.ToInt32(Request["ruleId"]); + domainId =3D userCred.DomainIds[index]; + + if(ruleId>0) + { RulesH2 myrules =3D new RulesH2(); DataTable dt1 =3D new DataTable(); - dt1 =3D myrules.GetRules(domainId,0,ruleId); - if(dt1.Rows.Count>0) - { - ruleName =3D dt1.Rows[0]["nameRule"].ToString(); - ruleDesc =3D dt1.Rows[0]["descRule"].ToString(); - attributeIdRule =3D dt1.Rows[0]["attributeIdRule"].ToString(); - operatorRule =3D dt1.Rows[0]["operatorRule"].ToString(); - elementRule =3D dt1.Rows[0]["elementRule"].ToString(); - setTo =3D dt1.Rows[0]["setTo"].ToString(); - valueRule =3D dt1.Rows[0]["valueRule"].ToString(); - orderRule =3D dt1.Rows[0]["orderRule"].ToString(); - } - } - - string strXml =3D "<Page>"; - strXml +=3D "<domainId>" + domainId + "</domainId>"; - strXml +=3D "<rule>"; - strXml +=3D "<id>" + ruleId + "</id>"; - strXml +=3D "<classId>" + classId + "</classId>"; - strXml +=3D "<name>" + ruleName + "</name>"; - strXml +=3D "<ruleDesc>" + ruleDesc + "</ruleDesc>"; - strXml +=3D "<attributeIdRule>" + attributeIdRule + "</attr= ibuteIdRule>"; - strXml +=3D "<operatorRule>" + operatorRule + "</operatorRu= le>"; - strXml +=3D "<elementRule>" + elementRule + "</elementRule>= "; - strXml +=3D "<setTo>" + setTo + "</setTo>"; - strXml +=3D "<valueRule>" + valueRule + "</valueRule>"; - strXml +=3D "<orderRule>" + orderRule + "</orderRule>"; - strXml +=3D "</rule>"; - strXml +=3D "<Attributes>"; + dt1 =3D myrules.GetRules(domainId,0,ruleId); + if(dt1.Rows.Count>0) + { + ruleName =3D dt1.Rows[0]["nameRule"].ToString(); + ruleDesc =3D dt1.Rows[0]["descRule"].ToString(); + attributeIdRule =3D dt1.Rows[0]["attributeIdRule"].ToString(); + operatorRule =3D dt1.Rows[0]["operatorRule"].ToString(); + elementRule =3D dt1.Rows[0]["elementRule"].ToString(); + setTo =3D dt1.Rows[0]["setTo"].ToString(); + valueRule =3D dt1.Rows[0]["valueRule"].ToString(); + orderRule =3D dt1.Rows[0]["orderRule"].ToString(); + } + } + + string strXml =3D "<Page>"; + strXml +=3D "<domainId>" + domainId + "</domainId>"; + strXml +=3D "<rule>"; + strXml +=3D "<id>" + ruleId + "</id>"; + strXml +=3D "<classId>" + classId + "</classId>"; + strXml +=3D "<name>" + ruleName + "</name>"; + strXml +=3D "<ruleDesc>" + ruleDesc + "</ruleDesc>"; + strXml +=3D "<attributeIdRule>" + attributeIdRule + "</attr= ibuteIdRule>"; + strXml +=3D "<operatorRule>" + operatorRule + "</operatorRu= le>"; + strXml +=3D "<elementRule>" + elementRule + "</elementRule>= "; + strXml +=3D "<setTo>" + setTo + "</setTo>"; + strXml +=3D "<valueRule>" + valueRule + "</valueRule>"; + strXml +=3D "<orderRule>" + orderRule + "</orderRule>"; + strXml +=3D "</rule>"; + strXml +=3D "<Attributes>"; adapter dbAdapter =3D new adapter(); DataTable attributeTable =3D dbAdapter.GetAttributesFromClass(classId= ); =20 @@ -147,7 +147,7 @@ foreach(DataRow row2 in dtrel.Rows)=20 { string attName =3D Convert.ToString(row2["attName"]); - string className =3D Convert.ToString(dr["name"]); + //string className =3D Convert.ToString(dr["name"]); strXml +=3D "<Att>"; strXml +=3D "<id>" + idatt.ToString()+"^"+row2["id_entity"] + "</i= d>"; strXml +=3D "<name>" + attNamePert+"."+attName + "</name>"; @@ -164,22 +164,22 @@ }=09 } =20 - strXml +=3D "</Attributes>"; - strXml +=3D "<operator>"; - strXml +=3D "<option><id>0</id><text>Greater Equal Than</text></opt= ion>"; - strXml +=3D "<option><id>1</id><text>Less Equal Than</text></option= >"; - strXml +=3D "<option><id>2</id><text>Greater Than</text></option>"; - strXml +=3D "<option><id>3</id><text>Less Than</text></option>"; - strXml +=3D "<option><id>4</id><text>Equal To</text></option>"; - strXml +=3D "<option><id>5</id><text>Distinct To</text></option>"; - strXml +=3D "<option><id>6</id><text>Begin With</text></option>"; - strXml +=3D "<option><id>7</id><text>Contains To</text></option>"; - strXml +=3D "<option><id>8</id><text>In</text></option>"; - strXml +=3D "</operator>"; - strXml +=3D "</Page>"; - Logger.Log("RuleMain: createXml(): " + strXml, LogLevel.Trace); - =20 - return strXml; + strXml +=3D "</Attributes>"; + strXml +=3D "<operator>"; + strXml +=3D "<option><id>0</id><text>Greater Equal Than</text></opt= ion>"; + strXml +=3D "<option><id>1</id><text>Less Equal Than</text></option= >"; + strXml +=3D "<option><id>2</id><text>Greater Than</text></option>"; + strXml +=3D "<option><id>3</id><text>Less Than</text></option>"; + strXml +=3D "<option><id>4</id><text>Equal To</text></option>"; + strXml +=3D "<option><id>5</id><text>Distinct To</text></option>"; + strXml +=3D "<option><id>6</id><text>Begin With</text></option>"; + strXml +=3D "<option><id>7</id><text>Contains To</text></option>"; + strXml +=3D "<option><id>8</id><text>In</text></option>"; + strXml +=3D "</operator>"; + strXml +=3D "</Page>"; + Logger.Log("RuleMain: createXml(): " + strXml, LogLevel.Trace); + =20 + return strXml; } =20 private int createRule(){ Modified: humano2/trunk/web/builder/site/dataoperationbar.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/dataoperationbar.aspx.cs 2005-07-08 14= :08:25 UTC (rev 1450) +++ humano2/trunk/web/builder/site/dataoperationbar.aspx.cs 2005-07-08 14= :29:43 UTC (rev 1451) @@ -35,7 +35,7 @@ { protected System.Web.UI.WebControls.DropDownList attributeList; protected System.Web.UI.WebControls.DropDownList ruleList; - private int _idClass; + // private int _idClass; =09 private void Page_Load(object sender, System.EventArgs e) { 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-07-08 14= :08:25 UTC (rev 1450) +++ humano2/trunk/web/builder/site/foldermanagement.aspx.cs 2005-07-08 14= :29:43 UTC (rev 1451) @@ -72,7 +72,7 @@ dt.Rows.Add(dr); =20 //Creates the table now - DataTable formTable =3D createFolderTable(); + //DataTable formTable =3D createFolderTable(); =20 if(dt !=3D null)=20 {=20 Modified: humano2/trunk/web/portal/site/downloadView.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/downloadView.aspx.cs 2005-07-08 14:08:2= 5 UTC (rev 1450) +++ humano2/trunk/web/portal/site/downloadView.aspx.cs 2005-07-08 14:29:4= 3 UTC (rev 1451) @@ -69,7 +69,6 @@ DataTable resp =3D dbAdapter.GetDataTableView(viewTable, iniClass); =20 StringBuilder sb =3D new StringBuilder(); - int rows, cols; int div =3D Convert.ToInt32(Request.QueryString["separador"]); string delimiter =3D "\""; =20 @@ -86,8 +85,8 @@ break; } =20 - rows =3D resp.Rows.Count; - cols =3D resp.Columns.Count; + //rows =3D resp.Rows.Count; + //cols =3D resp.Columns.Count; =20 absCrud crud =3D Factory.Crud(); absComplex complex =3D crud.GetCore().Complex; |
From: <sv...@de...> - 2005-07-08 14:08:22
|
Author: marcelo Date: 2005-07-08 10:08:25 -0400 (Fri, 08 Jul 2005) New Revision: 1450 Modified: humano2/trunk/components/viewTools/ViewTools.cs Log: * Fixing left over conflicts from merge. 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-07-08 13:59:49 U= TC (rev 1449) +++ humano2/trunk/components/viewTools/ViewTools.cs 2005-07-08 14:08:25 U= TC (rev 1450) @@ -866,11 +866,6 @@ return this.query; =20 } =09 - public string GetLastExecutedQuery() - { - return this.query; =20 - } - =09 private string GetGroupingFilters(string[] strParams) { StringBuilder strFilters =3D new StringBuilder(); |
From: <sv...@de...> - 2005-07-08 13:59:50
|
Author: marcelo Date: 2005-07-08 09:59:49 -0400 (Fri, 08 Jul 2005) New Revision: 1449 Modified: humano2/trunk/components/tests/Humano2.Components.Tests.csproj humano2/trunk/components/tests/formulas.cs humano2/trunk/components/tests/viewTools.cs humano2/trunk/components/tests/xmltools.cs humano2/trunk/components/viewTools/ViewColumns.cs humano2/trunk/components/viewTools/ViewTools.cs humano2/trunk/components/webTools/Adapter.cs humano2/trunk/core/db/absComplex.cs humano2/trunk/core/db/pgsql/pgsqlComplex.cs Log: * Fixes Bug #217, #226, ViewTools got a mayor makeover. But it is by far = not the last one!! Modified: humano2/trunk/components/tests/Humano2.Components.Tests.csproj =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/tests/Humano2.Components.Tests.csproj 2005-0= 7-08 12:00:48 UTC (rev 1448) +++ humano2/trunk/components/tests/Humano2.Components.Tests.csproj 2005-0= 7-08 13:59:49 UTC (rev 1449) @@ -89,6 +89,16 @@ Project =3D "{899BA1AC-E687-4E6D-9577-C0C79301D04A}" Package =3D "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> + <Reference + Name =3D "Humano2.Core" + Project =3D "{CB7AFB6C-990D-475C-85C6-54017060218E}" + Package =3D "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + /> + <Reference + Name =3D "Humano2.Core.Db" + Project =3D "{0CC5A8D4-547D-4283-B908-F4095E1D1A10}" + Package =3D "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + /> </References> </Build> <Files> Modified: humano2/trunk/components/tests/formulas.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/tests/formulas.cs 2005-07-08 12:00:48 UTC (r= ev 1448) +++ humano2/trunk/components/tests/formulas.cs 2005-07-08 13:59:49 UTC (r= ev 1449) @@ -29,7 +29,7 @@ ////// //First test the FunctionH2 class // - [Test] + //[Test] public void TestGetFormulas() { ProcessFormulas formula =3D new ProcessFormulas(); Modified: humano2/trunk/components/tests/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/tests/viewTools.cs 2005-07-08 12:00:48 UTC (= rev 1448) +++ humano2/trunk/components/tests/viewTools.cs 2005-07-08 13:59:49 UTC (= rev 1449) @@ -15,12 +15,13 @@ using Humano2.Core; using Humano2.Core.Db; using Humano2.Components.ViewTools; +using System.Collections; using NUnit.Framework; =20 namespace Humano2.Components.Test.ViewTools { /// <summary> - /// Summary description for ViewTools. + /// All tests work with the template HelpDesk SMB /// </summary> [TestFixture] public class ViewTools @@ -35,15 +36,55 @@ } =20 [Test] + public void getTableList() + { + init(); =20 + Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(10162); + vt.Complex =3D complex; + vt.KeyFlag =3D 0; =20 + =20 + ViewTable [] affectedTables =3D vt.TestGetTableList("10181,1= 0229^18,10231^18".Split(",".ToCharArray())); + ViewColumns[] affectedColumns; + =20 + foreach(ViewTable table in affectedTables) + { + affectedColumns =3D table.Columns; + Logger.Log("TableName: " + table.TableName, LogLevel.Tra= ce); =20 + foreach(ViewColumns Cols in affectedColumns) + { + Logger.Log("Cols Name: " + Cols.ColumnName, LogLevel= .Trace); =20 + } + Logger.Log("---", LogLevel.Trace); + } + =20 + Logger.Log("affectedTables[0].TableName: " + affectedTables[= 0].TableName, LogLevel.Trace); + Assert.IsTrue(affectedTables[0].TableName =3D=3D "\"d10160cT= icket\""); + =20 + affectedColumns =3D affectedTables[0].Columns; + Assert.IsTrue(affectedColumns[0].ColumnName =3D=3D "\"c10162= Title\""); + Logger.Log("affectedColumns[0].ColumnName: " + affectedColum= ns[0].ColumnName, LogLevel.Trace); + =20 + Assert.IsTrue(affectedTables[1].TableName =3D=3D "\"user\"")= ; + affectedColumns =3D affectedTables[1].Columns; + Assert.IsTrue(affectedColumns[0].ColumnName =3D=3D "\"email\= ""); + Assert.IsTrue(affectedColumns[1].ColumnName =3D=3D "\"email\= ""); + } + =20 + =20 + [Test] public void SQLSelect() { init(); =20 - =20 + string[] drCols =3D new string[6]; Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(10162); vt.Complex =3D complex; vt.KeyFlag =3D 0; =20 //Simple columns + drCols[0] =3D "10181"; + drCols[1] =3D ""; + + vt.TestInitSQLVars(drCols); //Don't forget to init SQLVars! string strSelect =3D vt.SQLSelect("10181"); Logger.Log("SQLSelect(\"10181\"): " + strSelect,LogLevel.Tra= ce); Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".\"c10162Title\"".Trim()); @@ -52,45 +93,69 @@ Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".id_entity, \"d10160cTicket\".\"c10162Title\"".Trim()); =20 //Pertinence columns + drCols[0] =3D "10231"; + drCols[1] =3D ""; + vt.TestInitSQLVars(drCols); //Don't forget to init SQLVars! strSelect =3D vt.SQLSelect("10231"); Logger.Log("SQLSelect(\"10231\"): " + strSelect,LogLevel.Tra= ce); Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".\"c10162Assigned to3\"".Trim()); =20 + drCols[0] =3D "10231^18"; + drCols[1] =3D ""; + vt.TestInitSQLVars(drCols); //Don't forget to init SQLVars! strSelect =3D vt.SQLSelect("10231^18"); Logger.Log("SQLSelect(\"10231^18\"): " + strSelect,LogLevel.= Trace); - Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"user\".\"ema= il\"".Trim()); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT user0.\"email\= "".Trim()); =20 + drCols[0] =3D "10181,10231^18"; + drCols[1] =3D ""; + vt.TestInitSQLVars(drCols); //Don't forget to init SQLVars! strSelect =3D vt.SQLSelect("10181,10231^18"); Logger.Log("SQLSelect(\"10181,10231^18\"): " + strSelect,Log= Level.Trace); - Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".\"c10162Title\", \"user\".\"email\"".Trim()); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".\"c10162Title\", user0.\"email\"".Trim()); =20 + drCols[0] =3D "10187^10179"; + drCols[1] =3D ""; + vt.TestInitSQLVars(drCols); //Don't forget to init SQLVars! strSelect =3D vt.SQLSelect("10187^10179"); Logger.Log("SQLSelect(\"10187^10179\"): " + strSelect,LogLev= el.Trace); - Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t Status\".\"c10163Status Name\"".Trim()); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT d10160cTicketS= tatus0.\"c10163Status Name\"".Trim()); + =20 + //Double Pertinence on the same class + drCols[0] =3D "10229^18,10231^18"; + drCols[1] =3D ""; + vt.TestInitSQLVars(drCols); //Don't forget to init SQLVars! + strSelect =3D vt.SQLSelect("10229^18,10231^18"); + Logger.Log("SQLSelect(\"10229^18,10231^18\"): " + strSelect,= LogLevel.Trace); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT user0.\"email\= ", user1.\"email\" as \"email1\"".Trim());=20 } =20 [Test] public void SQLWhere() { init(); =20 + string[] drCols =3D new string[6]; =20 Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(10162); vt.Complex =3D complex; vt.KeyFlag =3D 0; =20 + drCols[0] =3D "0,10187"; + drCols[1] =3D "10187^10179|7|'closed'|0|0"; + vt.TestInitSQLVars(drCols); //Don't forget to init SQLVars! + =20 //Simple conditions string strWhere =3D vt.SQLWhere("10187^10179|7|'closed'|0|0"= ); Logger.Log("SQLWhere(\"10187^10179|7|'closed'|0|0\"):" + str= Where, LogLevel.Trace); - Assert.IsTrue(strWhere.Trim() =3D=3D "WHERE \"d10160cTicket = Status\".\"c10163Status Name\" ILIKE '%closed%'".Trim()); + Assert.IsTrue(strWhere.Trim() =3D=3D "WHERE d10160cTicketSta= tus0.\"c10163Status Name\" ILIKE '%closed%'".Trim()); =20 - =20 //Double conditions strWhere =3D vt.SQLWhere("10187^10179|7|'closed'|1|0;10181|4= |'Joli ticket'|0|0"); Logger.Log("SQLWhere(\"10187^10179|7|'closed'|1|0;10181|4|'J= oli ticket'|0|0\"):" + strWhere, LogLevel.Trace); - Assert.IsTrue(strWhere.Trim() =3D=3D "WHERE \"d10160cTicket = Status\".\"c10163Status Name\" ILIKE '%closed%' AND \"d10160cTicket\".\"c= 10162Title\" =3D 'Joli ticket'".Trim()); =20 + Assert.IsTrue(strWhere.Trim() =3D=3D "WHERE d10160cTicketSta= tus0.\"c10163Status Name\" ILIKE '%closed%' AND \"d10160cTicket\".\"c1016= 2Title\" =3D 'Joli ticket'".Trim()); =20 } =20 - [Test] + //[Test] public void SQLOrderBy() { init(); =20 @@ -106,14 +171,20 @@ [Test] public void SQLFrom() { - init(); =20 + string[] drCols =3D new string[6]; + init(); =20 Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(10162); vt.Complex =3D complex; vt.KeyFlag =3D 0; =20 - string strFrom =3D vt.SQLFrom("0,10181,10208,10231^18,10209"= ,"10187^10179|7|'closed'|0|0"); - Logger.Log("SQLFrom(\"0,10181,10208,10231^18,10209\",\"10187= ^10179|7|'closed'|0|0\");" + strFrom, LogLevel.Trace); =20 - Assert.IsTrue(strFrom.Trim() =3D=3D "FROM \"d10160cTicket\" = inner join \"entity\" on \"d10160cTicket\".id_entity =3D \"entity\".id_en= tity and entity.\"delDate\" is null LEFT JOIN \"user\" ON \"d10160cTick= et\".\"c10162Assigned to3\" =3D \"user\".id_entity LEFT JOIN entity e1 ON= \"user\".id_entity =3D e1.id_entity LEFT JOIN \"d10160cTicket Status\" = ON \"d10160cTicket\".\"c10162Status\" =3D \"d10160cTicket Status\".id_ent= ity LEFT JOIN entity e2 ON \"d10160cTicket Status\".id_entity =3D e2.id_e= ntity".Trim()); + drCols[0] =3D "0,10231^18,10229^18,10187^10179"; + drCols[1] =3D ""; + vt.TestInitSQLVars(drCols); //Don't forget to init SQLVars! + string strFrom =3D vt.SQLFrom("0,10231^18,10229^18,10187^101= 79","",""); + Logger.Log("SQLFrom(\"0,10231^18,10229^18,10187^10179\",\"\"= );" + strFrom, LogLevel.Trace); + =20 + Assert.IsTrue(strFrom.Trim() =3D=3D=20 + "FROM \"d10160cTicket\" inner join \"entity\" on \"d= 10160cTicket\".id_entity =3D \"entity\".id_entity and entity.\"delDate\" = is null LEFT JOIN \"user\" user0 ON \"d10160cTicket\".\"c10162Assigned = to3\" =3D user0.id_entity LEFT JOIN entity e1 ON user0.id_entity =3D e1.i= d_entity LEFT JOIN \"user\" user1 ON \"d10160cTicket\".\"c10162Request b= y1\" =3D user1.id_entity LEFT JOIN \"d10160cTicket Status\" d10160cTicket= Status2 ON \"d10160cTicket\".\"c10162Status\" =3D d10160cTicketStatus2.id= _entity LEFT JOIN entity e2 ON d10160cTicketStatus2.id_entity =3D e2.id_e= ntity"); } =20 [Test] @@ -126,19 +197,62 @@ DataTable dtParam =3D this.makeDataTableInViewTools(); DataRow dr =3D dtParam.NewRow(); =20 - dr["columna"] =3D "0,10181,10208,10231^18,10209"; - dr["filtros"] =3D "10187^10179|7|'closed'|0|0"; - //dr["group"] =3D ""; - //dr["having"] =3D ""; - dr["order"] =3D "10231^18|0"; - + //Basic query with double pert attribute + dr["columna"] =3D "0,10231^18,10229^18,10187^10179"; + dr["filtros"] =3D ""; + =09 dtParam.Rows.Add(dr); vt.GetSQLDataTable(dtParam); //Don't get result, only to hav= e the query string strQuery =3D vt.GetLastExecutedQuery(); Logger.Log("strQuery=3D " + strQuery,LogLevel.Trace); - Assert.IsTrue(strQuery.Trim() =3D=3D "SELECT \"d10160cTicket= \".id_entity, \"d10160cTicket\".\"c10162Title\", \"d10160cTicket\".\"c101= 62Date\", \"user\".\"email\", \"d10160cTicket\".\"c10162Resolution Date\"= FROM \"d10160cTicket\" inner join \"entity\" on \"d10160cTicket\".id_ent= ity =3D \"entity\".id_entity and entity.\"delDate\" is null LEFT JOIN \= "user\" ON \"d10160cTicket\".\"c10162Assigned to3\" =3D \"user\".id_entit= y LEFT JOIN entity e1 ON \"user\".id_entity =3D e1.id_entity LEFT JOIN \= "d10160cTicket Status\" ON \"d10160cTicket\".\"c10162Status\" =3D \"d1016= 0cTicket Status\".id_entity LEFT JOIN entity e2 ON \"d10160cTicket Status= \".id_entity =3D e2.id_entity WHERE e1.\"delDate\" IS NULL AND e2.\"delD= ate\" IS NULL and \"d10160cTicket Status\".\"c10163Status Name\" ILIKE '= %closed%' ORDER BY upper(\"user\".\"email\") asc".Trim()); + Assert.IsTrue(strQuery.Trim() =3D=3D "SELECT \"d10160cTicket= \".id_entity, user0.\"email\", user1.\"email\" as \"email2\", d10160cTick= etStatus2.\"c10163Status Name\" FROM \"d10160cTicket\" inner join \"entit= y\" on \"d10160cTicket\".id_entity =3D \"entity\".id_entity and entity.\"= delDate\" is null LEFT JOIN \"user\" user0 ON \"d10160cTicket\".\"c1016= 2Assigned to3\" =3D user0.id_entity LEFT JOIN entity e1 ON user0.id_entit= y =3D e1.id_entity LEFT JOIN \"user\" user1 ON \"d10160cTicket\".\"c1016= 2Request by1\" =3D user1.id_entity LEFT JOIN \"d10160cTicket Status\" d10= 160cTicketStatus2 ON \"d10160cTicket\".\"c10162Status\" =3D d10160cTicket= Status2.id_entity LEFT JOIN entity e2 ON d10160cTicketStatus2.id_entity =3D= e2.id_entity WHERE e1.\"delDate\" IS NULL AND e2.\"delDate\" IS NULL".T= rim()); + =20 + //query with where + dr["columna"] =3D "0,10231^18,10229^18,10187^10179"; + dr["filtros"] =3D "10231^18|4|'te...@hu...'|0|0"; + vt.GetSQLDataTable(dtParam); //Don't get result, only to hav= e the query + strQuery =3D vt.GetLastExecutedQuery(); + Logger.Log("strQuery=3D " + strQuery,LogLevel.Trace); + Assert.IsTrue(strQuery.Trim() =3D=3D "SELECT \"d10160cTicket= \".id_entity, user0.\"email\", user1.\"email\" as \"email2\", d10160cTick= etStatus2.\"c10163Status Name\" FROM \"d10160cTicket\" inner join \"entit= y\" on \"d10160cTicket\".id_entity =3D \"entity\".id_entity and entity.\"= delDate\" is null LEFT JOIN \"user\" user0 ON \"d10160cTicket\".\"c1016= 2Assigned to3\" =3D user0.id_entity LEFT JOIN entity e1 ON user0.id_entit= y =3D e1.id_entity LEFT JOIN \"user\" user1 ON \"d10160cTicket\".\"c1016= 2Request by1\" =3D user1.id_entity LEFT JOIN \"d10160cTicket Status\" d10= 160cTicketStatus2 ON \"d10160cTicket\".\"c10162Status\" =3D d10160cTicket= Status2.id_entity LEFT JOIN entity e2 ON d10160cTicketStatus2.id_entity =3D= e2.id_entity WHERE e1.\"delDate\" IS NULL AND e2.\"delDate\" IS NULL AN= D e1.\"delDate\" IS NULL AND e2.\"delDate\" IS NULL and user0.\"email\" = =3D 'te...@hu...'".Trim()); } =20 + //[Test] + public void getSQLVars() + { + //Logger.Log(\"<<getSQLVars>>", LogLevel.Trace); + init(); =20 + Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(10162); + vt.Complex =3D complex; + vt.KeyFlag =3D 0; =20 + string[] drCols =3D new string[6]; + drCols[0] =3D "0,10181,10208,10213,10231^18"; + drCols[1] =3D "10231^18|4|'to...@em...'|1|0;10229^18|7|'lu= lu'|0|0"; + =20 + SortedList SQLVarsList =3D vt.TestGetSQLVars(drCols); + =20 + string tableName0 =3D Convert.ToString(SQLVarsList.GetByInde= x(SQLVarsList.IndexOfKey("10231^18")));=20 + string tableName1 =3D Convert.ToString(SQLVarsList.GetByInde= x(SQLVarsList.IndexOfKey("10229^18"))); + //Logger.Log("tableName0 =3D " + tableName0,LogLevel.Trace); + //Logger.Log("tableName1 =3D " + tableName1,LogLevel.Trace); + Assert.IsTrue(tableName0 =3D=3D "user0"); + Assert.IsTrue(tableName1 =3D=3D "user1"); + =20 + drCols[0] =3D "0,10181,10208,10213,10229^18,10229^19,10231^1= 8"; + drCols[1] =3D "10187^10179|4|'open'|0|0;"; + =20 + SQLVarsList =3D vt.TestGetSQLVars(drCols); + =20 + tableName0 =3D Convert.ToString(SQLVarsList.GetByIndex(SQLVa= rsList.IndexOfKey("10229^18")));=20 + tableName1 =3D Convert.ToString(SQLVarsList.GetByIndex(SQLVa= rsList.IndexOfKey("10231^18"))); + string tableName2 =3D Convert.ToString(SQLVarsList.GetByInde= x(SQLVarsList.IndexOfKey("10187^10179"))); + //Logger.Log("tableName0 =3D " + tableName0,LogLevel.Trace); + //Logger.Log("tableName1 =3D " + tableName1,LogLevel.Trace); + //Logger.Log("tableName2 =3D " + tableName2,LogLevel.Trace); + =20 + Assert.IsTrue(tableName0 =3D=3D "user0"); + Assert.IsTrue(tableName1 =3D=3D "user1"); + Assert.IsTrue(tableName2 =3D=3D "d10160cTicketStatus2"); + } =20 /// <summary> /// Funcion que genera un datatable con la forma en que ViewTool= s lo recibe... Modified: humano2/trunk/components/tests/xmltools.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/tests/xmltools.cs 2005-07-08 12:00:48 UTC (r= ev 1448) +++ humano2/trunk/components/tests/xmltools.cs 2005-07-08 13:59:49 UTC (r= ev 1449) @@ -35,7 +35,7 @@ return filereadbuf; } =20 - [Test] + //[Test] public void OrderAttributesInDataStructure() { //Loads the xml in a string Modified: humano2/trunk/components/viewTools/ViewColumns.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/ViewColumns.cs 2005-07-08 12:00:48= UTC (rev 1448) +++ humano2/trunk/components/viewTools/ViewColumns.cs 2005-07-08 13:59:49= UTC (rev 1449) @@ -27,6 +27,7 @@ private Enums.AggregateFunctions _func; private int _position; private string _type; + private string fullAtt; //The full attribute value of column. Ex= ample: 10179^10187 or 10167 etc... #endregion =20 #region "CONSTRUCTORS" @@ -61,6 +62,22 @@ this._type =3D value; } } + =20 + public string FullAtt + { + get + { + return this.fullAtt; + } + set + { + this.fullAtt =3D value; + if (value.IndexOf("^") > 0) + { + value =3D value; + } + } + } =20 public Enums.AggregateFunctions Function { @@ -157,4 +174,4 @@ } #endregion } -} \ No newline at end of file +} 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-07-08 12:00:48 U= TC (rev 1448) +++ humano2/trunk/components/viewTools/ViewTools.cs 2005-07-08 13:59:49 U= TC (rev 1449) @@ -36,6 +36,8 @@ private string _whereInit =3D ""; private bool _caseSensitive; //To allow doing insensitive case s= earch private string query; //To get the query from outside + private SortedList SQLVars; //The sql vars used to build the fin= al query =20 + =20 #endregion =20 #region "CONSTRUCTORES" @@ -288,10 +290,63 @@ #endregion =20 #region "METODOS" + =20 + private SortedList getSQLVars(string[] drCols) + { + SortedList res =3D new SortedList(); + int globalIndex =3D 0; + + string strSelect =3D drCols[0]; + string [] strSelectArr =3D strSelect.Split(",".ToCharArray()); + + string strWhere =3D drCols[1]; + string [] strWhereArr =3D strWhere.Split(";".ToCharArray()); + + //Parse strSelect and fill the sortedList + globalIndex =3D fillSortedListWithPertAttributes(res, strSelectArr, 0= ); + fillSortedListWithPertAttributes(res, strWhereArr, globalIndex); + + if (drCols.Length >4) + { + string strOrder =3D drCols[4]; + string [] strOrderArr =3D strOrder.Split(",".ToCharArray()); + fillSortedListWithPertAttributes(res, strOrderArr, globalIndex); + } + //Logger.Log("<<getSQLVars>>", LogLevel.Trace); + =20 + return res; + } + =20 + ///<summary>With a list of attributes fills a sorted list with (= att,SQLVar) id the att is a pert att</summary> + ///<param name=3D"list">The list to fill</param> + ///<param name=3D"attributes">The list of attributes</param> + ///<param name=3D"index">The index used to create the name of va= riables: TableName concatenated to index</param> + private int fillSortedListWithPertAttributes(SortedList list, st= ring [] attributes, int index) + { + for(int i=3D0; i<attributes.Length;i++) + { + string fullAtt =3D (attributes[i].Split("|".ToCharArray(= )))[0]; + string att =3D fullAtt.Split("^".ToCharArray())[0]; //Re= move target if pertinence + Logger.Log("att: " + att,LogLevel.Trace); + bool isPert =3D fullAtt.IndexOf('^') !=3D -1; + //FIXME: do a split fullAtt on ^ to remove remote attribute + // also fix all the calls to SQLVarsList.IndexOfKey to do the same + if(!list.ContainsKey(att) && isPert) + { + Logger.Log(fullAtt + " added",LogLevel.Trace); + string tableId =3D Complex.GetPertinenceClassForAttr= ibute(att); =20 + string tableName =3D (Complex.GetClassSysName(tableI= d) + index).Replace(" ",""); //Don't forget to remove spaces... This is a= SQL variable!! + list.Add(att,"\"" + tableName + "\""); + index++; + } + } + return index; + } + =20 public void ChangeSelect(string strSelect, string strWhere) { Select =3D SQLSelect(strSelect); - From =3D SQLFrom(strSelect,strWhere); + From =3D SQLFrom(strSelect,strWhere,""); Where =3D SQLWhere(strWhere); } =20 @@ -379,10 +434,10 @@ Logger.Log("Final Statement was: " + sql, LogLevel.Error); =09 throw ex; } - =09 } =20 - if(find > -1) { + if(find > -1)=20 + { Complex.doCommand(dropTable); } return res; @@ -407,13 +462,16 @@ return xml; } =20 + =20 public string SQLSelect(string param) { - ViewTable[] affectedTables; + Logger.Log("<<SQLSelect:>>",LogLevel.Trace); + =20 + ViewTable[] affectedTables; StringBuilder Query =3D new StringBuilder(); ViewColumns[] affectedColumns; Logger.Log("SQLSelect: " + param,LogLevel.Trace); - affectedTables =3D GetTableList(param.Split(",".ToCharArray(= ))); + affectedTables =3D getTableList(param.Split(",".ToCharArray(= ))); int i =3D 1; ArrayList values =3D new ArrayList(); DisplayOrder[] disp; @@ -422,35 +480,44 @@ foreach(ViewTable table in affectedTables) { affectedColumns =3D table.Columns; - =09 - foreach(ViewColumns Cols in affectedColumns) + int index =3D 0; + foreach(ViewColumns Col in affectedColumns) { aux =3D new DisplayOrder(); - if(Cols.Function =3D=3D Enums.AggregateFunctions.nofunc) - { - aux.Position =3D Cols.Position; - aux.Text =3D table.TableName + "." + Cols.ColumnName + ", "; - aux.Id =3D Cols.ColumnIndex; - aux.Type =3D Cols.Type; - } - else - { - switch(Cols.Function) - { - case Enums.AggregateFunctions.count: - aux.Position =3D Cols.Position; - aux.Text =3D "count(" + table.TableName + "." + Cols.ColumnName = + "), "; - aux.Id =3D Cols.ColumnIndex; - aux.Type =3D Cols.Type; - break; - case Enums.AggregateFunctions.sum: - aux.Position =3D Cols.Position; - aux.Text =3D "sum(" + table.TableName + "." + Cols.ColumnName + = "), "; - aux.Id =3D Cols.ColumnIndex; - aux.Type =3D Cols.Type; - break; - } - } + =20 + //if the column is in the SQLVars then find the name= in SQLVars else choose table.TableName + string tableAffectedName =3D ""; + if(this.SQLVars.ContainsKey(Col.FullAtt)) + { + tableAffectedName =3D Convert.ToString(this.SQLV= ars.GetByIndex(this.SQLVars.IndexOfKey(Col.FullAtt))); =20 + } + else + { + tableAffectedName =3D table.TableName; + } + =20 + string beginFunction =3D ""; + string endFunction =3D ""; + =20 + switch(Col.Function) + { + case Enums.AggregateFunctions.nofunc: + beginFunction =3D ""; + endFunction =3D ""; + break; + case Enums.AggregateFunctions.count: + beginFunction =3D "count("; + endFunction =3D ")"; + break; + case Enums.AggregateFunctions.sum: + beginFunction =3D "sum("; + endFunction =3D ")"; + break; + } + aux.Text =3D beginFunction + tableAffectedName + ".= " + Col.ColumnName + endFunction + ", "; + aux.Position =3D Col.Position; + aux.Id =3D Col.ColumnIndex; + aux.Type =3D Col.Type; values.Add(aux); i++; } @@ -476,6 +543,7 @@ int begin =3D var.Text.IndexOf(".")+1; int end =3D var.Text.IndexOf(",",begin); string field =3D var.Text.Substring(begin,end - begin); + Logger.Log("field: " + field, LogLevel.Trace); if (selCols.ContainsKey(field)) { field =3D field.Replace("\"",""); @@ -500,7 +568,7 @@ return Query.ToString(); } =20 - public string SQLFrom(string param1, string param2) + public string SQLFrom(string param1, string param2, string order) { string inheritance =3D GetInheritance(IdClass); StringBuilder Query =3D new StringBuilder(); @@ -526,46 +594,61 @@ } } } + if(order !=3D String.Empty) + { + foreach(string p in order.Split(",".ToCharArray())) + { + string[] arrFilters =3D p.Split("|".ToCharArray()); + cols.Add(arrFilters[0]); + } + } =09 relations =3D GetRelatedTableList((string[])cols.ToArray(typeof(strin= g))); if(relations.Length > 0) { - //ViewRelation previousRelation =3D null;=09 string relationType =3D ""; ArrayList tableDictionary =3D new ArrayList(); int counter =3D 1; + SortedList tables =3D new SortedList(); + foreach(ViewRelation relation in relations) { - switch((int)relation.RelationType) + + //Here use SQLVars to build from query + string SQLVar =3D Convert.ToString(this.SQLVars.GetByIndex(this.SQL= Vars.IndexOfKey(relation.IdPK.ToString()))); + =09 + //added this to add only once the table name + if(!tables.ContainsKey(relation.IdPK.ToString())) { - case 1: - relationType =3D " LEFT JOIN "; - break; - case 2: - relationType =3D " LEFT JOIN "; - break; - case 3: - relationType =3D " LEFT JOIN "; - break; - } + tables.Add(relation.IdPK.ToString(),SQLVar); =09 + switch((int)relation.RelationType) + { + case 1: + relationType =3D " LEFT JOIN "; + break; + case 2: + relationType =3D " LEFT JOIN "; + break; + case 3: + relationType =3D " LEFT JOIN "; + break; + } =09 - Query.Append(relationType + relation.EndTableName); - Query.Append(" ON " + relation.IniTableName + "." + relation.Primar= yKeyName); - Query.Append(" =3D " + relation.EndTableName + "." + relation.Forei= gnKeyName); -// Query.Append(" relTbl"+counter+" ON tblA." + relation.PrimaryKeyN= ame); -// Query.Append(" =3D relTbl"+counter+"." + relation.ForeignKeyName)= ; - //previousRelation =3D relation; + Query.Append(relationType + relation.EndTableName + " " + SQLVar )= ; + Logger.Log("fromColumnIndex=3D " + relation.IdPK, LogLevel.Trace); + Logger.Log("toColumnIndex=3D " + relation.IdFK, LogLevel.Trace); + Query.Append(" ON " + relation.IniTableName + "." + relation.Prima= ryKeyName); + Query.Append(" =3D " + SQLVar + "." + relation.ForeignKeyName); =20 - if(tableDictionary.IndexOf(relation.EndTableName) =3D=3D -1) - { - tableDictionary.Add(relation.EndTableName); - Query.Append(" LEFT JOIN entity e" + counter + " ON "); - Query.Append(relation.EndTableName + ".id_entity =3D e" + counter = + ".id_entity "); -// Query.Append("relTbl"+counter+ ".id_entity =3D e" + counter + ".= id_entity "); - - // Query.Append("AND e" + counter + ".\"delDate\" IS NULL "); - _whereInit =3D _whereInit + "e" + counter + ".\"delDate\" IS NULL = AND "; - counter++; + =20 + if(tableDictionary.IndexOf(relation.EndTableName) =3D=3D -1) + { + tableDictionary.Add(relation.EndTableName); + Query.Append(" LEFT JOIN entity e" + counter + " ON "); + Query.Append(SQLVar + ".id_entity =3D e" + counter + ".id_entity = "); + _whereInit =3D _whereInit + "e" + counter + ".\"delDate\" IS NULL= AND "; + counter++; + } } } } @@ -646,6 +729,14 @@ order =3D GetOrder(param.Split(",".ToCharArray())); if(order !=3D String.Empty) { + //Here use SQLVars to build from query + /*string SQLVar =3D Convert.ToString(this.SQLVars.GetByIndex(this.S= QLVars.IndexOfKey(relation.IdPK.ToString()))); + Query.Append(relationType + relation.EndTableName + " " + SQLVar); + Logger.Log("fromColumnIndex=3D " + relation.IdPK, LogLevel.Trace); + Logger.Log("toColumnIndex=3D " + relation.IdFK, LogLevel.Trace); + Query.Append(" ON " + relation.IniTableName + "." + relation.Primar= yKeyName); + Query.Append(" =3D " + SQLVar + "." + relation.ForeignKeyName); +*/ Query.Append("ORDER BY " + order); return Query.ToString(); } @@ -667,13 +758,21 @@ return Query.ToString(); } =20 + ///<summary>Init the SQLVars with select and where strings</summ= ary> + ///<param name=3D"strSelect">The select string</param> + ///<param name=3D"strWhere">The where string</param> + private void initSQLVars(string[] drCols) + { + this.SQLVars =3D getSQLVars(drCols); =20 + } + =20 public string ParseQuery(DataTable Params) { DataRow objRow; object[] objArray; =20 objRow =3D Params.Rows[0]; - + =20 string res =3D ViewCache.Instance().GetCachedStatement(objRow, PageVi= ew) ; if( res !=3D null ) { // We got the cached datatable result. lets return that and not con= struct a new one again. @@ -696,6 +795,10 @@ dataRowColumns[j] =3D String.Empty; } } + + //Paso 0: + //Here set the SortedList that contains the SQLVars + initSQLVars(dataRowColumns); //column and where conditions =09 //Paso 1: //Determinar Tablas y Columnas afectadas en la consulta @@ -705,7 +808,8 @@ =20 //Paso 2: //Construir FROM - Query.Append(SQLFrom(dataRowColumns[0],dataRowColumns[1])); + =09 + Query.Append(SQLFrom(dataRowColumns[0],dataRowColumns[1],dataRowColum= ns[4])); //Logger.Log("FromParam: " + dataRowColumns[1],LogLevel.Trac= e ); =20 //Paso 3: @@ -752,7 +856,7 @@ =09 this.query =3D res; //Update query =20 - ViewCache.Instance().AddStatement(objRow, res, PageView); + ViewCache.Instance().AddStatement(objRow, res, PageView); =20 return res; } @@ -762,6 +866,11 @@ return this.query; =20 } =09 + public string GetLastExecutedQuery() + { + return this.query; =20 + } + =09 private string GetGroupingFilters(string[] strParams) { StringBuilder strFilters =3D new StringBuilder(); @@ -940,17 +1049,25 @@ string parameter; string[] cols; int columnIndex; - string tableName, columnName; + string tableName =3D "", columnName; =20 foreach(string Filtro in strParams) { parameters =3D Filtro.Split("|".ToCharArray()); cols =3D parameters[0].Split("^".ToCharArray()); columnIndex =3D Convert.ToInt32(cols[cols.Length - 1]); - + =09 if(columnIndex !=3D 0) { - tableName =3D Complex.TableName(columnIndex); + int index =3D this.SQLVars.IndexOfKey(cols[0]); + if (index !=3D -1 ) + { + tableName =3D Convert.ToString(this.SQLVars.GetByIndex(this.SQLVar= s.IndexOfKey(cols[0]))); + } + else + { + tableName =3D Complex.TableName(columnIndex); + } columnName =3D Complex.ColumnName(columnIndex); } else @@ -1013,12 +1130,22 @@ =20 if(columnIndex !=3D 0) { - tableName =3D Complex.TableName(columnIndex); + //If pertatt use SQL vars if not simple table name + string fullAtt =3D parameters[0]; + if(fullAtt.IndexOf('^')!=3D-1) + { + Logger.Log("fullAtt: " + fullAtt,LogLevel.Trace)= ; + tableName =3D Convert.ToString(this.SQLVars.GetB= yIndex(this.SQLVars.IndexOfKey(fullAtt.Substring(0,fullAtt.IndexOf("^")))= )); =20 + } + else + { + tableName =3D Complex.TableName(columnIndex);=20 + } columnName =3D Complex.ColumnName(columnIndex); } else { - tableName =3D Complex.TableName(IdClass); + tableName =3D Complex.TableName(IdClass); //id_entity attribute ok columnName =3D "id_entity"; } =20 @@ -1029,6 +1156,7 @@ =09 strFilters.Append(tableName + "." + columnName + " "); int recursionIndex; + Logger.Log("parameters[2]: " + parameters[2],LogLevel.Tr= ace); recursionIndex =3D parameters[2].IndexOf("{"); =20 if(recursionIndex !=3D -1) @@ -1201,7 +1329,7 @@ break; } =20 - if(parameters[4] =3D=3D "2") + if(parameters[4] =3D=3D "2") //FIXME: Should not be =3D=3D"1"?? { strFilters.Append(") "); } @@ -1234,7 +1362,7 @@ return parameter; } =20 - private ViewTable[] GetTableList(string[] strParams) + private ViewTable[] getTableList(string[] strParams) { ArrayList TableNames =3D new ArrayList(); ArrayList Tables =3D new ArrayList(); @@ -1243,13 +1371,14 @@ string tableName; int columnIndex, tablePosition; int i =3D 1; - Logger.Log("GetTableList. Step 1",LogLevel.Trace); + //Logger.Log("getTableList. Step 1",LogLevel.Trace); foreach(string Indice in strParams) { - Logger.Log("GetTableList. Loop",LogLevel.Trace); - Logger.Log("GetTableList. param=3D " + Indice,LogLevel.T= race); + //Logger.Log("getTableList. Loop",LogLevel.Trace); + //Logger.Log("getTableList. param=3D " + Indice,LogLevel= .Trace); string valor =3D Indice.Split("|".ToCharArray()).GetValu= e(0).ToString(); - if(IsNumeric(valor)) + =09 + if(IsNumeric(valor)) { columnIndex =3D Convert.ToInt32(valor); } @@ -1272,11 +1401,13 @@ Logger.Log("columnIndex=3D" + columnIndex,LogLevel.Trace); Col =3D new ViewColumns(columnIndex,Complex.ColumnNa= me(columnIndex)); Col.Type =3D Complex.InstanceType(columnIndex); + tableName =3D Complex.TableName(columnIndex); } else { Col =3D new ViewColumns(0,"id_entity"); Col.Type =3D "int"; + tableName =3D Complex.TableName(IdClass); } =09 try @@ -1288,17 +1419,7 @@ Col.Function =3D (Enums.AggregateFunctions)0; } =20 - if(columnIndex !=3D 0) - { - tableName =3D Complex.TableName(columnIndex); - } - else - { - tableName =3D Complex.TableName(IdClass); - } - tablePosition =3D TableNames.IndexOf(tableName); - =20 if(tablePosition < 0) { Table =3D new ViewTable(); @@ -1311,43 +1432,41 @@ { Table.TableIndex =3D IdClass; } - - if(IdClass !=3D Table.TableIndex && KeyFlag =3D=3D 1) - { - ViewColumns aux =3D new ViewColumns(0,"id_entity"); - aux.Position =3D i; - aux.Type =3D "int"; - Table.AddColumn(aux); - i++; - } - Col.Position =3D i; - Table.PrimaryKeyName =3D "id_entity"; - Table.AddColumn(Col); Tables.Add(Table); TableNames.Add(tableName); } else { Table =3D (ViewTable)Tables[tablePosition]; - // Tables.RemoveAt(tablePosition); - if(IdClass !=3D Table.TableIndex && KeyFlag =3D=3D 1) - { - ViewColumns aux =3D new ViewColumns(0,"id_entity"); - aux.Position =3D i; - aux.Type =3D "int"; =20 - Table.AddColumn(aux); - i++; - } - Col.Position =3D i; - Table.AddColumn(Col); - // Tables.Add(Table); } + =20 + if(IdClass !=3D Table.TableIndex && KeyFlag =3D=3D 1) + { + ViewColumns aux =3D new ViewColumns(0,"id_entity"); + aux.Position =3D i; + aux.Type =3D "int"; + aux.FullAtt =3D valor.Substring(0,valor.IndexOf("^")); + Table.AddColumn(aux); + i++; + } + =20 + if (valor.IndexOf("^")>0) + { + Col.FullAtt =3D valor.Substring(0,valor.IndexOf("^")); //Will be us= ed as a key with SQLVars then + } + else + { + Col.FullAtt =3D valor; //Will be used as a key with SQLVars then + } + =20 + Table.AddColumn(Col); + Col.Position =3D i; i++; } return (ViewTable[])Tables.ToArray(typeof(ViewTable)); } - + =20 private int[] GetParentIndexes(int id_entity) { object res =3D null; @@ -1374,7 +1493,7 @@ StringBuilder Query =3D new StringBuilder(); string iniTable, endTable; =09 - parentIndexes =3D GetParentIndexes(intIdClass); + parentIndexes =3D GetParentIndexes(intIdClass); =20 for(int i =3D 0; i<=3D parentIndexes.Length - 2;i++) { @@ -1383,17 +1502,14 @@ if(previousRelation =3D=3D 0) { Query.Append(iniTable + " inner join " + endTable); - Query.Append(" on " + iniTable + ".id_entity"); - Query.Append(" =3D " + endTable + ".id_entity "); - previousRelation =3D 1; } else { Query.Append("inner join" + endTable); - Query.Append(" on " + iniTable + ".id_entity"); - Query.Append(" =3D " + endTable + ".id_entity "); - previousRelation =3D 1; } + Query.Append(" on " + iniTable + ".id_entity"); + Query.Append(" =3D " + endTable + ".id_entity "); + previousRelation =3D 1; } Query.Append("and entity.\"delDate\" is null "); return Query.ToString(); @@ -1401,7 +1517,8 @@ =20 private ViewRelation[] GetRelatedTableList(string[] strParams) { - ArrayList Relations =3D new ArrayList(); + Logger.Log("<<GetRelatedTableList>> ", LogLevel.Trace); + ArrayList Relations =3D new ArrayList(); string tableNameTo =3D "", tableNameFrom =3D "", columnNameTo =3D "",= columnNameFrom =3D ""; int toColumnIndex =3D 0, length =3D 0, toTableIndex =3D 0, fromColumn= Index =3D 0, fromTableIndex =3D 0; Enums.RelationType rel; @@ -1411,7 +1528,8 @@ foreach(string index in strParams) { flag =3D 0; - if(!IsNumeric(index)) + Logger.Log("index=3D " + index, LogLevel.Trace); + if(!IsNumeric(index)) { string[] aux =3D index.Split("|".ToCharArray()); columns =3D aux[0].Split("^".ToCharArray()); @@ -1626,35 +1744,31 @@ =20 int position =3D 0; int pos =3D -1; - =09 - if(Relations.Count > 0) + =20 + //Logger.Log("fromColumnIndex=3D " + fromColumnIndex, LogLev= el.Trace); + //Logger.Log("toColumnIndex=3D " + toColumnIndex, LogLevel.T= race); + =09 + //Add the relation if it does not belongs yet to the list of= relations + if(!relationsContains(Relation,Relations)) { - foreach(ViewRelation vr in Relations) - { - pos =3D -1; - if(vr.IdClassIni =3D=3D Relation.IdClassIni && vr.IdClassFin =3D=3D= Relation.IdClassFin) - { - pos =3D position; - break; - } - position++; - } - if(pos > -1) - { - Relations.RemoveAt(position); - Relations.Insert(position,Relation); - } - else - { - Relations.Add(Relation); - } - } - else - { Relations.Add(Relation); } } =20 + private bool relationsContains(ViewRelation rel, ArrayList Relat= ions) + { + bool res =3D false; + foreach( ViewRelation relation in Relations) + { + if(relation.IdPK =3D=3D rel.IdPK && relation.IdFK =3D=3D= rel.IdFK) =20 + { + res=3Dtrue; + break; + } + } + return res; + } + =20 private Enums.RelationType GetRelationType(int ClassFrom, int ClassTo,= int RelationColumn) { string strRatio =3D ""; @@ -1693,9 +1807,25 @@ } return res; } - - + =20 + ////////////////////////////////////////////////////////////////= ///////////////////////////////////////////////// + //These functions are not used in the code. They are only here t= o be able to test private functions from outside + // + public ViewTable[] TestGetTableList(string [] strParams) + { + return getTableList(strParams); + } + =20 + public SortedList TestGetSQLVars(string[] drCols) + { + return getSQLVars(drCols); =20 + } + =20 + public void TestInitSQLVars(string[] drCols) + { + initSQLVars(drCols); + } + =20 #endregion - } } 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-07-08 12:00:48 UTC = (rev 1448) +++ humano2/trunk/components/webTools/Adapter.cs 2005-07-08 13:59:49 UTC = (rev 1449) @@ -462,13 +462,22 @@ Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(7); vt.Complex =3D complex; =20 - //Estructuras necesatias para llamar a view tools + //Necesary structure for Viewtools: + //The dataTable MUST contain at lease 6 columns DataTable tabla =3D new DataTable(); DataColumn columna; columna =3D new DataColumn("columna",typeof(string)); tabla.Columns.Add(columna); columna =3D new DataColumn("filtros",typeof(string)); tabla.Columns.Add(columna); + columna =3D new DataColumn("relleno1",typeof(string)); + tabla.Columns.Add(columna); + columna =3D new DataColumn("relleno2",typeof(string)); + tabla.Columns.Add(columna); + columna =3D new DataColumn("relleno3",typeof(string)); + tabla.Columns.Add(columna); + columna =3D new DataColumn("relleno4",typeof(string)); + tabla.Columns.Add(columna); =20 //La consulta que retorna el id del usuario string[] fila =3D {"0","18|4|'" + user + "'|1|0;19|4|'" + password + = "'|0|0"}; 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-07-08 12:00:48 UTC (rev 1448= ) +++ humano2/trunk/core/db/absComplex.cs 2005-07-08 13:59:49 UTC (rev 1449= ) @@ -118,6 +118,12 @@ ///<returns>Devuele un true si una clase. Si no, false.</returns> abstract public bool IsClass(int idEntity); =20 + ///<sumaray>Returns the sysName of a class given the classId</su= mmary> + ///<param name=3D"classId">The id of the class</param> + ///<returns>The sysName of the class</returns> + abstract public string GetClassSysName(string classId); + =20 + =20 /// <summary> /// Resuelve el sysName de una clase con '"' antes y despues del strin= g. /// </summary> @@ -329,14 +335,21 @@ abstract public void finalImport(string [,] attsArr, DataSet dsAtts, s= tring tableName, int domainId, int classId); =20 /// <summary> - /// Get the string id of the pertinence attribute an attribute is relat= ed to + /// Get the string id of the pertinence attribute an attribute is r= elated to /// </summary> /// <param name=3D"attributeId">The attribute for which we want = the pertinence attribute related to</param> /// <returns>The attribute of the pertinence attribute or "" if = attributeId is not a pertinence attribute</returns> abstract public string GetPertinenceForAttribute(string attribut= eId); =20 + ///<summary> + ///Returns the class a pertinence attribute points to + ///<summary> + ///<param name=3D"attributeId">the pertinence attribute</param> + ///<returns>The id_entity of the class pointed by the attribute.= If the att is not a pert att, returns ""</returns> + abstract public string GetPertinenceClassForAttribute(string att= ributeId); + =20 /// <summary> - /// Converts a system attribute name into a user attribute name + /// Converts a system attribute name into a user attribute name /// </summary> /// <param name=3D"sysAttName">system name for attribute </param= > /// <returns>user attribute name</returns> @@ -395,7 +408,6 @@ ///</summary> /// <param name=3D"classId">The classId of an attribute</param> /// <returns>the sys name of basic attribute</returns> - abstract public string GetBasicAttributeSysName(int classId); =20 =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-07-08 12:00:48 UTC (= rev 1448) +++ humano2/trunk/core/db/pgsql/pgsqlComplex.cs 2005-07-08 13:59:49 UTC (= rev 1449) @@ -934,6 +934,38 @@ } } =20 + =20 + override public string GetPertinenceClassForAttribute(string att= ributeId) + { + string req =3D "select \"to\" from pertinence where id_entit= y =3D" + attributeId; + 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]["to"]); //Get the per= tinence attribute + } + } + =20 + =20 + override public string GetClassSysName(string classId) + { + string req =3D "select \"sysName\" from class where id_entit= y=3D" + classId; + string res =3D ""; + DataTable dt =3D doSelect(req); + try + { + res =3D Convert.ToString(dt.Rows[0]["sysName"]); + } + catch + { + Logger.Log("GetClassSysName: " + classId + " is not the = id of a class... :(",LogLevel.Trace); + } + return res; + } + =20 /// <summary> /// Converts a system attribute name into a user attribute name /// </summary> |
From: <sv...@de...> - 2005-07-08 12:01:07
|
Author: marcelo Date: 2005-07-08 08:00:48 -0400 (Fri, 08 Jul 2005) New Revision: 1448 Modified: humano2/branches/viewtools/components/tests/viewTools.cs humano2/branches/viewtools/components/viewTools/ViewColumns.cs humano2/branches/viewtools/components/viewTools/ViewTools.cs humano2/branches/viewtools/components/webTools/Adapter.cs Log: * Final fixes to the branch, going to merge with trunk. Modified: humano2/branches/viewtools/components/tests/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/viewtools/components/tests/viewTools.cs 2005-07-07 0= 3:37:39 UTC (rev 1447) +++ humano2/branches/viewtools/components/tests/viewTools.cs 2005-07-08 1= 2:00:48 UTC (rev 1448) @@ -75,13 +75,16 @@ public void SQLSelect() { init(); =20 - =20 + string[] drCols =3D new string[6]; Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(10162); vt.Complex =3D complex; vt.KeyFlag =3D 0; =20 //Simple columns - vt.TestInitSQLVars("10181",""); //Don't forget to init SQLVa= rs! + drCols[0] =3D "10181"; + drCols[1] =3D ""; + + vt.TestInitSQLVars(drCols); //Don't forget to init SQLVars! string strSelect =3D vt.SQLSelect("10181"); Logger.Log("SQLSelect(\"10181\"): " + strSelect,LogLevel.Tra= ce); Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".\"c10162Title\"".Trim()); @@ -90,28 +93,38 @@ Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".id_entity, \"d10160cTicket\".\"c10162Title\"".Trim()); =20 //Pertinence columns - vt.TestInitSQLVars("10231",""); //Don't forget to init SQLVa= rs! + drCols[0] =3D "10231"; + drCols[1] =3D ""; + vt.TestInitSQLVars(drCols); //Don't forget to init SQLVars! strSelect =3D vt.SQLSelect("10231"); Logger.Log("SQLSelect(\"10231\"): " + strSelect,LogLevel.Tra= ce); Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".\"c10162Assigned to3\"".Trim()); =20 - vt.TestInitSQLVars("10231^18",""); //Don't forget to init SQ= LVars! + drCols[0] =3D "10231^18"; + drCols[1] =3D ""; + vt.TestInitSQLVars(drCols); //Don't forget to init SQLVars! strSelect =3D vt.SQLSelect("10231^18"); Logger.Log("SQLSelect(\"10231^18\"): " + strSelect,LogLevel.= Trace); Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT user0.\"email\= "".Trim()); =20 - vt.TestInitSQLVars("10181,10231^18",""); //Don't forget to i= nit SQLVars! + drCols[0] =3D "10181,10231^18"; + drCols[1] =3D ""; + vt.TestInitSQLVars(drCols); //Don't forget to init SQLVars! strSelect =3D vt.SQLSelect("10181,10231^18"); Logger.Log("SQLSelect(\"10181,10231^18\"): " + strSelect,Log= Level.Trace); Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".\"c10162Title\", user0.\"email\"".Trim()); =20 - vt.TestInitSQLVars("10187^10179",""); //Don't forget to init= SQLVars! + drCols[0] =3D "10187^10179"; + drCols[1] =3D ""; + vt.TestInitSQLVars(drCols); //Don't forget to init SQLVars! strSelect =3D vt.SQLSelect("10187^10179"); Logger.Log("SQLSelect(\"10187^10179\"): " + strSelect,LogLev= el.Trace); Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT d10160cTicketS= tatus0.\"c10163Status Name\"".Trim()); =20 //Double Pertinence on the same class - vt.TestInitSQLVars("10229^18,10231^18",""); //Don't forget t= o init SQLVars! + drCols[0] =3D "10229^18,10231^18"; + drCols[1] =3D ""; + vt.TestInitSQLVars(drCols); //Don't forget to init SQLVars! strSelect =3D vt.SQLSelect("10229^18,10231^18"); Logger.Log("SQLSelect(\"10229^18,10231^18\"): " + strSelect,= LogLevel.Trace); Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT user0.\"email\= ", user1.\"email\" as \"email1\"".Trim());=20 @@ -121,12 +134,15 @@ public void SQLWhere() { init(); =20 + string[] drCols =3D new string[6]; =20 Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(10162); vt.Complex =3D complex; vt.KeyFlag =3D 0; =20 - vt.TestInitSQLVars("0,10187","10187^10179|7|'closed'|0|0"); = //Don't forget to init SQLVars! + drCols[0] =3D "0,10187"; + drCols[1] =3D "10187^10179|7|'closed'|0|0"; + vt.TestInitSQLVars(drCols); //Don't forget to init SQLVars! =20 //Simple conditions string strWhere =3D vt.SQLWhere("10187^10179|7|'closed'|0|0"= ); @@ -155,13 +171,16 @@ [Test] public void SQLFrom() { - init(); =20 + string[] drCols =3D new string[6]; + init(); =20 Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(10162); vt.Complex =3D complex; vt.KeyFlag =3D 0; =20 =20 - vt.TestInitSQLVars("0,10231^18,10229^18,10187^10179",""); //= Don't forget to init SQLVars! - string strFrom =3D vt.SQLFrom("0,10231^18,10229^18,10187^101= 79",""); + drCols[0] =3D "0,10231^18,10229^18,10187^10179"; + drCols[1] =3D ""; + vt.TestInitSQLVars(drCols); //Don't forget to init SQLVars! + string strFrom =3D vt.SQLFrom("0,10231^18,10229^18,10187^101= 79","",""); Logger.Log("SQLFrom(\"0,10231^18,10229^18,10187^10179\",\"\"= );" + strFrom, LogLevel.Trace); =20 Assert.IsTrue(strFrom.Trim() =3D=3D=20 @@ -205,10 +224,11 @@ Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(10162); vt.Complex =3D complex; vt.KeyFlag =3D 0; =20 - string strSelect =3D "0,10181,10208,10213,10231^18"; - string strWhere =3D "10231^18|4|'to...@em...'|1|0;10229^18= |7|'lulu'|0|0"; + string[] drCols =3D new string[6]; + drCols[0] =3D "0,10181,10208,10213,10231^18"; + drCols[1] =3D "10231^18|4|'to...@em...'|1|0;10229^18|7|'lu= lu'|0|0"; =20 - SortedList SQLVarsList =3D vt.TestGetSQLVars(strSelect,strWh= ere); + SortedList SQLVarsList =3D vt.TestGetSQLVars(drCols); =20 string tableName0 =3D Convert.ToString(SQLVarsList.GetByInde= x(SQLVarsList.IndexOfKey("10231^18")));=20 string tableName1 =3D Convert.ToString(SQLVarsList.GetByInde= x(SQLVarsList.IndexOfKey("10229^18"))); @@ -217,10 +237,10 @@ Assert.IsTrue(tableName0 =3D=3D "user0"); Assert.IsTrue(tableName1 =3D=3D "user1"); =20 - strSelect =3D "0,10181,10208,10213,10229^18,10231^18"; - strWhere =3D "10187^10179|4|'open'|0|0;"; + drCols[0] =3D "0,10181,10208,10213,10229^18,10229^19,10231^1= 8"; + drCols[1] =3D "10187^10179|4|'open'|0|0;"; =20 - SQLVarsList =3D vt.TestGetSQLVars(strSelect,strWhere); + SQLVarsList =3D vt.TestGetSQLVars(drCols); =20 tableName0 =3D Convert.ToString(SQLVarsList.GetByIndex(SQLVa= rsList.IndexOfKey("10229^18")));=20 tableName1 =3D Convert.ToString(SQLVarsList.GetByIndex(SQLVa= rsList.IndexOfKey("10231^18"))); Modified: humano2/branches/viewtools/components/viewTools/ViewColumns.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/viewtools/components/viewTools/ViewColumns.cs 2005-0= 7-07 03:37:39 UTC (rev 1447) +++ humano2/branches/viewtools/components/viewTools/ViewColumns.cs 2005-0= 7-08 12:00:48 UTC (rev 1448) @@ -72,6 +72,10 @@ set { this.fullAtt =3D value; + if (value.IndexOf("^") > 0) + { + value =3D value; + } } } =20 Modified: humano2/branches/viewtools/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/viewtools/components/viewTools/ViewTools.cs 2005-07-= 07 03:37:39 UTC (rev 1447) +++ humano2/branches/viewtools/components/viewTools/ViewTools.cs 2005-07-= 08 12:00:48 UTC (rev 1448) @@ -291,18 +291,30 @@ =20 #region "METODOS" =20 - private SortedList getSQLVars(string strSelect, string strWhere) + private SortedList getSQLVars(string[] drCols) { + SortedList res =3D new SortedList(); + int globalIndex =3D 0; + + string strSelect =3D drCols[0]; + string [] strSelectArr =3D strSelect.Split(",".ToCharArray()); + + string strWhere =3D drCols[1]; + string [] strWhereArr =3D strWhere.Split(";".ToCharArray()); + + //Parse strSelect and fill the sortedList + globalIndex =3D fillSortedListWithPertAttributes(res, strSelectArr, 0= ); + fillSortedListWithPertAttributes(res, strWhereArr, globalIndex); + + if (drCols.Length >4) + { + string strOrder =3D drCols[4]; + string [] strOrderArr =3D strOrder.Split(",".ToCharArray()); + fillSortedListWithPertAttributes(res, strOrderArr, globalIndex); + } //Logger.Log("<<getSQLVars>>", LogLevel.Trace); - SortedList res =3D new SortedList(); =20 - //Parse strSelect and fill the sortedList - string [] strSelectArr =3D strSelect.Split(",".ToCharArray()= ); - string [] strWhereArr =3D strWhere.Split(";".ToCharArray()); - int globalIndex =3D 0; - globalIndex =3D fillSortedListWithPertAttributes(res, strSel= ectArr, 0); - fillSortedListWithPertAttributes(res, strWhereArr, globalInd= ex); - return res; + return res; } =20 ///<summary>With a list of attributes fills a sorted list with (= att,SQLVar) id the att is a pert att</summary> @@ -317,12 +329,14 @@ string att =3D fullAtt.Split("^".ToCharArray())[0]; //Re= move target if pertinence Logger.Log("att: " + att,LogLevel.Trace); bool isPert =3D fullAtt.IndexOf('^') !=3D -1; - if(!list.ContainsKey(fullAtt) && isPert) + //FIXME: do a split fullAtt on ^ to remove remote attribute + // also fix all the calls to SQLVarsList.IndexOfKey to do the same + if(!list.ContainsKey(att) && isPert) { Logger.Log(fullAtt + " added",LogLevel.Trace); string tableId =3D Complex.GetPertinenceClassForAttr= ibute(att); =20 string tableName =3D (Complex.GetClassSysName(tableI= d) + index).Replace(" ",""); //Don't forget to remove spaces... This is a= SQL variable!! - list.Add(fullAtt,tableName); + list.Add(att,tableName); index++; } } @@ -332,7 +346,7 @@ public void ChangeSelect(string strSelect, string strWhere) { Select =3D SQLSelect(strSelect); - From =3D SQLFrom(strSelect,strWhere); + From =3D SQLFrom(strSelect,strWhere,""); Where =3D SQLWhere(strWhere); } =20 @@ -554,7 +568,7 @@ return Query.ToString(); } =20 - public string SQLFrom(string param1, string param2) + public string SQLFrom(string param1, string param2, string order) { string inheritance =3D GetInheritance(IdClass); StringBuilder Query =3D new StringBuilder(); @@ -580,6 +594,14 @@ } } } + if(order !=3D String.Empty) + { + foreach(string p in order.Split(",".ToCharArray())) + { + string[] arrFilters =3D p.Split("|".ToCharArray()); + cols.Add(arrFilters[0]); + } + } =09 relations =3D GetRelatedTableList((string[])cols.ToArray(typeof(strin= g))); if(relations.Length > 0) @@ -603,7 +625,7 @@ } =09 //Here use SQLVars to build from query - string SQLVar =3D Convert.ToString(this.SQLVars.GetB= yIndex(this.SQLVars.IndexOfKey(relation.IdPK + "^" + relation.IdFK))); + string SQLVar =3D Convert.ToString(this.SQLVars.GetB= yIndex(this.SQLVars.IndexOfKey(relation.IdPK.ToString()))); Query.Append(relationType + relation.EndTableName + " " + SQLVar); Logger.Log("fromColumnIndex=3D " + relation.IdPK, Lo= gLevel.Trace); Logger.Log("toColumnIndex=3D " + relation.IdFK, LogL= evel.Trace); @@ -698,6 +720,14 @@ order =3D GetOrder(param.Split(",".ToCharArray())); if(order !=3D String.Empty) { + //Here use SQLVars to build from query + /*string SQLVar =3D Convert.ToString(this.SQLVars.GetByIndex(this.S= QLVars.IndexOfKey(relation.IdPK.ToString()))); + Query.Append(relationType + relation.EndTableName + " " + SQLVar); + Logger.Log("fromColumnIndex=3D " + relation.IdPK, LogLevel.Trace); + Logger.Log("toColumnIndex=3D " + relation.IdFK, LogLevel.Trace); + Query.Append(" ON " + relation.IniTableName + "." + relation.Primar= yKeyName); + Query.Append(" =3D " + SQLVar + "." + relation.ForeignKeyName); +*/ Query.Append("ORDER BY " + order); return Query.ToString(); } @@ -722,9 +752,9 @@ ///<summary>Init the SQLVars with select and where strings</summ= ary> ///<param name=3D"strSelect">The select string</param> ///<param name=3D"strWhere">The where string</param> - private void initSQLVars(string strSelect, string strWhere) + private void initSQLVars(string[] drCols) { - this.SQLVars =3D getSQLVars(strSelect,strWhere); =20 + this.SQLVars =3D getSQLVars(drCols); =20 } =20 public string ParseQuery(DataTable Params) @@ -759,7 +789,7 @@ =20 //Paso 0: //Here set the SortedList that contains the SQLVars - initSQLVars(dataRowColumns[0],dataRowColumns[1]); //column a= nd where conditions + initSQLVars(dataRowColumns); //column and where conditions =09 //Paso 1: //Determinar Tablas y Columnas afectadas en la consulta @@ -769,7 +799,8 @@ =20 //Paso 2: //Construir FROM - Query.Append(SQLFrom(dataRowColumns[0],dataRowColumns[1])); + =09 + Query.Append(SQLFrom(dataRowColumns[0],dataRowColumns[1],dataRowColum= ns[4])); //Logger.Log("FromParam: " + dataRowColumns[1],LogLevel.Trac= e ); =20 //Paso 3: @@ -1004,17 +1035,25 @@ string parameter; string[] cols; int columnIndex; - string tableName, columnName; + string tableName =3D "", columnName; =20 foreach(string Filtro in strParams) { parameters =3D Filtro.Split("|".ToCharArray()); cols =3D parameters[0].Split("^".ToCharArray()); columnIndex =3D Convert.ToInt32(cols[cols.Length - 1]); - + =09 if(columnIndex !=3D 0) { - tableName =3D Complex.TableName(columnIndex); + int index =3D this.SQLVars.IndexOfKey(cols[0]); + if (index !=3D -1 ) + { + tableName =3D Convert.ToString(this.SQLVars.GetByIndex(this.SQLVar= s.IndexOfKey(cols[0]))); + } + else + { + tableName =3D Complex.TableName(columnIndex); + } columnName =3D Complex.ColumnName(columnIndex); } else @@ -1392,12 +1431,20 @@ { ViewColumns aux =3D new ViewColumns(0,"id_entity"); aux.Position =3D i; - aux.Type =3D "int"; =20 + aux.Type =3D "int"; + aux.FullAtt =3D valor.Substring(0,valor.IndexOf("^")); Table.AddColumn(aux); i++; } =20 - Col.FullAtt =3D valor; //Will be used as a key with SQLV= ars then + if (valor.IndexOf("^")>0) + { + Col.FullAtt =3D valor.Substring(0,valor.IndexOf("^")); //Will be us= ed as a key with SQLVars then + } + else + { + Col.FullAtt =3D valor; //Will be used as a key with SQLVars then + } =20 Table.AddColumn(Col); Col.Position =3D i; @@ -1755,14 +1802,14 @@ return getTableList(strParams); } =20 - public SortedList TestGetSQLVars(string strSelect, string strWhe= re) + public SortedList TestGetSQLVars(string[] drCols) { - return getSQLVars(strSelect,strWhere); =20 + return getSQLVars(drCols); =20 } =20 - public void TestInitSQLVars(string strSelect, string strWhere) + public void TestInitSQLVars(string[] drCols) { - initSQLVars(strSelect, strWhere); + initSQLVars(drCols); } =20 #endregion Modified: humano2/branches/viewtools/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/viewtools/components/webTools/Adapter.cs 2005-07-07 = 03:37:39 UTC (rev 1447) +++ humano2/branches/viewtools/components/webTools/Adapter.cs 2005-07-08 = 12:00:48 UTC (rev 1448) @@ -462,13 +462,22 @@ Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(7); vt.Complex =3D complex; =20 - //Estructuras necesatias para llamar a view tools + //Necesary structure for Viewtools: + //The dataTable MUST contain at lease 6 columns DataTable tabla =3D new DataTable(); DataColumn columna; columna =3D new DataColumn("columna",typeof(string)); tabla.Columns.Add(columna); columna =3D new DataColumn("filtros",typeof(string)); tabla.Columns.Add(columna); + columna =3D new DataColumn("relleno1",typeof(string)); + tabla.Columns.Add(columna); + columna =3D new DataColumn("relleno2",typeof(string)); + tabla.Columns.Add(columna); + columna =3D new DataColumn("relleno3",typeof(string)); + tabla.Columns.Add(columna); + columna =3D new DataColumn("relleno4",typeof(string)); + tabla.Columns.Add(columna); =20 //La consulta que retorna el id del usuario string[] fila =3D {"0","18|4|'" + user + "'|1|0;19|4|'" + password + = "'|0|0"}; |
From: <sv...@de...> - 2005-06-30 22:14:59
|
Author: pcamacho Date: 2005-06-30 18:15:01 -0400 (Thu, 30 Jun 2005) New Revision: 1438 Modified: humano2/branches/viewtools/components/tests/viewTools.cs humano2/branches/viewtools/components/viewTools/ViewTools.cs Log: CHANGE: viewtools working with select from and where!! :D Modified: humano2/branches/viewtools/components/tests/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/viewtools/components/tests/viewTools.cs 2005-06-30 1= 8:53:44 UTC (rev 1437) +++ humano2/branches/viewtools/components/tests/viewTools.cs 2005-06-30 2= 2:15:01 UTC (rev 1438) @@ -21,7 +21,7 @@ namespace Humano2.Components.Test.ViewTools { /// <summary> - /// Summary description for ViewTools. + /// All tests work with the template HelpDesk SMB /// </summary> [TestFixture] public class ViewTools @@ -35,7 +35,7 @@ crud =3D complex.GetCore().Crud; =20 } =20 - //[Test] + [Test] public void getTableList() { init(); =20 @@ -117,7 +117,7 @@ Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT user0.\"email\= ", user1.\"email\" as \"email1\"".Trim());=20 } =20 - //[Test] + [Test] public void SQLWhere() { init(); =20 @@ -126,16 +126,17 @@ vt.Complex =3D complex; vt.KeyFlag =3D 0; =20 + vt.TestInitSQLVars("0,10187","10187^10179|7|'closed'|0|0"); = //Don't forget to init SQLVars! + =20 //Simple conditions string strWhere =3D vt.SQLWhere("10187^10179|7|'closed'|0|0"= ); Logger.Log("SQLWhere(\"10187^10179|7|'closed'|0|0\"):" + str= Where, LogLevel.Trace); Assert.IsTrue(strWhere.Trim() =3D=3D "WHERE d10160cTicketSta= tus0.\"c10163Status Name\" ILIKE '%closed%'".Trim()); =20 - =20 //Double conditions strWhere =3D vt.SQLWhere("10187^10179|7|'closed'|1|0;10181|4= |'Joli ticket'|0|0"); Logger.Log("SQLWhere(\"10187^10179|7|'closed'|1|0;10181|4|'J= oli ticket'|0|0\"):" + strWhere, LogLevel.Trace); - Assert.IsTrue(strWhere.Trim() =3D=3D "WHERE d10160cTicketSta= tus0.\"c10163Status Name\" ILIKE '%closed%' AND d10160cTicket1.\"c10162Ti= tle\" =3D 'Joli ticket'".Trim()); =20 + Assert.IsTrue(strWhere.Trim() =3D=3D "WHERE d10160cTicketSta= tus0.\"c10163Status Name\" ILIKE '%closed%' AND \"d10160cTicket\".\"c1016= 2Title\" =3D 'Joli ticket'".Trim()); =20 } =20 //[Test] @@ -164,7 +165,7 @@ Logger.Log("SQLFrom(\"0,10231^18,10229^18,10187^10179\",\"\"= );" + strFrom, LogLevel.Trace); =20 Assert.IsTrue(strFrom.Trim() =3D=3D=20 - "FROM \"d10160cTicket\" inner join \"entity\" on \"d= 10160cTicket\".id_entity =3D \"entity\".id_entity and entity.\"delDate\" = is null LEFT JOIN \"user\" user0 ON \"d10160cTicket\".\"c10162Assigned = to3\" =3D user0.id_entity LEFT JOIN entity e1 ON \"user\".id_entity =3D e= 1.id_entity LEFT JOIN \"user\" user1 ON \"d10160cTicket\".\"c10162Reques= t by1\" =3D user1.id_entity LEFT JOIN \"d10160cTicket Status\" d10160cTic= ketStatus2 ON \"d10160cTicket\".\"c10162Status\" =3D d10160cTicketStatus2= .id_entity LEFT JOIN entity e2 ON \"d10160cTicket Status\".id_entity =3D = e2.id_entity"); + "FROM \"d10160cTicket\" inner join \"entity\" on \"d= 10160cTicket\".id_entity =3D \"entity\".id_entity and entity.\"delDate\" = is null LEFT JOIN \"user\" user0 ON \"d10160cTicket\".\"c10162Assigned = to3\" =3D user0.id_entity LEFT JOIN entity e1 ON user0.id_entity =3D e1.i= d_entity LEFT JOIN \"user\" user1 ON \"d10160cTicket\".\"c10162Request b= y1\" =3D user1.id_entity LEFT JOIN \"d10160cTicket Status\" d10160cTicket= Status2 ON \"d10160cTicket\".\"c10162Status\" =3D d10160cTicketStatus2.id= _entity LEFT JOIN entity e2 ON d10160cTicketStatus2.id_entity =3D e2.id_e= ntity"); } =20 [Test] @@ -186,12 +187,20 @@ string strQuery =3D vt.GetLastExecutedQuery(); Logger.Log("strQuery=3D " + strQuery,LogLevel.Trace); Assert.IsTrue(strQuery.Trim() =3D=3D "SELECT \"d10160cTicket= \".id_entity, user0.\"email\", user1.\"email\" as \"email2\", d10160cTick= etStatus2.\"c10163Status Name\" FROM \"d10160cTicket\" inner join \"entit= y\" on \"d10160cTicket\".id_entity =3D \"entity\".id_entity and entity.\"= delDate\" is null LEFT JOIN \"user\" user0 ON \"d10160cTicket\".\"c1016= 2Assigned to3\" =3D user0.id_entity LEFT JOIN entity e1 ON user0.id_entit= y =3D e1.id_entity LEFT JOIN \"user\" user1 ON \"d10160cTicket\".\"c1016= 2Request by1\" =3D user1.id_entity LEFT JOIN \"d10160cTicket Status\" d10= 160cTicketStatus2 ON \"d10160cTicket\".\"c10162Status\" =3D d10160cTicket= Status2.id_entity LEFT JOIN entity e2 ON d10160cTicketStatus2.id_entity =3D= e2.id_entity WHERE e1.\"delDate\" IS NULL AND e2.\"delDate\" IS NULL".T= rim()); + =20 + //query with where + dr["columna"] =3D "0,10231^18,10229^18,10187^10179"; + dr["filtros"] =3D "10231^18|4|'te...@hu...'|0|0"; + vt.GetSQLDataTable(dtParam); //Don't get result, only to hav= e the query + strQuery =3D vt.GetLastExecutedQuery(); + Logger.Log("strQuery=3D " + strQuery,LogLevel.Trace); + Assert.IsTrue(strQuery.Trim() =3D=3D "SELECT \"d10160cTicket= \".id_entity, user0.\"email\", user1.\"email\" as \"email2\", d10160cTick= etStatus2.\"c10163Status Name\" FROM \"d10160cTicket\" inner join \"entit= y\" on \"d10160cTicket\".id_entity =3D \"entity\".id_entity and entity.\"= delDate\" is null LEFT JOIN \"user\" user0 ON \"d10160cTicket\".\"c1016= 2Assigned to3\" =3D user0.id_entity LEFT JOIN entity e1 ON user0.id_entit= y =3D e1.id_entity LEFT JOIN \"user\" user1 ON \"d10160cTicket\".\"c1016= 2Request by1\" =3D user1.id_entity LEFT JOIN \"d10160cTicket Status\" d10= 160cTicketStatus2 ON \"d10160cTicket\".\"c10162Status\" =3D d10160cTicket= Status2.id_entity LEFT JOIN entity e2 ON d10160cTicketStatus2.id_entity =3D= e2.id_entity WHERE e1.\"delDate\" IS NULL AND e2.\"delDate\" IS NULL AN= D e1.\"delDate\" IS NULL AND e2.\"delDate\" IS NULL and user0.\"email\" = =3D 'te...@hu...'".Trim()); } =20 - [Test] + //[Test] public void getSQLVars() { - //Logger.Log("<<getSQLVars>>", LogLevel.Trace); + //Logger.Log(\"<<getSQLVars>>", LogLevel.Trace); init(); =20 Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(10162); vt.Complex =3D complex; Modified: humano2/branches/viewtools/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/viewtools/components/viewTools/ViewTools.cs 2005-06-= 30 18:53:44 UTC (rev 1437) +++ humano2/branches/viewtools/components/viewTools/ViewTools.cs 2005-06-= 30 22:15:01 UTC (rev 1438) @@ -1077,12 +1077,22 @@ =20 if(columnIndex !=3D 0) { - tableName =3D Complex.TableName(columnIndex); + //If pertatt use SQL vars if not simple table name + string fullAtt =3D parameters[0]; + if(fullAtt.IndexOf('^')!=3D-1) + { + Logger.Log("fullAtt: " + fullAtt,LogLevel.Trace)= ; + tableName =3D Convert.ToString(this.SQLVars.GetB= yIndex(this.SQLVars.IndexOfKey(fullAtt))); =20 + } + else + { + tableName =3D Complex.TableName(columnIndex);=20 + } columnName =3D Complex.ColumnName(columnIndex); } else { - tableName =3D Complex.TableName(IdClass); + tableName =3D Complex.TableName(IdClass); //id_entity attribute ok columnName =3D "id_entity"; } =20 @@ -1676,38 +1686,28 @@ =20 //Logger.Log("fromColumnIndex=3D " + fromColumnIndex, LogLev= el.Trace); //Logger.Log("toColumnIndex=3D " + toColumnIndex, LogLevel.T= race); - =09 - if(Relations.Count > 0) + =09 + //Add the relation if it does not belongs yet to the list of= relations + if(!relationsContains(Relation,Relations)) { - foreach(ViewRelation vr in Relations) - { - pos =3D -1; - if(vr.IdClassIni =3D=3D Relation.IdClassIni && vr.IdClassFin =3D=3D= Relation.IdClassFin) - { - pos =3D position; - break; - } - position++; - } - /* - if(pos > -1) - { - Relations.RemoveAt(position); - Relations.Insert(position,Relation); - } - else - { - Relations.Add(Relation); - } - */ - Relations.Add(Relation); - } - else - { Relations.Add(Relation); } } =20 + private bool relationsContains(ViewRelation rel, ArrayList Relat= ions) + { + bool res =3D false; + foreach( ViewRelation relation in Relations) + { + if(relation.IdPK =3D=3D rel.IdPK && relation.IdFK =3D=3D= rel.IdFK) =20 + { + res=3Dtrue; + break; + } + } + return res; + } + =20 private Enums.RelationType GetRelationType(int ClassFrom, int ClassTo,= int RelationColumn) { string strRatio =3D ""; |
From: <sv...@de...> - 2005-06-30 18:53:39
|
Author: pcamacho Date: 2005-06-30 14:53:44 -0400 (Thu, 30 Jun 2005) New Revision: 1437 Modified: humano2/branches/viewtools/components/tests/viewTools.cs humano2/branches/viewtools/components/viewTools/ViewTools.cs Log: CHANGE: basic queries with multiple attributes pertinence to same class w= orking (only columns of select), Modified: humano2/branches/viewtools/components/tests/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/viewtools/components/tests/viewTools.cs 2005-06-30 1= 8:36:00 UTC (rev 1436) +++ humano2/branches/viewtools/components/tests/viewTools.cs 2005-06-30 1= 8:53:44 UTC (rev 1437) @@ -167,7 +167,7 @@ "FROM \"d10160cTicket\" inner join \"entity\" on \"d= 10160cTicket\".id_entity =3D \"entity\".id_entity and entity.\"delDate\" = is null LEFT JOIN \"user\" user0 ON \"d10160cTicket\".\"c10162Assigned = to3\" =3D user0.id_entity LEFT JOIN entity e1 ON \"user\".id_entity =3D e= 1.id_entity LEFT JOIN \"user\" user1 ON \"d10160cTicket\".\"c10162Reques= t by1\" =3D user1.id_entity LEFT JOIN \"d10160cTicket Status\" d10160cTic= ketStatus2 ON \"d10160cTicket\".\"c10162Status\" =3D d10160cTicketStatus2= .id_entity LEFT JOIN entity e2 ON \"d10160cTicket Status\".id_entity =3D = e2.id_entity"); } =20 - //[Test] + [Test] public void ParseQuery() { init(); =20 @@ -177,17 +177,15 @@ DataTable dtParam =3D this.makeDataTableInViewTools(); DataRow dr =3D dtParam.NewRow(); =20 - dr["columna"] =3D "0,10181,10208,10231^18,10209"; - dr["filtros"] =3D "10187^10179|7|'closed'|0|0"; - //dr["group"] =3D ""; - //dr["having"] =3D ""; - dr["order"] =3D "10231^18|0"; - + //Basic query with double pert attribute + dr["columna"] =3D "0,10231^18,10229^18,10187^10179"; + dr["filtros"] =3D ""; + =09 dtParam.Rows.Add(dr); vt.GetSQLDataTable(dtParam); //Don't get result, only to hav= e the query string strQuery =3D vt.GetLastExecutedQuery(); Logger.Log("strQuery=3D " + strQuery,LogLevel.Trace); - Assert.IsTrue(strQuery.Trim() =3D=3D "SELECT \"d10160cTicket= \".id_entity, \"d10160cTicket\".\"c10162Title\", \"d10160cTicket\".\"c101= 62Date\", \"user\".\"email\", \"d10160cTicket\".\"c10162Resolution Date\"= FROM \"d10160cTicket\" inner join \"entity\" on \"d10160cTicket\".id_ent= ity =3D \"entity\".id_entity and entity.\"delDate\" is null LEFT JOIN \= "user\" ON \"d10160cTicket\".\"c10162Assigned to3\" =3D \"user\".id_entit= y LEFT JOIN entity e1 ON \"user\".id_entity =3D e1.id_entity LEFT JOIN \= "d10160cTicket Status\" ON \"d10160cTicket\".\"c10162Status\" =3D \"d1016= 0cTicket Status\".id_entity LEFT JOIN entity e2 ON \"d10160cTicket Status= \".id_entity =3D e2.id_entity WHERE e1.\"delDate\" IS NULL AND e2.\"delD= ate\" IS NULL and \"d10160cTicket Status\".\"c10163Status Name\" ILIKE '= %closed%' ORDER BY upper(\"user\".\"email\") asc".Trim()); + Assert.IsTrue(strQuery.Trim() =3D=3D "SELECT \"d10160cTicket= \".id_entity, user0.\"email\", user1.\"email\" as \"email2\", d10160cTick= etStatus2.\"c10163Status Name\" FROM \"d10160cTicket\" inner join \"entit= y\" on \"d10160cTicket\".id_entity =3D \"entity\".id_entity and entity.\"= delDate\" is null LEFT JOIN \"user\" user0 ON \"d10160cTicket\".\"c1016= 2Assigned to3\" =3D user0.id_entity LEFT JOIN entity e1 ON user0.id_entit= y =3D e1.id_entity LEFT JOIN \"user\" user1 ON \"d10160cTicket\".\"c1016= 2Request by1\" =3D user1.id_entity LEFT JOIN \"d10160cTicket Status\" d10= 160cTicketStatus2 ON \"d10160cTicket\".\"c10162Status\" =3D d10160cTicket= Status2.id_entity LEFT JOIN entity e2 ON d10160cTicketStatus2.id_entity =3D= e2.id_entity WHERE e1.\"delDate\" IS NULL AND e2.\"delDate\" IS NULL".T= rim()); } =20 [Test] Modified: humano2/branches/viewtools/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/viewtools/components/viewTools/ViewTools.cs 2005-06-= 30 18:36:00 UTC (rev 1436) +++ humano2/branches/viewtools/components/viewTools/ViewTools.cs 2005-06-= 30 18:53:44 UTC (rev 1437) @@ -610,11 +610,12 @@ Query.Append(" ON " + relation.IniTableName + "." + relation.Primar= yKeyName); Query.Append(" =3D " + SQLVar + "." + relation.ForeignKeyName); =20 + =20 if(tableDictionary.IndexOf(relation.EndTableName) =3D=3D -1) { tableDictionary.Add(relation.EndTableName); Query.Append(" LEFT JOIN entity e" + counter + " ON "); - Query.Append(relation.EndTableName + ".id_entity =3D e" + counter = + ".id_entity "); + Query.Append(SQLVar + ".id_entity =3D e" + counter + ".id_entity "= ); _whereInit =3D _whereInit + "e" + counter + ".\"delDate\" IS NULL = AND "; counter++; } |
From: <sv...@de...> - 2005-06-30 18:35:59
|
Author: pcamacho Date: 2005-06-30 14:36:00 -0400 (Thu, 30 Jun 2005) New Revision: 1436 Modified: humano2/branches/viewtools/components/tests/viewTools.cs humano2/branches/viewtools/components/viewTools/ViewTools.cs Log: FIX/CHANGE: viewtools works with FROM (all columns appear with sql variab= les). Modified: humano2/branches/viewtools/components/tests/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/viewtools/components/tests/viewTools.cs 2005-06-29 2= 3:01:46 UTC (rev 1435) +++ humano2/branches/viewtools/components/tests/viewTools.cs 2005-06-30 1= 8:36:00 UTC (rev 1436) @@ -80,9 +80,6 @@ vt.Complex =3D complex; vt.KeyFlag =3D 0; =20 - //Don't forget to init SQLVars!!! - =20 - =20 //Simple columns vt.TestInitSQLVars("10181",""); //Don't forget to init SQLVa= rs! string strSelect =3D vt.SQLSelect("10181"); @@ -154,17 +151,20 @@ Assert.IsTrue(strOrder.Trim() =3D=3D "ORDER BY upper(\"d1016= 0cTicket\".\"c10162Title\") asc , upper(\"d10160cTicket\".\"c10162Date\")= desc".Trim()); } =20 - //[Test] + [Test] public void SQLFrom() { init(); =20 Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(10162); vt.Complex =3D complex; vt.KeyFlag =3D 0; =20 - string strFrom =3D vt.SQLFrom("0,10181,10208,10231^18,10209"= ,"10187^10179|7|'closed'|0|0"); - Logger.Log("SQLFrom(\"0,10181,10208,10231^18,10209\",\"10187= ^10179|7|'closed'|0|0\");" + strFrom, LogLevel.Trace); =20 - Assert.IsTrue(strFrom.Trim() =3D=3D "FROM \"d10160cTicket\" = inner join \"entity\" on \"d10160cTicket\".id_entity =3D \"entity\".id_en= tity and entity.\"delDate\" is null LEFT JOIN \"user\" ON \"d10160cTick= et\".\"c10162Assigned to3\" =3D \"user\".id_entity LEFT JOIN entity e1 ON= \"user\".id_entity =3D e1.id_entity LEFT JOIN \"d10160cTicket Status\" = ON \"d10160cTicket\".\"c10162Status\" =3D \"d10160cTicket Status\".id_ent= ity LEFT JOIN entity e2 ON \"d10160cTicket Status\".id_entity =3D e2.id_e= ntity".Trim()); + vt.TestInitSQLVars("0,10231^18,10229^18,10187^10179",""); //= Don't forget to init SQLVars! + string strFrom =3D vt.SQLFrom("0,10231^18,10229^18,10187^101= 79",""); + Logger.Log("SQLFrom(\"0,10231^18,10229^18,10187^10179\",\"\"= );" + strFrom, LogLevel.Trace); + =20 + Assert.IsTrue(strFrom.Trim() =3D=3D=20 + "FROM \"d10160cTicket\" inner join \"entity\" on \"d= 10160cTicket\".id_entity =3D \"entity\".id_entity and entity.\"delDate\" = is null LEFT JOIN \"user\" user0 ON \"d10160cTicket\".\"c10162Assigned = to3\" =3D user0.id_entity LEFT JOIN entity e1 ON \"user\".id_entity =3D e= 1.id_entity LEFT JOIN \"user\" user1 ON \"d10160cTicket\".\"c10162Reques= t by1\" =3D user1.id_entity LEFT JOIN \"d10160cTicket Status\" d10160cTic= ketStatus2 ON \"d10160cTicket\".\"c10162Status\" =3D d10160cTicketStatus2= .id_entity LEFT JOIN entity e2 ON \"d10160cTicket Status\".id_entity =3D = e2.id_entity"); } =20 //[Test] Modified: humano2/branches/viewtools/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/viewtools/components/viewTools/ViewTools.cs 2005-06-= 29 23:01:46 UTC (rev 1435) +++ humano2/branches/viewtools/components/viewTools/ViewTools.cs 2005-06-= 30 18:36:00 UTC (rev 1436) @@ -315,11 +315,11 @@ { string fullAtt =3D (attributes[i].Split("|".ToCharArray(= )))[0]; string att =3D fullAtt.Split("^".ToCharArray())[0]; //Re= move target if pertinence - //Logger.Log("att: " + att,LogLevel.Trace); + Logger.Log("att: " + att,LogLevel.Trace); bool isPert =3D fullAtt.IndexOf('^') !=3D -1; if(!list.ContainsKey(fullAtt) && isPert) { - //Logger.Log(fullAtt + " added",LogLevel.Trace); + Logger.Log(fullAtt + " added",LogLevel.Trace); string tableId =3D Complex.GetPertinenceClassForAttr= ibute(att); =20 string tableName =3D (Complex.GetClassSysName(tableI= d) + index).Replace(" ",""); //Don't forget to remove spaces... This is a= SQL variable!! list.Add(fullAtt,tableName); @@ -449,30 +449,6 @@ } =20 =20 - ///<summary> - /// Given a name of table like "Tickets" for example, builds the= name of sql var for this table - /// removing the quotes (") and concatenating the number passed = in param - /// It is important to remove spaces from the table name to avoi= d SQL error - ///</summary> - ///<param name=3D"number">The number to concatenate</param> - ///<param name=3D"sqlTableName">The name of table</param> - ///<returns>[name of table(without quotes)] + number.ToString</r= eturns> - /* - private string getSQLTableVar(string sqlTableName, int number) - { - string res =3D ""; - res =3D sqlTableName.Replace("\"","").Replace(" ","") + numb= er; //remove quotes and spaces - return res; - } - =20 - private string getSQLTableVarWithTableName(string sqlTableName, = int number) - { - string res =3D sqlTableName + " " + getSQLTableVar(sqlTableN= ame,number); =20 - return res; - } - */ - =20 - =20 public string SQLSelect(string param) { Logger.Log("<<SQLSelect:>>",LogLevel.Trace); @@ -499,7 +475,7 @@ string tableAffectedName =3D ""; if(this.SQLVars.ContainsKey(Col.FullAtt)) { - tableAffectedName =3D Convert.ToString(this.SQLV= ars.GetByIndex(this.SQLVars.IndexOfKey(Col.FullAtt))); //getSQLTableVar(= table.TableName,index++); + tableAffectedName =3D Convert.ToString(this.SQLV= ars.GetByIndex(this.SQLVars.IndexOfKey(Col.FullAtt))); =20 } else { @@ -626,9 +602,13 @@ break; } =09 - Query.Append(relationType + relation.EndTableName); + //Here use SQLVars to build from query + string SQLVar =3D Convert.ToString(this.SQLVars.GetB= yIndex(this.SQLVars.IndexOfKey(relation.IdPK + "^" + relation.IdFK))); + Query.Append(relationType + relation.EndTableName + " " + SQLVar); + Logger.Log("fromColumnIndex=3D " + relation.IdPK, Lo= gLevel.Trace); + Logger.Log("toColumnIndex=3D " + relation.IdFK, LogL= evel.Trace); Query.Append(" ON " + relation.IniTableName + "." + relation.Primar= yKeyName); - Query.Append(" =3D " + relation.EndTableName + "." + relation.Forei= gnKeyName); + Query.Append(" =3D " + SQLVar + "." + relation.ForeignKeyName); =20 if(tableDictionary.IndexOf(relation.EndTableName) =3D=3D -1) { @@ -1465,7 +1445,8 @@ =20 private ViewRelation[] GetRelatedTableList(string[] strParams) { - ArrayList Relations =3D new ArrayList(); + Logger.Log("<<GetRelatedTableList>> ", LogLevel.Trace); + ArrayList Relations =3D new ArrayList(); string tableNameTo =3D "", tableNameFrom =3D "", columnNameTo =3D "",= columnNameFrom =3D ""; int toColumnIndex =3D 0, length =3D 0, toTableIndex =3D 0, fromColumn= Index =3D 0, fromTableIndex =3D 0; Enums.RelationType rel; @@ -1475,7 +1456,8 @@ foreach(string index in strParams) { flag =3D 0; - if(!IsNumeric(index)) + Logger.Log("index=3D " + index, LogLevel.Trace); + if(!IsNumeric(index)) { string[] aux =3D index.Split("|".ToCharArray()); columns =3D aux[0].Split("^".ToCharArray()); @@ -1690,6 +1672,9 @@ =20 int position =3D 0; int pos =3D -1; + =20 + //Logger.Log("fromColumnIndex=3D " + fromColumnIndex, LogLev= el.Trace); + //Logger.Log("toColumnIndex=3D " + toColumnIndex, LogLevel.T= race); =09 if(Relations.Count > 0) { @@ -1703,6 +1688,7 @@ } position++; } + /* if(pos > -1) { Relations.RemoveAt(position); @@ -1712,6 +1698,8 @@ { Relations.Add(Relation); } + */ + Relations.Add(Relation); } else { |
From: <sv...@de...> - 2005-06-29 23:01:45
|
Author: pcamacho Date: 2005-06-29 19:01:46 -0400 (Wed, 29 Jun 2005) New Revision: 1435 Modified: humano2/branches/viewtools/components/tests/viewTools.cs humano2/branches/viewtools/components/viewTools/ViewColumns.cs humano2/branches/viewtools/components/viewTools/ViewTools.cs Log: CHANGE: SQLVars integrated to the build of SELECT string. Modified: humano2/branches/viewtools/components/tests/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/viewtools/components/tests/viewTools.cs 2005-06-29 2= 2:12:11 UTC (rev 1434) +++ humano2/branches/viewtools/components/tests/viewTools.cs 2005-06-29 2= 3:01:46 UTC (rev 1435) @@ -71,7 +71,7 @@ } =20 =20 - //[Test] + [Test] public void SQLSelect() { init(); =20 @@ -80,32 +80,41 @@ vt.Complex =3D complex; vt.KeyFlag =3D 0; =20 + //Don't forget to init SQLVars!!! + =20 + =20 //Simple columns + vt.TestInitSQLVars("10181",""); //Don't forget to init SQLVa= rs! string strSelect =3D vt.SQLSelect("10181"); Logger.Log("SQLSelect(\"10181\"): " + strSelect,LogLevel.Tra= ce); - Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT d10160cTicket0= .\"c10162Title\"".Trim()); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".\"c10162Title\"".Trim()); strSelect =3D vt.SQLSelect("0,10181"); Logger.Log("SQLSelect(\"0,10181\"): " + strSelect,LogLevel.T= race); - Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT d10160cTicket0= .id_entity, d10160cTicket1.\"c10162Title\"".Trim()); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".id_entity, \"d10160cTicket\".\"c10162Title\"".Trim()); =20 //Pertinence columns + vt.TestInitSQLVars("10231",""); //Don't forget to init SQLVa= rs! strSelect =3D vt.SQLSelect("10231"); Logger.Log("SQLSelect(\"10231\"): " + strSelect,LogLevel.Tra= ce); - Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT d10160cTicket0= .\"c10162Assigned to3\"".Trim()); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".\"c10162Assigned to3\"".Trim()); =20 + vt.TestInitSQLVars("10231^18",""); //Don't forget to init SQ= LVars! strSelect =3D vt.SQLSelect("10231^18"); Logger.Log("SQLSelect(\"10231^18\"): " + strSelect,LogLevel.= Trace); Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT user0.\"email\= "".Trim()); =20 + vt.TestInitSQLVars("10181,10231^18",""); //Don't forget to i= nit SQLVars! strSelect =3D vt.SQLSelect("10181,10231^18"); Logger.Log("SQLSelect(\"10181,10231^18\"): " + strSelect,Log= Level.Trace); - Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT d10160cTicket0= .\"c10162Title\", user0.\"email\"".Trim()); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".\"c10162Title\", user0.\"email\"".Trim()); =20 + vt.TestInitSQLVars("10187^10179",""); //Don't forget to init= SQLVars! strSelect =3D vt.SQLSelect("10187^10179"); Logger.Log("SQLSelect(\"10187^10179\"): " + strSelect,LogLev= el.Trace); Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT d10160cTicketS= tatus0.\"c10163Status Name\"".Trim()); =20 //Double Pertinence on the same class + vt.TestInitSQLVars("10229^18,10231^18",""); //Don't forget t= o init SQLVars! strSelect =3D vt.SQLSelect("10229^18,10231^18"); Logger.Log("SQLSelect(\"10229^18,10231^18\"): " + strSelect,= LogLevel.Trace); Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT user0.\"email\= ", user1.\"email\" as \"email1\"".Trim());=20 Modified: humano2/branches/viewtools/components/viewTools/ViewColumns.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/viewtools/components/viewTools/ViewColumns.cs 2005-0= 6-29 22:12:11 UTC (rev 1434) +++ humano2/branches/viewtools/components/viewTools/ViewColumns.cs 2005-0= 6-29 23:01:46 UTC (rev 1435) @@ -27,6 +27,7 @@ private Enums.AggregateFunctions _func; private int _position; private string _type; + private string fullAtt; //The full attribute value of column. Ex= ample: 10179^10187 or 10167 etc... #endregion =20 #region "CONSTRUCTORS" @@ -61,6 +62,18 @@ this._type =3D value; } } + =20 + public string FullAtt + { + get + { + return this.fullAtt; + } + set + { + this.fullAtt =3D value; + } + } =20 public Enums.AggregateFunctions Function { @@ -157,4 +170,4 @@ } #endregion } -} \ No newline at end of file +} Modified: humano2/branches/viewtools/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/viewtools/components/viewTools/ViewTools.cs 2005-06-= 29 22:12:11 UTC (rev 1434) +++ humano2/branches/viewtools/components/viewTools/ViewTools.cs 2005-06-= 29 23:01:46 UTC (rev 1435) @@ -36,6 +36,7 @@ private string _whereInit =3D ""; private bool _caseSensitive; //To allow doing insensitive case s= earch private string query; //To get the query from outside + private SortedList SQLVars; //The sql vars used to build the fin= al query =20 =20 #endregion =20 @@ -456,6 +457,7 @@ ///<param name=3D"number">The number to concatenate</param> ///<param name=3D"sqlTableName">The name of table</param> ///<returns>[name of table(without quotes)] + number.ToString</r= eturns> + /* private string getSQLTableVar(string sqlTableName, int number) { string res =3D ""; @@ -468,7 +470,9 @@ string res =3D sqlTableName + " " + getSQLTableVar(sqlTableN= ame,number); =20 return res; } + */ =20 + =20 public string SQLSelect(string param) { Logger.Log("<<SQLSelect:>>",LogLevel.Trace); @@ -487,14 +491,25 @@ { affectedColumns =3D table.Columns; int index =3D 0; - foreach(ViewColumns Cols in affectedColumns) + foreach(ViewColumns Col in affectedColumns) { aux =3D new DisplayOrder(); - string tableAffectedName =3D getSQLTableVar(table.Ta= bleName,index++); + =20 + //if the column is in the SQLVars then find the name= in SQLVars else choose table.TableName + string tableAffectedName =3D ""; + if(this.SQLVars.ContainsKey(Col.FullAtt)) + { + tableAffectedName =3D Convert.ToString(this.SQLV= ars.GetByIndex(this.SQLVars.IndexOfKey(Col.FullAtt))); //getSQLTableVar(= table.TableName,index++); + } + else + { + tableAffectedName =3D table.TableName; + } + =20 string beginFunction =3D ""; string endFunction =3D ""; =20 - switch(Cols.Function) + switch(Col.Function) { case Enums.AggregateFunctions.nofunc: beginFunction =3D ""; @@ -509,10 +524,10 @@ endFunction =3D ")"; break; } - aux.Text =3D beginFunction + tableAffectedName + end= Function + "." + Cols.ColumnName + ", "; - aux.Position =3D Cols.Position; - aux.Id =3D Cols.ColumnIndex; - aux.Type =3D Cols.Type; + aux.Text =3D beginFunction + tableAffectedName + end= Function + "." + Col.ColumnName + ", "; + aux.Position =3D Col.Position; + aux.Id =3D Col.ColumnIndex; + aux.Type =3D Col.Type; values.Add(aux); i++; } @@ -593,7 +608,6 @@ relations =3D GetRelatedTableList((string[])cols.ToArray(typeof(strin= g))); if(relations.Length > 0) { - //ViewRelation previousRelation =3D null;=09 string relationType =3D ""; ArrayList tableDictionary =3D new ArrayList(); int counter =3D 1; @@ -615,18 +629,12 @@ Query.Append(relationType + relation.EndTableName); Query.Append(" ON " + relation.IniTableName + "." + relation.Primar= yKeyName); Query.Append(" =3D " + relation.EndTableName + "." + relation.Forei= gnKeyName); -// Query.Append(" relTbl"+counter+" ON tblA." + relation.PrimaryKeyN= ame); -// Query.Append(" =3D relTbl"+counter+"." + relation.ForeignKeyName)= ; - //previousRelation =3D relation; =20 if(tableDictionary.IndexOf(relation.EndTableName) =3D=3D -1) { tableDictionary.Add(relation.EndTableName); Query.Append(" LEFT JOIN entity e" + counter + " ON "); Query.Append(relation.EndTableName + ".id_entity =3D e" + counter = + ".id_entity "); -// Query.Append("relTbl"+counter+ ".id_entity =3D e" + counter + ".= id_entity "); - - // Query.Append("AND e" + counter + ".\"delDate\" IS NULL "); _whereInit =3D _whereInit + "e" + counter + ".\"delDate\" IS NULL = AND "; counter++; } @@ -730,13 +738,21 @@ return Query.ToString(); } =20 + ///<summary>Init the SQLVars with select and where strings</summ= ary> + ///<param name=3D"strSelect">The select string</param> + ///<param name=3D"strWhere">The where string</param> + private void initSQLVars(string strSelect, string strWhere) + { + this.SQLVars =3D getSQLVars(strSelect,strWhere); =20 + } + =20 public string ParseQuery(DataTable Params) { DataRow objRow; object[] objArray; =20 objRow =3D Params.Rows[0]; - + =20 string res =3D ViewCache.Instance().GetCachedStatement(objRow, PageVi= ew) ; if( res !=3D null ) { // We got the cached datatable result. lets return that and not con= struct a new one again. @@ -759,6 +775,10 @@ dataRowColumns[j] =3D String.Empty; } } + + //Paso 0: + //Here set the SortedList that contains the SQLVars + initSQLVars(dataRowColumns[0],dataRowColumns[1]); //column a= nd where conditions =09 //Paso 1: //Determinar Tablas y Columnas afectadas en la consulta @@ -1313,7 +1333,8 @@ //Logger.Log("getTableList. Loop",LogLevel.Trace); //Logger.Log("getTableList. param=3D " + Indice,LogLevel= .Trace); string valor =3D Indice.Split("|".ToCharArray()).GetValu= e(0).ToString(); - if(IsNumeric(valor)) + =09 + if(IsNumeric(valor)) { columnIndex =3D Convert.ToInt32(valor); } @@ -1384,6 +1405,9 @@ Table.AddColumn(aux); i++; } + =20 + Col.FullAtt =3D valor; //Will be used as a key with SQLV= ars then + =20 Table.AddColumn(Col); Col.Position =3D i; i++; @@ -1746,7 +1770,12 @@ { return getSQLVars(strSelect,strWhere); =20 } - + =20 + public void TestInitSQLVars(string strSelect, string strWhere) + { + initSQLVars(strSelect, strWhere); + } + =20 #endregion } } |
From: <sv...@de...> - 2005-06-29 22:12:18
|
Author: pcamacho Date: 2005-06-29 18:12:11 -0400 (Wed, 29 Jun 2005) New Revision: 1434 Modified: humano2/branches/viewtools/components/tests/formulas.cs humano2/branches/viewtools/components/tests/viewTools.cs humano2/branches/viewtools/components/tests/xmltools.cs humano2/branches/viewtools/components/viewTools/ViewTools.cs humano2/branches/viewtools/core/db/absComplex.cs humano2/branches/viewtools/core/db/pgsql/pgsqlComplex.cs Log: CHANGE: in viewTools build of sorted list that will be used to build the = right SQL string. Modified: humano2/branches/viewtools/components/tests/formulas.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/viewtools/components/tests/formulas.cs 2005-06-28 20= :57:49 UTC (rev 1433) +++ humano2/branches/viewtools/components/tests/formulas.cs 2005-06-29 22= :12:11 UTC (rev 1434) @@ -29,7 +29,7 @@ ////// //First test the FunctionH2 class // - [Test] + //[Test] public void TestGetFormulas() { ProcessFormulas formula =3D new ProcessFormulas(); Modified: humano2/branches/viewtools/components/tests/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/viewtools/components/tests/viewTools.cs 2005-06-28 2= 0:57:49 UTC (rev 1433) +++ humano2/branches/viewtools/components/tests/viewTools.cs 2005-06-29 2= 2:12:11 UTC (rev 1434) @@ -15,6 +15,7 @@ using Humano2.Core; using Humano2.Core.Db; using Humano2.Components.ViewTools; +using System.Collections; using NUnit.Framework; =20 namespace Humano2.Components.Test.ViewTools @@ -34,7 +35,43 @@ crud =3D complex.GetCore().Crud; =20 } =20 - [Test] + //[Test] + public void getTableList() + { + init(); =20 + Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(10162); + vt.Complex =3D complex; + vt.KeyFlag =3D 0; =20 + =20 + ViewTable [] affectedTables =3D vt.TestGetTableList("10181,1= 0229^18,10231^18".Split(",".ToCharArray())); + ViewColumns[] affectedColumns; + =20 + foreach(ViewTable table in affectedTables) + { + affectedColumns =3D table.Columns; + Logger.Log("TableName: " + table.TableName, LogLevel.Tra= ce); =20 + foreach(ViewColumns Cols in affectedColumns) + { + Logger.Log("Cols Name: " + Cols.ColumnName, LogLevel= .Trace); =20 + } + Logger.Log("---", LogLevel.Trace); + } + =20 + Logger.Log("affectedTables[0].TableName: " + affectedTables[= 0].TableName, LogLevel.Trace); + Assert.IsTrue(affectedTables[0].TableName =3D=3D "\"d10160cT= icket\""); + =20 + affectedColumns =3D affectedTables[0].Columns; + Assert.IsTrue(affectedColumns[0].ColumnName =3D=3D "\"c10162= Title\""); + Logger.Log("affectedColumns[0].ColumnName: " + affectedColum= ns[0].ColumnName, LogLevel.Trace); + =20 + Assert.IsTrue(affectedTables[1].TableName =3D=3D "\"user\"")= ; + affectedColumns =3D affectedTables[1].Columns; + Assert.IsTrue(affectedColumns[0].ColumnName =3D=3D "\"email\= ""); + Assert.IsTrue(affectedColumns[1].ColumnName =3D=3D "\"email\= ""); + } + =20 + =20 + //[Test] public void SQLSelect() { init(); =20 @@ -46,30 +83,35 @@ //Simple columns string strSelect =3D vt.SQLSelect("10181"); Logger.Log("SQLSelect(\"10181\"): " + strSelect,LogLevel.Tra= ce); - Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".\"c10162Title\"".Trim()); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT d10160cTicket0= .\"c10162Title\"".Trim()); strSelect =3D vt.SQLSelect("0,10181"); Logger.Log("SQLSelect(\"0,10181\"): " + strSelect,LogLevel.T= race); - Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".id_entity, \"d10160cTicket\".\"c10162Title\"".Trim()); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT d10160cTicket0= .id_entity, d10160cTicket1.\"c10162Title\"".Trim()); =20 //Pertinence columns strSelect =3D vt.SQLSelect("10231"); Logger.Log("SQLSelect(\"10231\"): " + strSelect,LogLevel.Tra= ce); - Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".\"c10162Assigned to3\"".Trim()); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT d10160cTicket0= .\"c10162Assigned to3\"".Trim()); =20 strSelect =3D vt.SQLSelect("10231^18"); Logger.Log("SQLSelect(\"10231^18\"): " + strSelect,LogLevel.= Trace); - Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"user\".\"ema= il\"".Trim()); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT user0.\"email\= "".Trim()); =20 strSelect =3D vt.SQLSelect("10181,10231^18"); Logger.Log("SQLSelect(\"10181,10231^18\"): " + strSelect,Log= Level.Trace); - Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".\"c10162Title\", \"user\".\"email\"".Trim()); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT d10160cTicket0= .\"c10162Title\", user0.\"email\"".Trim()); =20 strSelect =3D vt.SQLSelect("10187^10179"); Logger.Log("SQLSelect(\"10187^10179\"): " + strSelect,LogLev= el.Trace); - Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t Status\".\"c10163Status Name\"".Trim()); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT d10160cTicketS= tatus0.\"c10163Status Name\"".Trim()); + =20 + //Double Pertinence on the same class + strSelect =3D vt.SQLSelect("10229^18,10231^18"); + Logger.Log("SQLSelect(\"10229^18,10231^18\"): " + strSelect,= LogLevel.Trace); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT user0.\"email\= ", user1.\"email\" as \"email1\"".Trim());=20 } =20 - [Test] + //[Test] public void SQLWhere() { init(); =20 @@ -81,16 +123,16 @@ //Simple conditions string strWhere =3D vt.SQLWhere("10187^10179|7|'closed'|0|0"= ); Logger.Log("SQLWhere(\"10187^10179|7|'closed'|0|0\"):" + str= Where, LogLevel.Trace); - Assert.IsTrue(strWhere.Trim() =3D=3D "WHERE \"d10160cTicket = Status\".\"c10163Status Name\" ILIKE '%closed%'".Trim()); + Assert.IsTrue(strWhere.Trim() =3D=3D "WHERE d10160cTicketSta= tus0.\"c10163Status Name\" ILIKE '%closed%'".Trim()); =20 =20 //Double conditions strWhere =3D vt.SQLWhere("10187^10179|7|'closed'|1|0;10181|4= |'Joli ticket'|0|0"); Logger.Log("SQLWhere(\"10187^10179|7|'closed'|1|0;10181|4|'J= oli ticket'|0|0\"):" + strWhere, LogLevel.Trace); - Assert.IsTrue(strWhere.Trim() =3D=3D "WHERE \"d10160cTicket = Status\".\"c10163Status Name\" ILIKE '%closed%' AND \"d10160cTicket\".\"c= 10162Title\" =3D 'Joli ticket'".Trim()); =20 + Assert.IsTrue(strWhere.Trim() =3D=3D "WHERE d10160cTicketSta= tus0.\"c10163Status Name\" ILIKE '%closed%' AND d10160cTicket1.\"c10162Ti= tle\" =3D 'Joli ticket'".Trim()); =20 } =20 - [Test] + //[Test] public void SQLOrderBy() { init(); =20 @@ -103,7 +145,7 @@ Assert.IsTrue(strOrder.Trim() =3D=3D "ORDER BY upper(\"d1016= 0cTicket\".\"c10162Title\") asc , upper(\"d10160cTicket\".\"c10162Date\")= desc".Trim()); } =20 - [Test] + //[Test] public void SQLFrom() { init(); =20 @@ -116,7 +158,7 @@ Assert.IsTrue(strFrom.Trim() =3D=3D "FROM \"d10160cTicket\" = inner join \"entity\" on \"d10160cTicket\".id_entity =3D \"entity\".id_en= tity and entity.\"delDate\" is null LEFT JOIN \"user\" ON \"d10160cTick= et\".\"c10162Assigned to3\" =3D \"user\".id_entity LEFT JOIN entity e1 ON= \"user\".id_entity =3D e1.id_entity LEFT JOIN \"d10160cTicket Status\" = ON \"d10160cTicket\".\"c10162Status\" =3D \"d10160cTicket Status\".id_ent= ity LEFT JOIN entity e2 ON \"d10160cTicket Status\".id_entity =3D e2.id_e= ntity".Trim()); } =20 - [Test] + //[Test] public void ParseQuery() { init(); =20 @@ -139,6 +181,42 @@ Assert.IsTrue(strQuery.Trim() =3D=3D "SELECT \"d10160cTicket= \".id_entity, \"d10160cTicket\".\"c10162Title\", \"d10160cTicket\".\"c101= 62Date\", \"user\".\"email\", \"d10160cTicket\".\"c10162Resolution Date\"= FROM \"d10160cTicket\" inner join \"entity\" on \"d10160cTicket\".id_ent= ity =3D \"entity\".id_entity and entity.\"delDate\" is null LEFT JOIN \= "user\" ON \"d10160cTicket\".\"c10162Assigned to3\" =3D \"user\".id_entit= y LEFT JOIN entity e1 ON \"user\".id_entity =3D e1.id_entity LEFT JOIN \= "d10160cTicket Status\" ON \"d10160cTicket\".\"c10162Status\" =3D \"d1016= 0cTicket Status\".id_entity LEFT JOIN entity e2 ON \"d10160cTicket Status= \".id_entity =3D e2.id_entity WHERE e1.\"delDate\" IS NULL AND e2.\"delD= ate\" IS NULL and \"d10160cTicket Status\".\"c10163Status Name\" ILIKE '= %closed%' ORDER BY upper(\"user\".\"email\") asc".Trim()); } =20 + [Test] + public void getSQLVars() + { + //Logger.Log("<<getSQLVars>>", LogLevel.Trace); + init(); =20 + Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(10162); + vt.Complex =3D complex; + vt.KeyFlag =3D 0; =20 + string strSelect =3D "0,10181,10208,10213,10231^18"; + string strWhere =3D "10231^18|4|'to...@em...'|1|0;10229^18= |7|'lulu'|0|0"; + =20 + SortedList SQLVarsList =3D vt.TestGetSQLVars(strSelect,strWh= ere); + =20 + string tableName0 =3D Convert.ToString(SQLVarsList.GetByInde= x(SQLVarsList.IndexOfKey("10231^18")));=20 + string tableName1 =3D Convert.ToString(SQLVarsList.GetByInde= x(SQLVarsList.IndexOfKey("10229^18"))); + //Logger.Log("tableName0 =3D " + tableName0,LogLevel.Trace); + //Logger.Log("tableName1 =3D " + tableName1,LogLevel.Trace); + Assert.IsTrue(tableName0 =3D=3D "user0"); + Assert.IsTrue(tableName1 =3D=3D "user1"); + =20 + strSelect =3D "0,10181,10208,10213,10229^18,10231^18"; + strWhere =3D "10187^10179|4|'open'|0|0;"; + =20 + SQLVarsList =3D vt.TestGetSQLVars(strSelect,strWhere); + =20 + tableName0 =3D Convert.ToString(SQLVarsList.GetByIndex(SQLVa= rsList.IndexOfKey("10229^18")));=20 + tableName1 =3D Convert.ToString(SQLVarsList.GetByIndex(SQLVa= rsList.IndexOfKey("10231^18"))); + string tableName2 =3D Convert.ToString(SQLVarsList.GetByInde= x(SQLVarsList.IndexOfKey("10187^10179"))); + //Logger.Log("tableName0 =3D " + tableName0,LogLevel.Trace); + //Logger.Log("tableName1 =3D " + tableName1,LogLevel.Trace); + //Logger.Log("tableName2 =3D " + tableName2,LogLevel.Trace); + =20 + Assert.IsTrue(tableName0 =3D=3D "user0"); + Assert.IsTrue(tableName1 =3D=3D "user1"); + Assert.IsTrue(tableName2 =3D=3D "d10160cTicketStatus2"); + } =20 /// <summary> /// Funcion que genera un datatable con la forma en que ViewTool= s lo recibe... Modified: humano2/branches/viewtools/components/tests/xmltools.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/viewtools/components/tests/xmltools.cs 2005-06-28 20= :57:49 UTC (rev 1433) +++ humano2/branches/viewtools/components/tests/xmltools.cs 2005-06-29 22= :12:11 UTC (rev 1434) @@ -35,7 +35,7 @@ return filereadbuf; } =20 - [Test] + //[Test] public void OrderAttributesInDataStructure() { //Loads the xml in a string Modified: humano2/branches/viewtools/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/viewtools/components/viewTools/ViewTools.cs 2005-06-= 28 20:57:49 UTC (rev 1433) +++ humano2/branches/viewtools/components/viewTools/ViewTools.cs 2005-06-= 29 22:12:11 UTC (rev 1434) @@ -36,6 +36,7 @@ private string _whereInit =3D ""; private bool _caseSensitive; //To allow doing insensitive case s= earch private string query; //To get the query from outside + =20 #endregion =20 #region "CONSTRUCTORES" @@ -288,6 +289,45 @@ #endregion =20 #region "METODOS" + =20 + private SortedList getSQLVars(string strSelect, string strWhere) + { + //Logger.Log("<<getSQLVars>>", LogLevel.Trace); + SortedList res =3D new SortedList(); + =20 + //Parse strSelect and fill the sortedList + string [] strSelectArr =3D strSelect.Split(",".ToCharArray()= ); + string [] strWhereArr =3D strWhere.Split(";".ToCharArray()); + int globalIndex =3D 0; + globalIndex =3D fillSortedListWithPertAttributes(res, strSel= ectArr, 0); + fillSortedListWithPertAttributes(res, strWhereArr, globalInd= ex); + return res; + } + =20 + ///<summary>With a list of attributes fills a sorted list with (= att,SQLVar) id the att is a pert att</summary> + ///<param name=3D"list">The list to fill</param> + ///<param name=3D"attributes">The list of attributes</param> + ///<param name=3D"index">The index used to create the name of va= riables: TableName concatenated to index</param> + private int fillSortedListWithPertAttributes(SortedList list, st= ring [] attributes, int index) + { + for(int i=3D0; i<attributes.Length;i++) + { + string fullAtt =3D (attributes[i].Split("|".ToCharArray(= )))[0]; + string att =3D fullAtt.Split("^".ToCharArray())[0]; //Re= move target if pertinence + //Logger.Log("att: " + att,LogLevel.Trace); + bool isPert =3D fullAtt.IndexOf('^') !=3D -1; + if(!list.ContainsKey(fullAtt) && isPert) + { + //Logger.Log(fullAtt + " added",LogLevel.Trace); + string tableId =3D Complex.GetPertinenceClassForAttr= ibute(att); =20 + string tableName =3D (Complex.GetClassSysName(tableI= d) + index).Replace(" ",""); //Don't forget to remove spaces... This is a= SQL variable!! + list.Add(fullAtt,tableName); + index++; + } + } + return index; + } + =20 public void ChangeSelect(string strSelect, string strWhere) { Select =3D SQLSelect(strSelect); @@ -379,10 +419,10 @@ Logger.Log("Final Statement was: " + sql, LogLevel.Error); =09 throw ex; } - =09 } =20 - if(find > -1) { + if(find > -1)=20 + { Complex.doCommand(dropTable); } return res; @@ -407,13 +447,37 @@ return xml; } =20 + =20 + ///<summary> + /// Given a name of table like "Tickets" for example, builds the= name of sql var for this table + /// removing the quotes (") and concatenating the number passed = in param + /// It is important to remove spaces from the table name to avoi= d SQL error + ///</summary> + ///<param name=3D"number">The number to concatenate</param> + ///<param name=3D"sqlTableName">The name of table</param> + ///<returns>[name of table(without quotes)] + number.ToString</r= eturns> + private string getSQLTableVar(string sqlTableName, int number) + { + string res =3D ""; + res =3D sqlTableName.Replace("\"","").Replace(" ","") + numb= er; //remove quotes and spaces + return res; + } + =20 + private string getSQLTableVarWithTableName(string sqlTableName, = int number) + { + string res =3D sqlTableName + " " + getSQLTableVar(sqlTableN= ame,number); =20 + return res; + } + =20 public string SQLSelect(string param) { - ViewTable[] affectedTables; + Logger.Log("<<SQLSelect:>>",LogLevel.Trace); + =20 + ViewTable[] affectedTables; StringBuilder Query =3D new StringBuilder(); ViewColumns[] affectedColumns; Logger.Log("SQLSelect: " + param,LogLevel.Trace); - affectedTables =3D GetTableList(param.Split(",".ToCharArray(= ))); + affectedTables =3D getTableList(param.Split(",".ToCharArray(= ))); int i =3D 1; ArrayList values =3D new ArrayList(); DisplayOrder[] disp; @@ -422,35 +486,33 @@ foreach(ViewTable table in affectedTables) { affectedColumns =3D table.Columns; - =09 + int index =3D 0; foreach(ViewColumns Cols in affectedColumns) { aux =3D new DisplayOrder(); - if(Cols.Function =3D=3D Enums.AggregateFunctions.nofunc) - { - aux.Position =3D Cols.Position; - aux.Text =3D table.TableName + "." + Cols.ColumnName + ", "; - aux.Id =3D Cols.ColumnIndex; - aux.Type =3D Cols.Type; - } - else - { - switch(Cols.Function) - { - case Enums.AggregateFunctions.count: - aux.Position =3D Cols.Position; - aux.Text =3D "count(" + table.TableName + "." + Cols.ColumnName = + "), "; - aux.Id =3D Cols.ColumnIndex; - aux.Type =3D Cols.Type; - break; - case Enums.AggregateFunctions.sum: - aux.Position =3D Cols.Position; - aux.Text =3D "sum(" + table.TableName + "." + Cols.ColumnName + = "), "; - aux.Id =3D Cols.ColumnIndex; - aux.Type =3D Cols.Type; - break; - } - } + string tableAffectedName =3D getSQLTableVar(table.Ta= bleName,index++); + string beginFunction =3D ""; + string endFunction =3D ""; + =20 + switch(Cols.Function) + { + case Enums.AggregateFunctions.nofunc: + beginFunction =3D ""; + endFunction =3D ""; + break; + case Enums.AggregateFunctions.count: + beginFunction =3D "count("; + endFunction =3D ")"; + break; + case Enums.AggregateFunctions.sum: + beginFunction =3D "sum("; + endFunction =3D ")"; + break; + } + aux.Text =3D beginFunction + tableAffectedName + end= Function + "." + Cols.ColumnName + ", "; + aux.Position =3D Cols.Position; + aux.Id =3D Cols.ColumnIndex; + aux.Type =3D Cols.Type; values.Add(aux); i++; } @@ -476,6 +538,7 @@ int begin =3D var.Text.IndexOf(".")+1; int end =3D var.Text.IndexOf(",",begin); string field =3D var.Text.Substring(begin,end - begin); + Logger.Log("field: " + field, LogLevel.Trace); if (selCols.ContainsKey(field)) { field =3D field.Replace("\"",""); @@ -530,7 +593,7 @@ relations =3D GetRelatedTableList((string[])cols.ToArray(typeof(strin= g))); if(relations.Length > 0) { - //ViewRelation previousRelation =3D null;=09 + //ViewRelation previousRelation =3D null;=09 string relationType =3D ""; ArrayList tableDictionary =3D new ArrayList(); int counter =3D 1; @@ -1029,6 +1092,7 @@ =09 strFilters.Append(tableName + "." + columnName + " "); int recursionIndex; + Logger.Log("parameters[2]: " + parameters[2],LogLevel.Tr= ace); recursionIndex =3D parameters[2].IndexOf("{"); =20 if(recursionIndex !=3D -1) @@ -1201,7 +1265,7 @@ break; } =20 - if(parameters[4] =3D=3D "2") + if(parameters[4] =3D=3D "2") //FIXME: Should not be =3D=3D"1"?? { strFilters.Append(") "); } @@ -1234,7 +1298,7 @@ return parameter; } =20 - private ViewTable[] GetTableList(string[] strParams) + private ViewTable[] getTableList(string[] strParams) { ArrayList TableNames =3D new ArrayList(); ArrayList Tables =3D new ArrayList(); @@ -1243,11 +1307,11 @@ string tableName; int columnIndex, tablePosition; int i =3D 1; - Logger.Log("GetTableList. Step 1",LogLevel.Trace); + //Logger.Log("getTableList. Step 1",LogLevel.Trace); foreach(string Indice in strParams) { - Logger.Log("GetTableList. Loop",LogLevel.Trace); - Logger.Log("GetTableList. param=3D " + Indice,LogLevel.T= race); + //Logger.Log("getTableList. Loop",LogLevel.Trace); + //Logger.Log("getTableList. param=3D " + Indice,LogLevel= .Trace); string valor =3D Indice.Split("|".ToCharArray()).GetValu= e(0).ToString(); if(IsNumeric(valor)) { @@ -1272,11 +1336,13 @@ Logger.Log("columnIndex=3D" + columnIndex,LogLevel.Trace); Col =3D new ViewColumns(columnIndex,Complex.ColumnNa= me(columnIndex)); Col.Type =3D Complex.InstanceType(columnIndex); + tableName =3D Complex.TableName(columnIndex); } else { Col =3D new ViewColumns(0,"id_entity"); Col.Type =3D "int"; + tableName =3D Complex.TableName(IdClass); } =09 try @@ -1288,17 +1354,7 @@ Col.Function =3D (Enums.AggregateFunctions)0; } =20 - if(columnIndex !=3D 0) - { - tableName =3D Complex.TableName(columnIndex); - } - else - { - tableName =3D Complex.TableName(IdClass); - } - tablePosition =3D TableNames.IndexOf(tableName); - =20 if(tablePosition < 0) { Table =3D new ViewTable(); @@ -1311,43 +1367,30 @@ { Table.TableIndex =3D IdClass; } - - if(IdClass !=3D Table.TableIndex && KeyFlag =3D=3D 1) - { - ViewColumns aux =3D new ViewColumns(0,"id_entity"); - aux.Position =3D i; - aux.Type =3D "int"; - Table.AddColumn(aux); - i++; - } - Col.Position =3D i; - Table.PrimaryKeyName =3D "id_entity"; - Table.AddColumn(Col); Tables.Add(Table); TableNames.Add(tableName); } else { Table =3D (ViewTable)Tables[tablePosition]; - // Tables.RemoveAt(tablePosition); - if(IdClass !=3D Table.TableIndex && KeyFlag =3D=3D 1) - { - ViewColumns aux =3D new ViewColumns(0,"id_entity"); - aux.Position =3D i; - aux.Type =3D "int"; =20 - Table.AddColumn(aux); - i++; - } - Col.Position =3D i; - Table.AddColumn(Col); - // Tables.Add(Table); } + =20 + if(IdClass !=3D Table.TableIndex && KeyFlag =3D=3D 1) + { + ViewColumns aux =3D new ViewColumns(0,"id_entity"); + aux.Position =3D i; + aux.Type =3D "int"; =20 + Table.AddColumn(aux); + i++; + } + Table.AddColumn(Col); + Col.Position =3D i; i++; } return (ViewTable[])Tables.ToArray(typeof(ViewTable)); } - + =20 private int[] GetParentIndexes(int id_entity) { object res =3D null; @@ -1374,7 +1417,7 @@ StringBuilder Query =3D new StringBuilder(); string iniTable, endTable; =09 - parentIndexes =3D GetParentIndexes(intIdClass); + parentIndexes =3D GetParentIndexes(intIdClass); =20 for(int i =3D 0; i<=3D parentIndexes.Length - 2;i++) { @@ -1383,17 +1426,14 @@ if(previousRelation =3D=3D 0) { Query.Append(iniTable + " inner join " + endTable); - Query.Append(" on " + iniTable + ".id_entity"); - Query.Append(" =3D " + endTable + ".id_entity "); - previousRelation =3D 1; } else { Query.Append("inner join" + endTable); - Query.Append(" on " + iniTable + ".id_entity"); - Query.Append(" =3D " + endTable + ".id_entity "); - previousRelation =3D 1; } + Query.Append(" on " + iniTable + ".id_entity"); + Query.Append(" =3D " + endTable + ".id_entity "); + previousRelation =3D 1; } Query.Append("and entity.\"delDate\" is null "); return Query.ToString(); @@ -1693,9 +1733,20 @@ } return res; } + =20 + ////////////////////////////////////////////////////////////////= ///////////////////////////////////////////////// + //These functions are not used in the code. They are only here t= o be able to test private functions from outside + // + public ViewTable[] TestGetTableList(string [] strParams) + { + return getTableList(strParams); + } + =20 + public SortedList TestGetSQLVars(string strSelect, string strWhe= re) + { + return getSQLVars(strSelect,strWhere); =20 + } =20 - #endregion - } } Modified: humano2/branches/viewtools/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/viewtools/core/db/absComplex.cs 2005-06-28 20:57:49 = UTC (rev 1433) +++ humano2/branches/viewtools/core/db/absComplex.cs 2005-06-29 22:12:11 = UTC (rev 1434) @@ -118,6 +118,12 @@ ///<returns>Devuele un true si una clase. Si no, false.</returns> abstract public bool IsClass(int idEntity); =20 + ///<sumaray>Returns the sysName of a class given the classId</su= mmary> + ///<param name=3D"classId">The id of the class</param> + ///<returns>The sysName of the class</returns> + abstract public string GetClassSysName(string classId); + =20 + =20 /// <summary> /// Resuelve el sysName de una clase con '"' antes y despues del strin= g. /// </summary> @@ -329,14 +335,21 @@ abstract public void finalImport(string [,] attsArr, DataSet dsAtts, s= tring tableName, int domainId, int classId); =20 /// <summary> - /// Get the string id of the pertinence attribute an attribute is relat= ed to + /// Get the string id of the pertinence attribute an attribute is r= elated to /// </summary> /// <param name=3D"attributeId">The attribute for which we want = the pertinence attribute related to</param> /// <returns>The attribute of the pertinence attribute or "" if = attributeId is not a pertinence attribute</returns> abstract public string GetPertinenceForAttribute(string attribut= eId); =20 + ///<summary> + ///Returns the class a pertinence attribute points to + ///<summary> + ///<param name=3D"attributeId">the pertinence attribute</param> + ///<returns>The id_entity of the class pointed by the attribute.= If the att is not a pert att, returns ""</returns> + abstract public string GetPertinenceClassForAttribute(string att= ributeId); + =20 /// <summary> - /// Converts a system attribute name into a user attribute name + /// Converts a system attribute name into a user attribute name /// </summary> /// <param name=3D"sysAttName">system name for attribute </param= > /// <returns>user attribute name</returns> @@ -395,7 +408,6 @@ ///</summary> /// <param name=3D"classId">The classId of an attribute</param> /// <returns>the sys name of basic attribute</returns> - abstract public string GetBasicAttributeSysName(int classId); =20 =20 Modified: humano2/branches/viewtools/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/viewtools/core/db/pgsql/pgsqlComplex.cs 2005-06-28 2= 0:57:49 UTC (rev 1433) +++ humano2/branches/viewtools/core/db/pgsql/pgsqlComplex.cs 2005-06-29 2= 2:12:11 UTC (rev 1434) @@ -934,6 +934,38 @@ } } =20 + =20 + override public string GetPertinenceClassForAttribute(string att= ributeId) + { + string req =3D "select \"to\" from pertinence where id_entit= y =3D" + attributeId; + 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]["to"]); //Get the per= tinence attribute + } + } + =20 + =20 + override public string GetClassSysName(string classId) + { + string req =3D "select \"sysName\" from class where id_entit= y=3D" + classId; + string res =3D ""; + DataTable dt =3D doSelect(req); + try + { + res =3D Convert.ToString(dt.Rows[0]["sysName"]); + } + catch + { + Logger.Log("GetClassSysName: " + classId + " is not the = id of a class... :(",LogLevel.Trace); + } + return res; + } + =20 /// <summary> /// Converts a system attribute name into a user attribute name /// </summary> |
From: <sv...@de...> - 2005-06-28 20:57:49
|
Author: pcamacho Date: 2005-06-28 16:57:49 -0400 (Tue, 28 Jun 2005) New Revision: 1433 Added: humano2/branches/viewtools/ Log: BRANCH: to test, refactor and debug viewtools. Copied: humano2/branches/viewtools (from rev 1432, humano2/trunk) |
From: <sv...@de...> - 2005-06-28 20:55:17
|
Author: pcamacho Date: 2005-06-28 16:55:22 -0400 (Tue, 28 Jun 2005) New Revision: 1432 Modified: humano2/trunk/components/tests/Makefile humano2/trunk/components/tests/viewTools.cs humano2/trunk/components/viewTools/ViewTools.cs Log: ADD: first tests for viewtools. Modified: humano2/trunk/components/tests/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/trunk/components/tests/Makefile 2005-06-28 16:37:26 UTC (rev = 1431) +++ humano2/trunk/components/tests/Makefile 2005-06-28 20:55:22 UTC (rev = 1432) @@ -24,6 +24,6 @@ all: $(dll) =20 $(dll): *.cs - $(csc) /out:$@ $(opts) /t:library /doc:$(docdir)/$(namespace).xml /r:Sy= stem.Data,$(extdir)/nunit/nunit.framework $(dlllist) $^ + $(csc) /out:$@ $(opts) /t:library /doc:$(docdir)/$(namespace).xml /r:Sy= stem.Data,$(extdir)/nunit/nunit.framework $(dlllist) /r:$(bindir)/Humano2= .Core.Db.dll /r:$(bindir)/Humano2.Core.dll $^ =20 -.PHONY: all \ No newline at end of file +.PHONY: all Modified: humano2/trunk/components/tests/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/tests/viewTools.cs 2005-06-28 16:37:26 UTC (= rev 1431) +++ humano2/trunk/components/tests/viewTools.cs 2005-06-28 20:55:22 UTC (= rev 1432) @@ -12,6 +12,8 @@ =20 using System; using System.Data; +using Humano2.Core; +using Humano2.Core.Db; using Humano2.Components.ViewTools; using NUnit.Framework; =20 @@ -20,90 +22,145 @@ /// <summary> /// Summary description for ViewTools. /// </summary> + [TestFixture] public class ViewTools { - [Test] - [Ignore("Aun no definidos los parametros de entrada")] - public string GenerarConsultaSimple() - { - DataTable tabla =3D new DataTable(); - DataColumn columna; - string[] fila =3D {"26"}; - string respuesta; - Humano2.Components.ViewTools.ViewTools vtInstancia; - =09 - columna =3D new DataColumn("columna",typeof(string)); - tabla.Columns.Add(columna); - columna =3D new DataColumn("filtros",typeof(string)); - tabla.Columns.Add(columna); - tabla.Rows.Add(fila); + private absCrud crud =3D null; + private absComplex complex =3D null; + =20 + private void init() + { + complex =3D Factory.Complex(); + crud =3D complex.GetCore().Crud; =20 + } + =20 + [Test] + public void SQLSelect() + { + init(); =20 + =20 + Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(10162); + vt.Complex =3D complex; + vt.KeyFlag =3D 0; + =20 + //Simple columns + string strSelect =3D vt.SQLSelect("10181"); + Logger.Log("SQLSelect(\"10181\"): " + strSelect,LogLevel.Tra= ce); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".\"c10162Title\"".Trim()); + strSelect =3D vt.SQLSelect("0,10181"); + Logger.Log("SQLSelect(\"0,10181\"): " + strSelect,LogLevel.T= race); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".id_entity, \"d10160cTicket\".\"c10162Title\"".Trim()); + =20 + //Pertinence columns + strSelect =3D vt.SQLSelect("10231"); + Logger.Log("SQLSelect(\"10231\"): " + strSelect,LogLevel.Tra= ce); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".\"c10162Assigned to3\"".Trim()); + =20 + strSelect =3D vt.SQLSelect("10231^18"); + Logger.Log("SQLSelect(\"10231^18\"): " + strSelect,LogLevel.= Trace); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"user\".\"ema= il\"".Trim()); + =20 + strSelect =3D vt.SQLSelect("10181,10231^18"); + Logger.Log("SQLSelect(\"10181,10231^18\"): " + strSelect,Log= Level.Trace); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t\".\"c10162Title\", \"user\".\"email\"".Trim()); + =20 + strSelect =3D vt.SQLSelect("10187^10179"); + Logger.Log("SQLSelect(\"10187^10179\"): " + strSelect,LogLev= el.Trace); + Assert.IsTrue(strSelect.Trim() =3D=3D "SELECT \"d10160cTicke= t Status\".\"c10163Status Name\"".Trim()); + } + =20 + [Test] + public void SQLWhere() + { + init(); =20 + =20 + Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(10162); + vt.Complex =3D complex; + vt.KeyFlag =3D 0; + =20 + //Simple conditions + string strWhere =3D vt.SQLWhere("10187^10179|7|'closed'|0|0"= ); + Logger.Log("SQLWhere(\"10187^10179|7|'closed'|0|0\"):" + str= Where, LogLevel.Trace); + Assert.IsTrue(strWhere.Trim() =3D=3D "WHERE \"d10160cTicket = Status\".\"c10163Status Name\" ILIKE '%closed%'".Trim()); + =20 + =20 + //Double conditions + strWhere =3D vt.SQLWhere("10187^10179|7|'closed'|1|0;10181|4= |'Joli ticket'|0|0"); + Logger.Log("SQLWhere(\"10187^10179|7|'closed'|1|0;10181|4|'J= oli ticket'|0|0\"):" + strWhere, LogLevel.Trace); + Assert.IsTrue(strWhere.Trim() =3D=3D "WHERE \"d10160cTicket = Status\".\"c10163Status Name\" ILIKE '%closed%' AND \"d10160cTicket\".\"c= 10162Title\" =3D 'Joli ticket'".Trim()); =20 + } + =20 + [Test] + public void SQLOrderBy() + { + init(); =20 + Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(10162); + vt.Complex =3D complex; + vt.KeyFlag =3D 0; + =20 + string strOrder =3D vt.SQLOrderBy(" 10181|0,10208|1"); + Logger.Log("SQLWhere(\"10181|0,10208|1\"):" + strOrder, LogL= evel.Trace); + Assert.IsTrue(strOrder.Trim() =3D=3D "ORDER BY upper(\"d1016= 0cTicket\".\"c10162Title\") asc , upper(\"d10160cTicket\".\"c10162Date\")= desc".Trim()); + } + =20 + [Test] + public void SQLFrom() + { + init(); =20 + Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(10162); + vt.Complex =3D complex; + vt.KeyFlag =3D 0; =20 + string strFrom =3D vt.SQLFrom("0,10181,10208,10231^18,10209"= ,"10187^10179|7|'closed'|0|0"); + Logger.Log("SQLFrom(\"0,10181,10208,10231^18,10209\",\"10187= ^10179|7|'closed'|0|0\");" + strFrom, LogLevel.Trace); + =20 + Assert.IsTrue(strFrom.Trim() =3D=3D "FROM \"d10160cTicket\" = inner join \"entity\" on \"d10160cTicket\".id_entity =3D \"entity\".id_en= tity and entity.\"delDate\" is null LEFT JOIN \"user\" ON \"d10160cTick= et\".\"c10162Assigned to3\" =3D \"user\".id_entity LEFT JOIN entity e1 ON= \"user\".id_entity =3D e1.id_entity LEFT JOIN \"d10160cTicket Status\" = ON \"d10160cTicket\".\"c10162Status\" =3D \"d10160cTicket Status\".id_ent= ity LEFT JOIN entity e2 ON \"d10160cTicket Status\".id_entity =3D e2.id_e= ntity".Trim()); + } + =20 + [Test] + public void ParseQuery() + { + init(); =20 + Humano2.Components.ViewTools.ViewTools vt =3D new Humano2.Components.= ViewTools.ViewTools(10162); + vt.Complex =3D complex; + vt.KeyFlag =3D 0; =20 + DataTable dtParam =3D this.makeDataTableInViewTools(); + DataRow dr =3D dtParam.NewRow(); + =20 + dr["columna"] =3D "0,10181,10208,10231^18,10209"; + dr["filtros"] =3D "10187^10179|7|'closed'|0|0"; + //dr["group"] =3D ""; + //dr["having"] =3D ""; + dr["order"] =3D "10231^18|0"; =20 - vtInstancia =3D new Humano2.Components.ViewTools.ViewTools(1); - respuesta =3D vtInstancia.GetSQLString(tabla).ToUpper(); - return respuesta; - } - - [Test] - [Ignore("Aun no definidos los parametros de entrada")] - public string GenerarConsultaConFiltro() - { - DataTable tabla =3D new DataTable(); - DataColumn columna; - string[] fila =3D {"21","20|5|'1'"}; - string respuesta; - Humano2.Components.ViewTools.ViewTools vtInstancia; - =09 - columna =3D new DataColumn("columna",typeof(string)); - tabla.Columns.Add(columna); - columna =3D new DataColumn("filtros",typeof(string)); - tabla.Columns.Add(columna); - tabla.Rows.Add(fila); - - vtInstancia =3D new Humano2.Components.ViewTools.ViewTools(1); - respuesta =3D vtInstancia.GetSQLString(tabla).ToUpper(); - return respuesta; - } - - [Test] - [Ignore("Aun no definidos los parametros de entrada")] - public string GenerarConsultaConRelacion() - { - DataTable tabla =3D new DataTable(); - DataColumn columna; - string[] fila =3D {"28^26,28","28^26^20|5|'29'"}; - string respuesta; - Humano2.Components.ViewTools.ViewTools vtInstancia; - =09 - columna =3D new DataColumn("columna",typeof(string)); - tabla.Columns.Add(columna); - columna =3D new DataColumn("filtros",typeof(string)); - tabla.Columns.Add(columna); - tabla.Rows.Add(fila); - - vtInstancia =3D new Humano2.Components.ViewTools.ViewTools(1); - respuesta =3D vtInstancia.GetSQLString(tabla).ToUpper(); - return respuesta; - } - - [Test] - [Ignore("Aun no definidos los parametros de entrada")] - public string GenerarConsultaConAgrupacion() - { - DataTable tabla =3D new DataTable(); - DataColumn columna; - string[] fila =3D {"28^26,28,28^26|1","28^26^20|5|'29'"}; - string respuesta; - Humano2.Components.ViewTools.ViewTools vtInstancia; - =09 - columna =3D new DataColumn("columna",typeof(string)); - tabla.Columns.Add(columna); - columna =3D new DataColumn("filtros",typeof(string)); - tabla.Columns.Add(columna); - tabla.Rows.Add(fila); - - vtInstancia =3D new Humano2.Components.ViewTools.ViewTools(1); - respuesta =3D vtInstancia.GetSQLString(tabla).ToUpper(); - return respuesta; - } - } + dtParam.Rows.Add(dr); + vt.GetSQLDataTable(dtParam); //Don't get result, only to hav= e the query + string strQuery =3D vt.GetLastExecutedQuery(); + Logger.Log("strQuery=3D " + strQuery,LogLevel.Trace); + Assert.IsTrue(strQuery.Trim() =3D=3D "SELECT \"d10160cTicket= \".id_entity, \"d10160cTicket\".\"c10162Title\", \"d10160cTicket\".\"c101= 62Date\", \"user\".\"email\", \"d10160cTicket\".\"c10162Resolution Date\"= FROM \"d10160cTicket\" inner join \"entity\" on \"d10160cTicket\".id_ent= ity =3D \"entity\".id_entity and entity.\"delDate\" is null LEFT JOIN \= "user\" ON \"d10160cTicket\".\"c10162Assigned to3\" =3D \"user\".id_entit= y LEFT JOIN entity e1 ON \"user\".id_entity =3D e1.id_entity LEFT JOIN \= "d10160cTicket Status\" ON \"d10160cTicket\".\"c10162Status\" =3D \"d1016= 0cTicket Status\".id_entity LEFT JOIN entity e2 ON \"d10160cTicket Status= \".id_entity =3D e2.id_entity WHERE e1.\"delDate\" IS NULL AND e2.\"delD= ate\" IS NULL and \"d10160cTicket Status\".\"c10163Status Name\" ILIKE '= %closed%' ORDER BY upper(\"user\".\"email\") asc".Trim()); + } + =20 + =20 + /// <summary> + /// Funcion que genera un datatable con la forma en que ViewTool= s lo recibe... + /// </summary> + /// <returns></returns> + private DataTable makeDataTableInViewTools() + { + DataTable dt1 =3D new DataTable(); + DataColumn dc1; + dc1 =3D new DataColumn("columna",typeof(string)); + dt1.Columns.Add(dc1); + dc1 =3D new DataColumn("filtros",typeof(string)); + dt1.Columns.Add(dc1); + dc1 =3D new DataColumn("group",typeof(string)); + dt1.Columns.Add(dc1); + dc1 =3D new DataColumn("having",typeof(string)); + dt1.Columns.Add(dc1); + dc1 =3D new DataColumn("order",typeof(string)); + dt1.Columns.Add(dc1); + dc1 =3D new DataColumn("keys",typeof(string)); + dt1.Columns.Add(dc1); + return dt1; + } + } } 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-06-28 16:37:26 U= TC (rev 1431) +++ humano2/trunk/components/viewTools/ViewTools.cs 2005-06-28 20:55:22 U= TC (rev 1432) @@ -35,6 +35,7 @@ private string _tempTable; private string _whereInit =3D ""; private bool _caseSensitive; //To allow doing insensitive case s= earch + private string query; //To get the query from outside #endregion =20 #region "CONSTRUCTORES" @@ -53,6 +54,7 @@ public ViewTools(int IdClass) { this._idclass =3D IdClass; + this.query =3D ""; } =20 /// <summary> @@ -410,7 +412,8 @@ ViewTable[] affectedTables; StringBuilder Query =3D new StringBuilder(); ViewColumns[] affectedColumns; - affectedTables =3D GetTableList(param.Split(",".ToCharArray())); + Logger.Log("SQLSelect: " + param,LogLevel.Trace); + affectedTables =3D GetTableList(param.Split(",".ToCharArray(= ))); int i =3D 1; ArrayList values =3D new ArrayList(); DisplayOrder[] disp; @@ -664,7 +667,7 @@ return Query.ToString(); } =20 - private string ParseQuery(DataTable Params) + public string ParseQuery(DataTable Params) { DataRow objRow; object[] objArray; @@ -746,10 +749,18 @@ =20 res =3D Query.ToString(); //Logger.Log("Query=3D" + res,LogLevel.Trace); - ViewCache.Instance().AddStatement(objRow, res, PageView); + =09 + this.query =3D res; //Update query + =20 + ViewCache.Instance().AddStatement(objRow, res, PageView); =20 return res; } + =20 + public string GetLastExecutedQuery() + { + return this.query; =20 + } =09 private string GetGroupingFilters(string[] strParams) { @@ -1232,10 +1243,12 @@ string tableName; int columnIndex, tablePosition; int i =3D 1; - =09 + Logger.Log("GetTableList. Step 1",LogLevel.Trace); foreach(string Indice in strParams) { - string valor =3D Indice.Split("|".ToCharArray()).GetValue(0).ToStrin= g(); + Logger.Log("GetTableList. Loop",LogLevel.Trace); + Logger.Log("GetTableList. param=3D " + Indice,LogLevel.T= race); + string valor =3D Indice.Split("|".ToCharArray()).GetValu= e(0).ToString(); if(IsNumeric(valor)) { columnIndex =3D Convert.ToInt32(valor); |
From: <sv...@de...> - 2005-06-28 16:37:24
|
Author: marcelo Date: 2005-06-28 12:37:26 -0400 (Tue, 28 Jun 2005) New Revision: 1431 Modified: humano2/trunk/core/config.cs Log: * Updated version number to Beta8 Modified: humano2/trunk/core/config.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/config.cs 2005-06-24 23:25:18 UTC (rev 1430) +++ humano2/trunk/core/config.cs 2005-06-28 16:37:26 UTC (rev 1431) @@ -26,7 +26,7 @@ // The Version of the Humano2 core code const int major =3D 5; const int minor =3D 0; - const string patch =3D "beta7"; + const string patch =3D "beta8"; =09 // Contains the instance, once instanced. private static Config instance =3D null; |
From: <sv...@de...> - 2005-06-24 23:25:13
|
Author: pcamacho Date: 2005-06-24 19:25:18 -0400 (Fri, 24 Jun 2005) New Revision: 1430 Added: humano2/trunk/components/tests/formulas.cs Log: ADD: first test for formulas with NUNIT. Added: humano2/trunk/components/tests/formulas.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/tests/formulas.cs 2005-06-24 22:55:54 UTC (r= ev 1429) +++ humano2/trunk/components/tests/formulas.cs 2005-06-24 23:25:18 UTC (r= ev 1430) @@ -0,0 +1,43 @@ +// +// 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$ +// + +using System; +using System.Data; +using Humano2.Components.WebTools; +using Humano2.Components.Formulas; +using Humano2.Components.Formulas.Functions; +using NUnit.Framework; + +namespace Humano2.Components.Test.Formulas +{ + /// <summary> + /// Test class for Formulas component + /// !!!! This class has to be used with the template HelpDeskSMB (so= lutions/pgsql-09-HelpDeskSMB.sql) !!!!! + /// </summary> + [TestFixture] + public class Formulas + { + ////// + //First test the FunctionH2 class + // + [Test] + public void TestGetFormulas() + { + ProcessFormulas formula =3D new ProcessFormulas(); + =20 + DataTable dt =3D formula.GetFormulas(10160, 10181,10251); + string formulaStr =3D Convert.ToString(dt.Rows[0]["formula"]= ); + Assert.IsTrue(formulaStr =3D=3D "[10187^10179]");=20 + = =20 + } + } +} Property changes on: humano2/trunk/components/tests/formulas.cs ___________________________________________________________________ Name: svn:keywords + Id |
From: <sv...@de...> - 2005-06-24 22:56:02
|
Author: pcamacho Date: 2005-06-24 18:55:54 -0400 (Fri, 24 Jun 2005) New Revision: 1429 Modified: humano2/trunk/components/formulas/ProcessFormulas.cs Log: DEL: unused functions. Modified: humano2/trunk/components/formulas/ProcessFormulas.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/formulas/ProcessFormulas.cs 2005-06-24 22:35= :13 UTC (rev 1428) +++ humano2/trunk/components/formulas/ProcessFormulas.cs 2005-06-24 22:55= :54 UTC (rev 1429) @@ -813,11 +813,11 @@ tableName =3D ""; columnName =3D "id_entity1"; //strSearch =3D columnName; - if (sql.IndexOf(" as \"id_entity1\" FROM ") > 0 ) + if (sql.IndexOf(" as \"id_entity1\" FROM ") > 0 ) { sql =3D sql.Replace(columnName, "col"); - } - else + } + else { sql =3D sql.Replace(" FROM", " as col FROM"); } @@ -868,68 +868,6 @@ return salida; } =20 - ///<sumary>Funcion que trae la columna Primary de una clase (o tabla)<= /sumary> - ///<remarks>Funcion no usada, pero se mantendra pues puede ser util</r= emarks> - private string getPrimaryColumn(int idTable, int domainId) - { - string nameColumnPrimary =3D ""; - crud.Domain =3D domainId; - - DataSet ds1; - ds1 =3D crud.ReadStructure(idTable); - - //ahora busco el campo login (is_Primary) - if(ds1.Tables.Contains("attribute")) - { - if(ds1.Tables["attribute"].Select("classId=3D"+idTable+" AND isPrima= ry=3DTrue").Length>0) - { - nameColumnPrimary =3D ds1.Tables["attribute"].Select("classId=3D"+i= dTable+" AND isPrimary=3DTrue")[0]["sysAttName"].ToString(); - } - } - return nameColumnPrimary; - } - =09 - ///<sumary>Funcion que trae uno de los campos pertinence entre 2 clase= s</sumary> - ///<remarks>Funcion Obsoleta, pero se mantendra pues puede ser util</r= emarks> - private string getColumnPertinence(int idTable, int idTablePertinence,= int domainId) - { - string nameColumnPertinence =3D ""; - int idColumnPertinence=3D0; - crud.Domain =3D domainId; - - DataSet ds1; - ds1 =3D crud.ReadStructure(idTablePertinence); - //DataGrid1.DataSource =3D ds1.Tables["pertinence"]; - //DataGrid1.DataBind(); - foreach(DataRow dr in ds1.Tables["pertinence"].Select("to=3D"+idTable= )) - { - idColumnPertinence =3D Convert.ToInt32(dr["owner"].ToString()); - } - if(idColumnPertinence>0) - nameColumnPertinence =3D complex.ColumnName(idColumnPertinence); - return nameColumnPertinence; - } - =09 - ///<sumary>Funcion que retorna la clase a la cual se le hace pertinenc= e desde idColumn.</sumary> - ///<remarks>Funcion Obsoleta, pero se mantendra pues puede ser util</r= emarks> - private int getTablePertinence(int idColumn, int domainId) - { - int idTable=3D0; - int idTablePert=3D0; - DataSet ds1; - - crud.Domain =3D domainId; - - //Se obtiene la tabla que contiene el pertinence - idTable =3D complex.TableId(idColumn); - - ds1 =3D crud.ReadStructure(idTable); - //Falta la validacion de esto - idTablePert =3D Convert.ToInt32(ds1.Tables["pertinence"].Select("owne= r=3D"+idColumn)[0]["to"].ToString()); - =09 - return idTablePert; - } - =09 ///<sumary>Funcion que genera el sql final, con creacion de tabla temp= oral</sumary> ///<param name=3D"dt">DataTable con los datos para la consulta Final</= param> ///<param name=3D"columnId">Id de la columna que contiene la formula</= param> |
From: <sv...@de...> - 2005-06-24 22:35:08
|
Author: cristian Date: 2005-06-24 18:35:13 -0400 (Fri, 24 Jun 2005) New Revision: 1428 Modified: humano2/trunk/components/rules/Rules.cs humano2/trunk/web/builder/site/createInstanceRule.aspx.cs humano2/trunk/web/builder/site/xsl/createrule.xsl Log: * Modificacion para en la creacion de reglas, en la seccion de filtros y= valor, mostrar y aceptar atributos de clases relacionadas. Modified: humano2/trunk/components/rules/Rules.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/rules/Rules.cs 2005-06-24 21:49:08 UTC (rev = 1427) +++ humano2/trunk/components/rules/Rules.cs 2005-06-24 22:35:13 UTC (rev = 1428) @@ -236,6 +236,7 @@ string attributes,operators,elements; string[] arrAttributes,arrOperators,arrElements; int attrib; + string str_attrib=3D""; int operatorId; //,setToId,idRel; string elementRule,setTo; string valueRule=3D""; @@ -267,7 +268,8 @@ =20 while(i<arrAttributes.Length) { - attrib =3D Convert.ToInt32(arrAttributes[i]); + //attrib =3D Convert.ToInt32(arrAttributes[i]); + str_attrib =3D Convert.ToString(arrAttributes[i]); operatorId =3D Convert.ToInt32(arrOperators[i]); elementRule =3D Convert.ToString(arrElements[i]); =20 @@ -282,15 +284,17 @@ //setToId =3D theparams[0]; //idRel =3D theparams[1]; =20 - tableId =3D complex.TableId(attrib); + //tableId =3D complex.TableId(attrib); + tableId =3D complex.TableId(Convert.ToInt32(setTo)); + =09 =20 if(operatorId!=3D-1 && elementRule!=3D"" && id_entity=3D=3D0) { - filtro =3D filtro + attrib+"|"+operatorId+"|"+elementRule+finfiltro= ; + filtro =3D filtro + str_attrib +"|"+operatorId+"|"+elementRule+finf= iltro; } else if(operatorId!=3D-1 && elementRule!=3D"" && id_entity>0) { - filtro =3D filtro + attrib+"|"+operatorId+"|"+elementRule+"|1|0"; + filtro =3D filtro + str_attrib +"|"+operatorId+"|"+elementRule+"|1|= 0"; filtro =3D filtro+";0|4|'"+id_entity+"'"+finfiltro; } else if(id_entity>0) @@ -340,6 +344,7 @@ string attributes,operators,elements; string[] arrAttributes,arrOperators,arrElements; int attrib; + string str_attrib =3D ""; int operatorId; //,setToId,idRel; string elementRule,setTo; string valueRule=3D""; @@ -371,7 +376,8 @@ =20 while(i<arrAttributes.Length) { - attrib =3D Convert.ToInt32(arrAttributes[i]); + //attrib =3D Convert.ToInt32(arrAttributes[i]); + str_attrib =3D Convert.ToString(arrAttributes[i]); operatorId =3D Convert.ToInt32(arrOperators[i]); elementRule =3D Convert.ToString(arrElements[i]); =20 @@ -386,15 +392,16 @@ //setToId =3D theparams[0]; //idRel =3D theparams[1]; =20 - tableId =3D complex.TableId(attrib); + //tableId =3D complex.TableId(attrib); + tableId =3D complex.TableId(Convert.ToInt32(setTo)); =20 if(operatorId!=3D-1 && elementRule!=3D"" && id_entity=3D=3D0) { - filtro =3D filtro + attrib+"|"+operatorId+"|"+elementRule+finfiltro= ; + filtro =3D filtro + str_attrib +"|"+operatorId+"|"+elementRule+finf= iltro; } else if(operatorId!=3D-1 && elementRule!=3D"" && id_entity>0) { - filtro =3D filtro + attrib+"|"+operatorId+"|"+elementRule+"|1|0"; + filtro =3D filtro + str_attrib +"|"+operatorId+"|"+elementRule+"|1|= 0"; filtro =3D filtro+";0|4|'"+id_entity+"'"+finfiltro; } else if(id_entity>0) Modified: humano2/trunk/web/builder/site/createInstanceRule.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/createInstanceRule.aspx.cs 2005-06-24 = 21:49:08 UTC (rev 1427) +++ humano2/trunk/web/builder/site/createInstanceRule.aspx.cs 2005-06-24 = 22:35:13 UTC (rev 1428) @@ -130,9 +130,40 @@ strXml +=3D "<Att>"; strXml +=3D "<id>" + currAtt["id_entity"] + "</id>"; strXml +=3D "<name>" + currAtt["attName"] + "</name>"; + strXml +=3D "<classid>" + classId + "</classid>"; strXml +=3D "</Att>"; + } =20 + foreach(DataRow row in attributeTable.Select("attType=3D'pertinence'"= ))=20 + { + int idatt =3D Convert.ToInt32(row["id_entity"]); + string attNamePert =3D Convert.ToString(row["attName"]); + DataTable dtpert =3D userCred.CoreAdapter.GetClassesFromPertinence(i= datt); + foreach(DataRow dr in dtpert.Rows) + { + =20 + int idClassRel =3D Convert.ToInt32(dr["to"].ToString()); + DataTable dtrel =3D userCred.CoreAdapter.GetAttributesFromClass(idC= lassRel); + foreach(DataRow row2 in dtrel.Rows)=20 + { + string attName =3D Convert.ToString(row2["attName"]); + string className =3D Convert.ToString(dr["name"]); + strXml +=3D "<Att>"; + strXml +=3D "<id>" + idatt.ToString()+"^"+row2["id_entity"] + "</i= d>"; + strXml +=3D "<name>" + attNamePert+"."+attName + "</name>"; + strXml +=3D "<classid>" + idClassRel + "</classid>"; + strXml +=3D "</Att>"; + /* + attrIdList[Convert.ToString(idatt.ToString()+"^"+row2["id_entity"]= )] =3D Convert.ToString(attNamePert+"."+attName); + if(row2["isPrimary"].ToString()=3D=3D"1") + { + attrIdList[Convert.ToString(idatt.ToString()+"^"+row2["id_entity"= ])] =3D Convert.ToString(attNamePert); + } + */ + } + }=09 } + strXml +=3D "</Attributes>"; strXml +=3D "<operator>"; strXml +=3D "<option><id>0</id><text>Greater Equal Than</text></opt= ion>"; Modified: humano2/trunk/web/builder/site/xsl/createrule.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/createrule.xsl 2005-06-24 21:49:08= UTC (rev 1427) +++ humano2/trunk/web/builder/site/xsl/createrule.xsl 2005-06-24 22:35:13= UTC (rev 1428) @@ -8,7 +8,7 @@ <META http-equiv=3D"Content-Type" content=3D"text/html"/> <title>Nueva Regla</title> <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-= 8"/> - <link href=3D"styles/css/createinterface.css" rel=3D"stylesheet" type=3D= "text/css"/> + <link href=3D"css/createinterface.css" rel=3D"stylesheet" type=3D"text= /css"/> </head> =20 =20 @@ -264,13 +264,13 @@ <td class=3D"smallgraytextnolink" width=3D"200" valign=3D"center"> <table cellspacing=3D"0" cellpadding=3D"0" border=3D"0"> <tr> - <td class=3D"smallgraytextnolink"><span class=3D"ast= eriscorojo">*</span>??</td> + <td class=3D"smallgraytextnolink"><span class=3D"ast= eriscorojo">*</span></td> <td class=3D"smallgraytextnolink">Nombre</td> </tr> </table> </td> <td class=3D"smallgraytextnolink" valign=3D"center"> - <input type=3D"text" name=3D"nameRule" size=3D"30" maxl= ength=3D"100" value=3D"{/Page/rule/name}"/>?? + <input type=3D"text" name=3D"nameRule" size=3D"30" maxl= ength=3D"100" value=3D"{/Page/rule/name}"/> </td> </tr> =20 @@ -278,8 +278,8 @@ <td class=3D"smallgraytextnolink" width=3D"200" valign=3D"center"> <table cellspacing=3D"0" cellpadding=3D"0" border=3D"0"> <tr> - <td class=3D"smallgraytextnolink"><span class=3D"ast= eriscorojo">*</span>??</td> - <td class=3D"smallgraytextnolink">Descripci??n</td> + <td class=3D"smallgraytextnolink"><span class=3D"ast= eriscorojo">*</span></td> + <td class=3D"smallgraytextnolink">Descripcion</td> </tr> </table> </td> @@ -400,7 +400,7 @@ <td class=3D"s"> <select style=3D"width:220px" martest2=3D= "56296" name=3D"setTo" class=3D"drpdwn2"> <option value=3D"">--Nada--</option> - <xsl:for-each select=3D"/Page/Attributes/Att= "> + <xsl:for-each select=3D"/Page/Attributes/Att= [classid=3D/Page/rule/classId]"> <option value=3D"{id}"><xsl:value-of disable-output-escaping=3D"y= es" select=3D"normalize-space(name)"/></option> </xsl:for-each> </select> |
From: <sv...@de...> - 2005-06-24 21:49:01
|
Author: marcelo Date: 2005-06-24 17:49:08 -0400 (Fri, 24 Jun 2005) New Revision: 1427 Added: humano2/tags/5.0.beta7/ Log: Weekly release of 5.0.Beta Copied: humano2/tags/5.0.beta7 (from rev 1426, humano2/trunk) |
From: <sv...@de...> - 2005-06-24 21:48:13
|
Author: marcelo Date: 2005-06-24 17:48:19 -0400 (Fri, 24 Jun 2005) New Revision: 1426 Modified: humano2/trunk/changelog.txt Log: * Final update to changelog.txt before tagging release Modified: humano2/trunk/changelog.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/changelog.txt 2005-06-24 21:39:39 UTC (rev 1425) +++ humano2/trunk/changelog.txt 2005-06-24 21:48:19 UTC (rev 1426) @@ -1,6 +1,6 @@ $Id$ =20 -=3D=3D 5.0.beta7 - 2005-06-24 Revision: 1423 =3D=3D =20 +=3D=3D 5.0.beta7 - 2005-06-24 Revision: 1426 =3D=3D =20 =20 * Builder * Interface for creation of folders, views, reports, and forms are un= der xsl |
From: <sv...@de...> - 2005-06-24 21:39:37
|
Author: marcelo Date: 2005-06-24 17:39:39 -0400 (Fri, 24 Jun 2005) New Revision: 1425 Modified: humano2/trunk/components/webTools/Humano2.Components.WebTools.csproj Log: * Added strings.cs to the project Modified: humano2/trunk/components/webTools/Humano2.Components.WebTools.c= sproj =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/Humano2.Components.WebTools.csproj = 2005-06-24 21:23:07 UTC (rev 1424) +++ humano2/trunk/components/webTools/Humano2.Components.WebTools.csproj = 2005-06-24 21:39:39 UTC (rev 1425) @@ -154,6 +154,11 @@ BuildAction =3D "Compile" /> <File + RelPath =3D "string.cs" + SubType =3D "Code" + BuildAction =3D "Compile" + /> + <File RelPath =3D "webConst.cs" SubType =3D "Code" BuildAction =3D "Compile" |