O
Ori
Hi,
I'm a beginner with web services and I need some help.
I build my web-service and I was able to deploy it and succeed to use
it by other application.
Now I was tiring to add a new function which returns an instance of a
class which I have in the web service project (which holds some
properties of a user in my system).
As I see, I'm able to execute the function, but I'm not able to access
the properties which I exposed in the class.
What should I do in order to be able to access to those properties?
Should I need to inherit from a specific class? mark the properties
with a special attributes?
I would like to say that this class isn't supposed to function as a
web service but only a "data carrier".
Here is my class:
public class PermissionInfo
{
protected long _userId;
protected string _logonName;
protected string _firstName;
protected string _lastName;
protected string _domainName;
protected int _domainId;
protected Permissions _permissionLevel;
protected string _moduleName;
protected int _moduleId;
public PermissionInfo()
{
//
// TODO: Add constructor logic here
//
}
public bool LoadPermission(string logonName,int moduleId)
{
// Set up parameters
SqlParameter [] arParms = new SqlParameter[2];
///Add the parameters to the array
arParms[0] = new SqlParameter("@LogonName",logonName);
arParms[1] = new SqlParameter("@ModuleId",moduleId);
DataTable dt = SqlHelper.ExecuteDataset(Global.GetConnectionString(),
CommandType.StoredProcedure,
"UC_GetUser_Module_Authorization_Info",
arParms).Tables[0];
_moduleId = moduleId;
_logonName = logonName;
if(dt.Rows.Count>0)
{
_userId = Convert.ToInt64(dt.Rows[0]["UserId"]);
_firstName= dt.Rows[0]["FirstName"].ToString();
_lastName = dt.Rows[0]["LastName"].ToString();
_domainName = dt.Rows[0]["DomainName"].ToString();
_moduleName = dt.Rows[0]["ModuleName"].ToString();
_permissionLevel = (Permissions)dt.Rows[0]["PermissionId"];
return true;
}
return false;
}
public Permissions PermissionLevel
{
get{return _permissionLevel;}
}
public string DomainName
{
get{return _domainName;}
}
public string FirstName
{
get{return _firstName;}
}
public string LastName
{
get{return _lastName;}
}
public string ModuleName
{
get{return _moduleName;}
}
Thanks,
Ori.
I'm a beginner with web services and I need some help.
I build my web-service and I was able to deploy it and succeed to use
it by other application.
Now I was tiring to add a new function which returns an instance of a
class which I have in the web service project (which holds some
properties of a user in my system).
As I see, I'm able to execute the function, but I'm not able to access
the properties which I exposed in the class.
What should I do in order to be able to access to those properties?
Should I need to inherit from a specific class? mark the properties
with a special attributes?
I would like to say that this class isn't supposed to function as a
web service but only a "data carrier".
Here is my class:
public class PermissionInfo
{
protected long _userId;
protected string _logonName;
protected string _firstName;
protected string _lastName;
protected string _domainName;
protected int _domainId;
protected Permissions _permissionLevel;
protected string _moduleName;
protected int _moduleId;
public PermissionInfo()
{
//
// TODO: Add constructor logic here
//
}
public bool LoadPermission(string logonName,int moduleId)
{
// Set up parameters
SqlParameter [] arParms = new SqlParameter[2];
///Add the parameters to the array
arParms[0] = new SqlParameter("@LogonName",logonName);
arParms[1] = new SqlParameter("@ModuleId",moduleId);
DataTable dt = SqlHelper.ExecuteDataset(Global.GetConnectionString(),
CommandType.StoredProcedure,
"UC_GetUser_Module_Authorization_Info",
arParms).Tables[0];
_moduleId = moduleId;
_logonName = logonName;
if(dt.Rows.Count>0)
{
_userId = Convert.ToInt64(dt.Rows[0]["UserId"]);
_firstName= dt.Rows[0]["FirstName"].ToString();
_lastName = dt.Rows[0]["LastName"].ToString();
_domainName = dt.Rows[0]["DomainName"].ToString();
_moduleName = dt.Rows[0]["ModuleName"].ToString();
_permissionLevel = (Permissions)dt.Rows[0]["PermissionId"];
return true;
}
return false;
}
public Permissions PermissionLevel
{
get{return _permissionLevel;}
}
public string DomainName
{
get{return _domainName;}
}
public string FirstName
{
get{return _firstName;}
}
public string LastName
{
get{return _lastName;}
}
public string ModuleName
{
get{return _moduleName;}
}
Thanks,
Ori.