コード例 #1
0
        /// <summary>Gets the <see cref="IExcelDataQuery"/> object which contains general properties, i.e. the table with name 'General Properties'.
        /// </summary>
        /// <param name="dataQueries">The data queries.</param>
        /// <returns>The <see cref="IExcelDataQuery"/> object which contains general properties.</returns>
        public static IExcelDataQuery GetGeneralProperties(this IIdentifierStringDictionary <IExcelDataQuery> dataQueries)
        {
            IExcelDataQuery value;

            if (dataQueries.TryGetValue(ExcelDataQuery.GeneralPropertyDataQueryName, out value) == false)
            {
                throw new ArgumentException("No data table found with name '" + ExcelDataQuery.GeneralPropertyDataQueryName + "'.");
            }
            return(value);
        }
コード例 #2
0
 /// <summary>Gets the collection of properties with respect to a specific property group name.
 /// </summary>
 /// <param name="propertyGroupName">The name of the property group (i.e. 'General Properties' etc.).</param>
 /// <param name="value">The property collection (output).</param>
 /// <returns>A value indicating whether <paramref name="value"/> contains valid data.</returns>
 public bool TryGetProperties(IdentifierString propertyGroupName, out IIdentifierStringDictionary <InfoOutputProperty> value)
 {
     if (propertyGroupName != null)
     {
         if (m_Properties.TryGetValue(propertyGroupName, out IdentifierStringDictionaryBase <InfoOutputProperty> propertyCollection) == true)
         {
             value = propertyCollection;
             return(true);
         }
     }
     value = null;
     return(false);
 }
コード例 #3
0
ファイル: ExcelPoolItem.cs プロジェクト: xiaodelea/dodoni.net
        /// <summary>Initializes a new instance of the <see cref="ExcelPoolItem"/> class.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <param name="objectName">The name of <paramref name="value"/>.</param>
        /// <param name="objectType">The type of <paramref name="value"/>.</param>
        /// <param name="excelDataQueries">The excel data queries, i.e. the (user) input.</param>
        /// <param name="inputDependencyItems">A collection of <see cref="ExcelPoolItem"/> objects which are used as input for the construction of <paramref name="value"/>, i.e. dependent objects.</param>
        /// <remarks>The <see cref="IExcelDataQuery.QueryCompleted(bool)"/> will be called for each element of <paramref name="excelDataQueries"/> and the <see cref="GuidedExcelDataQuery"/> representation
        /// will be stored internally.</remarks>
        /// <example><paramref name="inputDependencyItems"/> are for example swap rates, deposit rates etc. if the current instance is a discount factor curve etc.</example>
        public ExcelPoolItem(IInfoOutputQueriable value, string objectName, ExcelPoolItemType objectType, IEnumerable <IExcelDataQuery> excelDataQueries, IEnumerable <ExcelPoolItem> inputDependencyItems = null)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            Value = value;

            if (objectName == null)
            {
                throw new ArgumentNullException("objectName");
            }
            ObjectName = objectName.ToIdentifierString();

            if (objectType == null)
            {
                throw new ArgumentNullException("objectType");
            }
            ObjectType = objectType;

            if (excelDataQueries == null)
            {
                throw new ArgumentNullException("excelDataQueries");
            }
            var guidedExcelDataQueryInput = new IdentifierStringDictionary <GuidedExcelDataQuery>(isReadOnlyExceptAdding: false);

            foreach (var inputExcelDataQuery in excelDataQueries)
            {
                inputExcelDataQuery.QueryCompleted();
                guidedExcelDataQueryInput.Add(inputExcelDataQuery.Name, inputExcelDataQuery.AsCustomizeData());
            }
            m_ExcelDataQueries = guidedExcelDataQueryInput;

            InputDependencyItems = inputDependencyItems;
            TimeStamp            = DateTime.Now;
        }
コード例 #4
0
ファイル: ExcelPool.cs プロジェクト: xiaodelea/dodoni.net
        /// <summary>Adds a collection of <see cref="ExcelPoolItem"/> object into the <see cref="ExcelPool"/>.
        /// </summary>
        /// <param name="tryCreateExcelPoolItem">A delegate for creating a collection of <see cref="ExcelPoolItem"/> objects via <paramref name="inputExcelDataQueries"/>.</param>
        /// <param name="inputExcelDataQueries">A collection of <see cref="IExcelDataQuery"/> objects used as input to construct a collection of <see cref="ExcelPoolItem"/> objects.</param>
        /// <returns>A <see cref="System.String"/> representation which contains a error message or the name of the object to insert together with some time stamp.</returns>
        public static IEnumerable <string> InsertObject(TryCreateExcelPoolItems tryCreateExcelPoolItem, IIdentifierStringDictionary <IExcelDataQuery> inputExcelDataQueries)
        {
            IEnumerable <ExcelPoolItem> values;
            string        errorMessage;
            List <string> output = new List <string>();

            if (tryCreateExcelPoolItem(inputExcelDataQueries, out values, out errorMessage) == false)
            {
                output.Add(errorMessage);
            }
            else
            {
                Add(values, output);
            }
            return(output);
        }
コード例 #5
0
ファイル: ExcelPool.cs プロジェクト: xiaodelea/dodoni.net
        /// <summary>Adds a specific <see cref="ExcelPoolItem"/> object into the <see cref="ExcelPool"/>.
        /// </summary>
        /// <param name="tryCreateExcelPoolItem">A delegate for creating a <see cref="ExcelPoolItem"/> object via <paramref name="inputExcelDataQueries"/>.</param>
        /// <param name="inputExcelDataQueries">A collection of <see cref="IExcelDataQuery"/> objects used as input to construct a <see cref="ExcelPoolItem"/> object.</param>
        /// <returns>A <see cref="System.String"/> representation which contains a error message or the name of the object to insert together with some time stamp.</returns>
        public static string InsertObject(TryCreateExcelPoolItem tryCreateExcelPoolItem, IIdentifierStringDictionary <IExcelDataQuery> inputExcelDataQueries)
        {
            ExcelPoolItem value;
            string        errorMessage;

            if (tryCreateExcelPoolItem(inputExcelDataQueries, out value, out errorMessage) == false)
            {
                return(errorMessage);
            }
            if (InsertObject(value) == ItemAddedState.Rejected)
            {
                return("Error! Object rejected, i.e. not added to the [Excel] pool.");
            }
            return(value.GetObjectNameWithTimeStamp());
        }