public ChangelogIdentificationType OrderChangelog(ChangelogOrderType order) { try { return(OrderChangelogAsyncCaller(order)); } catch (Exception ex) { throw new FaultException(ex.Message); } }
private ChangelogIdentificationType OrderChangelogAsyncCaller(ChangelogOrderType order) { int id = -1; int.TryParse(order.datasetId, out id); IChangelogProvider changelogprovider; OrderChangelog resp; int startindex = -1; int count = -1; string initType; var datasets = from d in db.Datasets where d.DatasetId == id select d; initType = datasets.First().DatasetProvider; //Initiate provider from config/dataset Type providerType = Assembly.GetExecutingAssembly().GetType(initType); changelogprovider = Activator.CreateInstance(providerType) as IChangelogProvider; changelogprovider.Intitalize(id); int.TryParse(order.startIndex, out startindex); int.TryParse(order.count, out count); if (startindex == -1) { throw new Exception("MissingParameterValue : startindex"); } if (count == -1) { throw new Exception("MissingParameterValue : count"); } if (datasets.First().ServerMaxCount.HasValue&& (datasets.First().ServerMaxCount < count || count == 0)) { count = (int)datasets.First().ServerMaxCount; } resp = changelogprovider.CreateChangelog(startindex, count, "", id); // Create the delegate. OrderChangelogAsync caller = OrderChangeLogAsync; ProcessState state = new ProcessState(resp.changelogId); state.Request = caller; caller.BeginInvoke(changelogprovider, startindex, count, "", id, CallbackProcessStatus, state); ChangelogIdentificationType res = new ChangelogIdentificationType(); res.changelogId = resp.changelogId; return(res); }
public ChangelogIdentificationType OrderChangelog2(ChangelogOrderType order, string datasetVersion) { try { var providerVersion = GetDataset(order.datasetId).Version; return(providerVersion.Trim() != datasetVersion.Trim() ? new ChangelogIdentificationType { changelogId = "-1" } : OrderChangelogAsyncCaller(order)); } catch (Exception ex) { throw new FaultException(ex.Message); } }