Wrox Programmer Forums
|
BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio
This is the forum to discuss the Wrox book ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solution by Vincent Varallo; ISBN: 9780470396865
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 2nd, 2009, 10:36 AM
Authorized User
 
Join Date: Mar 2009
Posts: 68
Thanks: 6
Thanked 0 Times in 0 Posts
Question In ENTRoleCapabilityEO.cs

In this class there is code that list like this

//Check if there were any validation errors
if (validationErrors.Count == 0)
{
if (ID <= 0)
{
//Add
ID = new ENTRoleCapabilityData().Insert(db, ENTRoleId, Capability.ID, Convert.ToByte(AccessFlag), userAccountId);
}
else
{
//Update
if (!new ENTRoleCapabilityData().Update(db, ID, ENTRoleId, Capability.ID, Convert.ToByte(AccessFlag), userAccountId, Version))
{
UpdateFailed(
ref validationErrors);
returnfalse;
}
}

Shouldn't this section


ID = new ENTRoleCapabilityData().Insert(db, ENTRoleId, Capability.ID, Convert.ToByte(AccessFlag), userAccountId);
}

be replaced with this


ID = new ENTRoleCapabilityData().Insert(db, ENTRoleId, ENTCapabilityId, Convert.ToByte(AccessFlag), userAccountId);
}

in both the insert and update parts

 
Old April 4th, 2009, 12:42 AM
Authorized User
 
Join Date: Apr 2009
Posts: 41
Thanks: 1
Thanked 2 Times in 2 Posts
Default

Short answer, no :)

ENTRoleCapabilityEO has a property (Capability) that is of type ENTCapabilityBO. There is no ENTCapabilityId property in ENTRoleCapabilityEO - instead, the class loads the associated capability object into Capability.

You could, I suppose, add an ENTCapabilityId property, but that would be redundant since you can get the value from Capability.ID (unless you removed the Capability property. But then you'd lose the convenience of having the related Capability object information readily available within ENTRoleCapability.)

Tim
 
Old April 4th, 2009, 11:30 AM
Authorized User
 
Join Date: Mar 2009
Posts: 68
Thanks: 6
Thanked 0 Times in 0 Posts
Question I'm confused

When I run this code the way it is, I only get one capabilityId, when ther counld be more than on for a EntRoleCapabilityEO.

So as the code is written I fail on insert, but the way wrote I get the capabilityId associated with a roleId, a roleId can have more than capabilityId.

So something I must be doing wrong. Because my Capability.ID is either 0 or stays the same as the first one selected.

So the second insert into the EntRoleCapabilityEO fails.





Similar Threads
Thread Thread Starter Forum Replies Last Post
missing the PhileIdentity.cs china911 BOOK: ASP.NET Website Programming Problem-Design-Solution 0 April 1st, 2008 09:36 PM
How to compile - First.cs gau404 BOOK: Professional C#, 2nd and 3rd Editions 1 November 14th, 2005 03:19 AM
Enums.cs allanhu BOOK: ASP.NET Website Programming Problem-Design-Solution 3 November 2nd, 2004 10:37 PM





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