本文整理汇总了C#中TValidationControlsDict.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# TValidationControlsDict.ContainsKey方法的具体用法?C# TValidationControlsDict.ContainsKey怎么用?C# TValidationControlsDict.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TValidationControlsDict
的用法示例。
在下文中一共展示了TValidationControlsDict.ContainsKey方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImportString
/// <summary>
/// Imports a string value from the specified text line using the specified delimiter
/// </summary>
/// <param name="AImportLine">The line containing the text to be imported. When the method returns the imported value
/// will have been removed from the start ready for the next call to an Import method.</param>
/// <param name="ADelimiter">The delimiter</param>
/// <param name="AColumnTitle"></param>
/// <param name="ADataColumn"></param>
/// <param name="ARowNumber"></param>
/// <param name="AMessages"></param>
/// <param name="AValidationColumnsDict"></param>
/// <param name="ATreatEmptyStringAsText">When true the return value will be the empty string. When false the return value will be null.</param>
/// <returns>The string value. The AImportLine parameter will have been clipped.</returns>
public static String ImportString(ref String AImportLine,
String ADelimiter,
String AColumnTitle,
DataColumn ADataColumn,
int ARowNumber,
TVerificationResultCollection AMessages,
TValidationControlsDict AValidationColumnsDict,
bool ATreatEmptyStringAsText = true)
{
if ((ADataColumn != null) && (AValidationColumnsDict != null) && !AValidationColumnsDict.ContainsKey(ADataColumn))
{
AValidationColumnsDict.Add(ADataColumn, new TValidationControlsData(null, AColumnTitle));
}
String sReturn = StringHelper.GetNextCSV(ref AImportLine, ADelimiter);
if ((sReturn == StringHelper.CSV_STRING_FORMAT_ERROR) && (AMessages != null))
{
AMessages.Add(new TVerificationResult(String.Format(MCommonConstants.StrParsingErrorInLineColumn, ARowNumber, AColumnTitle),
Catalog.GetString("Could not parse the quoted string. Did you forget a quotation mark?"),
TResultSeverity.Resv_Critical));
}
if ((sReturn.Length == 0) && !ATreatEmptyStringAsText)
{
return null;
}
return sReturn;
}
示例2: ImportDate
private DateTime ImportDate(String AColumnTitle,
DataColumn ADataColumn,
int ARowNumber,
TVerificationResultCollection AMessages,
TValidationControlsDict AValidationColumnsDict,
String ADefaultString = "")
{
if ((ADataColumn != null) && (AValidationColumnsDict != null) && !AValidationColumnsDict.ContainsKey(ADataColumn))
{
AValidationColumnsDict.Add(ADataColumn, new TValidationControlsData(null, AColumnTitle));
}
String sDate = StringHelper.GetNextCSV(ref FImportLine, FDelimiter);
if (sDate == String.Empty)
{
sDate = ADefaultString;
}
DateTime dtReturn;
try
{
dtReturn = Convert.ToDateTime(sDate, FCultureInfoDate);
}
catch (Exception)
{
AMessages.Add(new TVerificationResult(String.Format(MCommonConstants.StrParsingErrorInLineColumn, ARowNumber, AColumnTitle),
String.Format(Catalog.GetString("Cannot convert '{0}' to a date. Will assume a value of 'Today'."), sDate),
TResultSeverity.Resv_Critical));
TLogging.Log("Problem parsing " + sDate + " with format " + FCultureInfoDate.DateTimeFormat.ShortDatePattern);
return DateTime.Today;
}
return dtReturn;
}
示例3: ImportDecimal
private decimal ImportDecimal(String AColumnTitle,
DataColumn ADataColumn,
int ARowNumber,
TVerificationResultCollection AMessages,
TValidationControlsDict AValidationColumnsDict,
String ADefaultString = "")
{
if ((ADataColumn != null) && (AValidationColumnsDict != null) && !AValidationColumnsDict.ContainsKey(ADataColumn))
{
AValidationColumnsDict.Add(ADataColumn, new TValidationControlsData(null, AColumnTitle));
}
String sReturn = StringHelper.GetNextCSV(ref FImportLine, FDelimiter);
if (sReturn == String.Empty)
{
sReturn = ADefaultString;
}
try
{
decimal dec = Convert.ToDecimal(sReturn, FCultureInfoNumberFormat);
return dec;
}
catch
{
AMessages.Add(new TVerificationResult(String.Format(MCommonConstants.StrParsingErrorInLineColumn, ARowNumber, AColumnTitle),
String.Format(Catalog.GetString("Cannot convert '{0}' to a decimal number. Will assume a value of 1.00."), sReturn),
TResultSeverity.Resv_Critical));
return 1.0m;
}
}
示例4: ImportInt32
private Int32 ImportInt32(String AColumnTitle,
DataColumn ADataColumn,
int ARowNumber,
TVerificationResultCollection AMessages,
TValidationControlsDict AValidationColumnsDict,
String ADefaultString = "")
{
if ((ADataColumn != null) && (AValidationColumnsDict != null) && !AValidationColumnsDict.ContainsKey(ADataColumn))
{
AValidationColumnsDict.Add(ADataColumn, new TValidationControlsData(null, AColumnTitle));
}
String sReturn = StringHelper.GetNextCSV(ref FImportLine, FDelimiter);
if (sReturn == String.Empty)
{
sReturn = ADefaultString;
}
Int32 retVal;
if (Int32.TryParse(sReturn, out retVal))
{
return retVal;
}
AMessages.Add(new TVerificationResult(String.Format(MCommonConstants.StrParsingErrorInLineColumn, ARowNumber, AColumnTitle),
String.Format(Catalog.GetString("Cannot convert '{0}' to a number. Will assume a value of -1."), sReturn),
TResultSeverity.Resv_Critical));
return -1;
}
示例5: ImportBoolean
private Boolean ImportBoolean(String AColumnTitle,
DataColumn ADataColumn,
TValidationControlsDict AValidationColumnsDict,
String ADefaultString = "")
{
if ((ADataColumn != null) && (AValidationColumnsDict != null) && !AValidationColumnsDict.ContainsKey(ADataColumn))
{
AValidationColumnsDict.Add(ADataColumn, new TValidationControlsData(null, AColumnTitle));
}
String sReturn = StringHelper.GetNextCSV(ref FImportLine, FDelimiter);
if (sReturn == String.Empty)
{
sReturn = ADefaultString;
}
return sReturn.ToLower().Equals("yes");
}
示例6: ImportString
private String ImportString(String AColumnTitle,
DataColumn ADataColumn,
TValidationControlsDict AValidationColumnsDict,
bool ATreatEmptyStringAsText = true)
{
if ((ADataColumn != null) && (AValidationColumnsDict != null) && !AValidationColumnsDict.ContainsKey(ADataColumn))
{
AValidationColumnsDict.Add(ADataColumn, new TValidationControlsData(null, AColumnTitle));
}
String sReturn = StringHelper.GetNextCSV(ref FImportLine, FDelimiter);
if ((sReturn.Length == 0) && !ATreatEmptyStringAsText)
{
return null;
}
return sReturn;
}
示例7: ImportBoolean
/// <summary>
/// Imports a boolean value from the specified text line using the specified delimiter.
/// </summary>
/// <param name="AImportLine">The line containing the text to be imported. When the method returns the imported value
/// will have been removed from the start ready for the next call to an Import method.</param>
/// <param name="ADelimiter">The delimiter</param>
/// <param name="AColumnTitle"></param>
/// <param name="ADataColumn"></param>
/// <param name="ARowNumber"></param>
/// <param name="AMessages"></param>
/// <param name="AValidationColumnsDict"></param>
/// <param name="ADefaultString">A string to apply if the import returns empty text. Must be either 'yes' or 'no'</param>
/// <returns>Returns true if the text is 'yes', false if the text is 'no'. Otherwise the method returns a critical Verification Result.</returns>
public static Boolean ImportBoolean(ref String AImportLine,
String ADelimiter,
String AColumnTitle,
DataColumn ADataColumn,
int ARowNumber,
TVerificationResultCollection AMessages,
TValidationControlsDict AValidationColumnsDict,
String ADefaultString = "")
{
if ((ADataColumn != null) && (AValidationColumnsDict != null) && !AValidationColumnsDict.ContainsKey(ADataColumn))
{
AValidationColumnsDict.Add(ADataColumn, new TValidationControlsData(null, AColumnTitle));
}
String sReturn = StringHelper.GetNextCSV(ref AImportLine, ADelimiter).ToLower();
String sDefault = ADefaultString.ToLower();
bool canBeEmptyString = ((sDefault == "yes") || (sDefault == "no"));
if ((sReturn == String.Empty) && canBeEmptyString)
{
sReturn = sDefault;
}
if ((sReturn == "yes") || (sReturn == "no"))
{
return sReturn.Equals("yes");
}
AMessages.Add(new TVerificationResult(String.Format(MCommonConstants.StrParsingErrorInLineColumn, ARowNumber, AColumnTitle),
String.Format(Catalog.GetString("Cannot convert '{0}' to a Boolean. The text must be {1}. The text is not case-sensitive."),
sReturn,
canBeEmptyString ? Catalog.GetString("one of 'yes', 'no' or an empty string") : Catalog.GetString("either 'yes' or 'no'")),
TResultSeverity.Resv_Critical));
return false;
}