Moved group table and row parsing into a separate DLL to clean up the main binary a bit. Added custom engine to detect for bin counts and updated the record form to total the bins for the user automatically. Updated the .gitignore file to include the necessary DLLs for the projects.

This commit is contained in:
2017-07-02 20:59:33 -05:00
parent 12a6b36370
commit fd47690224
22 changed files with 878 additions and 727 deletions
+62 -4
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -9,7 +10,7 @@ namespace AdvertsingProfitControl
/// </summary>
internal static class TextFormat
{
private static readonly FrmLogConsole LogConsole = FrmLogConsole.GetStaticInstance;
//private static readonly FrmLogConsole LogConsole = FrmLogConsole.GetStaticInstance;
/// <summary>
/// Formats an ad item's name / text into a standard format so as to help reduce redundancy in the database.
@@ -248,8 +249,7 @@ namespace AdvertsingProfitControl
/// <param name="abbreviations">A list of abbreviations that were found in the text.</param>
/// <param name="words">A list of words found in the text.</param>
/// <param name="preserveAcronyms">Whether or not to force normal casing rules on abbreviations.</param>
private static void BuildAbbreviationsAndWordsLists(string adItemText, int startingIndex, out List<string> abbreviations,
out List<string> words, bool preserveAcronyms = false)
private static void BuildAbbreviationsAndWordsLists(string adItemText, int startingIndex, out List<string> abbreviations, out List<string> words, bool preserveAcronyms = false)
{
abbreviations = new List<string>();
words = new List<string>();
@@ -340,6 +340,64 @@ namespace AdvertsingProfitControl
return isWord;
}
public static bool TryParseBinCount(string inputText, out double binCount, out string binCountString)
{
if (inputText.Length == 0)
{
binCountString = string.Empty;
binCount = 0;
return false;
}
var success = false;
binCountString = string.Empty;
var number = new StringBuilder();
var binString = new StringBuilder(); //
var characterReached = false;
for (var i = 0; i < inputText.Length; i++)
{
if (char.IsNumber(inputText[i]) && !characterReached)
{
number.Append(inputText[i]);
continue;
}
if (inputText[i] == '-' || inputText[i] == '.')
{
number.Append(inputText[i]);
continue;
}
if (!char.IsLetter(inputText[i])) continue;
binString.Append(inputText[i]);
characterReached = true;
}
if (number.ToString() == string.Empty)
{
binCount = 0;
return false;
}
if (double.TryParse(number.ToString(), out binCount))
{
if (binString.ToString().Equals("bin", StringComparison.InvariantCultureIgnoreCase) ||
binString.ToString().Equals("bins", StringComparison.InvariantCultureIgnoreCase))
{
if (binCount < 1 || binCount > 1)
{
binCountString = binCount + " Bins";
}
else
{
binCountString = "1 Bin";
}
success = true;
}
}
return success;
}
/// <summary>
/// Capitalizes the first letter of the text sent to this method.
/// </summary>