|
From: <sv...@de...> - 2005-06-22 14:17:06
|
Author: pcamacho
Date: 2005-06-22 10:17:06 -0400 (Wed, 22 Jun 2005)
New Revision: 1385
Modified:
humano2/trunk/components/webTools/Adapter.cs
humano2/trunk/web/builder/site/domainedit.aspx.cs
Log:
FIX: bug #139.
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-06-21 22:57:33 UTC =
(rev 1384)
+++ humano2/trunk/components/webTools/Adapter.cs 2005-06-22 14:17:06 UTC =
(rev 1385)
@@ -519,6 +519,18 @@
return Convert.ToString(resp);
}
=20
+ ///<summary>Says if the name of a domain already exists</summary=
>
+ ///<param name=3D"name">The name of domain to check</summary>
+ ///<returns>True: the name of domain exists, else returns false<=
/returns>
+ public bool DomainNameExists(string name)
+ {
+ bool res =3D false;
+ string filter =3D "16|4|'"+ name +"'|0|0"; //Filter by the n=
ame to check
+ DataTable dt =3D GenerateViewTools(6,"0,16",filter,"","","",=
0); =20
+ res =3D dt.Rows.Count =3D=3D 1; //If there's a line, the dom=
ain name exists
+ return res;
+ }
+ =20
///<summary>Get the email of a user by it's id_entity</summary>
public string GetDomainNameById(int domainId) {
// Setting view tools to look at class 6 (domains)
Modified: humano2/trunk/web/builder/site/domainedit.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/domainedit.aspx.cs 2005-06-21 22:57:33=
UTC (rev 1384)
+++ humano2/trunk/web/builder/site/domainedit.aspx.cs 2005-06-22 14:17:06=
UTC (rev 1385)
@@ -94,7 +94,6 @@
userList.Items[t].Selected =3D true;
}
}
- =09
}=09
=09
#region Web Form Designer generated code
@@ -123,20 +122,29 @@
ArrayList userIds =3D new ArrayList();
=09
// Make a list of all the domains that are selected.=20
- foreach(ListItem li in userList.Items) {
- if(li.Selected) {
+ foreach(ListItem li in userList.Items)
+ {
+ if(li.Selected)=20
+ {
userIds.Add(li.Value);
}
}
=09
- if(userIds.Count =3D=3D 0) {
+ if(userIds.Count =3D=3D 0)=20
+ {
warnings.Text =3D "A domain has to be associated with at least one u=
ser.";
return;
}
=09
if(domainId =3D=3D 0)=20
{
- userCred.CoreAdapter.CreateDomain(name, userIds);
+ //Check if the domain name already exists, and raise a warning in th=
at case
+ if(userCred.CoreAdapter.DomainNameExists(name))
+ {
+ warnings.Text =3D "The domain name " + name + " alre=
ady exists. Please choose another one.";=20
+ return;
+ }
+ userCred.CoreAdapter.CreateDomain(name, userIds);
}=20
else=20
{
|