Ejemplo n.º 1
0
        private void ValidateDataDetailsManual(PPartnerAttributeTypeRow ARow)
        {
            var VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection;

            TSharedPartnerValidation_Partner.ValidateContactTypesSetupManual(this, ARow, ref VerificationResultCollection,
                                                                             FValidationControlsDict);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Performs checks to determine whether a deletion of the current row is permissable
 /// </summary>
 /// <param name="ARowToDelete">the currently selected row to be deleted</param>
 /// <param name="ADeletionQuestion">can be changed to a context-sensitive deletion confirmation question</param>
 /// <returns>true if user is permitted and able to delete the current row</returns>
 private bool PreDeleteManual(PPartnerAttributeTypeRow ARowToDelete, ref string ADeletionQuestion)
 {
     // If the last Row in the Grid is to be deleted: check if there are added 'Detail' Rows in *other* 'Master' Rows,
     // and if any of those 'Master' Rows was added too, tell the user that data needs to be saved first before deletion
     // of the present 'Detail' Row can go ahead.
     // The reason for that is that the deletion of that last 'Detail' Row will cause the OnNoMoreDetailRecords Event to
     // be raised by the UserControl, which in turn will cause the Form to call the 'SaveChanges' Method of the
     // UserControl before the Form saves its own data. While this in itself is OK, saving in the 'SaveChanges' Method
     // of the UserControl would fail as a 'Master' Row itself was newly added AND it wouldn't be in the DB yet!
     return(TDeleteGridRows.MasterDetailFormsSpecialPreDeleteCheck(this.Count,
                                                                   FPartnerAttributeCategoryDT, FMainDS.PPartnerAttributeType,
                                                                   PPartnerAttributeCategoryTable.GetCategoryCodeDBName(), PPartnerAttributeTypeTable.GetCategoryCodeDBName()));
 }
Ejemplo n.º 3
0
 private void PostDeleteManual(PPartnerAttributeTypeRow ARowToDelete,
                               bool AAllowDeletion,
                               bool ADeletionPerformed,
                               string ACompletionMessage)
 {
     if (ADeletionPerformed)
     {
         // If we have no Contact Types anymore: Inform the Form
         if (this.Count == 0)
         {
             OnNoMoreDetailRecords(null);
         }
     }
 }
Ejemplo n.º 4
0
        private void GetDetailDataFromControlsManual(PPartnerAttributeTypeRow ARow)
        {
            switch (cmbDetailAttributeTypeValueKind.SelectedIndex)
            {
            case 0:
                ARow.AttributeTypeValueKind = "CONTACTDETAIL_GENERAL";
                // Remove any HyperlinkFormat that might have been set if the record previously held AttributeTypeValueKind "CONTACTDETAIL_HYPERLINK_WITHVALUE"
                ARow.HyperlinkFormat = String.Empty;

                break;

            case 1:
                ARow.AttributeTypeValueKind = "CONTACTDETAIL_EMAILADDRESS";
                // Remove any HyperlinkFormat that might have been set if the record previously held AttributeTypeValueKind "CONTACTDETAIL_HYPERLINK_WITHVALUE"
                ARow.HyperlinkFormat = String.Empty;

                break;

            case 2:
                ARow.AttributeTypeValueKind = "CONTACTDETAIL_HYPERLINK";
                // Remove any HyperlinkFormat that might have been set if the record previously held AttributeTypeValueKind "CONTACTDETAIL_HYPERLINK_WITHVALUE"
                ARow.HyperlinkFormat = String.Empty;

                break;

            case 3:
                ARow.AttributeTypeValueKind = "CONTACTDETAIL_HYPERLINK_WITHVALUE";

                break;

            case 4:
                ARow.AttributeTypeValueKind = "CONTACTDETAIL_SKYPEID";
                // Remove any HyperlinkFormat that might have been set if the record previously held AttributeTypeValueKind "CONTACTDETAIL_HYPERLINK_WITHVALUE"
                ARow.HyperlinkFormat = String.Empty;

                break;

            default:
                ARow.AttributeTypeValueKind = "CONTACTDETAIL_GENERAL";
                // Remove any HyperlinkFormat that might have been set if the record previously held AttributeTypeValueKind "CONTACTDETAIL_HYPERLINK_WITHVALUE"
                ARow.HyperlinkFormat = String.Empty;

                break;
            }
        }
Ejemplo n.º 5
0
        private void ShowDetailsManual(PPartnerAttributeTypeRow ARow)
        {
            if (ARow == null)
            {
                cmbDetailAttributeTypeValueKind.SelectedIndex = 0;

                return;
            }
            else
            {
                switch (ARow.AttributeTypeValueKind)
                {
                case "CONTACTDETAIL_GENERAL":
                    cmbDetailAttributeTypeValueKind.SelectedIndex = 0;
                    break;

                case "CONTACTDETAIL_HYPERLINK":
                    cmbDetailAttributeTypeValueKind.SelectedIndex = 2;
                    break;

                case "CONTACTDETAIL_HYPERLINK_WITHVALUE":
                    cmbDetailAttributeTypeValueKind.SelectedIndex = 3;
                    break;

                case "CONTACTDETAIL_EMAILADDRESS":
                    cmbDetailAttributeTypeValueKind.SelectedIndex = 1;
                    break;

                case "CONTACTDETAIL_SKYPEID":
                    cmbDetailAttributeTypeValueKind.SelectedIndex = 4;
                    break;

                default:
                    cmbDetailAttributeTypeValueKind.SelectedIndex = 0;
                    break;
                }
            }

            FIndexedGridRowsHelper.UpdateButtons(GetSelectedRowIndex());
        }
Ejemplo n.º 6
0
        private void NewRowManual(ref PPartnerAttributeTypeRow ARow)
        {
            string NewName        = Catalog.GetString("NEWTYPE");
            Int32  CountNewDetail = 0;

            if (FMainDS.PPartnerAttributeType.Rows.Find(new object[] { NewName }) != null)
            {
                while (FMainDS.PPartnerAttributeType.Rows.Find(new object[] { NewName + CountNewDetail.ToString() }) != null)
                {
                    CountNewDetail++;
                }

                NewName += CountNewDetail.ToString();
            }

            ARow.AttributeType          = NewName;
            ARow.SpecialLabel           = "PLEASE ENTER LABEL";
            ARow.CategoryCode           = FContactCategory;
            ARow.AttributeTypeValueKind = "CONTACTDETAIL_GENERAL";
            ARow.Deletable = true;  // all manually created Contact Types are deletable

            // Determine and set the 'Index' (ARow.Index in this case) of the new Row
            FIndexedGridRowsHelper.DetermineIndexForNewRow(ARow);
        }
        private void SelectCorrespondingCategory(PPartnerAttributeTypeRow ARow)
        {
            int SelectionCounter = 0;

            foreach (DataRowView Drv in cmbContactCategory.Table.DefaultView)
            {
                if (((PPartnerAttributeCategoryRow)(Drv.Row)).CategoryCode == ARow.CategoryCode)
                {
                    break;
                }

                SelectionCounter++;
            }

            cmbContactCategory.SelectedIndex = SelectionCounter;
        }
        private void ValidateDataDetailsManual(PPartnerAttributeTypeRow ARow)
        {
            var VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection;

            TSharedPartnerValidation_Partner.ValidateContactTypesSetupManual(this, ARow, ref VerificationResultCollection,
                FValidationControlsDict);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Validates the Partner Contact Types Setup usercontrol 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 ValidateContactTypesSetupManual(object AContext, PPartnerAttributeTypeRow ARow,
            ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict)
        {
            DataColumn ValidationColumn;
            TValidationControlsData ValidationControlsData;
            TVerificationResult VerificationResult = null;

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

            // 'HyperLink Format' must be correct if ARow.AttributeTypeValueKind is "CONTACTDETAIL_HYPERLINK_WITHVALUE"
            ValidationColumn = ARow.Table.Columns[PPartnerAttributeTypeTable.ColumnHyperlinkFormatId];

            if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
            {
                if (ARow.AttributeTypeValueKind == "CONTACTDETAIL_HYPERLINK_WITHVALUE")
                {
                    // Remove any Data Validation errors that might have been recorded
                    AVerificationResultCollection.Remove(ValidationColumn);

                    // 'HyperLink Format' must not be empty string
                    VerificationResult = TGeneralChecks.ValueMustNotBeNullOrEmptyString(ARow.HyperlinkFormat, Catalog.GetString("Link Format"),
                        AContext, ValidationColumn, ValidationControlsData.ValidationControl);

                    if ((VerificationResult == null)
                        && (ARow.HyperlinkFormat == THyperLinkHandling.HYPERLINK_WITH_VALUE_VALUE_PLACEHOLDER_IDENTIFIER))
                    {
                        // 'HyperLink Format' must contain more than just THyperLinkHandling.HYPERLINK_WITH_VALUE_VALUE_PLACEHOLDER_IDENTIFIER
                        VerificationResult = new TScreenVerificationResult(new TVerificationResult(AContext,
                                ErrorCodes.GetErrorInfo(PetraErrorCodes.ERR_INVALID_HYPERLINK_WITH_VALUE_JUST_CONTAINING_PLACEHOLDER,
                                    new string[] { THyperLinkHandling.HYPERLINK_WITH_VALUE_VALUE_PLACEHOLDER_IDENTIFIER })),
                            ValidationColumn, ValidationControlsData.ValidationControl);
                    }

                    if ((VerificationResult == null)
                        && (ARow.HyperlinkFormat.IndexOf(THyperLinkHandling.HYPERLINK_WITH_VALUE_VALUE_PLACEHOLDER_IDENTIFIER,
                                StringComparison.InvariantCulture) == -1))
                    {
                        // 'HyperLink Format' must contain THyperLinkHandling.HYPERLINK_WITH_VALUE_VALUE_PLACEHOLDER_IDENTIFIER,
                        VerificationResult = new TScreenVerificationResult(new TVerificationResult(AContext,
                                ErrorCodes.GetErrorInfo(PetraErrorCodes.ERR_INVALID_HYPERLINK_WITH_VALUE_NOT_CONTAINING_PLACEHOLDER,
                                    new string[] { THyperLinkHandling.HYPERLINK_WITH_VALUE_VALUE_PLACEHOLDER_IDENTIFIER })),
                            ValidationColumn, ValidationControlsData.ValidationControl);
                    }

                    // Handle addition to/removal from TVerificationResultCollection
                    AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
                }
                else
                {
                    // Remove any Data Validation errors that might have been recorded
                    AVerificationResultCollection.Remove(ValidationColumn);
                }
            }

            VerificationResult = null;

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

            if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
            {
                if (ARow.Unassignable)
                {
                    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);
            }
        }
 private void PostDeleteManual(PPartnerAttributeTypeRow ARowToDelete,
     bool AAllowDeletion,
     bool ADeletionPerformed,
     string ACompletionMessage)
 {
     if (ADeletionPerformed)
     {
         // If we have no Contact Types anymore: Inform the Form
         if (this.Count == 0)
         {
             OnNoMoreDetailRecords(null);
         }
     }
 }
 /// <summary>
 /// Performs checks to determine whether a deletion of the current row is permissable
 /// </summary>
 /// <param name="ARowToDelete">the currently selected row to be deleted</param>
 /// <param name="ADeletionQuestion">can be changed to a context-sensitive deletion confirmation question</param>
 /// <returns>true if user is permitted and able to delete the current row</returns>
 private bool PreDeleteManual(PPartnerAttributeTypeRow ARowToDelete, ref string ADeletionQuestion)
 {
     // If the last Row in the Grid is to be deleted: check if there are added 'Detail' Rows in *other* 'Master' Rows,
     // and if any of those 'Master' Rows was added too, tell the user that data needs to be saved first before deletion
     // of the present 'Detail' Row can go ahead.
     // The reason for that is that the deletion of that last 'Detail' Row will cause the OnNoMoreDetailRecords Event to
     // be raised by the UserControl, which in turn will cause the Form to call the 'SaveChanges' Method of the
     // UserControl before the Form saves its own data. While this in itself is OK, saving in the 'SaveChanges' Method
     // of the UserControl would fail as a 'Master' Row itself was newly added AND it wouldn't be in the DB yet!
     return TDeleteGridRows.MasterDetailFormsSpecialPreDeleteCheck(this.Count,
         FPartnerAttributeCategoryDT, FMainDS.PPartnerAttributeType,
         PPartnerAttributeCategoryTable.GetCategoryCodeDBName(), PPartnerAttributeTypeTable.GetCategoryCodeDBName());
 }
        private void GetDetailDataFromControlsManual(PPartnerAttributeTypeRow ARow)
        {
            switch (cmbDetailAttributeTypeValueKind.SelectedIndex)
            {
                case 0:
                    ARow.AttributeTypeValueKind = "CONTACTDETAIL_GENERAL";
                    // Remove any HyperlinkFormat that might have been set if the record previously held AttributeTypeValueKind "CONTACTDETAIL_HYPERLINK_WITHVALUE"
                    ARow.HyperlinkFormat = String.Empty;

                    break;

                case 1:
                    ARow.AttributeTypeValueKind = "CONTACTDETAIL_EMAILADDRESS";
                    // Remove any HyperlinkFormat that might have been set if the record previously held AttributeTypeValueKind "CONTACTDETAIL_HYPERLINK_WITHVALUE"
                    ARow.HyperlinkFormat = String.Empty;

                    break;

                case 2:
                    ARow.AttributeTypeValueKind = "CONTACTDETAIL_HYPERLINK";
                    // Remove any HyperlinkFormat that might have been set if the record previously held AttributeTypeValueKind "CONTACTDETAIL_HYPERLINK_WITHVALUE"
                    ARow.HyperlinkFormat = String.Empty;

                    break;

                case 3:
                    ARow.AttributeTypeValueKind = "CONTACTDETAIL_HYPERLINK_WITHVALUE";

                    break;

                case 4:
                    ARow.AttributeTypeValueKind = "CONTACTDETAIL_SKYPEID";
                    // Remove any HyperlinkFormat that might have been set if the record previously held AttributeTypeValueKind "CONTACTDETAIL_HYPERLINK_WITHVALUE"
                    ARow.HyperlinkFormat = String.Empty;

                    break;

                default:
                    ARow.AttributeTypeValueKind = "CONTACTDETAIL_GENERAL";
                    // Remove any HyperlinkFormat that might have been set if the record previously held AttributeTypeValueKind "CONTACTDETAIL_HYPERLINK_WITHVALUE"
                    ARow.HyperlinkFormat = String.Empty;

                    break;
            }
        }
        private void ShowDetailsManual(PPartnerAttributeTypeRow ARow)
        {
            if (ARow == null)
            {
                cmbDetailAttributeTypeValueKind.SelectedIndex = 0;

                return;
            }
            else
            {
                switch (ARow.AttributeTypeValueKind)
                {
                    case "CONTACTDETAIL_GENERAL":
                        cmbDetailAttributeTypeValueKind.SelectedIndex = 0;
                        break;

                    case "CONTACTDETAIL_HYPERLINK":
                        cmbDetailAttributeTypeValueKind.SelectedIndex = 2;
                        break;

                    case "CONTACTDETAIL_HYPERLINK_WITHVALUE":
                        cmbDetailAttributeTypeValueKind.SelectedIndex = 3;
                        break;

                    case "CONTACTDETAIL_EMAILADDRESS":
                        cmbDetailAttributeTypeValueKind.SelectedIndex = 1;
                        break;

                    case "CONTACTDETAIL_SKYPEID":
                        cmbDetailAttributeTypeValueKind.SelectedIndex = 4;
                        break;

                    default:
                        cmbDetailAttributeTypeValueKind.SelectedIndex = 0;
                        break;
                }
            }

            FIndexedGridRowsHelper.UpdateButtons(GetSelectedRowIndex());
        }
        private void NewRowManual(ref PPartnerAttributeTypeRow ARow)
        {
            string NewName = Catalog.GetString("NEWTYPE");
            Int32 CountNewDetail = 0;

            if (FMainDS.PPartnerAttributeType.Rows.Find(new object[] { NewName }) != null)
            {
                while (FMainDS.PPartnerAttributeType.Rows.Find(new object[] { NewName + CountNewDetail.ToString() }) != null)
                {
                    CountNewDetail++;
                }

                NewName += CountNewDetail.ToString();
            }

            ARow.AttributeType = NewName;
            ARow.SpecialLabel = "PLEASE ENTER LABEL";
            ARow.CategoryCode = FContactCategory;
            ARow.AttributeTypeValueKind = "CONTACTDETAIL_GENERAL";
            ARow.Deletable = true;  // all manually created Contact Types are deletable

            // Determine and set the 'Index' (ARow.Index in this case) of the new Row
            FIndexedGridRowsHelper.DetermineIndexForNewRow(ARow);
        }