Mar 26, 2012, 4:59 AM
The controller code calls a WCF service and returns a StoreResult. The code is as follows:
public StoreResult GetOrganisations()
{
StoreResult response = new StoreResult();
string filter = HttpContext.Request["query"];
int totalCount = 0;
PartyManagerServiceClient pmService = new PartyManagerServiceClient();
List<OrganisationVO> organisations = (List<OrganisationVO>)MemoryCache.Default["OrganisationVOs"];
List<Organisation> orgs = new List<Organisation>();
if (organisations == null)
{
organisations = new List<OrganisationVO>();
orgs = pmService.GetOrganisationsByName("", 0, 4000, ref totalCount);
foreach (Organisation org in orgs)
{
OrganisationVO orgVO = new OrganisationVO();
orgVO = Mapper.ToViewObject(org);
organisations.Add(orgVO);
}
MemoryCache.Default.AddOrGetExisting("OrganisationVOs", organisations, DateTime.Now.AddMinutes(10));
}
List<OrganisationVO> data = new List<OrganisationVO>();
data = organisations.ToList();
if (!string.IsNullOrEmpty(filter) && filter != "*")
{
data.RemoveAll(filterOrg => !filterOrg.DisplayName.ToLower().StartsWith(filter.ToLower()));
}
response.Data = data;
response.Total = data.Count;
return response;
}
OrganisationVO:public class OrganisationVO
{
public int PartyID { get; set; }
public string OrganisationCode { get; set; }
public List<string> OrganisationNames { get; set; }
public string DisplayName { get; set; }
public bool IsCustomer { get; set; }
public bool IsSupplier { get; set; }
public OrganisationVO()
{
OrganisationNames = new List<string>();
}
}
public class OrganisationVOCollection : List<OrganisationVO>
{}
The other stuff is defined in the contracts/proxies from the WCF service. As I said this stuff works perfectly with the previous beta build - it's just the update I did this morning that seems to have broken it...