bug 2935 : This proved to be a more complicated problem than it might have. Exceptions thrown during deletion were not caught by the user interface, so the user got a fairly ugly error message. Fixed.

status 2935 : resolved FIXED
This commit is contained in:
sb 2009-05-12 15:43:18 +00:00
parent 9fac74f803
commit b87e01bd64
2 changed files with 57 additions and 21 deletions

View file

@ -9,8 +9,8 @@
Transform ADL into (partial) controller classes
$Author: sb $
$Revision: 1.42 $
$Date: 2009-05-12 14:29:12 $
$Revision: 1.43 $
$Date: 2009-05-12 15:43:18 $
-->
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
@ -72,7 +72,7 @@
//
// Automatically generated abstract super class for controllers for the
// <xsl:value-of select="/adl:application/@name"/> application; generated using
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.42 $', 10)"/>
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.43 $', 10)"/>
//
// <xsl:value-of select="/adl:application/@revision"/>
//
@ -182,7 +182,7 @@
//
// Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s
// Automatically generated from application description using
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.42 $', 10)"/>
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.43 $', 10)"/>
//
// This file is automatically generated; DO NOT EDIT IT.
//
@ -684,27 +684,33 @@
/// &lt;summary&gt;
/// Actually delete the selected record
/// &lt;/summary&gt;
[AccessibleThrough(Verb.Post)]
public void Delete()
{
AssertUserCanDelete();
ISession hibernator = GetDBSession();
[AccessibleThrough(Verb.Post)]
public void Delete()
{
AssertUserCanDelete();
ISession hibernator = GetDBSession();
<xsl:value-of select="concat($entityns, '.', @name)"/> record = null;
if ( "true".Equals( Params["reallydelete"]))
{
<xsl:value-of select="concat($entityns, '.', @name)"/> record = FetchRecord( hibernator);
if ( "true".Equals( Params["reallydelete"]))
{
record = FetchRecord( hibernator);
if ( record != null)
{
try {
record.BeforeDeleteHook( hibernator);
hibernator.Delete( record);
hibernator.Flush();
} catch ( DomainKnowledgeViolationException dkve) {
AddError( dkve);
}
}
else
{
throw new ApplicationException( "No such record?");
}
}
if ( HasNoErrors()) {
<xsl:choose>
<xsl:when test="adl:list">
Redirect( "<xsl:value-of select="concat(adl:list[position()=1]/@name, '.rails')"/>");
@ -713,8 +719,12 @@
Redirect( FormsAuthentication.DefaultUrl);
</xsl:otherwise>
</xsl:choose>
}
</xsl:if>
} else {
PropertyBag[ "instance"] = record;
RenderViewWithFailover( "maybedelete.vm", "maybedelete.auto.vm");
}
}
</xsl:if>
<xsl:apply-templates select="adl:form"/>
<xsl:if test="adl:list">