Exemple #1
0
        //Клонинг конструктор когато стойността е различна от Null
        public Step Clone()
        {
            Step newStep = new Step();

            newStep.Highlight = Highlight;
            newStep.Message   = Message;
            newStep.Command   = Command;


            if (AttachNames != null)
            {
                newStep.AttachNames = AttachNames.ToList <string>();
            }
            if (AttachTo != null)
            {
                newStep.AttachTo = AttachTo.ToList <int>();
            }
            if (Rows != null)
            {
                newStep.Rows = Rows.ToList <int>();
            }
            if (VariableNames != null)
            {
                newStep.VariableNames = VariableNames.ToList <string>();
            }
            if (VariableIndexes != null)
            {
                newStep.VariableIndexes = VariableIndexes.ToList <int>();
            }
            if (Values != null)
            {
                newStep.Values = Values.ToList <string>();
            }
            if (HighlightenedBlockIndexes != null)
            {
                newStep.HighlightenedBlockIndexes = HighlightenedBlockIndexes.ToList <int>();
            }
            if (HighlightenedLabelIndexes != null)
            {
                newStep.HighlightenedLabelIndexes = HighlightenedLabelIndexes.ToList <int>();
            }
            if (HighlightedTableIndexes != null)
            {
                newStep.HighlightedTableIndexes = HighlightedTableIndexes.ToList <int>();
            }
            newStep.Swit                  = Swit;
            newStep.Delimiter             = Delimiter;
            newStep.UsedelimForUpdateInit = UsedelimForUpdateInit;
            return(newStep);
        }
Exemple #2
0
        /// <summary>
        /// Find and return a from and to clause in a variable.
        /// </summary>
        /// <param name="from"></param>
        /// <param name="to"></param>
        protected void FindFromTo(out string from, out string to)
        {
            // Find the first aggregation column.
            var firstAggregatedVariableName = VariableNames.ToList().Find(var => var.Contains(" from "));

            if (firstAggregatedVariableName == null)
            {
                throw new Exception("A report 'group by' can only be specified if there is at least one temporal aggregated column.");
            }

            var pattern = @".+from\W(?<from>.+)\Wto\W(?<to>.+)\Was\W.+";
            var regEx   = new Regex(pattern);
            var match   = regEx.Match(firstAggregatedVariableName);

            if (!match.Success)
            {
                throw new Exception($"Invalid format for report agregation variable {firstAggregatedVariableName}");
            }
            from = match.Groups["from"].Value;
            to   = match.Groups["to"].Value;
        }