I am using lightswitch and i was able to set a default value for a field using the Created() method. Now I can explicitly set this value. My query has a parameter that filters it. I want to set my default value of the field to which ever dynamic value is going to be supplied. how do i do that? Below is what i have..
partial void Payperiod_Created()
{
this.EstateID = 5;
}
Edited
I created a method method in public partial class sspDataService
.. the data serivce class that is going to return the value that i want. My intention here was to create a global variable.
public string estateName()
{
string esName = "";
string uName = this.Application.User.Identity.Name;
try
{
var qryUser =
this.aspnet_Users.Where(a => (a.UserName == uName)).SingleOrDefault();
esName = qryUser.PayGroup;
}
catch (Exception e)
{
Debug.WriteLine(e.InnerException.ToString());
}
return esName;
}
However i cannot access this method inside my Payperiod_Created()
method. Hope this helps.