public static void LoadProducts(string txt)
{
try
{
DataServiceQuery<Product> query = (DataServiceQuery<Product>)context.ProductSet.Where<Product>(a => a.ProductNumber.StartsWith(txt) );
query.BeginExecute(OnReapirGunModelComplete1, query);
}
catch (Exception ex)
{
_syncContext.Send(new SendOrPostCallback(showErrorDetails), ex);
}
}
private static void OnReapirGunModelComplete1(IAsyncResult result)
{
try
{
DataServiceQuery<Product> results = result.AsyncState as DataServiceQuery<Product>;
List<Product> tmp = new DataServiceCollection<Product>(results.EndExecute(result)).ToList<Product>();
if (tmp.Count > 0)
{
//your code
}
}
catch (Exception ex)
{
_syncContext.Send(new SendOrPostCallback(showErrorDetails), ex);
}
}
{
try
{
DataServiceQuery<Product> query = (DataServiceQuery<Product>)context.ProductSet.Where<Product>(a => a.ProductNumber.StartsWith(txt) );
query.BeginExecute(OnReapirGunModelComplete1, query);
}
catch (Exception ex)
{
_syncContext.Send(new SendOrPostCallback(showErrorDetails), ex);
}
}
private static void OnReapirGunModelComplete1(IAsyncResult result)
{
try
{
DataServiceQuery<Product> results = result.AsyncState as DataServiceQuery<Product>;
List<Product> tmp = new DataServiceCollection<Product>(results.EndExecute(result)).ToList<Product>();
if (tmp.Count > 0)
{
//your code
}
}
catch (Exception ex)
{
_syncContext.Send(new SendOrPostCallback(showErrorDetails), ex);
}
}
No comments:
Post a Comment