Exemplo n.º 1
0
        private static Dictionary <string, ClassificationItem> ProcessJKSO(CostModel model, TeSoupis soupis)
        {
            var result = new Dictionary <string, ClassificationItem>();
            var items  = (soupis.STAVBA ?? new List <TStavba>())
                         .SelectMany(s => s.OBJEKT ?? new List <TObjekt>())
                         .Where(o => !string.IsNullOrWhiteSpace(o.CisloJKSO))
                         .Select(o => new { Nazev = o.NazevJKSO, Cislo = o.CisloJKSO })
                         .ToList();

            if (!items.Any())
            {
                return(result);
            }

            var jkso = new Classification(model, "JKSO");

            items.ForEach(i => {
                if (result.ContainsKey(i.Cislo))
                {
                    return;
                }

                var j = new ClassificationItem(model)
                {
                    Name           = i.Nazev,
                    Identification = i.Cislo
                };

                jkso.Children.Add(j);
                result.Add(i.Cislo, j);
            });

            return(result);
        }
Exemplo n.º 2
0
        private static Dictionary <string, ClassificationItem> ConvertClassification(CostModel model, IEnumerable <TZatrideni> zatrideni, ClassificationItemCollection parent)
        {
            var result = new Dictionary <string, ClassificationItem>();

            foreach (var zatr in zatrideni)
            {
                // classification items model classification hierarchy (breakdown structure)
                // there might be several classifications in the model
                var item = new ClassificationItem(model)
                {
                    Sort           = zatr.Typ.ToString(),
                    Name           = zatr.Nazev,
                    Identification = zatr.Cislo,
                    Description    = zatr.ZPOPIS
                };

                // nested level of classification breakdown
                if (zatr.ZATRIDENI?.Any() == true)
                {
                    var children = ConvertClassification(model, zatr.ZATRIDENI, item.Children);
                    foreach (var ch in children)
                    {
                        result.Add(ch.Key, ch.Value);
                    }
                }

                // keep key in the lookup for later use
                if (!string.IsNullOrWhiteSpace(zatr.PolozkaZatrideniUID) && !result.ContainsKey(zatr.PolozkaZatrideniUID))
                {
                    result.Add(zatr.PolozkaZatrideniUID, item);
                }
            }
            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Update the exclusions based on the file type or extension
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void lbFileTypeExt_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (lbFileTypeExt.SelectedIndex != -1)
            {
                string contentType     = (string)lbFileTypeExt.SelectedItem;
                var    classifications = solutionSpellCheckItems.Where(s => s.ContentType == contentType).ToList();

                // Don't notify about change events when adding missing items as they may not end up being used
                solutionSpellCheckItems.ListChanged -= ClassificationItems_ListChanged;

                foreach (var r in Enum.GetValues(typeof(RangeClassification)))
                {
                    if ((RangeClassification)r != RangeClassification.Undefined &&
                        !classifications.Any(c => c.Classification == r.ToString()))
                    {
                        var c = new ClassificationItem
                        {
                            ContentType    = contentType,
                            Classification = r.ToString()
                        };

                        solutionSpellCheckItems.Add(c);
                        classifications.Add(c);
                    }
                }

                solutionSpellCheckItems.ListChanged += ClassificationItems_ListChanged;

                lbExtClassifications.ItemsSource = classifications.OrderBy(c => c.Classification);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 ///     Equalses the specified other.
 /// </summary>
 /// <param name="other">The other.</param>
 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
 public bool Equals(ClassificationItem other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(other._score.Equals(_score) && Equals(other._value, _value) && Equals(other._id, _id) && Equals(other._classname, _classname));
 }