Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsStoreStoreThe category cannot be deleted once it is assigned child productsThe category cannot be deleted once it is assigned child products
Previous
 
Next
New Post
8/30/2007 9:46 AM
 

Hi to all,

after navigating to the WWStore admin module page and added some categories and products, i have noticed the following cases:

case 1: When a category has never been assigned child products, it can be deleted without problem.

case 2: When a category is assigned one or more child products, it cannot be deleted due to the Foreign Key constraint between tables Categories and Products and throws an exception. This makes complete sense, but the error message is really scary and in no case informative. The only way to figure out what happened is to debug the source code and search the database. Is there any way of providing a more descriptive error message?

case3: When deleting all the child products of a category, the category still cannot be deleted due to the same Foreign Key constraint and the same error message is displayed (case 2). When deleting a product, it is not physically deleted from the database, rather the column IsDeleted is set to true. This functionality is used, because the product could be inside an order, so the product information should exist, even if it is declared as deleted. But, why is the category not able to be deleted, since (in a logical level) it has no  products assigned.  I am not an SQL expert but, could a  possible solution be  for the Foreign key  constraint to be in use only when the products are active (not logically deleted)?

 
New Post
8/30/2007 10:18 AM
 

Hi Dimitris,

Case 1: It's normal.

Case 2: You'r right. In the future Store module (02.01.00), I have added a generic message insteed the current error message from the exception.

Case 3: This will be corrected in a future version (not the next).

Gilles


We (team members) are Humans offering their knowledge, their work and their spare time FOR FREE to benefit the community. It would be so particularly appreciated that your messages begin with "Hello" and end with "Thank you" or any other form of politeness. Ask yourself what your reaction would be, if you were approached by me (a total stranger) on the street to ask you something without saying "Hello" nor "Thank you"? After several years of services dedicated to the community, I begin to be tired to read requests without any form of politeness.
 
New Post
8/30/2007 10:51 AM
 

Hi Gilles,

don't know if i can wait for the next version, so, if i am not tiring you, i would like to continue with some more questions

Case2: Do you display your custom message by avoiding the ProcessModuleLoadException function, or by using it?

              I have used another overload of the same function on the catch block of the cmdDelete_Click event:

            Exceptions.ProcessModuleLoadException(ex.Source, this, ex, true);

            and now i get a more descriptive (but also more ugly error message).

Case 3: Could you give me some initial thoughts you may have, so i can implement this change?

regards,

Dimitris

 
New Post
8/30/2007 12:56 PM
 

Hi Dimitris,

You are welcome!

Here the modified code of the event handler inside CategoryEdit.ascx.cs :

 protected void cmdDelete_Click(object sender, EventArgs e)
{
try
{
if (!Null.IsNull(_categoryID))
{
CategoryController controller = new CategoryController();
controller.DeleteCategory(_categoryID);

_categoryID = Null.NullInteger;
}

invokeEditComplete();
}
catch(Exception ex)
{
if (ex.InnerException != null)
{
Exceptions.ProcessModuleLoadException(this, ex.InnerException);
}
else
{
string ErrorDelete = Localization.GetString("ErrorDelete", this.LocalResourceFile);
Exceptions.ProcessModuleLoadException(ErrorDelete, this, ex);
}
}
}

And the text of the ressource ErrorDelete.Text inside CategoryEdit.ascx.resx is : This category cannot be removed! Possible causes: one or more sub categories are dependent. One or more products are dependent.

Concerning the case 3, I do not have clear idea for now. Probably, using the same logic than products (add a field and mark as deleted).

Gilles


We (team members) are Humans offering their knowledge, their work and their spare time FOR FREE to benefit the community. It would be so particularly appreciated that your messages begin with "Hello" and end with "Thank you" or any other form of politeness. Ask yourself what your reaction would be, if you were approached by me (a total stranger) on the street to ask you something without saying "Hello" nor "Thank you"? After several years of services dedicated to the community, I begin to be tired to read requests without any form of politeness.
 
New Post
9/4/2007 2:37 AM
 

Hi Gilles,

I have implemented the case 3, using an IsDeleted filed for categories, as you suggested.

The changes contain a new SQL script file and some minor code changes. It is tested and working, so, if you want i can send it over.

regards,

Dimitris

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsStoreStoreThe category cannot be deleted once it is assigned child productsThe category cannot be deleted once it is assigned child products


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out