using System;
using System.Web.Services;
public struct SecurityInfo
{
public string Code;
public string CompanyName;
public double Price;
}
public class SecurityWebService : WebService
{
private SecurityInfo Security;
public SecurityWebService()
{
Security.Code = "";
Security.CompanyName = "";
Security.Price = 0;
}
private void AssignValues(string Code)
{
Security.Code = Code;
Security.CompanyName = Code + " Pty Ltd";
Random RandomNumber = new System.Random();
Security.Price = double.Parse(new System.Random(RandomNumber.Next(1,
10)).NextDouble().ToString("##.##"));
}
[WebMethod(Description = "This method call will get the company name and
the price for a given security code.", EnableSession = false)]
public SecurityInfo GetSecurityInfo(string Code)
{
AssignValues(Code);
SecurityInfo SecurityDetails = new SecurityInfo();
SecurityDetails.Code = Security.Code;
SecurityDetails.CompanyName = Security.CompanyName;
SecurityDetails.Price = Security.Price;
return SecurityDetails;
}
}