public BuildSqlStatement ( |
||
requestContext | ||
additionalClause | string | |
oleDbParameters | System.Data.OleDb.OleDbParameter | |
리턴 | void |
public virtual String[] GetFeed() { string whereClause = string.Empty; OleDbParameter[] oleDbParameters = null; if (this is IEntityQueryWrapper) { QueryFilterBuilder queryFilterBuilder = new QueryFilterBuilder((IEntityQueryWrapper)this); queryFilterBuilder.BuildSqlStatement(_context, out whereClause, out oleDbParameters); } Token emptyToken = new Token(); List <Identity> identities = new List <Identity>(); if (String.IsNullOrEmpty(_context.ResourceKey)) { identities = _entity.GetAll(_context.Config, whereClause, oleDbParameters); } else { identities.Add(GetIdentity(_context.ResourceKey)); } string[] result = new string[identities.Count]; for (int i = 0; i < identities.Count; i++) { result[i] = identities[i].Id; } return(result); }
public override string[] GetFeed() { string whereClause = string.Empty; OleDbParameter[] oleDbParameters = null; if (this is IEntityQueryWrapper) { QueryFilterBuilder queryFilterBuilder = new QueryFilterBuilder((IEntityQueryWrapper)this); queryFilterBuilder.BuildSqlStatement(_context, out whereClause, out oleDbParameters); } Token emptyToken = new Token(); List<Identity> identities = new List<Identity>(); if (String.IsNullOrEmpty(_context.ResourceKey)) identities = _entity.GetAll(_context.Config, whereClause, oleDbParameters); else identities.Add(GetIdentity(_context.ResourceKey)); string[] result = new string[identities.Count * 2]; for (int i = 0; i < identities.Count; i++) { result[i * 2] = identities[i].Id + Sage.Integration.Northwind.Application.API.Constants.PhoneIdPostfix; } for (int i = 0; i < identities.Count; i++) { result[i * 2 + 1] = identities[i].Id + Sage.Integration.Northwind.Application.API.Constants.FaxIdPostfix; } return result; }
public String[] GetFeed() { string whereClause = string.Empty; OleDbParameter[] oleDbParameters = null; if (this is IEntityQueryWrapper) //What's dat? { QueryFilterBuilder queryFilterBuilder = new QueryFilterBuilder((IEntityQueryWrapper)this); queryFilterBuilder.BuildSqlStatement(_context, out whereClause, out oleDbParameters); } Token emptyToken = new Token(); List <Identity> identities = new List <Identity>(); identities = this._entity.GetAll(_context.Config, whereClause, oleDbParameters); string[] result = new string[identities.Count]; for (int i = 0; i < identities.Count; i++) { result[i] = identities[i].Id; } return(result); }
public override string[] GetFeed() { string whereClause = string.Empty; OleDbParameter[] oleDbParameters = null; if (this is IEntityQueryWrapper) { QueryFilterBuilder queryFilterBuilder = new QueryFilterBuilder((IEntityQueryWrapper)this); queryFilterBuilder.BuildSqlStatement(_context, out whereClause, out oleDbParameters); } Token emptyToken = new Token(); List <Identity> identities = new List <Identity>(); if (String.IsNullOrEmpty(_context.ResourceKey)) { identities = _entity.GetAll(_context.Config, whereClause, oleDbParameters); } else { identities.Add(GetIdentity(_context.ResourceKey)); } string[] result = new string[identities.Count * 2]; for (int i = 0; i < identities.Count; i++) { result[i * 2] = identities[i].Id + Sage.Integration.Northwind.Application.API.Constants.PhoneIdPostfix; } for (int i = 0; i < identities.Count; i++) { result[i * 2 + 1] = identities[i].Id + Sage.Integration.Northwind.Application.API.Constants.FaxIdPostfix; } return(result); }
public String[] GetFeed() { string whereClause = string.Empty; OleDbParameter[] oleDbParameters = null; if (this is IEntityQueryWrapper) //What's dat? { QueryFilterBuilder queryFilterBuilder = new QueryFilterBuilder((IEntityQueryWrapper)this); queryFilterBuilder.BuildSqlStatement(_context, out whereClause, out oleDbParameters); } Token emptyToken = new Token(); List<Identity> identities = new List<Identity>(); identities = this._entity.GetAll(_context.Config, whereClause, oleDbParameters); string[] result = new string[identities.Count]; for (int i = 0; i < identities.Count; i++) result[i] = identities[i].Id; return result; }
public override SyncFeed GetFeed() { bool includeUuid; string whereClause = string.Empty; OleDbParameter[] oleDbParameters = null; if (this is IEntityQueryWrapper) { QueryFilterBuilder queryFilterBuilder = new QueryFilterBuilder((IEntityQueryWrapper)this); queryFilterBuilder.BuildSqlStatement(_context, out whereClause, out oleDbParameters); } SyncFeed feed = new SyncFeed(); feed.Title = _resourceKind.ToString() + ": " + DateTime.Now.ToString(); Token emptyToken = new Token(); List <Identity> identities = new List <Identity>(); if (String.IsNullOrEmpty(_context.ResourceKey)) { identities = _entity.GetAll(_context.Config, whereClause, oleDbParameters); } else { identities.Add(new Identity(_entity.EntityName, _context.ResourceKey)); } int totalResult = identities.Count; #region PAGING & OPENSEARCH /* PAGING */ feed.Links = FeedMetadataHelpers.CreatePageFeedLinks(_context, totalResult, FeedMetadataHelpers.RequestKeywordType.none); /* OPENSEARCH */ PageController pageController = FeedMetadataHelpers.GetPageLinkBuilder(_context, totalResult, FeedMetadataHelpers.RequestKeywordType.none); feed.Opensearch_ItemsPerPageElement = pageController.GetOpensearch_ItemsPerPageElement(); feed.Opensearch_StartIndexElement = pageController.GetOpensearch_StartIndexElement(); feed.Opensearch_TotalResultsElement = pageController.GetOpensearch_TotalResultsElement(); #endregion feed.Id = _context.SdataUri.ToString(); string tmpValue; // ?includeUuid includeUuid = false; // default value, but check for settings now if (_context.SdataUri.QueryArgs.TryGetValue("includeUuid", out tmpValue)) { includeUuid = System.Xml.XmlConvert.ToBoolean(tmpValue); } ICorrelatedResSyncInfoStore correlatedResSyncStore = null; if (includeUuid) { // get store to request the correlations correlatedResSyncStore = RequestReceiver.NorthwindAdapter.StoreLocator.GetCorrelatedResSyncStore(_context.SdataContext); } for (int pageIndex = pageController.StartIndex; pageIndex <= pageController.LastIndex; pageIndex++) //for (int index = startIndex; index < startIndex + count; index++) { int zeroBasedIndex = pageIndex - 1; Identity identity = identities[zeroBasedIndex]; AccountDocument accountDocument = (AccountDocument)_entity.GetDocument(identity, emptyToken, _context.Config); if (accountDocument.LogState == LogState.Deleted) { continue; } SyncFeedEntry entry = new SyncFeedEntry(); if (accountDocument.addresses.documents.Count == 0) { return(null); } entry.Id = String.Format("{0}{1}('{2}')", _context.DatasetLink, _resourceKind.ToString(), identity.Id); entry.Title = String.Format("{0}: {1}", _resourceKind.ToString(), identity.Id); entry.Updated = DateTime.Now; if (_context.SdataUri.Precedence == null) { List <SyncFeedEntryLink> links; Document document = accountDocument.addresses.documents[0]; entry.Payload = GetTransformedPayload(document, out links); string taUuid = GetTradingAccountUuid(accountDocument.Id); if (!String.IsNullOrEmpty(taUuid)) { SyncFeedEntryLink tradingAccountLink = SyncFeedEntryLink.CreateRelatedLink( String.Format("{0}{1}('{2}')", _context.DatasetLink, SupportedResourceKinds.tradingAccounts.ToString(), accountDocument.Id), SupportedResourceKinds.tradingAccounts.ToString(), _tradingAccountUuidPayloadPath, taUuid); links.Add(tradingAccountLink); } entry.SyncLinks = links; } if (includeUuid) { CorrelatedResSyncInfo[] infos = correlatedResSyncStore.GetByLocalId(_context.ResourceKind.ToString(), new string[] { identity.Id }); entry.Uuid = (infos.Length > 0) ? infos[0].ResSyncInfo.Uuid : Guid.Empty; } if (entry != null) { feed.Entries.Add(entry); } } return(feed); }
public override SyncFeed GetFeed() { bool includeUuid; string whereClause = string.Empty; OleDbParameter[] oleDbParameters = null; if (this is IEntityQueryWrapper) { QueryFilterBuilder queryFilterBuilder = new QueryFilterBuilder((IEntityQueryWrapper)this); queryFilterBuilder.BuildSqlStatement(_context, out whereClause, out oleDbParameters); } SyncFeed feed = new SyncFeed(); feed.Title = _resourceKind.ToString() + ": " + DateTime.Now.ToString(); Token emptyToken = new Token(); List<Identity> identities = new List<Identity>(); if (String.IsNullOrEmpty(_context.ResourceKey)) identities = _entity.GetAll(_context.Config, whereClause, oleDbParameters); else identities.Add(new Identity(_entity.EntityName, _context.ResourceKey)); int totalResult = identities.Count; #region PAGING & OPENSEARCH /* PAGING */ feed.Links = FeedMetadataHelpers.CreatePageFeedLinks(_context, totalResult, FeedMetadataHelpers.RequestKeywordType.none); /* OPENSEARCH */ PageController pageController = FeedMetadataHelpers.GetPageLinkBuilder(_context, totalResult, FeedMetadataHelpers.RequestKeywordType.none); feed.Opensearch_ItemsPerPageElement = pageController.GetOpensearch_ItemsPerPageElement(); feed.Opensearch_StartIndexElement = pageController.GetOpensearch_StartIndexElement(); feed.Opensearch_TotalResultsElement = pageController.GetOpensearch_TotalResultsElement(); #endregion feed.Id = _context.SdataUri.ToString(); string tmpValue; // ?includeUuid includeUuid = false; // default value, but check for settings now if (_context.SdataUri.QueryArgs.TryGetValue("includeUuid", out tmpValue)) includeUuid = System.Xml.XmlConvert.ToBoolean(tmpValue); ICorrelatedResSyncInfoStore correlatedResSyncStore = null; if (includeUuid) // get store to request the correlations correlatedResSyncStore = RequestReceiver.NorthwindAdapter.StoreLocator.GetCorrelatedResSyncStore(_context.SdataContext); for (int pageIndex = pageController.StartIndex; pageIndex <= pageController.LastIndex; pageIndex++) //for (int index = startIndex; index < startIndex + count; index++) { int zeroBasedIndex = pageIndex - 1; Identity identity = identities[zeroBasedIndex]; AccountDocument accountDocument = (AccountDocument)_entity.GetDocument(identity, emptyToken, _context.Config); if (accountDocument.LogState == LogState.Deleted) continue; SyncFeedEntry entry = new SyncFeedEntry(); if (accountDocument.addresses.documents.Count == 0) return null; entry.Id = String.Format("{0}{1}('{2}')", _context.DatasetLink, _resourceKind.ToString(), identity.Id); entry.Title = String.Format("{0}: {1}", _resourceKind.ToString(), identity.Id); entry.Updated = DateTime.Now; if (_context.SdataUri.Precedence == null) { List<SyncFeedEntryLink> links; Document document = accountDocument.addresses.documents[0]; entry.Payload = GetTransformedPayload(document, out links); string taUuid = GetTradingAccountUuid(accountDocument.Id); if (!String.IsNullOrEmpty(taUuid)) { SyncFeedEntryLink tradingAccountLink = SyncFeedEntryLink.CreateRelatedLink( String.Format("{0}{1}('{2}')", _context.DatasetLink, SupportedResourceKinds.tradingAccounts.ToString(), accountDocument.Id), SupportedResourceKinds.tradingAccounts.ToString(), _tradingAccountUuidPayloadPath, taUuid); links.Add(tradingAccountLink); } entry.SyncLinks = links; } if (includeUuid) { CorrelatedResSyncInfo[] infos = correlatedResSyncStore.GetByLocalId(_context.ResourceKind.ToString(), new string[] { identity.Id }); entry.Uuid = (infos.Length > 0) ? infos[0].ResSyncInfo.Uuid : Guid.Empty; } if (entry != null) feed.Entries.Add(entry); } return feed; }
public virtual String[] GetFeed() { string whereClause = string.Empty; OleDbParameter[] oleDbParameters = null; if (this is IEntityQueryWrapper) { QueryFilterBuilder queryFilterBuilder = new QueryFilterBuilder((IEntityQueryWrapper)this); queryFilterBuilder.BuildSqlStatement(_context, out whereClause, out oleDbParameters); } Token emptyToken = new Token(); List<Identity> identities = new List<Identity>(); if (String.IsNullOrEmpty(_context.ResourceKey)) identities = _entity.GetAll(_context.Config, whereClause, oleDbParameters); else identities.Add(GetIdentity(_context.ResourceKey)); string[] result = new string[identities.Count]; for (int i = 0; i < identities.Count; i++) result[i] = identities[i].Id; return result; }