public List<TsIndexField> GetJobFieldList(int templateBatchId, TsCallbackHelper callBackHelper, bool writeBlob = false) { var fieldListBlob = string.Empty; var fieldList = new List<TsIndexField>(); try { // Call back to get the field info from TS var i = callBackHelper.GetFieldList(ref fieldListBlob); if (writeBlob) { var blobPath = "C:\\Temp"; if (!Directory.Exists(blobPath)) { Directory.CreateDirectory(blobPath); } File.WriteAllText(Path.Combine(blobPath, "Blob_FieldList.ini"), fieldListBlob); } // Get the field info from TS DB var tsDbFields = GetTsDbFields(templateBatchId); if (i > 0) { var iNumFields = TsMemFiles.GetInt("Index", "NumOfFields", 0, fieldListBlob); for (var iField = 1; iField <= iNumFields; iField++) { var field = new TsIndexField(); field.FieldName = TsMemFiles.GetString("Field" + iField, "FieldName", string.Empty, fieldListBlob); field.FieldType = TsMemFiles.GetInt("Field" + iField, "FieldType", 0, fieldListBlob); field.FieldLength = TsMemFiles.GetInt("Field" + iField, "FieldLength", 0, fieldListBlob); field.RequiredField = TsMemFiles.GetInt("Field" + iField, "RequiredField", 0, fieldListBlob); field.VerifyField = TsMemFiles.GetInt("Field" + iField, "VerifyField", 0, fieldListBlob); field.LevelMask = TsMemFiles.GetInt("Field" + iField, "LevelMask", 0, fieldListBlob); // Try to get the field order var tsDbField = tsDbFields.FirstOrDefault(f => f.FieldId == iField); if (tsDbField != null) { field.Order = TsMemFiles.GetInt("Values", "Order", 0, tsDbField.Options); } fieldList.Add(field); } fieldList.Sort((x, y) => x.Order.CompareTo(y.Order)); } } catch (Exception) { throw; } return fieldList; }
public static int SetTsFieldValue(string fieldName, string fieldValue, TsCallbackHelper tsCallBackHelper) { int i = 0; try { string blobSettings = string.Empty; TsMemFiles.SetString("Lookup Command", "Function", "103", ref blobSettings); TsMemFiles.SetString("Lookup Command", "Control", string.Empty, ref blobSettings); TsMemFiles.SetString("Field Data", fieldName, fieldValue, ref blobSettings); TsMemFiles.SetString("Field Confidence", fieldName, Convert.ToString(SetConfidenceForField(fieldValue, 95)), ref blobSettings); i = tsCallBackHelper.SetCustom(ref blobSettings); } catch (Exception ex) { MessageBox.Show("Error in SetTSFieldValue: " + ex.Message); } return i; }
public static void SetTsFieldFocus(string fieldName, TsCallbackHelper tsCallBackHelper) { try { string blobSettings = ""; int i = 0; // Set focus to field TsMemFiles.SetString("Lookup Command", "Function", "102", ref blobSettings); TsMemFiles.SetString("Lookup Command", "Control", string.Empty, ref blobSettings); TsMemFiles.SetString("Lookup Command", "Action", "102", ref blobSettings); TsMemFiles.SetString("Group Fields", fieldName, "1", ref blobSettings); i = tsCallBackHelper.SetCustom(ref blobSettings); } catch (Exception ex) { MessageBox.Show("Error in SetTSFieldFocus: " + ex.Message); } }