p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 (http://p2p.wrox.com/forumdisplay.php?f=264)
-   -   Additional page to my store (http://p2p.wrox.com/showthread.php?t=63309)

d-print October 29th, 2007 04:46 AM

Additional page to my store
 
Hi there,
Was just wondering if any of you could help me. I am trying to create an additional page in my store.

I am trying to add a 'storeCategories' section before i get to departments.

so the store goes: StCategories > Departments > Products
instead of Departments > Products

I have created an extra table called StCategories and i have also create the stored procedures.

how hard is this to do and has anyone actually completed it in their Project?

Regards
John

retroviz October 29th, 2007 06:38 PM

Hi John,
I havent needed to implement the store but I expect this could be accomplished in the same way most category based databased applications are. One method (as you have already done) is to create an additional table and create a relationship between this an the existing Departments table. If you have already created the Stored Procedures you must already know the data you need from this table so creating the new classes should not be that difficult (you will fine that you could probably copy the existing Departments classes). Another method is to have just one categories table that has an additional field (parentCategory). The advantage of this method is that you can have unlimited levels of categories, and this in my experience normally ends up being the requirement of most e-tailers.

Essentially all you are changing is the way in which you filter the current departments so you should not have to make any changes to the existing products table or classes.

I would suggest checking out the "Customer Support Site" example in Wrox's ASP.net 2.0 Instant Results as this uses the latter method of categorizing db records. You could probably download the app from here if you don't have the book.


d-print October 30th, 2007 05:26 AM

Thank you very much for you reply.
It is good to know that you are thinking along the same lines as me with this one.
I like the parent category idea as well so i might try it both ways.
I have been struggling trying to re-create the Departments CS to my new Category functions but i should over come this.

once again thanks for your reply, would it be possible to call on you again if i struggle?

Regards
John



d-print October 30th, 2007 06:47 AM

Just a quick one.
So i am right in thinking that the items i need to edit are the following:-

'SqlStore Provider' (copy all Department info to my Category info)
'Department' (copy this file and amend to categories)
'StoreProvider' (copy all Department info to my Category info)

would you be able to have a look at the resulting files when i have completed them for me :)

regards
John


d-print October 30th, 2007 09:01 AM

retroviz,

i have implemented all the extra additions that i need to do this but i cannot get my ShowStCategories page to load with out a exception error.

Would it be possible for me to email you my project for you to have a look at the coding to see if you can spot my error?

The database is already online and all stored procedures are in place as well as the table.

I have decided to create the extra table and just have a relationship with my departments table.

can you please please help?

Kind Regards
John Whiting


retroviz October 31st, 2007 04:06 AM

John,

May be worth checking your stored procedures for errors first. Can you post the details of the error you are getting?


d-print October 31st, 2007 04:16 AM

the error i am receiving is below.

Server Error in '/KM_Web' Application.
The method or operation is not implemented.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: The method or operation is not implemented.

Source Error:

Line 105: private static List<StCategories> GetStCategoriesListFromStCategoriesDetailsList(Lis t<StCategoryDetails> recordset)
Line 106: {
Line 107: throw new Exception("The method or operation is not implemented.");
Line 108: }
Line 109:


Source File: c:\Documents and Settings\J Whiting\My Documents\Visual Studio 2005\WebSites\KM Alarms Limited\KM_Web\App_Code\BLL\Store\StCategories.cs Line: 107

Stack Trace:

[Exception: The method or operation is not implemented.]
   MB.TheBeerHouse.BLL.Store.StCategories.GetStCatego riesListFromStCategoriesDetailsList(List`1 recordset) in c:\Documents and Settings\J Whiting\My Documents\Visual Studio 2005\WebSites\KM Alarms Limited\KM_Web\App_Code\BLL\Store\StCategories.cs: 107
   MB.TheBeerHouse.BLL.Store.StCategories.GetStCatego ries() in c:\Documents and Settings\J Whiting\My Documents\Visual Studio 2005\WebSites\KM Alarms Limited\KM_Web\App_Code\BLL\Store\StCategories.cs: 99

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle._InvokeMethodFast(Objec t target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
   System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +72
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +296
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
   System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +17
   System.Web.UI.WebControls.ObjectDataSourceView.Inv okeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +676
   System.Web.UI.WebControls.ObjectDataSourceView.Exe cuteSelect(DataSourceSelectArguments arguments) +2655
   System.Web.UI.WebControls.BaseDataList.GetData() +55
   System.Web.UI.WebControls.DataList.CreateControlHi erarchy(Boolean useDataSource) +381
   System.Web.UI.WebControls.BaseDataList.OnDataBindi ng(EventArgs e) +75
   System.Web.UI.WebControls.BaseDataList.DataBind() +86
   System.Web.UI.WebControls.BaseDataList.EnsureDataB ound() +82
   System.Web.UI.WebControls.BaseDataList.CreateChild Controls() +91
   System.Web.UI.Control.EnsureChildControls() +134
   System.Web.UI.WebControls.BaseDataList.get_Control s() +27
   MB.TheBeerHouse.Helpers.SetInputControlsHighlight( Control container, String className, Boolean onlyTextBoxes) in c:\Documents and Settings\J Whiting\My Documents\Visual Studio 2005\WebSites\KM Alarms Limited\KM_Web\App_Code\Helpers.cs:130
   MB.TheBeerHouse.Helpers.SetInputControlsHighlight( Control container, String className, Boolean onlyTextBoxes) in c:\Documents and Settings\J Whiting\My Documents\Visual Studio 2005\WebSites\KM Alarms Limited\KM_Web\App_Code\Helpers.cs:131
   MB.TheBeerHouse.Helpers.SetInputControlsHighlight( Control container, String className, Boolean onlyTextBoxes) in c:\Documents and Settings\J Whiting\My Documents\Visual Studio 2005\WebSites\KM Alarms Limited\KM_Web\App_Code\Helpers.cs:131
   MB.TheBeerHouse.Helpers.SetInputControlsHighlight( Control container, String className, Boolean onlyTextBoxes) in c:\Documents and Settings\J Whiting\My Documents\Visual Studio 2005\WebSites\KM Alarms Limited\KM_Web\App_Code\Helpers.cs:131
   MB.TheBeerHouse.UI.BasePage.OnLoad(EventArgs e) in c:\Documents and Settings\J Whiting\My Documents\Visual Studio 2005\WebSites\KM Alarms Limited\KM_Web\App_Code\BasePage.cs:55
   System.Web.UI.Control.LoadRecursive() +74
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3034

P.S Thanks for the book advice, i bought it yesterday and it arrived today.

regards
John


d-print October 31st, 2007 09:25 AM

retroviz,

please ignore the error as i have now managed to apply the additional page - i now just need to tie it all in with my admin section etc.

The only problem i have got now is that i can go from my categories page to my department page and then onto products, however the list of departments from the category page is not listing the relevant departments under that catID - it is only returning the department with an ID of 1.....

can you help?

Regards
John


retroviz October 31st, 2007 02:10 PM

John,

I imagine your departments were already created prior to adding the categories table. I would check that each of the department records in your departments table have an associated CategoryID value (or whatever the PK of your category table is).

If all of your departments DO have an associated CategoryID try manually passing the Category ID in your querystring rather than clicking on a hyperlink from your categories page i.e. "ShowDepartments.aspx?CategoryID=2" (or whatever your page is called).

This will then determine whether it is your departments classes/methods failing to retrieve the correct data or just your categories page failing to pass the correct querystring.

Hope that helps

d-print October 31st, 2007 06:39 PM

retroviz,

thanks for yet another reply/answer.
I did mange to do this earlier.

I have set up a test cat & a test cat 2 which 'should' be linked to dept 1 & dept 2. when i click on cat 1 and ID of 1 is passed and when i click on cat 2 an ID of 2 is passed so that is fine.

the departments page just appears to be showing a list of everything in the dapartments table and not by the specific CatID i am passing.

you mentiontioned in your last post that i should look at the Class/method for the departments, where/what in particulr do you think i should have changed with these pages as it appears to me that i obviously havent......:(

regards
John



All times are GMT -4. The time now is 10:43 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.