private void ValidateDataDetailsManual(PMailingRow ARow)
        {
            TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection;

            TSharedPartnerValidation_Partner.ValidateMailingSetup(this, ARow, ref VerificationResultCollection,
                FPetraUtilsObject.ValidationControlsDict);
        }
        private void ValidateDataDetailsManual(PMailingRow ARow)
        {
            TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection;

            TSharedPartnerValidation_Partner.ValidateMailingSetup(this, ARow, ref VerificationResultCollection,
                                                                  FPetraUtilsObject.ValidationControlsDict);
        }
        private void NewRowManual(ref PMailingRow ARow)
        {
            // Deal with the primary key - we need a unique mailing code
            string newName = Catalog.GetString("NEWVALUE");
            Int32 countNewDetail = 0;

            if (FMainDS.PMailing.Rows.Find(new object[] { newName }) != null)
            {
                while (FMainDS.PMailing.Rows.Find(new object[] { newName + countNewDetail.ToString() }) != null)
                {
                    countNewDetail++;
                }

                newName += countNewDetail.ToString();
            }

            ARow.MailingCode = newName;

            // Initialise the date to today
            ARow.MailingDate = DateTime.Today;
        }
        private void NewRowManual(ref PMailingRow ARow)
        {
            // Deal with the primary key - we need a unique mailing code
            string newName        = Catalog.GetString("NEWVALUE");
            Int32  countNewDetail = 0;

            if (FMainDS.PMailing.Rows.Find(new object[] { newName }) != null)
            {
                while (FMainDS.PMailing.Rows.Find(new object[] { newName + countNewDetail.ToString() }) != null)
                {
                    countNewDetail++;
                }

                newName += countNewDetail.ToString();
            }

            ARow.MailingCode = newName;

            // Initialise the date to today
            ARow.MailingDate = DateTime.Today;
        }
示例#5
0
        /// <summary>
        /// Validates the MPartner Mailing 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>
        public static void ValidateMailingSetup(object AContext, PMailingRow ARow,
            ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict)
        {
            DataColumn ValidationColumn;
            TValidationControlsData ValidationControlsData;
            TVerificationResult VerificationResult = null;

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

            // 'MailingDate' must not be empty
            ValidationColumn = ARow.Table.Columns[PMailingTable.ColumnMailingDateId];

            if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
            {
                VerificationResult = TSharedValidationControlHelper.IsNotInvalidDate(ARow.MailingDate,
                    ValidationControlsData.ValidationControlLabel, AVerificationResultCollection, true,
                    AContext, ValidationColumn, ValidationControlsData.ValidationControl);

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