Question about submitting data to a child of a collection

Question about submitting data to a child of a collection

Old forum URL: forums.lhotka.net/forums/t/2680.aspx


CSLABound posted on Thursday, April 12, 2007

I think this may be a really junior question, but I'm just starting c# and CSLA... if I have a windows form that has a binding to a Business List base that shows a listing of users, on the same form I'm allowing people to edit those users.  I want to directly pass the Id from the Current User into the save so that the User Id shows up in the database, but I can't figure out how to submit that value to the child of the user collection.  Sorry if this sounds confusing.  Currently everything else saves fine on the form.

JoeFallon1 replied on Thursday, April 12, 2007

You can always get the current user like this:

Protected Friend Overridable Sub Update(ByVal tr As IDbTransaction)
  Dim user As MyCustomPrincipal
  user =
DirectCast(Thread.CurrentPrincipal, MyCustomPrincipal)

  Dim userID As String = user.UserID

etc.

 

Joe

CSLABound replied on Thursday, April 12, 2007

Thanks.  Would I put that method in th child that I'm updating?

Also, How would I do that in c#

Thanks again

Brian

CSLABound replied on Thursday, April 12, 2007

Nevermind.... got it... thanks a ton!!!!

ajj3085 replied on Thursday, April 12, 2007

IN your DP_I or DP_U,

MyPrincipal prin;

int userId;

prin = (MyPrincial)ApplicationContext.User;

userid = prin.Identity.UserId; // Assuming you have a userID on your Identity object

HTH

Andy

 

Copyright (c) Marimer LLC