/// <summary>
 /// Merge data object with this list.
 /// Only objects that are not already in the list
 /// are added to the list.
 /// </summary>
 /// <param name='data'>The data to merge.</param>
 public void Merge(WebFactor data)
 {
     if (data.IsNotNull() && _idHashTable[data.Id].IsNull())
     {
         Add(data);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Create a WebFactorTreeNode instance.
 /// </summary>
 /// <param name='dataReader'>An open data reader.</param>
 public WebFactorTreeNode(DataReader dataReader)
 {
     Id       = dataReader.GetInt32(FactorData.ID);
     Factor   = new WebFactor(dataReader);
     Children = new List <WebFactorTreeNode>();
     _parents = new List <WebFactorTreeNode>();
     base.LoadData(dataReader);
 }
Beispiel #3
0
        /// <summary>
        /// Get information about all factor trees.
        /// Only factors that are in the factor cache are returned.
        /// This is done in order to avoid problem where cached
        /// factor data differ from factor data in database.
        /// </summary>
        /// <param name="context">Web service request context.</param>
        /// <param name="factors">Factor list where factors are added.</param>
        /// <param name="factorTreeNodes">All factor tree nodes.</param>
        /// <param name="dataReader">An open DataReader with information about factors.</param>
        private static void GetFactors(WebServiceContext context,
                                       List <WebFactor> factors,
                                       WebFactorTreeNodeList factorTreeNodes,
                                       DataReader dataReader)
        {
            WebFactor factor;

            while (dataReader.Read())
            {
                factor = new WebFactor(dataReader);
                if (factorTreeNodes.Contains(factor.Id))
                {
                    factors.Add(factorTreeNodes.Get(factor.Id).Factor);
                }
            }
        }