当前位置: 首页>>代码示例>>C#>>正文


C# TValidationControlsDict.ContainsKey方法代码示例

本文整理汇总了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;
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:43,代码来源:Common.Import.cs

示例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;
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:36,代码来源:Gift.Importing.cs

示例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;
            }
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:32,代码来源:Gift.Importing.cs

示例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;
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:31,代码来源:Gift.Importing.cs

示例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");
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:19,代码来源:Gift.Importing.cs

示例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;
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:19,代码来源:Gift.Importing.cs

示例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;
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:49,代码来源:Common.Import.cs


注:本文中的TValidationControlsDict.ContainsKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。