Hi
Ok this is the script code ...
Ok this is the script code ...
using (var engine = new JScriptEngine())
{
engine.AddHostObject("host", new RFManagerService());
StringBuilder script = new StringBuilder();
script.Append("function DoWork() {return host.GetCustomerInternal('ContractNo', '15405844');}");
engine.Execute(script.ToString());
result = engine.Script.DoWork();
}
now this script is called in a function in a class that also contains the following method ... this method works from other C# code in the same class, but not from script? public Customer GetCustomerInternal(string searchBy, string searchVal)
{
string validationMsg = string.Empty;
//return null;
return GetCustomer(searchBy, searchVal, out validationMsg);
}
public Customer GetCustomer(string searchBy, string searchValue, out string validationMsg)
{
RFWellnessEngineProxy wellnessEngineProxy = null;
Customer customer = null;
validationMsg = string.Empty;
try
{
wellnessEngineProxy = new RFWellnessEngineProxy();
if (searchBy.Equals("ContractNo") || searchBy.Equals("Contract_No"))
{
customer = wellnessEngineProxy.GetCustomerByContractNo(int.Parse(searchValue), out validationMsg);
}
return customer;
}
catch (Exception ex)
{
HandleException(ex);
}
finally
{
//Close proxy(ies)
CloseProxy(wellnessEngineProxy);
}
return customer;
}