• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Verification.TScreenVerificationResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Ict.Common.Verification.TScreenVerificationResult的典型用法代码示例。如果您正苦于以下问题:C# TScreenVerificationResult类的具体用法?C# TScreenVerificationResult怎么用?C# TScreenVerificationResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TScreenVerificationResult类属于Ict.Common.Verification命名空间,在下文中一共展示了TScreenVerificationResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ValueMustNotBeNull

        /// <summary>
        /// Checks whether an Object is null.
        /// </summary>
        /// <param name="AValue">The Object to check.</param>
        /// <param name="ADescription">Description what the value is about (for the
        /// error message).</param>
        /// <param name="AResultContext">Context of verification (can be null).</param>
        /// <param name="AResultColumn">Which <see cref="System.Data.DataColumn" /> failed (can be null).</param>
        /// <param name="AResultControl">Which <see cref="System.Windows.Forms.Control" /> is involved (can be null).</param>
        /// <returns>Null if <paramref name="AValue" /> is not null,
        /// otherwise a <see cref="TVerificationResult" /> is returned that
        /// contains details about the problem, with a message that uses <paramref name="ADescription" />.</returns>
        public static TVerificationResult ValueMustNotBeNull(object AValue, string ADescription,
            object AResultContext = null, System.Data.DataColumn AResultColumn = null, System.Windows.Forms.Control AResultControl = null)
        {
            TVerificationResult ReturnValue = null;
            String Description = THelper.NiceValueDescription(ADescription);

            // Check
            if (AValue == null)
            {
                ReturnValue = new TVerificationResult(AResultContext,
                    ErrorCodes.GetErrorInfo(CommonErrorCodes.ERR_NONULL, StrValueMustNotBeNull, new string[] { Description }));

                if (AResultColumn != null)
                {
                    ReturnValue = new TScreenVerificationResult(ReturnValue, AResultColumn, AResultControl);
                }
            }

            return ReturnValue;
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:32,代码来源:GeneralChecks.cs


示例2: ValidateAccountDetailManual

        /// <summary>
        /// Check that Foreign Currency Accounts are using a valid currency
        /// </summary>
        /// <param name="AContext">Context that describes what I'm validating.</param>
        /// <param name="ARow">DataRow with the the data I'm validating</param>
        /// <param name="AVerificationResultCollection">Will be filled with TVerificationResult items if data validation errors occur.</param>
        /// <param name="AValidationControlsDict">A <see cref="TValidationControlsDict" /> containing the Controls that
        /// display data that is about to be validated.</param>
        public static void ValidateAccountDetailManual(object AContext, GLSetupTDSAAccountRow ARow,
            ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict)
        {
            // Don't validate deleted DataRows
            if (ARow.RowState == DataRowState.Deleted)
            {
                return;
            }

            TValidationControlsData ValidationControlsData;

            // If this account is foreign, its currency must be assigned!
            if (ARow.ForeignCurrencyFlag)
            {
                if (ARow.ForeignCurrencyCode == "")
                {
                    DataColumn ValidationColumn = ARow.Table.Columns[AAccountTable.ColumnForeignCurrencyCodeId];

                    Control targetControl = null;

                    if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
                    {
                        targetControl = ValidationControlsData.ValidationControl;
                    }

                    TScreenVerificationResult VerificationResult = new TScreenVerificationResult(
                        AContext,
                        ValidationColumn,
                        Catalog.GetString("Currency Code must be specified for foreign accounts."),
                        targetControl,
                        TResultSeverity.Resv_Critical);
                    // Handle addition/removal to/from TVerificationResultCollection
                    AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
                }
            }
            else // If the Account is not foreign, I have nothing at all to say about the contents of the currency field.
            {
                AVerificationResultCollection.AddOrRemove(null, ARow.Table.Columns[AAccountTable.ColumnForeignCurrencyCodeId]);
            }
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:48,代码来源:Setup.Validation.cs


示例3: IsValidInternationalPostalCode

        /// <summary>
        /// Checks whether an International Postal Type is valid. Null values are accepted.
        /// </summary>
        /// <param name="AInternatPostalTypeCode">The International Postal Type to check.</param>
        /// <param name="ADescription">Description what the value is about (for the
        /// error message).</param>
        /// <param name="AResultContext">Context of verification (can be null).</param>
        /// <param name="AResultColumn">Which <see cref="System.Data.DataColumn" /> failed (can be null).</param>
        /// <param name="AResultControl">Which <see cref="System.Windows.Forms.Control" /> is involved (can be null).</param>
        /// <returns>Null if <paramref name="AInternatPostalTypeCode" /> is null,
        /// otherwise a <see cref="TVerificationResult" /> is returned that
        /// contains details about the problem, with a message that uses <paramref name="ADescription" />.</returns>
        public static TVerificationResult IsValidInternationalPostalCode(string AInternatPostalTypeCode,
            string ADescription = "", object AResultContext = null, System.Data.DataColumn AResultColumn = null,
            System.Windows.Forms.Control AResultControl = null)
        {
            TVerificationResult ReturnValue = null;

            Ict.Common.Data.TTypedDataTable IntPostalDT;

            if (AInternatPostalTypeCode != null)
            {
                if (AInternatPostalTypeCode != String.Empty)
                {
                    TSharedValidationHelper.GetData(PInternationalPostalTypeTable.GetTableDBName(), null, out IntPostalDT);

                    if (IntPostalDT.Rows.Find(new object[] { AInternatPostalTypeCode }) == null)
                    {
                        ReturnValue = new TVerificationResult(AResultContext,
                            ErrorCodes.GetErrorInfo(PetraErrorCodes.ERR_INVALIDINTERNATIONALPOSTALCODE));

                        if (AResultColumn != null)
                        {
                            ReturnValue = new TScreenVerificationResult(ReturnValue, AResultColumn, AResultControl);
                        }
                    }
                }
                else
                {
                    ReturnValue = new TVerificationResult(AResultContext,
                        ErrorCodes.GetErrorInfo(PetraErrorCodes.ERR_INVALIDINTERNATIONALPOSTALCODE));

                    if (AResultColumn != null)
                    {
                        ReturnValue = new TScreenVerificationResult(ReturnValue, AResultColumn, AResultControl);
                    }
                }
            }

            return ReturnValue;
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:51,代码来源:Common.Validation.cs


示例4: ValidateSUserDetails

        /// <summary>
        /// Validates SUser Details
        /// </summary>
        /// <param name="AContext">Context that describes where the data validation failed.</param>
        /// <param name="ARow">The <see cref="DataRow" /> which holds the the data against which the validation is run.</param>
        /// <param name="AVerificationResultCollection">Will be filled with any <see cref="TVerificationResult" /> items if
        /// data validation errors occur.</param>
        /// <param name="AValidationControlsDict">A <see cref="TValidationControlsDict" /> containing the Controls that
        /// display data that is about to be validated.</param>
        public static void ValidateSUserDetails(object AContext, SUserRow ARow,
            ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict)
        {
            DataColumn ValidationColumn;
            TValidationControlsData ValidationControlsData;
            TVerificationResult VerificationResult = null;

            // Don't validate deleted DataRows
            if (ARow.RowState == DataRowState.Deleted)
            {
                return;
            }

            ValidationColumn = ARow.Table.Columns[SUserTable.ColumnPasswordHashId];
            AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData);

            // PasswordHash must not be empty.
            if ((ARow.RowState != DataRowState.Unchanged) && string.IsNullOrEmpty(ARow.PasswordHash))
            {
                VerificationResult = new TScreenVerificationResult(new TVerificationResult(AContext,
                        ErrorCodes.GetErrorInfo(PetraErrorCodes.ERR_MISSING_PASSWORD, new string[] { ARow.UserId })),
                    ValidationColumn, ValidationControlsData.ValidationControl);

                // Handle addition to/removal from TVerificationResultCollection
                AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
            }

            // If this is a first password (no salt) check that the password is valid.
            if ((ARow.RowState != DataRowState.Unchanged) && string.IsNullOrEmpty(ARow.PasswordSalt) && !string.IsNullOrEmpty(ARow.PasswordHash))
            {
                VerificationResult = null;

                if (!CheckPasswordQuality(ARow.PasswordHash, out VerificationResult))
                {
                    VerificationResult = new TScreenVerificationResult(VerificationResult, ValidationColumn, ValidationControlsData.ValidationControl);
                    AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
                }
            }
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:48,代码来源:SysMan.Validation.cs


示例5: IsDateBetweenDates


//.........这里部分代码省略.........
        /// <param name="AUpperRangeCheckType">Type of Date Check: upper end of the valid Date Range (defaults to <see cref="TDateBetweenDatesCheckType.dbdctUnspecific" />).</param>
        /// <param name="AResultContext">Context of verification (can be null).</param>
        /// <param name="AResultColumn">Which <see cref="System.Data.DataColumn" /> failed (can be null).</param>
        /// <param name="AResultControl">Which <see cref="System.Windows.Forms.Control" /> is involved (can be null).</param>
        /// <returns>Null if the date <paramref name="ADate" /> is between the lower and the upper end of the Date Range specified
        /// (lower and upper end dates are included), otherwise a verification result with a message that uses
        /// <paramref name="ADescription" />.
        /// </returns>
        public static TVerificationResult IsDateBetweenDates(DateTime? ADate, DateTime? ALowerDateRangeEnd, DateTime? AUpperDateRangeEnd,
            String ADescription,
            TDateBetweenDatesCheckType ALowerRangeCheckType = TDateBetweenDatesCheckType.dbdctUnspecific,
            TDateBetweenDatesCheckType AUpperRangeCheckType = TDateBetweenDatesCheckType.dbdctUnspecific,
            object AResultContext = null, System.Data.DataColumn AResultColumn = null, System.Windows.Forms.Control AResultControl = null)
        {
            TVerificationResult ReturnValue = null;
            DateTime TheDate = TSaveConvert.ObjectToDate(ADate);
            DateTime LowerDateRangeEndDate = TSaveConvert.ObjectToDate(ALowerDateRangeEnd);
            DateTime UpperDateRangeEndDate = TSaveConvert.ObjectToDate(AUpperDateRangeEnd);
            String Description = THelper.NiceValueDescription(ADescription);

            if ((!ADate.HasValue)
                || (!ALowerDateRangeEnd.HasValue)
                || (!AUpperDateRangeEnd.HasValue))
            {
                return null;
            }

            // Check
            if ((TheDate < LowerDateRangeEndDate)
                || (TheDate > UpperDateRangeEndDate))
            {
                if ((ALowerRangeCheckType == TDateBetweenDatesCheckType.dbdctUnspecific)
                    && (AUpperRangeCheckType == TDateBetweenDatesCheckType.dbdctUnspecific))
                {
                    ReturnValue = GetUnspecificDateRangeCheckVerificationResult(LowerDateRangeEndDate,
                        UpperDateRangeEndDate,
                        Description,
                        AResultContext);
                }
                else if (TheDate < LowerDateRangeEndDate)
                {
                    if (ALowerRangeCheckType == TDateBetweenDatesCheckType.dbdctNoPastDate)
                    {
                        ReturnValue = new TVerificationResult(AResultContext,
                            ErrorCodes.GetErrorInfo(CommonErrorCodes.ERR_NOPASTDATE, CommonResourcestrings.StrInvalidDateEntered +
                                Environment.NewLine +
                                StrDateMustNotBePastDate, new string[] { Description }));
                    }
                    else if (ALowerRangeCheckType == TDateBetweenDatesCheckType.dbdctUnrealisticDate)
                    {
                        ReturnValue = new TVerificationResult(AResultContext,
                            ErrorCodes.GetErrorInfo(CommonErrorCodes.ERR_UNREALISTICDATE_ERROR, CommonResourcestrings.StrInvalidDateEntered +
                                Environment.NewLine +
                                StrDateNotSensible, new string[] { Description }));
                    }
                    else
                    {
                        ReturnValue = GetUnspecificDateRangeCheckVerificationResult(LowerDateRangeEndDate,
                            UpperDateRangeEndDate,
                            Description,
                            AResultContext);
                    }
                }
                else if (TheDate > UpperDateRangeEndDate)
                {
                    if (AUpperRangeCheckType == TDateBetweenDatesCheckType.dbdctNoFutureDate)
                    {
                        ReturnValue = new TVerificationResult(AResultContext,
                            ErrorCodes.GetErrorInfo(CommonErrorCodes.ERR_NOFUTUREDATE, CommonResourcestrings.StrInvalidDateEntered +
                                Environment.NewLine +
                                StrDateMustNotBeFutureDate, new string[] { Description }));
                    }
                    else if (AUpperRangeCheckType == TDateBetweenDatesCheckType.dbdctUnrealisticDate)
                    {
                        ReturnValue = new TVerificationResult(AResultContext,
                            ErrorCodes.GetErrorInfo(CommonErrorCodes.ERR_UNREALISTICDATE_ERROR, CommonResourcestrings.StrInvalidDateEntered +
                                Environment.NewLine +
                                StrDateNotSensible, new string[] { Description }));
                    }
                    else
                    {
                        ReturnValue = GetUnspecificDateRangeCheckVerificationResult(LowerDateRangeEndDate,
                            UpperDateRangeEndDate,
                            Description,
                            AResultContext);
                    }
                }

                if (AResultColumn != null)
                {
                    ReturnValue = new TScreenVerificationResult(ReturnValue, AResultColumn, AResultControl);
                }
            }
            else
            {
                ReturnValue = null;
            }

            return ReturnValue;
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:101,代码来源:DateChecks.cs


示例6: IsCurrentOrPastDate

        /// <summary>
        /// Checks whether the date is today or in the past. Null values are accepted.
        /// </summary>
        /// <param name="ADate">The date to check.</param>
        /// <param name="ADescription">The name of the date value.</param>
        /// <param name="AResultContext">Context of verification (can be null).</param>
        /// <param name="AResultColumn">Which <see cref="System.Data.DataColumn" /> failed (can be null).</param>
        /// <param name="AResultControl">Which <see cref="System.Windows.Forms.Control" /> is involved (can be null).</param>
        /// <returns>Null if the date <paramref name="ADate" /> is today or in the past,
        /// otherwise a verification result with a message that uses <paramref name="ADescription" />.
        /// </returns>
        public static TVerificationResult IsCurrentOrPastDate(DateTime? ADate, String ADescription,
            object AResultContext = null, System.Data.DataColumn AResultColumn = null, System.Windows.Forms.Control AResultControl = null)
        {
            TVerificationResult ReturnValue;
            String Description = THelper.NiceValueDescription(ADescription);

            if (!ADate.HasValue)
            {
                return null;
            }

            // Check
            if (ADate <= DateTime.Today)
            {
                //MessageBox.Show('Date <= Today');
                ReturnValue = null;
            }
            else
            {
                ReturnValue = new TVerificationResult(AResultContext,
                    ErrorCodes.GetErrorInfo(CommonErrorCodes.ERR_NOFUTUREDATE, CommonResourcestrings.StrInvalidDateEntered +
                        Environment.NewLine + StrDateMustNotBeFutureDate, new string[] { Description }));

                if (AResultColumn != null)
                {
                    ReturnValue = new TScreenVerificationResult(ReturnValue, AResultColumn, AResultControl);
                }
            }

            return ReturnValue;
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:42,代码来源:DateChecks.cs


示例7: OnDataboundTableColumnChanged

        /// <summary>
        /// This procedure verifies the changes of the DataSource.
        /// </summary>
        /// <returns>void</returns>
        protected void OnDataboundTableColumnChanged(System.Object sender, DataColumnChangeEventArgs e)
        {
            // mVerified:           System.Boolean;
            bool mDelegateVerified;

            // mErrorMessage:       System.String;  mCaption:            System.String;
            String mColumnName;
            TResultSeverity mResultSev;
            TScreenVerificationResult mVerificationResult;
            bool mPartnerExists;
            String mVerifiedString;

            System.Int64 mPartnerKey;
            TPartnerClass mPartnerClass;
            bool mPartnerIsMerged;

            String mExtractName;

            // was a set of TPartnerClass
            Object[] mPartnerClassSet;
            String[] mPartnerValues;
            Char[] mPartnerClassDelimiter;

            /* This works in two different ways depending on whether it is
             * partner key mode of occupation mode.
             *
             * It is triggered by the datatable the control is bound to  firing
             * a column changed event, indicating new data.
             *
             * If occupation mode - we use a VerifyLookupValue in txtButtonLabel to
             * determine whether it is a valid value or not. Because the control is bound
             * to a datatable, it can simply check against the values in the databound table.
             *
             * In partner key mode, we invoke the delegate  VerifyUserEntry, which
             * the hosting form must implement, which returns true if the value is value,
             * or false if not.
             * (hope to do this in-control soon)
             *
             */
            if (e.ProposedValue == null)
            {
                // we can't possibly do anything useful here
                return;
            }

            // Initialization
            mColumnName = e.Column.ColumnName;
            mDelegateVerified = false;
            this.FErrorData.RVerified = false;
            mResultSev = TResultSeverity.Resv_Critical;
            mVerifiedString = null;
            mPartnerClassDelimiter = new char[] {
                ','
            };
            mPartnerValues = this.PartnerClass.Split(mPartnerClassDelimiter);

            // Needs the event handling here?
            if (mColumnName.Equals(this.FValueMember) == false)
            {
                // we are not concerned, out of here!
                return;
            }

            // we need to verify the data:
            switch (this.FListTable)
            {
                case TListTableEnum.OccupationList:
                    #region TListTableEnum.OccupationList

                    // TLogging.Log('Verification Branch: ' + Enum.GetName(typeof(TListTableEnum), TListTableEnum.OccupationList));
                    // TLogging.Log('mColumn.ColumnName:  ' + mColumnName);
                    // Do all things necessary to verify the Occupation code:
                    // mDataRow := this.txtAutoPopulated.GetLookUpRow('p_occupation_code_c', e.ProposedValue.ToString);
                    // SPECIAL CASE: an empty string IS a valid value!
                    if (e.ProposedValue.ToString() == "")
                    {
                        this.FErrorData.RVerified = true;
                        return;
                    }

                    mVerifiedString = this.txtAutoPopulated.VerifyLookUpValue("p_occupation_code_c", e.ProposedValue.ToString(), false);

                    // TLogging.Log('mVerifiedString:  ' + mVerifiedString);
                    if ((mVerifiedString == null) || (mVerifiedString == ""))
                    {
                        // Occupation Code does not exist in the LookUpTable
                        this.FDisplayLabelString = UNIT_NO_VALID_OCCUPATIONCODE;

                        // this.FErrorData.RErrorMessage := 'The specified occupation code "' + e.ProposedValue.ToString + '" is invalid!' + "\n" + 'Please check spelling!';
                        this.FErrorData.RErrorMessage = String.Format(Catalog.GetString("The specified Occupation Code '{0}' is invalid!\r\n" +
                                "Please check spelling!"), e.ProposedValue);
                        this.FErrorData.RCaption = Catalog.GetString("Invalid Occupation Code");

                        //mErrorName = "OccupationCode Error";
                        mResultSev = TResultSeverity.Resv_Noncritical;

//.........这里部分代码省略.........
开发者ID:Davincier,项目名称:openpetra,代码行数:101,代码来源:txtAutoPopulatedButtonLabel.cs


示例8: ValidateEverything

        /// validate all data not in a DataRow
        private void ValidateEverything()
        {
            TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection;
            TScreenVerificationResult VerificationResult;

            // Validate Reference
            if (!string.IsNullOrEmpty(txtFromReference.Text) && (txtFromReference.Text.Length > 100))
            {
                // 'Reference' must not contain more than 100 characters
                VerificationResult = new TScreenVerificationResult(TStringChecks.StringLengthLesserOrEqual(txtFromReference.Text, 100,
                        "Reference", txtFromReference), null, txtFromReference);

                // Handle addition to/removal from TVerificationResultCollection
                VerificationResultCollection.Auto_Add_Or_AddOrRemove(txtFromReference, VerificationResult, null);
            }
            else if (string.IsNullOrEmpty(txtFromReference.Text))
            {
                // 'Reference' must not be empty
                VerificationResult = new TScreenVerificationResult(TStringChecks.StringMustNotBeEmpty(txtFromReference.Text,
                        "Reference", txtFromReference), null, txtFromReference);

                // Handle addition/removal to/from TVerificationResultCollection
                VerificationResultCollection.Auto_Add_Or_AddOrRemove(txtFromReference, VerificationResult, null);
            }

            // Validate Narrative
            if (!string.IsNullOrEmpty(txtFromNarrative.Text) && (txtFromNarrative.Text.Length > 500))
            {
                // 'Narrative' must not contain more than 100 characters
                VerificationResult = new TScreenVerificationResult(TStringChecks.StringLengthLesserOrEqual(txtFromNarrative.Text, 500,
                        "Narrative", txtFromNarrative), null, txtFromNarrative);

                // Handle addition to/removal from TVerificationResultCollection
                VerificationResultCollection.Auto_Add_Or_AddOrRemove(txtFromNarrative, VerificationResult, null);
            }

            // Validate FromCostCentreCode
            if (string.IsNullOrEmpty(cmbFromCostCentreCode.GetSelectedString()))
            {
                // 'Cost Centre Code' must not be empty
                VerificationResult = new TScreenVerificationResult(TStringChecks.StringMustNotBeEmpty(cmbFromCostCentreCode.Text,
                        "Cost Centre Code", cmbFromCostCentreCode), null, cmbFromCostCentreCode);

                // Handle addition/removal to/from TVerificationResultCollection
                VerificationResultCollection.Auto_Add_Or_AddOrRemove(cmbFromCostCentreCode, VerificationResult, null);
            }

            // Validate FromAccountCode
            if (string.IsNullOrEmpty(cmbFromAccountCode.GetSelectedString()))
            {
                // 'Account Code' must not be empty
                VerificationResult = new TScreenVerificationResult(TStringChecks.StringMustNotBeEmpty(cmbFromAccountCode.Text,
                        "Account Code", cmbFromAccountCode), null, cmbFromAccountCode);

                // Handle addition/removal to/from TVerificationResultCollection
                VerificationResultCollection.Auto_Add_Or_AddOrRemove(cmbFromAccountCode, VerificationResult, null);
            }

            // Validate TotalAmount
            if (string.IsNullOrEmpty(txtTotalAmount.Text) || (Convert.ToDecimal(txtTotalAmount.Text) <= 0))
            {
                if (string.IsNullOrEmpty(txtTotalAmount.Text))
                {
                    txtTotalAmount.NumberValueDecimal = 0;
                }

                // From Amount must not = 0
                VerificationResult = new TScreenVerificationResult(TNumericalChecks.IsPositiveDecimal(Convert.ToDecimal(txtTotalAmount.Text),
                        "Amount", txtTotalAmount), null, txtTotalAmount);

                // Handle addition/removal to/from TVerificationResultCollection
                VerificationResultCollection.Auto_Add_Or_AddOrRemove(txtTotalAmount, VerificationResult, null);
            }
            else
            {
                // Validate Allocations' amounts
                if (rbtAmountOption.Checked)
                {
                    if (GetAmountTotal() != Convert.ToDecimal(txtTotalAmount.Text))
                    {
                        VerificationResult = new TScreenVerificationResult(this, null,
                            Catalog.GetString(
                                "The amounts entered do not match the total amount of the Allocation. Please check the amounts entered."),
                            txtTotalAmount, TResultSeverity.Resv_Critical);

                        // Handle addition/removal to/from TVerificationResultCollection
                        VerificationResultCollection.Auto_Add_Or_AddOrRemove(txtTotalAmount, VerificationResult, null);
                    }
                }
                // Validate Allocations' percentages
                else
                {
                    if (GetPercentageTotal() != 100)
                    {
                        VerificationResult = new TScreenVerificationResult(this, null,
                            Catalog.GetString("The percentages entered must add up to 100%."),
                            txtDetailPercentage, TResultSeverity.Resv_Critical);

                        // Handle addition/removal to/from TVerificationResultCollection
//.........这里部分代码省略.........
开发者ID:js1987,项目名称:openpetragit,代码行数:101,代码来源:AllocationJournalDialog.ManualCode.cs


示例9: ValidationEmailAddrSetButNotAmongEmailAddrs

        /// <summary>
        /// Creates a Data Validation *Error* for E-Mail ComboBoxes.
        /// </summary>
        private void ValidationEmailAddrSetButNotAmongEmailAddrs(TOverallContactComboType AContactComboType)
        {
            const string ResCont = "ContactDetails_EmailAddress_Set_But_Not_Among_Email_Addrs";
            TScreenVerificationResult VerificationResult;
            TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection;
            string ErrorCode;
            TCmbAutoComplete ComboBoxForContactComboType;
            string ComboTypeStr;   // Ignored, but needed as this is an out Argument of GetDataAccordingToContactComboType...

            if (AContactComboType == TOverallContactComboType.occtPrimaryEmail)
            {
                ErrorCode = PetraErrorCodes.ERR_PRIMARY_EMAIL_ADDR_SET_BUT_NOT_AMONG_EMAIL_ADDR;
            }
            else if (AContactComboType == TOverallContactComboType.occtSecondaryEmail)
            {
                ErrorCode = PetraErrorCodes.ERR_SECONDARY_EMAIL_ADDR_SET_BUT_NOT_AMONG_EMAIL_ADDR;
            }
            else if (AContactComboType == TOverallContactComboType.occtEmailWithinOrganisation)
            {
                ErrorCode = PetraErrorCodes.ERR_OFFICE_EMAIL_ADDR_SET_BUT_NOT_AMONG_EMAIL_ADDR;
            }
            else
            {
                throw new EOPAppException("AContactComboType Argument must designate an E-Mail ComboBox");
            }

            GetDataAccordingToContactComboType(AContactComboType,
                out ComboBoxForContactComboType, out ComboTypeStr);

            VerificationResult = new TScreenVerificationResult(
                new TVerificationResult((object)ResCont,
                    ErrorCodes.GetErrorInfo(ErrorCode),
                    FPetraUtilsObject.VerificationResultCollection.CurrentDataValidationRunID),
                null, ComboBoxForContactComboType, FPetraUtilsObject.VerificationResultCollection.CurrentDataValidationRunID);

            VerificationResultCollection.Remove(ResCont);

            if (VerificationResult != null)
            {
                VerificationResultCollection.Add(VerificationResult);
            }
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:45,代码来源:UC_ContactDetails.UnboundComboBoxes.ManualCode.cs


示例10: ValidationPrimaryEmailAddrNotSet

        /// <summary>
        /// Creates a Data Validation *Warning* for specifically for cmbPrimaryEmail.
        /// </summary>
        private void ValidationPrimaryEmailAddrNotSet()
        {
            const string ResCont = "ContactDetails_PrimaryEmailAddress_Not_Set";
            TScreenVerificationResult VerificationResult;

            TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection;

            VerificationResult = new TScreenVerificationResult(
                new TVerificationResult((object)ResCont,
                    ErrorCodes.GetErrorInfo(PetraErrorCodes.ERR_PRIMARY_EMAIL_ADDR_NOT_SET_DESIPITE_EMAIL_ADDR_AVAIL),
                    FPetraUtilsObject.VerificationResultCollection.CurrentDataValidationRunID),
                null, cmbPrimaryEMail, FPetraUtilsObject.VerificationResultCollection.CurrentDataValidationRunID);


            VerificationResultCollection.Remove(ResCont);

            if (VerificationResult != null)
            {
                VerificationResultCollection.Add(VerificationResult);
            }
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:24,代码来源:UC_ContactDetails.UnboundComboBoxes.ManualCode.cs


示例11: IsNotUndefinedDateTime

        /// <summary>
        /// Checks whether the date is not undefined. DateTime.MinValue is seen as undefined by this Method.
        /// Null values are accepted. They are treated as valid, unless <paramref name="ATreatNullAsInvalid" /> is
        /// set to true.
        /// </summary>
        /// <param name="ADate">The date to check.</param>
        /// <param name="ADescription">The name of the date value.</param>
        /// <param name="ATreatNullAsInvalid">Set this to true to treated null value in <paramref name="ADate" /> as invalid.</param>
        /// <param name="AResultContext">Context of verification (can be null).</param>
        /// <param name="AResultColumn">Which <see cref="System.Data.DataColumn" /> failed (can be null).</param>
        /// <param name="AResultControl">Which <see cref="System.Windows.Forms.Control" /> is involved (can be null).</param>
        /// <remarks>Usage in the Data Validation Framework: rather than using this Method, use Method
        /// 'TSharedValidationControlHelper.IsNotInvalidDate' for checking the validity of dates as the latter can deal not only with
        /// empty dates, but dates that are invalid in other respects (e.g. exceeding a valid date range)!!!</remarks>
        /// <returns>Null if validation succeeded, otherwise a <see cref="TVerificationResult" /> is
        /// returned that contains details about the problem.</returns>
        public static TVerificationResult IsNotUndefinedDateTime(DateTime? ADate, String ADescription,
            bool ATreatNullAsInvalid = false, object AResultContext = null, System.Data.DataColumn AResultColumn = null,
            System.Windows.Forms.Control AResultControl = null)
        {
            TVerificationResult ReturnValue;
            DateTime TheDate = TSaveConvert.ObjectToDate(ADate);
            String Description = THelper.NiceValueDescription(ADescription);

            if (!ADate.HasValue)
            {
                if (!ATreatNullAsInvalid)
                {
                    return null;
                }
                else
                {
                    ReturnValue = new TVerificationResult(AResultContext,
                        ErrorCodes.GetErrorInfo(CommonErrorCodes.ERR_NOUNDEFINEDDATE,
                            CommonResourcestrings.StrInvalidDateEntered + Environment.NewLine +
                            StrDateMustNotBeEmpty, new string[] { Description }));

                    if (AResultColumn != null)
                    {
                        ReturnValue = new TScreenVerificationResult(ReturnValue, AResultColumn, AResultControl);
                    }
                }
            }

            // Check
            if (TheDate != DateTime.MinValue)
            {
                //MessageBox.Show('Date <> DateTime.MinValue');
                ReturnValue = null;
            }
            else
            {
                ReturnValue = new TVerificationResult(AResultContext,
                    ErrorCodes.GetErrorInfo(CommonErrorCodes.ERR_NOUNDEFINEDDATE,
                        CommonResourcestrings.StrInvalidDateEntered + Environment.NewLine +
                        StrDateMustNotBeEmpty, new string[] { Description }));

                if (AResultColumn != null)
                {
                    ReturnValue = new TScreenVerificationResult(ReturnValue, AResultColumn, AResultControl);
                }
            }

            return ReturnValue;
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:65,代码来源:DateChecks.cs


示例12: IsNotInvalidDate

        /// <summary>
        /// Checks wheter a given DateTime is an invalid date. A check whether it is an undefined DateTime is always performed.
        /// If Delegate <see cref="SharedGetDateVerificationResultDelegate" /> is set up and Argument
        /// <paramref name="AResultControl" /> isn't null, the 'DateVerificationResult' of the TtxtPetraDate Control is
        /// returned by this Method through this Method if it isn't null. That way the Data Validation Framework can
        /// use the detailed Data Verification error that is held by the Control.
        /// </summary>
        /// <returns>Null if validation succeeded, otherwise a <see cref="TVerificationResult" /> is
        /// returned that contains details about the problem.</returns>
        public static TVerificationResult IsNotInvalidDate(DateTime? ADate, String ADescription,
            TVerificationResultCollection AVerificationResultCollection, bool ATreatNullAsInvalid = false,
            object AResultContext = null, System.Data.DataColumn AResultColumn = null,
            Control AResultControl = null)
        {
            TVerificationResult VerificationResult;

            if (FDelegateSharedGetDateVerificationResult != null)
            {
                if ((AResultControl != null))
                {
                    VerificationResult = FDelegateSharedGetDateVerificationResult(AResultControl);

                    if (VerificationResult == null)
                    {
                        VerificationResult = TDateChecks.IsNotUndefinedDateTime(ADate,
                            ADescription, ATreatNullAsInvalid, AResultContext, AResultColumn, AResultControl);
                    }
                    else
                    {
                        VerificationResult.OverrideResultContext(AResultContext);
                        VerificationResult = new TScreenVerificationResult(VerificationResult, AResultColumn, AResultControl);
                    }
                }
                else
                {
                    VerificationResult = TDateChecks.IsNotUndefinedDateTime(ADate,
                        ADescription, ATreatNullAsInvalid, AResultContext, AResultColumn, AResultControl);
                }

                // Remove Verification Result that would have been recorded earlier for the same DataColumn
                TVerificationResult OtherRecordedVerificationResult = AVerificationResultCollection.FindBy(AResultColumn);

                if (OtherRecordedVerificationResult != null)
                {
                    AVerificationResultCollection.Remove(OtherRecordedVerificationResult);
                }
            }
            else
            {
                VerificationResult = TDateChecks.IsNotUndefinedDateTime(ADate,
                    ADescription, ATreatNullAsInvalid, AResultContext, AResultColumn, AResultControl);
            }

            return VerificationResult;
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:55,代码来源:ControlHelper.cs


示例13: OnUnitDataColumnChanging

        /// <summary>
        /// TODO: Replace this with the Data Validation Framework - once it supports user interaction as needed
        /// in this case (=asking the user to make a decision).
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnUnitDataColumnChanging(System.Object sender, DataColumnChangeEventArgs e)
        {
            TVerificationResult VerificationResultReturned;
            TScreenVerificationResult VerificationResultEntry;
            Control BoundControl;

            // MessageBox.Show('Column ''' + e.Column.ToString + ''' is changing...');
            try
            {
                if (TPartnerVerification.VerifyUnitData(e, FMainDS, out VerificationResultReturned) == false)
                {
                    if (VerificationResultReturned.ResultCode != PetraErrorCodes.ERR_UNITNAMECHANGEUNDONE)
                    {
                        TMessages.MsgVerificationError(VerificationResultReturned, this.GetType());

                        BoundControl = TDataBinding.GetBoundControlForColumn(BindingContext[FMainDS.PUnit], e.Column);

                        // MessageBox.Show('Bound control: ' + BoundControl.ToString);
// TODO                        BoundControl.Focus();
                        VerificationResultEntry = new TScreenVerificationResult(this,
                            e.Column,
                            VerificationResultReturned.ResultText,
                            VerificationResultReturned.ResultTextCaption,
                            VerificationResultReturned.ResultCode,
                            BoundControl,
                            VerificationResultReturned.ResultSeverity);
                        FPetraUtilsObject.VerificationResultCollection.Add(VerificationResultEntry);

                        // MessageBox.Show('After setting the error: ' + e.ProposedValue.ToString);
                    }
                    else
                    {
                        // undo the change in the DataColumn
                        e.ProposedValue = e.Row[e.Column.ColumnName, DataRowVersion.Original];

                        // need to assign this to make the change actually visible...
                        txtUnitName.Text = e.ProposedValue.ToString();
// TODO                        BoundControl = TDataBinding.GetBoundControlForColumn(BindingContext[FMainDS.PUnit], e.Column);

                        // MessageBox.Show('Bound control: ' + BoundControl.ToString);
// TODO                        BoundControl.Focus();
                    }
                }
                else
                {
                    if (FPetraUtilsObject.VerificationResultCollection.Contains(e.Column))
                    {
                        FPetraUtilsObject.VerificationResultCollection.Remove(e.Column);
                    }
                }
            }
            catch (Exception Exp)
            {
                MessageBox.Show(Exp.ToString());
            }
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:62,代码来源:UC_PartnerEdit_TopPart.ManualCode.cs


示例14: ValidateRecord

        private void ValidateRecord(AAccountingPeriodRow ARow, Boolean ACheckGapToPrevious, Boolean ACheckGapToNext)
        {
            TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection;
            DataColumn ValidationColumn;
            TValidationControlsData ValidationControlsData;
            TVerificationResult VerificationResult = null;
            AAccountingPeriodRow OtherRow;
            DataRow OtherDataRow;

            string CurrentDateRangeErrorCode;

            if (FDuringSave)
            {
                CurrentDateRangeErrorCode = PetraErrorCodes.ERR_PERIOD_DATE_RANGE;
            }
            else
            {
                CurrentDateRangeErrorCode = PetraErrorCodes.ERR_PERIOD_DATE_RANGE_WARNING;
            }

            // first run through general checks related to the current AccountingPeriod row
            TSharedFinanceValidation_GLSetup.ValidateAccountingPeriod(this, ARow, ref VerificationResultCollection,
                FPetraUtilsObject.ValidationControlsDict);

            // the following checks need to be done in this ManualCode file as they involve other rows on the screen:

            // check that there is no gap to previous accounting period
            if (ACheckGapToPrevious)
            {
                ValidationColumn = ARow.Table.Columns[AAccountingPeriodTable.ColumnPeriodStartDateId];

                if (FPetraUtilsObject.ValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
                {
                    if (!ARow.IsPeriodStartDateNull()
                        && (ARow.PeriodStartDate != DateTime.MinValue))
                    {
                        OtherDataRow = FMainDS.AAccountingPeriod.Rows.Find(
                            new string[] { FLedgerNumber.ToString(), (ARow.AccountingPeriodNumber - 1).ToString() });

                        if (OtherDataRow != null)
               

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Verification.TVerificationResult类代码示例发布时间:2022-05-26
下一篇:
C# IceInternal.ProtocolInstance类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap