|
From: <sv...@de...> - 2005-06-22 19:08:20
|
Author: pcamacho
Date: 2005-06-22 15:08:19 -0400 (Wed, 22 Jun 2005)
New Revision: 1389
Modified:
humano2/trunk/web/builder/site/dataattributedelete.aspx.cs
Log:
FIX: bug #164. For now only it is impossible to delete a primary attribut=
e. Then would be better to check that a=20
class always have a primary attribute.
Modified: humano2/trunk/web/builder/site/dataattributedelete.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/dataattributedelete.aspx.cs 2005-06-22=
17:53:44 UTC (rev 1388)
+++ humano2/trunk/web/builder/site/dataattributedelete.aspx.cs 2005-06-22=
19:08:19 UTC (rev 1389)
@@ -23,12 +23,12 @@
using System.Text;
=20
using Humano2.Core;
+using Humano2.Core.Db;
using Humano2.Components.WebTools;
=20
namespace Builder.site
{
/// <summary>
- /// Summary description for dataclasscreate.
/// </summary>
public class dataAttributeDelete : Humano2.Components.WebTools.basePage=
=20
{
@@ -46,14 +46,23 @@
private void Page_Load(object sender, System.EventArgs e)
{
adapter dbAdapter =3D new adapter();
- int classId =3D Convert.ToInt32(Request.QueryString["classId"]);
+ absCrud crud =3D Factory.Crud();
+ absComplex complex =3D crud.GetCore().Complex;
+ int classId =3D Convert.ToInt32(Request.QueryString["classId=
"]);
=09
int attrId =3D Convert.ToInt32(Request.QueryString["attrId"]);=09
Logger.Log("Deleting Attribute attributeID: " + attrId, LogLevel.Trac=
e);
- dbAdapter.DeleteInstance(attrId, userCred);
- Logger.Log("Deleting Attribute Done", LogLevel.Trace);
-
- Response.Redirect(Html.genAbsoluteUrl("/builder/site/datamain.aspx?op=
=3D"+classId));=09
+ if(!complex.IsPrimary(attrId))
+ {
+ dbAdapter.DeleteInstance(attrId, userCred);
+ Logger.Log("Deleting Attribute Done", LogLevel.Trace);
+ Response.Redirect(Html.genAbsoluteUrl("/builder/site/dat=
amain.aspx?op=3D"+classId));=09
+ }
+ else
+ {
+ Response.Write("<center>Attribute " + attrId + " can not=
be deleted as it is primary.</center>"); =20
+ }
+ =09
} =09
}
}
|