Hi guys,
Basically, there is a system at my work place that provides OCR capabilities. The process is that, a third party application is configured to display a captured screen (during the OCR process) and a user sits at the pc making sure the captured data is correct.
This capture stage has validation on each of the fields. for example if the document is an invoice for a specific client, the supplier of the invoice is verified against reference data. The verification code is in the form of a compiled .net dll that is generated by myself, from a visual studio 2008 solution.
The third party interfaces are used in communicating between the capture form and the code I write. An example is;
#region GetLinesTotal
/// <summary>
/// Gets the total for e.g. all VAT lines from the table
/// </summary>
/// <param name="oCSM">ITisClientServicesModule</param>
/// <param name="oTab">field table object</param>
/// <param name="fieldName">partial fieldname of table field (without the $XXXX)/param>
/// <returns>total as a string, empty string if all values empty</returns>
public static string GetLinesTotal(ITisClientServicesModule oCSM,ITisFieldTableData oTab, string fieldName )
{
string sLineTot = string.Empty;
ErrHandling.TryInit(oCSM);
string sFunction = "GetLinesTotal";
try
{
decimal dTot = 0m;
string sTemp = string.Empty;
for (int i = 0; i< oTab.NumberOfRepetitions;i++)
{
sTemp = Utils.GetFieldCont(oTab.ParentForm,fieldName + "$" + i.ToString("X").PadLeft(4,'0')).Trim();
if (sTemp != string.Empty)
{
dTot += Convert.ToDecimal(sTemp);
sLineTot = dTot.ToString();
}
}
}
catch (Exception ex)
{
ErrHandling.errHandler.LogMsg(ex.ToString(),sFunction,CLASS_NAME,TIS_SEVERITY.TIS_ERROR);
sLineTot = "INVALID";
}
return sLineTot;
}
#endregion GetLinesTotal
What I wish to do, is to create a layer of abstraction, removing the 3rd party interfaces from this code (separating the concerns), which will allow for easier testing (TDD) etc.
I am new to these approaches, and I apologise if I have made any wrong assumptions. I was just wondering if I could get some advice on how to go forward with the code. At some point we(the company) may chose to go with a different 3rd party OCR application.
Thanks in advance