protected virtual void PerformSearch() { try { var searchToken = txtSearch.Text.Trim(); IEnumerable <IFieldDefinition> fieldDefinitions; if (String.IsNullOrEmpty(searchToken)) { fieldDefinitions = this.FieldDefinitions.AsEnumerable(); } else { fieldDefinitions = FieldDefinitions .Where(f => f.Name.ToUpper().Contains(searchToken.ToUpper()) || f.Group.ToUpper().Contains(searchToken.ToUpper()) ); } DisplayFieldDefinitions(fieldDefinitions); } catch (Exception ex) { ExceptionHandler(ex); } }
public FieldDefinition <ContentTypeDefinition> WithField(string fieldName) { var definition = new FieldDefinition <ContentTypeDefinition>(fieldName, this); FieldDefinitions.Add(definition); return(definition); }
public SPContentType CreateAsPartOfGroup(string groupName) { if (Web.ContentTypes[Name] != null) { return(Web.ContentTypes[Name]); } var contentType = new SPContentType(Web.AvailableContentTypes[ParentContentType], Web.ContentTypes, Name) { Group = groupName }; foreach (var fieldInfo in FieldDefinitions.Select(fieldDef => new { fieldDef.IsHidden, Field = fieldDef.CreateIn(Web.Fields, groupName) })) { contentType.FieldLinks.Add(new SPFieldLink(fieldInfo.Field) { Hidden = fieldInfo.IsHidden }); } if (!string.IsNullOrEmpty(NewFormUrl)) { contentType.NewFormUrl = NewFormUrl; } Web.ContentTypes.Add(contentType); Web.Update(); contentType.Update(); return(contentType); }
public virtual async Task <long> ReplaceMany(IEnumerable <T> entities, bool isUpsert, CancellationToken token = default) { if (entities.Count() == 0) { return(0); } var requests = new List <WriteModel <T> >(); Func <object, object> idGetter = FieldDefinitions.GetIdFieldGetter(typeof(T)); foreach (T entity in entities) { ObjectId entityId = (ObjectId)idGetter.Invoke(entity); var filter = Builders <T> .Filter.Eq("_id", entityId); requests.Add(new ReplaceOneModel <T>(filter, entity) { IsUpsert = isUpsert }); } // BulkWrite var options = new BulkWriteOptions() { IsOrdered = false }; BulkWriteResult <T> bulkResult = await _collection .BulkWriteAsync(requests, options, cancellationToken : token) .ConfigureAwait(false); return(bulkResult.Upserts.Count + bulkResult.ModifiedCount); }
public virtual string FetchContent(HtmlDocument doc, string key, NameValueCollection mappings) { string rowValue = string.Empty; bool textOnly = false; try { int index = mappings[key].IndexOf('_'); string toWhatField = mappings[key].Substring(0, index); IBaseField mappingItem = FieldDefinitions.FirstOrDefault(f => f.InnerItem.Fields[FromWhatField].Value == key && f.InnerItem.Fields["To What Field"].Value == toWhatField); textOnly = mappingItem.InnerItem.Fields["Strip HTML"]?.Value == "1" || ImportTextOnly; } catch (Exception ex) { Logger.Log(ex.ToString(), rowValue, LogType.GetImportDataError, key, rowValue); } var node = HtmlService.HandleNodesLookup(key, doc); if (node == null) { return(rowValue); } rowValue = textOnly ? node.InnerText : node.InnerHtml; return(rowValue); }
protected virtual string ToCategorySettingsLookupFilter(SubscriptionParameters parameters, SubscribersRangeParameters <ObjectId> subscribersRange, bool joinOnCategories) { string subscriberIdField = FieldDefinitions.GetFieldMappedName <TCategory>(x => x.SubscriberId); string deliveryTypeField = FieldDefinitions.GetFieldMappedName <TCategory>(x => x.DeliveryType); string categoryField = FieldDefinitions.GetFieldMappedName <TCategory>(x => x.CategoryId); string categoriesJoinCondition = joinOnCategories ? $", $eq: [\"${categoryField}\", \"$$category_id\"]" : ""; var categoryFilter = ToCategorySettingsFilter(parameters, subscribersRange); string categoryFilterJson = categoryFilter.RenderJson(); return($@"""$and"": [ {{ ""$expr"": {{ $and: [ {{ $eq: [""${ subscriberIdField }"", ""$$subscriber_id""] }}, {{ $eq: [""${ deliveryTypeField }"", ""$$delivery_type""] }} {categoriesJoinCondition} ] }} }}, {categoryFilterJson} ]"); }
internal void AddFieldDefinition(string fieldName, Type type) { Microsoft.Reporting.Map.WebForms.Field field = new Microsoft.Reporting.Map.WebForms.Field(); field.Name = fieldName; field.Type = type; FieldDefinitions.Add(field); }
private void OnModelPropertyChanged(object sender, PropertyChangedEventArgs e) { if (FieldDefinitions.Any(f => f.Identifier == e.PropertyName)) { BindItemsSource(); } }
protected virtual PipelineDefinition <TInput, BsonDocument> AddCategoryLookupStages <TInput>( PipelineDefinition <TInput, BsonDocument> pipeline, SubscriptionParameters parameters, SubscribersRangeParameters <ObjectId> subscribersRange) { if (!subscribersRange.SelectFromCategories) { return(pipeline); } string categoryCollection = _collectionFactory.GetCollection <TCategory>().CollectionNamespace.CollectionName; string subscriberIdField = subscribersRange.SelectFromTopics ? FieldDefinitions.GetFieldMappedName <TTopic>(x => x.SubscriberId) : FieldDefinitions.GetFieldMappedName <TDeliveryType>(x => x.SubscriberId); string deliveryTypeField = subscribersRange.SelectFromTopics ? FieldDefinitions.GetFieldMappedName <TTopic>(x => x.DeliveryType) : FieldDefinitions.GetFieldMappedName <TDeliveryType>(x => x.DeliveryType); string categoryField = FieldDefinitions.GetFieldMappedName <TTopic>(x => x.CategoryId); string categoriesIntermediateField = "cats"; bool joinOnCategories = subscribersRange.SelectFromTopics; string joinOnCategory = joinOnCategories ? $", category_id: \"{categoryField}\"" : ""; string matchConditions = ToCategorySettingsLookupFilter(parameters, subscribersRange, joinOnCategories); string categoriesLookup = $@" {{ $lookup : {{ from: ""{categoryCollection}"", let: {{ subscriber_id: ""${subscriberIdField}"", delivery_type: ""${deliveryTypeField}"" {joinOnCategory} }}, pipeline: [ {{ $match: {{ {matchConditions} }} }}, {{ $project: {{ _id: 1 }} }} ], as: ""{categoriesIntermediateField}"" }} }}"; string hasCategoriesStage = $@" {{ $match: {{ {categoriesIntermediateField}: {{ $exists: true, $ne: [] }} }} }}"; return(pipeline .AppendStage(categoriesLookup, BsonDocumentSerializer.Instance) .AppendStage(hasCategoriesStage, BsonDocumentSerializer.Instance)); }
public FieldDefinition <ContentTypeDefinition> WithOptionalField(string fieldName) { var definition = new FieldDefinition <ContentTypeDefinition>(fieldName, this) { IsRequired = false }; FieldDefinitions.Add(definition); return(definition); }
public void AfterInit() { fieldDefinitionsArray = FieldDefinitions.ToArray(); ignoredFieldDefinitionsArray = IgnoredFieldDefinitions.ToArray(); var allItems = new List <FieldDefinition>(FieldDefinitions); allItems.AddRange(IgnoredFieldDefinitions); allFieldDefinitionsArray = allItems.ToArray(); }
public string FetchContent(HtmlDocument doc, object key, NameValueCollection mappings, ImportConfig storedConfig) { string rowValue = string.Empty; bool textOnly = false; bool useXPath = false; try { int index = mappings[key.ToString()].IndexOf('_'); string toWhatField = mappings[key.ToString()].Substring(0, index); IBaseField mappingItem = FieldDefinitions.FirstOrDefault(f => f.InnerItem.Fields[HtmlScraper.Constants.FieldNames.FromWhatField].Value == key.ToString() && f.InnerItem.Fields[HtmlScraper.Constants.FieldNames.ToWhatField].Value == toWhatField); useXPath = mappingItem.InnerItem.Fields[HtmlScraper.Constants.FieldNames.UseXpath].Value == "1"; textOnly = mappingItem.InnerItem.Fields[HtmlScraper.Constants.FieldNames.ImportTextOnly].Value == "1" || storedConfig.ImportTextOnly; } catch (Exception ex) { Logger.Log(ex.ToString(), rowValue, ProcessStatus.GetImportDataError, key.ToString(), rowValue); } string htmlObj = string.Empty; bool isAttrValue = false; string attrName = string.Empty; HtmlNode node = null; htmlObj = key.ToString(); if (htmlObj.Contains("/@")) { isAttrValue = true; List <string> attrItems = htmlObj.Split('/').Where(a => a.StartsWith("@")).ToList(); attrName = attrItems.FirstOrDefault(a => !a.Contains("=")); htmlObj = htmlObj.Replace("/" + attrName, ""); attrName = attrName.Replace("@", ""); } node = useXPath ? Helper.HandleNodesLookup(htmlObj, doc, true) : Helper.HandleNodesLookup(htmlObj, doc); if (node == null) { return(rowValue); } rowValue = isAttrValue && node.Attributes[attrName] != null ? node.Attributes[attrName].Value : (textOnly ? node.InnerText : node.InnerHtml); return(rowValue); }
public void AfterInit() { FieldDefinitionsArray = FieldDefinitions.ToArray(); FieldDefinitionsWithAliases = FieldDefinitions.Where(x => x.Alias != null).ToArray(); IgnoredFieldDefinitionsArray = IgnoredFieldDefinitions.ToArray(); var allItems = new List <FieldDefinition>(FieldDefinitions); allItems.AddRange(IgnoredFieldDefinitions); AllFieldDefinitionsArray = allItems.ToArray(); }
private void QueryTestCases() { // Set up the query. Query psQuery = new QueryClass(); psQuery.CountOnly = false; psQuery.SelectionCriteria = QUERY_ACTIVE; psQuery.DatastoreItemType = PsDatastoreItemTypeEnum.psDatastoreItemTypeTestCase; // Bind the query and Datastore to our // DatastoreItemList. DatastoreItemList psDataList = new DatastoreItemListClass(); psDataList.Query = psQuery; psDataList.Datastore = m_psDataStore; // Get the field definitions so we can specify // them in the result and sort list. // You can also use the GetEnumerator to // enumerate the fields. FieldDefinitions psFields = m_psDataStore.FieldDefinitions; foreach (FieldDefinition item in psFields) { Console.WriteLine(item.Name); } // Add fields with the FieldDefinitions indexer psQuery.QueryFields.Clear(); for (int fieldCount = 0; fieldCount < TEST_CASE_FIELDS.Length; fieldCount++) { psQuery.QueryFields.Add(psFields[TEST_CASE_FIELDS[fieldCount]]); } // Add fields to sort by for (int fieldCount = 0; fieldCount < TEST_CASE_SORT.Length; fieldCount++) { psQuery.QuerySortFields.Add( psFields[TEST_CASE_SORT[fieldCount]], PsSortTypeEnum.psSortTypeAscending); } psDataList.Execute(); foreach (DatastoreItem psItem in psDataList.DatastoreItems) { foreach (String name in TEST_CASE_FIELDS) { Console.Write("{0}\t", psItem.Fields[name].Value); } Console.WriteLine(); } }
public void AfterInit() { fieldDefinitionsArray = FieldDefinitions.ToArray(); ignoredFieldDefinitionsArray = IgnoredFieldDefinitions.ToArray(); var allItems = new List <FieldDefinition>(FieldDefinitions); allItems.AddRange(IgnoredFieldDefinitions); allFieldDefinitionsArray = allItems.ToArray(); SqlSelectAllFromTable = "SELECT {0} FROM {1} " .Fmt(OrmLiteConfig.DialectProvider.GetColumnNames(this), OrmLiteConfig.DialectProvider.GetQuotedTableName(this)); }
public virtual Task <T> FindOneAndReplace(T entity, bool isUpsert, ReturnDocument returnDocument = ReturnDocument.Before, CancellationToken token = default) { Func <object, object> idGetter = FieldDefinitions.GetIdFieldGetter(typeof(T)); ObjectId entityId = (ObjectId)idGetter.Invoke(entity); var filter = Builders <T> .Filter.Eq("_id", entityId); var options = new FindOneAndReplaceOptions <T> { ReturnDocument = returnDocument, IsUpsert = isUpsert }; return(_collection.FindOneAndReplaceAsync(filter, entity, options, cancellationToken: token)); }
public void AfterInit() { FieldDefinitionsArray = FieldDefinitions.ToArray(); FieldDefinitionsWithAliases = FieldDefinitions.Where(x => x.Alias != null).ToArray(); IgnoredFieldDefinitionsArray = IgnoredFieldDefinitions.ToArray(); var allItems = new List <FieldDefinition>(FieldDefinitions); allItems.AddRange(IgnoredFieldDefinitions); AllFieldDefinitionsArray = allItems.ToArray(); OrmLiteConfig.OnModelDefinitionInit?.Invoke(this); }
private DatastoreItemList GetStoreItemList(bool cacheStoreItemList = true) { try { if (m_storeItemList == null || ConnectionTime.Elapsed.Minutes > MaxConnectionMinutes) { ConnectionTime.Reset(); ProductStudio.Directory psDir = new ProductStudio.Directory(); psDir.Connect(); ProductStudio.Product psProduct = psDir.GetProductByName(StoreID.Name); DatastoreItemList storeItemList = new DatastoreItemList(); storeItemList.Datastore = psProduct.Connect(); // Simulate outdated Product Studio error //if (storeItemList.Datastore == null || storeItemList.Datastore != null) //{ // throw new Exception("[Product Studio] 80044005. Access to this product requires updated client components."); //} ConnectionTime.Start(); FieldDefs = storeItemList.Datastore.FieldDefinitions; if (cacheStoreItemList) { m_storeItemList = storeItemList; } else { return(storeItemList); } } return(m_storeItemList); } catch (Exception exception) { StringBuilder sb = new StringBuilder(); sb.AppendLine("Unable to connect to " + StoreID.Name); sb.AppendLine(); sb.AppendLine(exception.Message); sb.AppendLine(); Planner.Instance.WriteToEventLog(sb.ToString()); throw new Exception(sb.ToString()); } }
public virtual async Task <long> ReplaceOne(T entity, bool isUpsert, CancellationToken token = default) { Func <object, object> idGetter = FieldDefinitions.GetIdFieldGetter(typeof(T)); ObjectId entityId = (ObjectId)idGetter.Invoke(entity); var filter = Builders <T> .Filter.Eq("_id", entityId); var options = new ReplaceOptions { IsUpsert = isUpsert }; ReplaceOneResult result = await _collection.ReplaceOneAsync(filter, entity, options, cancellationToken : token) .ConfigureAwait(false); return(result.ModifiedCount); }
private string GenerateUniqueFieldName() { int num = FieldDefinitions.Count; string text; while (true) { text = num.ToString(CultureInfo.InvariantCulture); if (FieldDefinitions.GetByName(text) == null) { break; } num++; } return(text); }
public TypeTracker(ISchema schema) { EnterOperationDefinition = node => { var root = node.Operation switch { OperationType.Query => schema.Query, OperationType.Mutation => schema.Mutation, OperationType.Subscription => schema.Subscription, _ => throw new ArgumentOutOfRangeException() }; Types.Push(root); }; LeaveOperationDefinition = node => { Types.TryPop(out _); }; EnterSelectionSet = node => { ParentTypes.Push(CurrentType); }; LeaveSelectionSet = node => { ParentTypes.TryPop(out _); }; EnterFieldSelection = node => { if (ParentType is not null) { var fieldDefinition = schema.GetField(ParentType.Name, node.Name); FieldDefinitions.Push(fieldDefinition ?? null); if (fieldDefinition?.Type is not null) { var fieldTypeDefinition = Ast.UnwrapAndResolveType(schema, fieldDefinition.Type); if (fieldTypeDefinition is not null && TypeIs.IsOutputType(fieldTypeDefinition)) { Types.Push(fieldTypeDefinition); } else { Types.Push(null); } } else { Types.Push(null); } }
public object this[string lookup] { get { return(Values[lookup]); } set { FieldDefinition field = FieldDefinitions.Single(f => f.Name == lookup); string valueString = value.ToString(); if (valueString.Length > field.Length) { valueString = valueString.Substring(0, field.Length); } AssignField(field, valueString); } }
public Task <long> ReplaceOne(T entity, bool isUpsert, CancellationToken token = default) { Func <object, object> idGetter = FieldDefinitions.GetIdFieldGetter(typeof(T)); ObjectId entityId = (ObjectId)idGetter.Invoke(entity); T entityToReplace = Collection.Find(x => (ObjectId)idGetter.Invoke(x) == entityId); long replaced = 0; bool doReplace = isUpsert || entityToReplace != null; if (doReplace) { replaced = Collection.RemoveAll(x => (ObjectId)idGetter.Invoke(x) == entityId); Collection.Add(entity); } return(Task.FromResult(replaced)); }
private Hashtable CurrentTests() { // Set up the query. Query psQuery = new QueryClass(); psQuery.CountOnly = false; psQuery.SelectionCriteria = QUERY_ACTIVE; psQuery.DatastoreItemType = PsDatastoreItemTypeEnum.psDatastoreItemTypeTestCase; DatastoreItemList psDataList = new DatastoreItemListClass(); psDataList.Query = psQuery; psDataList.Datastore = m_psDataStore; FieldDefinitions psFields = m_psDataStore.FieldDefinitions; // Add fields with the FieldDefinitions indexer psQuery.QueryFields.Clear(); for (int fieldCount = 0; fieldCount < TEST_CASE_FIELDS.Length; fieldCount++) { psQuery.QueryFields.Add(psFields[TEST_CASE_FIELDS[fieldCount]]); } // Add fields to sort by for (int fieldCount = 0; fieldCount < TEST_CASE_SORT.Length; fieldCount++) { psQuery.QuerySortFields.Add( psFields[TEST_CASE_SORT[fieldCount]], PsSortTypeEnum.psSortTypeAscending); } Hashtable res = new Hashtable(); psDataList.Execute(); foreach (DatastoreItem psItem in psDataList.DatastoreItems) { object module = psItem.Fields["Test Module"].Value; object suite = psItem.Fields["Test Suite"].Value; object testcase = psItem.Fields["TestCase"].Value; res[TestKey(module, suite, testcase)] = psItem.Fields["ID"].Value; } return(res); }
public async Task <T> FindOneAndReplace(T entity, bool isUpsert, ReturnDocument returnDocument = ReturnDocument.Before, CancellationToken token = default) { Func <object, object> idGetter = FieldDefinitions.GetIdFieldGetter(typeof(T)); ObjectId entityId = (ObjectId)idGetter.Invoke(entity); T collectionEntity = Collection .Where(x => (ObjectId)idGetter.Invoke(x) == entityId) .FirstOrDefault(); T returnedEntity = collectionEntity; if (returnDocument == ReturnDocument.Before) { //Could clone it here if required with AutoMapper or BinarySerializer. //However BinarySerializer does not serialize ObjectId. returnedEntity = collectionEntity; } await ReplaceOne(entity, isUpsert, token); return(returnedEntity); }
//Autodesk.Gis.Map.ObjectData.Table crODTable; /// <summary> /// Создаём таблицу ObjectData. /// </summary> /// <param name="wRule"> LayerRule как источник описания таблицы </param> /// <returns> ObjectData.Table </returns> public Autodesk.Gis.Map.ObjectData.Table CreateODTable(Rule.LayerRule wRule) { Autodesk.Gis.Map.MapApplication mapApp = Autodesk.Gis.Map.HostMapApplicationServices.Application; Autodesk.Gis.Map.Project.ProjectModel activeProject = mapApp.ActiveProject; Autodesk.Gis.Map.ObjectData.Tables tableList = activeProject.ODTables; // if (!tableList.GetTableNames().Contains(wRule.LName)) { FieldDefinitions fieldDefs = mapApp.ActiveProject.MapUtility.NewODFieldDefinitions(); foreach (Rule.FieldRule fr in wRule.FieldList) { if (!fr.IsGeom) { fieldDefs.Add(fr.FName, "", Autodesk.Gis.Map.Constants.DataType.Character, 0); //!!1 } } tableList.Add(wRule.LName, fieldDefs, "", true); } // return(tableList[wRule.LName]); }
protected virtual string ToDeliveryTypeSettingsLookupFilter( SubscriptionParameters parameters, SubscribersRangeParameters <ObjectId> subscribersRange) { string deliveryTypeField = FieldDefinitions.GetFieldMappedName <TDeliveryType>(x => x.DeliveryType); string subscriberIdField = FieldDefinitions.GetFieldMappedName <TDeliveryType>(x => x.SubscriberId); var deliveryTypesFilter = ToDeliveryTypeSettingsFilter(parameters, subscribersRange); string deliveryTypesFilterJson = deliveryTypesFilter.RenderJson(); return($@"""$and"": [ {{ ""$expr"": {{ $and: [ {{ $eq: [""${subscriberIdField}"", ""$$subscriber_id""] }}, {{ $eq: [""${deliveryTypeField}"", ""$$delivery_type""] }} ] }} }}, {deliveryTypesFilterJson} ]"); }
/// <summary> /// if a template definition has custom field imports then use that before the global field definitions /// </summary> /// <param name="importRow"></param> /// <returns></returns> public override List <IBaseField> GetFieldDefinitionsByRow(object importRow) { List <IBaseField> l = new List <IBaseField>(); //get the template TemplateMapping tm = GetTemplateMapping((Item)importRow); if (tm == null) { return(FieldDefinitions); } //get the template fields List <IBaseField> tempFields = tm.FieldDefinitions; //filter duplicates in template fields from global fields List <string> names = tempFields.Select(a => a.Name).ToList(); l.AddRange(tempFields); l.AddRange(FieldDefinitions.Where(a => !names.Contains(a.Name))); return(l); }
//------------------------------------------------------------------------------------ /// <summary> /// Executes the given query against this data store. Returns false if a cancellation /// request is detected via the given taskWorker. /// </summary> //------------------------------------------------------------------------------------ public BackgroundTaskResult ExecuteQuery(IRepository repository, BaseQuery query, ShouldRefresh shouldRefresh, BackgroundTask taskWorker, bool deferItemCreation) { DatastoreItemList storeItemList = GetStoreItemList(); FieldDefinitions fieldDefs = storeItemList.Datastore.FieldDefinitions; // Set up a query, using QueryDefinition to define the query XML ProductStudio.Query psQuery = new ProductStudio.Query(); psQuery.CountOnly = false; psQuery.DatastoreItemType = PsDatastoreItemTypeEnum.psDatastoreItemTypeBugs; psQuery.SelectionCriteria = query.QueryXml; psQuery.QueryFields.Clear(); psQuery.QuerySortFields.Clear(); psQuery.QuerySortFields.Add(fieldDefs["ID"], PsSortTypeEnum.psSortTypeDescending); // Execute the query try { storeItemList.Query = psQuery; storeItemList.Execute(); } catch (Exception e) { return(new BackgroundTaskResult { ResultType = ResultType.Failed, ResultMessage = e.Message }); } Planner.Instance.WriteToEventLog(StoreName + ": Query results count: " + storeItemList.DatastoreItems.Count.ToString()); repository.ReceiveDSItems(this, storeItemList.DatastoreItems, shouldRefresh, deferItemCreation); return(new BackgroundTaskResult { ResultType = ResultType.Completed }); }
private void ExportProfile(string testType, string profileName) { // Set up the query. Query psQuery = new QueryClass(); psQuery.CountOnly = false; string query = string.Format(QUERY_PROFILE, testType); //string query = QUERY_PROFILE; psQuery.SelectionCriteria = query; psQuery.DatastoreItemType = PsDatastoreItemTypeEnum.psDatastoreItemTypeTestCase; DatastoreItemList psDataList = new DatastoreItemListClass(); psDataList.Query = psQuery; psDataList.Datastore = m_psDataStore; // Get the field definitions so we can specify // them in the result and sort list. FieldDefinitions psFields = m_psDataStore.FieldDefinitions; // Add fields with the FieldDefinitions indexer psQuery.QueryFields.Clear(); for (int fieldCount = 0; fieldCount < TEST_CASE_FIELDS.Length; fieldCount++) { psQuery.QueryFields.Add(psFields[TEST_CASE_FIELDS[fieldCount]]); } // Add fields to sort by for (int fieldCount = 0; fieldCount < TEST_CASE_SORT.Length; fieldCount++) { psQuery.QuerySortFields.Add(psFields[TEST_CASE_SORT[fieldCount]], PsSortTypeEnum.psSortTypeAscending); } psDataList.Execute(); ExportCases(testType, profileName, psDataList.DatastoreItems); }
public int? GetIntFieldFromPosition(FieldDefinitions.FieldDefinition position) { var parsedString = GetStringFieldFromPosition(position); if (string.IsNullOrWhiteSpace(parsedString)) { return null; } return int.Parse(parsedString); }
public string GetStringFieldFromPosition(FieldDefinitions.FieldDefinition position) { return pknodData.Substring(position.StartPosition - 1, position.Length).Trim(); }
public CreateTableStatement() { Fields = new FieldDefinitions(); }
public DateTime? GetDateFieldFromPosition(FieldDefinitions.FieldDefinition position) { var rawDate = GetStringFieldFromPosition(position); DateTime date; if (DateTime.TryParseExact(rawDate, "yyyyMMdd", CultureInfo.InvariantCulture, DateTimeStyles.None, out date)) { return date; } return null; }