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

            TSharedValidation_CacheableDataTables.ValidateDocumentType(this, ARow, ref VerificationResultCollection,
                                                                       FPetraUtilsObject.ValidationControlsDict);
        }
        private void NewRowManual(ref PmDocumentTypeRow ARow)
        {
            // Deal with primary key.  DocCode is a unique string
            string newName        = Catalog.GetString("NEWCODE");
            Int32  countNewDetail = 0;

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

                newName += countNewDetail.ToString();
            }

            ARow.DocCode = newName;
        }
        private void NewRowManual(ref PmDocumentTypeRow ARow)
        {
            // Deal with primary key.  DocCode is a unique string
            string newName = Catalog.GetString("NEWCODE");
            Int32 countNewDetail = 0;

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

                newName += countNewDetail.ToString();
            }

            ARow.DocCode = newName;
        }
        private void ValidateDataDetailsManual(PmDocumentTypeRow ARow)
        {
            TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection;

            TSharedValidation_CacheableDataTables.ValidateDocumentType(this, ARow, ref VerificationResultCollection,
                FPetraUtilsObject.ValidationControlsDict);
        }
        /// <summary>
        /// Validates the MPersonnel Document Type 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 ValidateDocumentType(object AContext, PmDocumentTypeRow ARow,
            ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict)
        {
            DataColumn ValidationColumn;
            TValidationControlsData ValidationControlsData;
            TVerificationResult VerificationResult = null;

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

            // 'AssignableDate' must not be empty if the flag is set
            ValidationColumn = ARow.Table.Columns[PmDocumentTypeTable.ColumnUnassignableDateId];

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

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

            // 'Document Category' must not be unassignable
            ValidationColumn = ARow.Table.Columns[PmDocumentTypeTable.ColumnDocCategoryId];

            if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
            {
                PmDocumentCategoryTable DocumentCategoryTable;
                PmDocumentCategoryRow DocumentCategoryRow;

                VerificationResult = null;

                DocumentCategoryTable = (PmDocumentCategoryTable)TSharedDataCache.TMPersonnel.GetCacheablePersonnelTable(
                    TCacheablePersonTablesEnum.DocumentTypeCategoryList);
                DocumentCategoryRow = (PmDocumentCategoryRow)DocumentCategoryTable.Rows.Find(new object[] { ARow.DocCategory });

                // 'Document Category' must not be unassignable
                if ((DocumentCategoryRow != null)
                    && DocumentCategoryRow.UnassignableFlag
                    && (DocumentCategoryRow.IsUnassignableDateNull()
                        || (DocumentCategoryRow.UnassignableDate <= DateTime.Today)))
                {
                    // if 'Document Category' is unassignable then check if the value has been changed or if it is a new record
                    if (TSharedValidationHelper.IsRowAddedOrFieldModified(ARow, PmDocumentTypeTable.GetDocCategoryDBName()))
                    {
                        VerificationResult = new TScreenVerificationResult(new TVerificationResult(AContext,
                                ErrorCodes.GetErrorInfo(PetraErrorCodes.ERR_VALUEUNASSIGNABLE_WARNING,
                                    new string[] { ValidationControlsData.ValidationControlLabel, ARow.DocCategory })),
                            ValidationColumn, ValidationControlsData.ValidationControl);
                    }
                }

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