/// <summary> /// Set <see cref="ComponentType"/> from string. If the string is not valid then <see cref="ComponentType"/> is set to <see cref="SdmxComponentType.None"/> /// </summary> /// <param name="type"> /// The type. /// </param> public void SetType(string type) { if (string.IsNullOrEmpty(type) || !Enum.TryParse(type, true, out this._componentType)) { this._componentType = SdmxComponentType.None; // redundant but specified for readability } }
/// <summary> /// Inserts the key values. /// </summary> /// <param name="state">The state.</param> /// <param name="isInclude">if set to <c>true</c> [is include].</param> /// <param name="cubeRegionPrimaryKey">The cube region primary key.</param> /// <param name="keyValuesCollection">The key values collection.</param> /// <param name="sdmxComponentType">Type of the SDMX component.</param> /// <returns> /// The list of primary key, <see cref="IKeyValues" /> and <see cref="IComponent" /> /// </returns> private static IEnumerable <Tuple <long, IKeyValues> > InsertKeyValues(DbTransactionState state, bool isInclude, long cubeRegionPrimaryKey, ICollection <IKeyValues> keyValuesCollection, SdmxComponentType sdmxComponentType) { var dimensionType = sdmxComponentType.ToString(); var keyValuesWithId = new List <Tuple <long, IKeyValues> >(keyValuesCollection.Count); var keyValueProc = new InsertCubeRegionKeyValueProcedure(); using (var command = keyValueProc.CreateCommand(state)) { keyValueProc.CreateIncludeParameter(command, isInclude); keyValueProc.CreateCubeRegionIdParameter(command, cubeRegionPrimaryKey); foreach (var keyValues in keyValuesCollection) { keyValueProc.CreateMemberIdParameter(command, keyValues.Id); keyValueProc.CreateComponentTypeParameter(command, dimensionType); var outputParameter = keyValueProc.CreateOutputParameter(command); command.ExecuteNonQuery(); keyValuesWithId.Add(new Tuple <long, IKeyValues>((long)outputParameter.Value, keyValues)); } } return(keyValuesWithId); }
/// <summary> /// Set <see cref="ComponentType"/> from string. If the string is not valid then <see cref="ComponentType"/> is set to <see cref="SdmxComponentType.None"/> /// </summary> /// <param name="type"> /// The type. /// </param> public void SetType(string type) { if (string.IsNullOrEmpty(type) || !Enum.TryParse(type, true, out this._componentType)) { this._componentType = SdmxComponentType.None; // redundant but specified for readability } }