/// <summary>
        /// Validates the MConference Standard Cost Setup screen data.
        /// </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>
        /// <param name="AGridData">A <see cref="TValidationControlsDict" />Contains all rows that are included in the grid</param>
        public static void ValidateConferenceStandardCost(object AContext, PcConferenceCostRow ARow,
                                                          ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict,
                                                          DataRowCollection AGridData)
        {
            // Don't validate deleted DataRows
            if (ARow.RowState == DataRowState.Deleted)
            {
                return;
            }

            // Check the row being validated is consistent with the rest of the data in the table
            PcConferenceCostRow ARowCompare = null;
            Boolean             StandardCostInconsistency = false;

            string[] InconsistentRows = new string[2];  // used for the error message
            int      i = 0;

            while (i < AGridData.Count)
            {
                ARowCompare = (PcConferenceCostRow)AGridData[i];

                if ((ARowCompare.RowState != DataRowState.Deleted) && (ARowCompare.OptionDays > ARow.OptionDays) && (ARowCompare.Charge < ARow.Charge))
                {
                    StandardCostInconsistency = true;
                    InconsistentRows[0]       = ARow.OptionDays.ToString();
                    InconsistentRows[1]       = ARowCompare.OptionDays.ToString();
                    break;
                }
                else if ((ARowCompare.RowState != DataRowState.Deleted) && (ARowCompare.OptionDays < ARow.OptionDays) &&
                         (ARowCompare.Charge > ARow.Charge))
                {
                    StandardCostInconsistency = true;
                    InconsistentRows[0]       = ARowCompare.OptionDays.ToString();
                    InconsistentRows[1]       = ARow.OptionDays.ToString();
                    break;
                }

                i++;
            }

            // if an inconsistency is found
            if (StandardCostInconsistency == true)
            {
                TValidationControlsData   ValidationControlsData;
                TScreenVerificationResult VerificationResult = null;
                DataColumn ValidationColumn = ARow.Table.Columns[PcConferenceCostTable.ColumnChargeId];

                // displays a warning message (non-critical error)
                VerificationResult = new TScreenVerificationResult(new TVerificationResult(AContext, ErrorCodes.GetErrorInfo(
                                                                                               PetraErrorCodes.ERR_STANDARD_COST_INCONSISTENCY, InconsistentRows)),
                                                                   ValidationColumn, ValidationControlsData.ValidationControl);

                // Handle addition to/removal from TVerificationResultCollection
                AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
            }
        }
예제 #2
0
        /// <summary>
        /// Validates the MConference Standard Cost Setup screen data.
        /// </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>
        /// <param name="AGridData">A <see cref="TValidationControlsDict" />Contains all rows that are included in the grid</param>
        public static void ValidateConferenceStandardCost(object AContext, PcConferenceCostRow ARow,
            ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict,
            DataRowCollection AGridData)
        {
            // Don't validate deleted DataRows
            if (ARow.RowState == DataRowState.Deleted)
            {
                return;
            }

            // Check the row being validated is consistent with the rest of the data in the table
            PcConferenceCostRow ARowCompare = null;
            Boolean StandardCostInconsistency = false;
            string[] InconsistentRows = new string[2];  // used for the error message
            int i = 0;

            while (i < AGridData.Count)
            {
                ARowCompare = (PcConferenceCostRow)AGridData[i];

                if ((ARowCompare.RowState != DataRowState.Deleted) && (ARowCompare.OptionDays > ARow.OptionDays) && (ARowCompare.Charge < ARow.Charge))
                {
                    StandardCostInconsistency = true;
                    InconsistentRows[0] = ARow.OptionDays.ToString();
                    InconsistentRows[1] = ARowCompare.OptionDays.ToString();
                    break;
                }
                else if ((ARowCompare.RowState != DataRowState.Deleted) && (ARowCompare.OptionDays < ARow.OptionDays)
                         && (ARowCompare.Charge > ARow.Charge))
                {
                    StandardCostInconsistency = true;
                    InconsistentRows[0] = ARowCompare.OptionDays.ToString();
                    InconsistentRows[1] = ARow.OptionDays.ToString();
                    break;
                }

                i++;
            }

            // if an inconsistency is found
            if (StandardCostInconsistency == true)
            {
                TValidationControlsData ValidationControlsData;
                TScreenVerificationResult VerificationResult = null;
                DataColumn ValidationColumn = ARow.Table.Columns[PcConferenceCostTable.ColumnChargeId];

                // displays a warning message (non-critical error)
                VerificationResult = new TScreenVerificationResult(new TVerificationResult(AContext, ErrorCodes.GetErrorInfo(
                            PetraErrorCodes.ERR_STANDARD_COST_INCONSISTENCY, InconsistentRows)),
                    ValidationColumn, ValidationControlsData.ValidationControl);

                // Handle addition to/removal from TVerificationResultCollection
                AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
            }
        }
        private void NewRowManual(ref PcConferenceCostRow ARow)
        {
            int NewOptionDays = 1;  // starts at 1 day
            int i = 1;

            // if a row already exists for 1 day find the next available integer
            if (FMainDS.PcConferenceCost.Rows.Find(new object[] { FPartnerKey, NewOptionDays }) != null)
            {
                while (FMainDS.PcConferenceCost.Rows.Find(new object[] { FPartnerKey, NewOptionDays + i }) != null)
                {
                    i++;
                }

                NewOptionDays += i;
            }

            ARow.OptionDays = NewOptionDays;

            // set the conference key
            ARow.ConferenceKey = FPartnerKey;
        }
예제 #4
0
        private void NewRowManual(ref PcConferenceCostRow ARow)
        {
            int NewOptionDays = 1;  // starts at 1 day
            int i             = 1;

            // if a row already exists for 1 day find the next available integer
            if (FMainDS.PcConferenceCost.Rows.Find(new object[] { FPartnerKey, NewOptionDays }) != null)
            {
                while (FMainDS.PcConferenceCost.Rows.Find(new object[] { FPartnerKey, NewOptionDays + i }) != null)
                {
                    i++;
                }

                NewOptionDays += i;
            }

            ARow.OptionDays = NewOptionDays;

            // set the conference key
            ARow.ConferenceKey = FPartnerKey;
        }
예제 #5
0
        private void ValidateDataDetailsManual(PcConferenceCostRow ARow)
        {
            StackFrame frame = new StackFrame(2);

            // only validate when data is being saved
            if (frame.GetMethod().Name == "SaveChanges")
            {
                // this is used to compare with the row that is being validated
                DataRowCollection GridData = FMainDS.PcConferenceCost.Rows;

                if (txtDetailCharge.Text == "")
                {
                    txtDetailCharge.Text = "0.00";
                    ARow.Charge          = 0;
                }

                TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection;

                TSharedConferenceValidation_Conference.ValidateConferenceStandardCost(this, ARow, ref VerificationResultCollection,
                                                                                      FPetraUtilsObject.ValidationControlsDict, GridData);
            }
        }
        private void ValidateDataDetailsManual(PcConferenceCostRow ARow)
        {
            StackFrame frame = new StackFrame(2);

            // only validate when data is being saved
            if (frame.GetMethod().Name == "SaveChanges")
            {
                // this is used to compare with the row that is being validated
                DataRowCollection GridData = FMainDS.PcConferenceCost.Rows;

                if (txtDetailCharge.Text == "")
                {
                    txtDetailCharge.Text = "0.00";
                    ARow.Charge = 0;
                }

                TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection;

                TSharedConferenceValidation_Conference.ValidateConferenceStandardCost(this, ARow, ref VerificationResultCollection,
                    FPetraUtilsObject.ValidationControlsDict, GridData);
            }
        }