Пример #1
0
 public void ApplyRulesToCell(Form1.Position cellPosition, XLFunctions xlFunc, Range range, ColumnRules ruleList)
 {
     //TODO Evaluate if functions should be bool or just change to method
     if (ruleList.IsEmpty)
     {
         CheckIfEmpty(range.Value2, cellPosition);
     }
     if (ruleList.CheckLength)
     {
         CheckLength(cell: range.Value, pos: cellPosition, length: ruleList.Length);
     }
     if (ruleList.ContainsSpaces)
     {
         CheckForSpaces(range.Value, cellPosition);
     }
     if (ruleList.ContainsNumber)
     {
         CheckForNumbers(range.Value, cellPosition);
     }
     if (ruleList.AllowValuesEnabled)
     {
         CheckIfListEqual(range.Value, cellPosition, ruleList.AllowedValuesArray);
     }
     if (ruleList.ContainsNonAlpha)
     {
         CheckForNonAlpha(range.Value, cellPosition);
     }
     if (ruleList.ContainsLetters)
     {
         CheckForLetter(range.Value, cellPosition);
     }
     if (ruleList.CheckMustBeginWith)
     {
         CheckBeginsWith(range.Value, cellPosition, ruleList.MustBeginWith);
     }
     if (ruleList.CheckMustEndWith)
     {
         CheckEndsWith(range.Value, cellPosition, ruleList.MustEndWith);
     }
     if (ruleList.ChangeCaseEnabled)
     {
         range.Value2 = xlFunc.ChangeCase(range.Value, ruleList.ChangeCaseType);
     }
     if (ruleList.TrimCell)
     {
         range.Value = xlFunc.TrimCell(range.Value);
     }
     if (ruleList.ReverseData)
     {
         range.Value = xlFunc.ReverseCell(range.Value);
     }
     if (ruleList.CheckMoreThan)
     {
         CheckNumber(range.Value, cellPosition, ruleList.MoreThanValue, true);
     }
     if (ruleList.CheckLessThan)
     {
         CheckNumber(range.Value, cellPosition, ruleList.LessThanValue, false);
     }
 }
Пример #2
0
    public void UpdateProgressInfo(int row, int column, Stopwatch stopwatch, XLFunctions xlFunc, int errorNumbers)
    {
        RowCheckLabel.Text    = $@"Row:{row}";
        ColumnCheckLabel.Text = $@"Column:{column}";
        UpdateProgressBar(row, column);
        ErrorsFoundLabel.Text = $@"Errors Found:{errorNumbers}";
        var    time   = TimeSpan.FromMilliseconds(stopwatch.ElapsedMilliseconds);
        string answer = $"{time.Hours:D2}h:{time.Minutes:D2}m:{time.Seconds:D2}s";

        ElapsedLabel.Text      = $@"Time Elapsed:{answer}";
        FunctionsRunLabel.Text = $@"Functions Run:{xlFunc.FunctionCallCount.ToString()}";
        Application.DoEvents();
    }