/// --------------------------------------------------------------------------------
        /// <summary>
        /// Expose the DetectDifferencesInListOfStTexts for testing.
        /// </summary>
        /// <param name="stTextsCurr"></param>
        /// <param name="stTextsRev"></param>
        /// --------------------------------------------------------------------------------
        new public void DetectDifferencesInListOfStTexts(List <IStText> stTextsCurr, List <IStText> stTextsRev)
        {
            // init our cluster differences list
            ClusterDiffs = new List <Difference>();

            base.DetectDifferencesInListOfStTexts(stTextsCurr, stTextsRev);

            // copy differences to the master list, where it's easy to verify them
            Differences.Clear();
            Differences.AddRange(ClusterDiffs);
        }
        private void CompareWithCustomComparer(object object1,
                                               object object2,
                                               string breadCrumb,
                                               Type t1,
                                               Delegate customComparer)
        {
            if (TypesToIgnore.Contains(t1))
            {
                return;
            }

            CustomComparerDelegateWithDifferenceRecording customComparerDelegateWithDifferenceRecording = customComparer as CustomComparerDelegateWithDifferenceRecording;
            CustomComparerDelegate customComparerDelegate = customComparer as CustomComparerDelegate;

            if (customComparerDelegateWithDifferenceRecording != null)
            {
                // Compare with a custom comparator
                List <string> differences = customComparerDelegateWithDifferenceRecording.Invoke(object1, object2);
                if (differences.Count > 0)
                {
                    Differences.AddRange(differences);
                }
            }
            else
            {
                if (customComparerDelegate != null)
                {
                    // Compare with a custom comparator
                    if (!customComparerDelegate.Invoke(object1, object2))
                    {
                        Differences.Add(string.Format("object1{0} != object2{0} ({1},{2})", breadCrumb, object1, object2));
                    }
                }
                else
                {
                    throw new InvalidOperationException("Bad custom comparer specified.");
                }
            }

            if (Differences.Count >= MaxDifferences)
            {
                return;
            }
        }
Exemple #3
0
        public void GetGetDifferenceInventoryLines(object parameter)
        {
            var selectedinventory = (InventoryModel)parameter;

            if (selectedinventory == null)
            {
                return;
            }

            using (var db = new PetaPoco.Database("db"))
            {
                try
                {
                    Differences.Clear();

                    Differences.AddRange(db.Fetch <DifferenceModel>("SELECT a.GTIN AS GTIN, a.ADesc AS ArtDesc, s.StorageName AS StorageName, a.ArticleId AS ArtId, il.Amt AS Amt, il.InventoryId AS InventoryId, il.InventoryLineId AS InventoryLineId FROM Articles a LEFT JOIN Storages s ON a.StorageId = s.StorageId LEFT JOIN InventoryLines il ON a.ArticleId = il.ArtId LEFT JOIN Inventories i ON i.InventoryId = il.InventoryId  WHERE (il.inventoryId = @0 OR il.inventoryId IS NULL) AND il.Amt <> 0 ORDER BY i.Dt "));
                }
                catch (Exception ex)
                {
                    MessageBox.Show(string.Format("Daten konnten nicht abgerufen werden:\n\n" + ex.Message), "Fehler");
                }
            }
        }