Esempio n. 1
0
        public void TopRule()
        {
            var rule = new TopRule();
            IList <RuleProblem> problems;
            string sql;

            sql      = "SELECT TOP(10) * FROM abc";
            problems = _engine.RunRules(sql, GetRuleRequest(Constants.Namespace, Constants.TopRuleId));
            Assert.AreEqual(0, problems.Count);

            sql      = "SELECT TOP 10 * FROM abc";
            problems = _engine.RunRules(sql, GetRuleRequest(Constants.Namespace, Constants.TopRuleId));
            Assert.AreEqual(1, problems.Count);
        }
        private void AddTotalPriceRule(Worksheet sheet)
        {
            ConditionalFormattingDxfRule totalPriceRule = null;

            switch (this.SelectedPriceFilter)
            {
            case PriceFilter.Bottom:
                totalPriceRule = new BottomRule(ConditionalFormattingUnit.Items, this.PriceRank);
                break;

            case PriceFilter.Top:
                totalPriceRule = new TopRule(ConditionalFormattingUnit.Items, this.PriceRank);
                break;
            }

            totalPriceRule.Formatting = new DifferentialFormatting();
            ThemableColor fillColor = new ThemableColor(Telerik.Documents.Media.Color.FromArgb(255, 255, 199, 206));
            ThemableColor foreColor = new ThemableColor(Telerik.Documents.Media.Color.FromArgb(255, 156, 0, 6));

            totalPriceRule.Formatting.ForeColor = foreColor;
            totalPriceRule.Formatting.Fill      = new PatternFill(PatternType.Solid, fillColor, fillColor);

            sheet.Cells[3, 4, 48, 4].AddConditionalFormatting(new Telerik.Windows.Documents.Spreadsheet.Model.ConditionalFormatting(totalPriceRule));
        }