Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 24th, 2009, 05:05 PM
Authorized User
 
Join Date: Mar 2009
Posts: 79
Thanks: 4
Thanked 4 Times in 4 Posts
Default WorkFlow on cgv

Trying to implement WF into one of my pages. However it seems I can go to every page of the application except the page that contains the cgv. Everything is modeled fairly close. I made a few modifications to some classes, but this is the first time I am trying to implement WF.

When I try to go to the page with the cgv I get.

Code:
Sequence contains no elements 

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.InvalidOperationException: Sequence contains no elements

Source Error: 

Line 27:                 if (eNTWFState != null)Line 28:                 {Line 29:                     return eNTWFState.Single();Line 30:                 }Line 31:                 else
Code:
privatevoid BindGridView(string sortExpression, SortDirection sortDirection)
{
//Create an instance of the list object
Type objectType = Type.GetType(ListClassName);
object listObject = Activator.CreateInstance(objectType);
//Call the method to load the object
//objectType.InvokeMember(LoadMethodName, BindingFlags.InvokeMethod, null, listObject, new object[] { });
objectType.InvokeMember(LoadMethodName, BindingFlags.InvokeMethod, null, listObject, _methodParameters.ToArray());
//Call the SortByPropertyName method. This is in the ENTBaseBOList class. The object must inherit
//from this class.
base.DataSource = objectType.InvokeMember("SortByPropertyName", BindingFlags.InvokeMethod, null, listObject, newobject[] { sortExpression, sortDirection == SortDirection.Ascending });
base.DataBind();
//Save the sortExpression and sortDirection to the view state.
SortExpressionLast = sortExpression;
SortDirectionLast = sortDirection;
objectType = null;
listObject = null;
}
I thnk it has something to do with the listobject in the bold line above. Any ideas are appreciated. Im going to go back to the EO for this object and compare.
  #2 (permalink)  
Old October 15th, 2009, 10:04 AM
Authorized User
 
Join Date: Mar 2008
Location: New York, NY, USA.
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
Send a message via Yahoo to kalel_4444
Default Same Problem.. !!

Hello ZeroFactorial,

Were you able to figure this problem out..?!?!?! I'm having the same problem and I've been pulling my hair out trying to figure this out for the past 3 days..

I initially had the ENTWFState Select(int id) returned a bit differently:
Code:
return db.ENTWFStateSelectById(id).SingleOrDefault();
While I didn't get the exception you posted, my problem was that the CustomGrid(cgv) in PTORequests.aspx ("View My Requests") populated,
but when adding a second request, the Status and Current Owner for the second request in the grid was empty.

I ended up matching the above SelectById with the one from the sample code and I now have the same exception that you are getting.

Code:
ISingleResult<ENTWFState> eNTWFState = db.ENTWFStateSelectById(id);

if (eNTWFState != null)
{
   return eNTWFState.Single();
}
else
{
   return null;
}
I haven't figured it out but I've concluded so far that it occurs when there is more then one request in the Grid.
Because if there is one request, you can move it through the workflow. But as soon as there are 2 or more requests that need to be populated in the grid. The exception is thrown.

I noticed that you had a more recent post about Reporting so hopefully you were able to find the problem and save me on this...

Thank you,
Ronnie
  #3 (permalink)  
Old October 15th, 2009, 11:41 AM
Authorized User
 
Join Date: Mar 2009
Posts: 79
Thanks: 4
Thanked 4 Times in 4 Posts
Default

kalel_4444,

Unfortunately I still havent been able to figure this one out. I would have hoped Vince would pass through and offer some input, but seems he has become real scarce.

Anyway I went about it a different way, to get around it. I completely left the WF portion out and created my own WF soft of by, creating a ddl on the form with 3 different states.

From there depending on the state selected, I created a stored procedure to populate the cgv. If the right state is selected, upon save, an email is generated. This is the only thing I could come with to incorporate some form of WF. The problem is that since I cant get the WF to work from the book, it also prevents you from utilizing the Email Notification feature also since it is tied to the WF.

Best of luck guy and if you need help on anything feel free to contact me.

-Z-
  #4 (permalink)  
Old October 15th, 2009, 09:10 PM
Authorized User
 
Join Date: Mar 2008
Location: New York, NY, USA.
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
Send a message via Yahoo to kalel_4444
Default

Z,

Appreciate the feedback.
I picked up this book especially to add the Role Security and the Workflow to my app. Though not necessarily to be used for requesting time off.

I'm going to sit on this a bit longer and try and figure out the problem. I originally thought the problem was the way I added it to my namespace schema. But, since it happened to you also, something else is the problem.
I'm thinking of creating a new project and build the workflow again using the sample code schema and see what happens.

If I find a solution, I'll let you know.

Thanks again,
Ronnie
  #5 (permalink)  
Old October 20th, 2009, 04:21 AM
Authorized User
 
Join Date: Mar 2008
Location: New York, NY, USA.
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
Send a message via Yahoo to kalel_4444
Default

Hello Z,

Ok, I successfully got the workflow to work in my application.

As much as I'd like to say I found the problem, I can't. But I have pinpointed the problem to the database and sproc implementation. I don't know if you created the tables and procedures manually or not... I'm thinking not.. because I initially did and after using the sample sql code it worked. Here's what I did to arrive at this conclusion:

- Over the weekend I added the sample PaidTimeOff DAL & BLL into my app and used it with my UI.. IT WORKED..!! So the CustomGridView is NOT the problem.

- I modified my BLL to use the PaidTimeOff DAL and IT WORKED..!! So the BLL is not the problem.

- I modified the PaidTimeOff BLL to use my DAL and IT FLOPPED..!! So, I pinpointed it to somewhere in my DAL.
With that, I matched my DAL exactly to the one in PaidTimeOff, except for the .dbml file, that is impossible. It still didn't work.

- FINALLY, I took the sql files in the Chapter 7 folder (tables & sprocs) and patiently converted the naming structure to match my database schema and ran it into my database.
  • I then moved everything to a new dbml file with the ORM (the exact same way as I did in the past.. dragging to the sprocs to either the method pane or onto the table entity). I'm sure it's already a given that not all select sprocs are to be dropped onto the table and should be in the method pane.
  • With my initial UI, BLL, and DAL .cs files (so only the dbml is new). The workflow worked just fine. I thoroughly tested the workflow, moving multiple requests back and forth between users and it worked as it should...
So all I can say is that somewhere in the table/sproc implementation there must be a constraint, relationship, default value, or something that I missed causing the problem.

While this is not the answer, it was the solution (at least for me). If this is important to implement and you don't want to use the provided sample schema. Then I suggest working the sql files over and giving it a try.

If you find the problem, or if anyone else (Vince) knows about this, I'd still would like to know what is the fix.

Good luck,
Ronnie

Last edited by kalel_4444; October 20th, 2009 at 04:23 AM.
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Workflow Question realkewl BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 2 May 15th, 2009 09:24 AM
How can I use workflow with website? Jihad Windows Workflow 0 March 13th, 2008 04:47 PM
How to do workflow in Eclipse alokgupta14 Java Basics 0 December 14th, 2006 02:16 AM
Workflow Engine yanis97 J2EE 1 February 27th, 2006 09:49 AM
Workflow bmains ASP.NET 1.x and 2.0 Application Design 2 May 15th, 2004 10:14 PM



All times are GMT -4. The time now is 04:19 PM.


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