Our currently logged in user info is inside the PBM project while our search class is inside web.
so we can not access utiltiy class from web
we will be need of to write loggedin user info in temporary storage of silverlight-
This comes into play when I want to display only those records that the user has entered.
Here in this code I can do that with a search as well:
// search by user logged in has to be done – userid 1 hard coded
pSearchQuery = pSearchQuery.Where(item => item.AddedBy == 1);
How do I go about setting up this storage area in Silverlight? Note security is not a major concern in this app.
Here is code how I display patients. the user can do a search by first or last name or gender. here I would add filter to ensure that user sees only his/her patients.
namespace PBM.Web.Classes
{
public class Search
{
public static IQueryable GetSearchQueryPatient(IQueryable pSearchQuery, Patient pPatient)
{
if (!string.IsNullOrEmpty(pPatient.FirstName))
{
pSearchQuery = pSearchQuery.Where(item => item.FirstName.Contains(pPatient.FirstName)) ;
}
if (!string.IsNullOrEmpty(pPatient.LastName))
{
pSearchQuery = pSearchQuery.Where(item => item.LastName.Contains(pPatient.LastName));
}
if (pPatient.Gender.HasValue && pPatient.Gender.Value > 0)
{
pSearchQuery = pSearchQuery.Where(item => item.Gender.Value == pPatient.Gender.Value);
}
// search by user logged in has to be done - need to write user loggedin to a silverlight storage area and compare here to Addedby which is what we call the user owner of the patient record. current set to 1.
pSearchQuery = pSearchQuery.Where(item => item.AddedBy == 1);
pSearchQuery = pSearchQuery.OrderBy(item => item.FirstName).ThenBy(item => item.LastName);
return pSearchQuery;
You could store your user id in the session… this should be accessable from booth worlds… or should take a look at the html bridge for silverlight.
http://www.silverlight.net/learn/overview/working-with-javascript/html-bridge-(silverlight-quickstart)
Or google for some Javascript/Silverlight Interop…
Don’t know if I understand you correct, if not please provide some additional information or add code example…