public IDataTableComparision Columns(IEnumerable <ICompareColumnInfo> columns)
        {
            if (columns != null)
            {
                CompareColumns.AddRange(columns);
            }

            return(this);
        }
        public ICompareColumnInfo Column(string columnName)
        {
            Guard.ArgumentIsNotNull(columnName, nameof(columnName));

            if (!Table.Columns.Contains(columnName))
            {
                throw new ArgumentException($"Column {columnName} is not found in Table.");
            }

            return(CompareColumns.Add(columnName, null));
        }
Example #3
0
        private static void Main(string[] args)
        {
            //Documents
            CompareDocumentsWithTables.WithTablesOnAppropriatePages();
            CompareDocumentsWithTables.WithTablesOnDefferentPages();
            CompareDocumentsWithTables.WithTablesWitchContainsDifferentCountOfColumns();
            CompareDocumentsWithTables.WithTablesWitchContainsDifferentCountOfColumnsAndDifferentCountOfRows();
            CompareDocumentsWithTables.WithTablesWitchContainsDifferentCountOfColumns();
            CompareDocumentsWithTables.WithTablesWitchContainsDifferentCountOfRows();

            CompareDocumentsWithText.WithTextOnAppropriatePages();
            CompareDocumentsWithText.WithTextOnDifferentPages();

            CompareDocumentsWithHyperlinks.WithIgnoreLinkSetting();
            CompareDocumentsWithHyperlinks.WithoutIgnoreLinkSetting();

            //Settings
            ComparisonWithDifferentSettings.CompareDocumentsWithComparisonDepthSetChars();
            ComparisonWithDifferentSettings.CompareDocumentsWithComparisonDepthSetWords();
            ComparisonWithDifferentSettings.CompareDocumentsWithGenerationSummaryPage();
            ComparisonWithDifferentSettings.CompareDocumentsWithOutGenerationSummaryPage();
            ComparisonWithDifferentSettings.CompareDocumentsWithOutShowDeletedContent();
            ComparisonWithDifferentSettings.CompareDocumentsWithShowDeletedContent();
            ComparisonWithDifferentSettings.CompareDocumentsWithWordsSepCharsSetSpace();
            ComparisonWithDifferentSettings.CompareDocumentsWithSettingStylesOnDelInsComponents();

            //Components
            CompareParagraphs.CompareParagraphsFromDifferentDocuments();
            CompareParagraphs.CompareParagraphFromDocumentWithCreatingParagraph();
            CompareParagraphs.CompareTwoCreatingParagraphs();

            CompareRows.CompareRowsFromDifferentDocuments();
            CompareRows.CompareRowFromDocumentWithCreatingRow();
            CompareRows.CompareTwoCreatingRows();

            CompareColumns.CompareColumnFromDocumentWithCreatingColumn();
            CompareColumns.CompareColumnsFromDifferentDocuments();
            CompareColumns.CompareTwoCreatingColumns();

            CompareCells.CompareCellFromDocumentWithCreatingCell();
            CompareCells.CompareCellsFromDifferentDocuments();
            CompareCells.CompareTwoCreatingCells();

            CompareTables.CompareTableFromDocumentWithCreatingTable();
            CompareTables.CompareTablesFromDifferentDocuments();
            CompareTables.CompareTwoCreatingTables();

            //Console.ReadKey();
        }
        public string GetJsonColumns()
        {
            StringBuilder oReturn = new StringBuilder();

            oReturn.Append("[");

            CompareColumns.All(col =>
            {
                oReturn.Append("{" +
                               MarketPlace.Models.General.Constants.C_Program_Compare_ColumnItem.
                               Replace("{Width}", "'380px'").
                               Replace("{Field}", "'_" + col + "'").
                               Replace("{HeaderTemplate}", "Compare_DetailObject.GetHeaderTemplate('" + col + "')").
                               Replace("{Template}", "Compare_DetailObject.GetItemTemplate('" + col + "')").
                               Replace("{Locked}", "false") +
                               "},");
                return(true);
            });

            return(oReturn.ToString().Trim().TrimEnd(new char[] { ',' }) + "]");
        }
        public virtual IComparisionResult Execute()
        {
            if (Table == CompareTable)
            {
                return(null);
            }
            Validate();

            if (CompareColumns.Count <= 0)
            {
                for (var i = 0; i < Table.Columns.Count && i < CompareTable.Columns.Count; i++)
                {
                    CompareColumns.Add(Table.Columns[i].ColumnName, CompareTable.Columns[i].ColumnName);
                }
            }

            if (CompareKeys.Count > 0)
            {
                return(CompareWithPrimaryKeys());
            }
            return(CompareWithColumns());
        }
Example #6
0
        private static void Main(string[] args)
        {
            //Components
            CompareSlides.CompareSlidesFromDifferentPresentations();
            CompareSlides.CompareSlidesFromOnePresentations();
            CompareSlides.CompareSlideFromPresentationsWithCreatingSlide();
            CompareSlides.CompareTwoCreatingSlides();

            CompareCells.CompareCellsFromDifferentPresentations();
            CompareCells.CompareCellsFromOnePresentations();
            CompareCells.CompareCellFromPresentationsWithCreatingCell();
            CompareCells.CompareTwoCreatingCells();

            CompareParagraphs.CompareParagraphFromPresentationsWithCreatingParagraph();
            CompareParagraphs.CompareParagraphsFromDifferentPresentations();
            CompareParagraphs.CompareParagraphsFromOnePresentations();
            CompareParagraphs.CompareTwoCreatingParagraphs();

            CompareAutoShapes.CompareAutoShapeFromPresentationsWithCreatingAutoShape();
            CompareAutoShapes.CompareAutoShapesFromDifferentPresentations();
            CompareAutoShapes.CompareAutoShapesFromOnePresentations();
            CompareAutoShapes.CompareTwoCreatingAutoShapes();

            CompareTables.CompareTableFromPresentationsWithCreatingTable();
            CompareTables.CompareTablesFromDifferentPresentations();
            CompareTables.CompareTablesFromOnePresentations();
            CompareTables.CompareTwoCreatingTables();

            CompareRows.CompareRowFromPresentationsWithCreatingRow();
            CompareRows.CompareRowsFromDifferentPresentations();
            CompareRows.CompareRowsFromOnePresentations();
            CompareRows.CompareTwoCreatingRows();

            CompareColumns.CompareColumnFromPresentationsWithCreatingColumn();
            CompareColumns.CompareColumnsFromDifferentPresentations();
            CompareColumns.CompareColumnsFromOnePresentations();
            CompareColumns.CompareTwoCreatingColumns();

            // Presentations
            ComparePresentationsWithAutoShapes.ComparePresentationsWithAutoShapesOnAppropriateSlides();
            ComparePresentationsWithAutoShapes.ComparePresentationsWithAutoShapesOnDifferentSlides();

            ComparePresentationsWithTables.ComparePresentationsWithTablesOnAppropriateSlides();
            ComparePresentationsWithTables.ComparePresentationsWithTablesOnDifferentSlides();
            ComparePresentationsWithTables.ComparePresentationsWithTablesWitchConyainsDifferentCountOfRows();
            ComparePresentationsWithTables.ComparePresentationsWithTablesWitchConyainsDifferentCountOfColumns();
            ComparePresentationsWithTables
            .ComparePresentationsWithTablesWitchConyainsDifferentCountOfColumnsAndDifferentCountOfRows();

            //Settings
            ComparisonWithDifferentSettings.ComparePresentationsWithComparisonDepthSetChars();
            ComparisonWithDifferentSettings.ComparePresentationsWithComparisonDepthSetWords();
            ComparisonWithDifferentSettings.ComparePresentationsWithGenerationSummaryPage();
            ComparisonWithDifferentSettings.ComparePresentationsWithOutGenerationSummaryPage();
            ComparisonWithDifferentSettings.ComparePresentationsWithOutShowDeletedContent();
            ComparisonWithDifferentSettings.ComparePresentationsWithShowDeletedContent();
            ComparisonWithDifferentSettings.ComparePresentationsWithWordsSepCharsSetSpace();
            ComparisonWithDifferentSettings.ComparePresentationsWithSettingStylesOnDelInsComponents();

            //Console.ReadKey();
        }
        public string GetJsonDataFinancial(ProveedoresOnLine.Company.Models.Util.GenericItemModel RelatedAccount)
        {
            StringBuilder oReturn = new StringBuilder();

            MarketPlace.Models.Company.CompanyUtil.FinancialAccount.
            Where(ac =>
                  RelatedAccount != null ?
                  (ac.ParentItem != null && ac.ParentItem.ItemId == RelatedAccount.ItemId) :
                  (ac.ParentItem == null)).
            OrderBy(ac => ac.ItemInfo.
                    Where(aci => aci.ItemInfoType.ItemId == (int)MarketPlace.Models.General.enumCategoryInfoType.AI_Order).
                    Select(aci => Convert.ToInt32(aci.Value)).
                    DefaultIfEmpty(0).
                    FirstOrDefault()).
            All(ac =>
            {
                #region Get Account Values

                //get account type
                string strAccountType = ac.ItemInfo.
                                        Where(y => y.ItemInfoType.ItemId == (int)MarketPlace.Models.General.enumCategoryInfoType.AI_IsValue).
                                        Select(y => y.Value.Replace(" ", "")).
                                        DefaultIfEmpty("2").
                                        FirstOrDefault();

                //get account unit
                string oAccountUnit = ac.ItemInfo.
                                      Where(y => y.ItemInfoType.ItemId == (int)MarketPlace.Models.General.enumCategoryInfoType.AI_Unit).
                                      Select(y => y.Value.Replace(" ", "")).
                                      DefaultIfEmpty(string.Empty).
                                      FirstOrDefault();

                #endregion

                if (strAccountType != "2")
                {
                    //get child values
                    oReturn.AppendLine(GetJsonDataFinancial(ac));
                }

                oReturn.Append("{");

                #region Item data

                CompareColumns.All(col =>
                {
                    if (col == "EvaluationArea")
                    {
                        oReturn.Append("EvaluationArea:{" +
                                       MarketPlace.Models.General.Constants.C_Program_Compare_Value_EvaluationArea.
                                       Replace("{Name}", "'" + ac.ItemName + "'").
                                       Replace("{Type}", "'" + strAccountType + "'") +
                                       "},");
                    }
                    else if (col != "EvaluationArea" && RelatedCompare.RelatedProvider != null)
                    {
                        //get currency rate
                        int oCurrencyFrom = RelatedCompare.RelatedProvider.
                                            Where(rp => rp.RelatedCompany != null &&
                                                  rp.RelatedCompany.CompanyPublicId == col &&
                                                  rp.CompareDetail != null &&
                                                  rp.CompareDetail.Count > 0).
                                            Select(rp => rp.CompareDetail.
                                                   Where(cd => cd.EvaluationAreaId == ac.ItemId &&
                                                         !string.IsNullOrEmpty(cd.Currency)).
                                                   Select(cd => Convert.ToInt32(cd.Currency)).
                                                   FirstOrDefault()).
                                            FirstOrDefault();

                        decimal CurrencyRate = GetCurrencyRateCaching
                                                   (oCurrencyFrom, CompareCurrency, Year == null ? DateTime.Now.Year : Year.Value);

                        //get company values
                        List <Tuple <int, string, string> > lstValItem = RelatedCompare.RelatedProvider.
                                                                         Where(rp => rp.RelatedCompany != null &&
                                                                               rp.RelatedCompany.CompanyPublicId == col &&
                                                                               rp.CompareDetail != null &&
                                                                               rp.CompareDetail.Count > 0).
                                                                         Select(rp => rp.CompareDetail.
                                                                                Where(cd => cd.EvaluationAreaId == ac.ItemId &&
                                                                                      cd.Value != null &&
                                                                                      cd.Value.Count > 0).
                                                                                Select(cd => cd.Value).
                                                                                FirstOrDefault()).
                                                                         FirstOrDefault();

                        oReturn.Append("_" + col + ":{");

                        for (int i = 1; i <= MaxValueCount; i++)
                        {
                            //get current value
                            Tuple <int, string, string> ValItem = null;
                            if (lstValItem != null && lstValItem.Count > 0)
                            {
                                ValItem = lstValItem.Where(vi => vi.Item1 == i).FirstOrDefault();
                            }
                            oReturn.Append(MarketPlace.Models.General.Constants.C_Program_Compare_Value_Item.
                                           Replace("{i}", i.ToString()).
                                           Replace("{Value}", "'" + (ValItem != null ? (oAccountUnit != "$" ? ValItem.Item2 : GetDecimalCurrency(ValItem.Item2, CurrencyRate)) : (strAccountType == "2" ? " - " : "0")) + "'").
                                           Replace("{After}", "'" + (oAccountUnit == "$" ? string.Empty : (ValItem != null ? ValItem.Item3 : string.Empty)) + "'").
                                           Replace("{Before}", "'" + (oAccountUnit != "$" ? string.Empty : (ValItem != null ? ValItem.Item3 : string.Empty)) + "'"));
                        }

                        oReturn.Append("},");
                    }
                    return(true);
                });

                #endregion

                oReturn.Append("},");

                if (strAccountType == "2")
                {
                    //get child values
                    oReturn.Append(GetJsonDataFinancial(ac));
                }

                return(true);
            });

            return(oReturn.ToString());
        }
        private string GetJsonDataCertifications()
        {
            StringBuilder oReturn = new StringBuilder();

            if (RelatedCompare.RelatedProvider != null && RelatedCompare.RelatedProvider.Count > 0)
            {
                //get all economic activity to eval
                List <ProveedoresOnLine.Company.Models.Util.GenericItemModel> olstEvaluationArea =
                    new List <ProveedoresOnLine.Company.Models.Util.GenericItemModel>();

                RelatedCompare.RelatedProvider.FirstOrDefault().CompareDetail.All(cd =>
                {
                    olstEvaluationArea.Add(new ProveedoresOnLine.Company.Models.Util.GenericItemModel()
                    {
                        ItemId   = cd.EvaluationAreaId,
                        ItemName = cd.EvaluationAreaName,
                    });

                    return(true);
                });
                olstEvaluationArea = olstEvaluationArea.OrderBy(x => x.ItemName).ToList();

                //get all compare detail items
                olstEvaluationArea.All(ea =>
                {
                    oReturn.Append("{");

                    #region ItemData

                    CompareColumns.All(col =>
                    {
                        if (col == "EvaluationArea")
                        {
                            oReturn.Append("EvaluationArea:{" +
                                           MarketPlace.Models.General.Constants.C_Program_Compare_Value_EvaluationArea.
                                           Replace("{Name}", "'" + ea.ItemName + "'").
                                           Replace("{Type}", "'0'") +
                                           "},");
                        }
                        else if (col != "EvaluationArea" && RelatedCompare.RelatedProvider != null)
                        {
                            //get company values
                            List <Tuple <int, string, string> > lstValItem = RelatedCompare.RelatedProvider.
                                                                             Where(rp => rp.RelatedCompany != null &&
                                                                                   rp.RelatedCompany.CompanyPublicId == col &&
                                                                                   rp.CompareDetail != null &&
                                                                                   rp.CompareDetail.Count > 0).
                                                                             Select(rp => rp.CompareDetail.
                                                                                    Where(cd => cd.EvaluationAreaId == ea.ItemId &&
                                                                                          cd.Value != null &&
                                                                                          cd.Value.Count > 0).
                                                                                    Select(cd => cd.Value).
                                                                                    FirstOrDefault()).
                                                                             FirstOrDefault();

                            oReturn.Append("_" + col + ":{");

                            for (int i = 1; i <= MaxValueCount; i++)
                            {
                                //get current value
                                Tuple <int, string, string> ValItem = null;
                                if (lstValItem != null && lstValItem.Count > 0)
                                {
                                    ValItem = lstValItem.Where(vi => vi.Item1 == i).FirstOrDefault();
                                }
                                oReturn.Append(MarketPlace.Models.General.Constants.C_Program_Compare_Value_Item.
                                               Replace("{i}", i.ToString()).
                                               Replace("{Value}", "'" + (ValItem != null ? ValItem.Item2 : "0") + "'").
                                               Replace("{After}", "'" + string.Empty + "'").
                                               Replace("{Before}", "'" + ValItem.Item3 + "'"));
                            }
                            oReturn.Append("},");
                        }

                        return(true);
                    });

                    #endregion

                    oReturn.Append("},");

                    return(true);
                });
            }

            return(oReturn.ToString().Trim().TrimEnd(new char[] { ',' }));
        }