Exemplo n.º 1
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="ACallerForm">the form that has opened this window; needed for focusing when this window is closed later</param>
        /// <param name="ATheForm"></param>
        /// <param name="AStatusBar"></param>
        public TFrmPetraUtils(Form ACallerForm, IFrmPetra ATheForm, TExtStatusBarHelp AStatusBar)
        {
            FFormActivatedForFirstTime    = true;
            FVerificationResultCollection = new TVerificationResultCollection();

            FTheForm    = ATheForm;
            FWinForm    = (Form)ATheForm;
            FStatusBar  = AStatusBar;
            FCallerForm = ACallerForm;

            if (ACallerForm != null)
            {
                TFormsList.GFormsList.NotifyWindowOpened(ACallerForm.Handle, FWinForm.Handle);
            }

            FWindowExtensions = new TFrmPetraWindowExtensions(FWinForm, FCallerForm);

            //
            // Initialise the Data Validation ToolTip
            //
            FValidationToolTip              = new System.Windows.Forms.ToolTip();
            FValidationToolTip.ToolTipIcon  = System.Windows.Forms.ToolTipIcon.Warning;
            FValidationToolTip.ToolTipTitle = Catalog.GetString("Incorrect Data");
            FValidationToolTip.UseAnimation = true;
            FValidationToolTip.UseFading    = true;

            // WriteToStatusBar(Catalog.GetString("Ready."));
        }
        /// <summary>
        /// Processes the result of a data submission to the Server where the result of that operation is
        /// <see cref="TSubmitChangesResult.scrOK" />. (Overload for DataTables.)
        /// </summary>
        /// <param name="ACallingFormOrUserControl"></param>
        /// <param name="ALocalDT"></param>
        /// <param name="ASubmitDT"></param>
        /// <param name="APetraUtilsObject"></param>
        /// <param name="AVerificationResults"></param>
        /// <param name="ASetPrimaryKeyOnlyMethod"></param>
        /// <param name="AMasterDataTableSaveCall"></param>
        /// <param name="ACalledFromUserControl"></param>
        /// <param name="ACallAcceptChangesOnReturnedDataBeforeMerge"></param>
        public static void ProcessSubmitChangesResultOK(IFrmPetra ACallingFormOrUserControl, DataTable ALocalDT,
            DataTable ASubmitDT, TFrmPetraEditUtils APetraUtilsObject, TVerificationResultCollection AVerificationResults,
            Action <bool>ASetPrimaryKeyOnlyMethod, bool AMasterDataTableSaveCall, bool ACalledFromUserControl,
            bool ACallAcceptChangesOnReturnedDataBeforeMerge = false)
        {
            if (AMasterDataTableSaveCall)
            {
                // Call AcceptChanges to get rid now of any deleted columns before we Merge with the result from the Server
                ALocalDT.AcceptChanges();

                // Merge back with data from the Server (eg. for getting Sequence values)
                if (ACallAcceptChangesOnReturnedDataBeforeMerge)
                {
                    ASubmitDT.AcceptChanges();
                }

                ALocalDT.Merge(ASubmitDT, false);

                // Need to accept any new modification ID's
                ALocalDT.AcceptChanges();

                if (ASetPrimaryKeyOnlyMethod != null)
                {
                    // Ensure the Primary-Key(s)-containing Controls are disabled to prevent further modification of Primary Key values
                    ASetPrimaryKeyOnlyMethod(true);
                }
            }

            CommonPostMergeOperations(ACallingFormOrUserControl, APetraUtilsObject,
                AVerificationResults, ACalledFromUserControl);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Processes the result of a data submission to the Server where the result of that operation is
        /// <see cref="TSubmitChangesResult.scrOK" />. (Overload for DataTables.)
        /// </summary>
        /// <param name="ACallingFormOrUserControl"></param>
        /// <param name="ALocalDT"></param>
        /// <param name="ASubmitDT"></param>
        /// <param name="APetraUtilsObject"></param>
        /// <param name="AVerificationResults"></param>
        /// <param name="ASetPrimaryKeyOnlyMethod"></param>
        /// <param name="AMasterDataTableSaveCall"></param>
        /// <param name="ACalledFromUserControl"></param>
        /// <param name="ACallAcceptChangesOnReturnedDataBeforeMerge"></param>
        public static void ProcessSubmitChangesResultOK(IFrmPetra ACallingFormOrUserControl, DataTable ALocalDT,
                                                        DataTable ASubmitDT, TFrmPetraEditUtils APetraUtilsObject, TVerificationResultCollection AVerificationResults,
                                                        Action <bool> ASetPrimaryKeyOnlyMethod, bool AMasterDataTableSaveCall, bool ACalledFromUserControl,
                                                        bool ACallAcceptChangesOnReturnedDataBeforeMerge = false)
        {
            if (AMasterDataTableSaveCall)
            {
                // Call AcceptChanges to get rid now of any deleted columns before we Merge with the result from the Server
                ALocalDT.AcceptChanges();

                // Merge back with data from the Server (eg. for getting Sequence values)
                if (ACallAcceptChangesOnReturnedDataBeforeMerge)
                {
                    ASubmitDT.AcceptChanges();
                }

                ALocalDT.Merge(ASubmitDT, false);

                // Need to accept any new modification ID's
                ALocalDT.AcceptChanges();

                if (ASetPrimaryKeyOnlyMethod != null)
                {
                    // Ensure the Primary-Key(s)-containing Controls are disabled to prevent further modification of Primary Key values
                    ASetPrimaryKeyOnlyMethod(true);
                }
            }

            CommonPostMergeOperations(ACallingFormOrUserControl, APetraUtilsObject,
                                      AVerificationResults, ACalledFromUserControl);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Processes the result of a data submission to the Server where the result of that operation is
 /// <see cref="TSubmitChangesResult.scrNothingToBeSaved" />.
 /// </summary>
 /// <param name="ACallingFormOrUserControl"></param>
 /// <param name="APetraUtilsObject"></param>
 /// <param name="ACalledFromUserControl"></param>
 public static void ProcessSubmitChangesResultNothingToBeSaved(IFrmPetra ACallingFormOrUserControl,
                                                               TFrmPetraEditUtils APetraUtilsObject,
                                                               bool ACalledFromUserControl = false)
 {
     CommonUIUpdatesNoChangesAnymore(ACallingFormOrUserControl, APetraUtilsObject,
                                     MCommonResourcestrings.StrSavingDataNothingToSave, ACalledFromUserControl);
 }
Exemplo n.º 5
0
        private static void CommonPostMergeOperations(IFrmPetra ACallingFormOrUserControl,
                                                      TFrmPetraEditUtils APetraUtilsObject,
                                                      TVerificationResultCollection AVerificationResults,
                                                      bool ACalledFromUserControl = false)
        {
            CommonUIUpdatesSavingSuccessful(ACallingFormOrUserControl, APetraUtilsObject, ACalledFromUserControl);

            if ((AVerificationResults != null) &&
                (AVerificationResults.HasCriticalOrNonCriticalErrors))
            {
                TDataValidation.ProcessAnyDataValidationErrors(false, AVerificationResults, ACallingFormOrUserControl.GetType(), null);
            }
        }
Exemplo n.º 6
0
        private static void CommonUIUpdatesNoChangesAnymore(IFrmPetra ACallingFormOrUserControl,
                                                            TFrmPetraEditUtils APetraUtilsObject,
                                                            string AStatusBarMessage,
                                                            bool ACalledFromUserControl = false)
        {
            APetraUtilsObject.WriteToStatusBar(AStatusBarMessage);
            APetraUtilsObject.ShowDefaultCursor();

            // We don't have unsaved changes anymore
            APetraUtilsObject.DisableSaveButton();

            if (!ACalledFromUserControl)
            {
                APetraUtilsObject.OnDataSaved(ACallingFormOrUserControl, new TDataSavedEventArgs(true));
            }
        }
        private static void CommonUIUpdatesNoChangesAnymore(IFrmPetra ACallingFormOrUserControl,
            TFrmPetraEditUtils APetraUtilsObject,
            string AStatusBarMessage,
            bool ACalledFromUserControl = false)
        {
            APetraUtilsObject.WriteToStatusBar(AStatusBarMessage);
            APetraUtilsObject.ShowDefaultCursor();

            // We don't have unsaved changes anymore
            APetraUtilsObject.DisableSaveButton();

            if (!ACalledFromUserControl)
            {
                APetraUtilsObject.OnDataSaved(ACallingFormOrUserControl, new TDataSavedEventArgs(true));
            }
        }
 private static void CommonUIUpdatesSavingSuccessful(IFrmPetra ACallingFormOrUserControl, TFrmPetraEditUtils APetraUtilsObject,
     bool ACalledFromUserControl = false)
 {
     CommonUIUpdatesNoChangesAnymore(ACallingFormOrUserControl, APetraUtilsObject,
         MCommonResourcestrings.StrSavingDataSuccessful, ACalledFromUserControl);
 }
        private static void CommonPostMergeOperations(IFrmPetra ACallingFormOrUserControl,
            TFrmPetraEditUtils APetraUtilsObject,
            TVerificationResultCollection AVerificationResults,
            bool ACalledFromUserControl = false)
        {
            CommonUIUpdatesSavingSuccessful(ACallingFormOrUserControl, APetraUtilsObject, ACalledFromUserControl);

            if ((AVerificationResults != null)
                && (AVerificationResults.HasCriticalOrNonCriticalErrors))
            {
                TDataValidation.ProcessAnyDataValidationErrors(false, AVerificationResults, ACallingFormOrUserControl.GetType(), null);
            }
        }
 /// <summary>
 /// Processes the result of a data submission to the Server where the result of that operation is
 /// <see cref="TSubmitChangesResult.scrNothingToBeSaved" />.
 /// </summary>
 /// <param name="ACallingFormOrUserControl"></param>
 /// <param name="APetraUtilsObject"></param>
 /// <param name="ACalledFromUserControl"></param>
 public static void ProcessSubmitChangesResultNothingToBeSaved(IFrmPetra ACallingFormOrUserControl,
     TFrmPetraEditUtils APetraUtilsObject,
     bool ACalledFromUserControl = false)
 {
     CommonUIUpdatesNoChangesAnymore(ACallingFormOrUserControl, APetraUtilsObject,
         MCommonResourcestrings.StrSavingDataNothingToSave, ACalledFromUserControl);
 }
Exemplo n.º 11
0
 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="AParentForm">the form that has opened this window; needed for focusing when this window is closed later</param>
 /// <param name="ATheForm"></param>
 /// <param name="AStatusBar"></param>
 public TFrmPetraReportingUtils(Form AParentForm, IFrmPetra ATheForm,
     TExtStatusBarHelp AStatusBar) : base(AParentForm,
                                         (IFrmPetra)ATheForm,
                                         AStatusBar)
 {
     FCurrentSettingsName = "";
     FSelectedColumn = -1;
     FAvailableFunctions = new ArrayList();
     FGenerateReportThread = null;
     FGenerateExtractThread = null;
     FDontResizeForm = false;
     FDelegateLoadSettingsStarting = null;
     FDelegateLoadSettingsFinished = null;
     FDelegateGenerateReportOverride = null;
     FDelegateViewReportOverride = null;
     FDelegateCancelReportOverride = null;
     FFormReportUi = (Form)ATheForm;
 }
Exemplo n.º 12
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="ACallerForm">the form that has opened this window; needed for focusing when this window is closed later</param>
        /// <param name="ATheForm"></param>
        /// <param name="AStatusBar"></param>
        public TFrmPetraUtils(Form ACallerForm, IFrmPetra ATheForm, TExtStatusBarHelp AStatusBar)
        {
            FFormActivatedForFirstTime = true;
            FVerificationResultCollection = new TVerificationResultCollection();

            FTheForm = ATheForm;
            FWinForm = (Form)ATheForm;
            FStatusBar = AStatusBar;
            FCallerForm = ACallerForm;

            if (ACallerForm != null)
            {
                TFormsList.GFormsList.NotifyWindowOpened(ACallerForm.Handle, FWinForm.Handle);
            }

            FWindowExtensions = new TFrmPetraWindowExtensions(FWinForm, FCallerForm);

            //
            // Initialise the Data Validation ToolTip
            //
            FValidationToolTip = new System.Windows.Forms.ToolTip();
            FValidationToolTip.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Warning;
            FValidationToolTip.ToolTipTitle = Catalog.GetString("Incorrect Data");
            FValidationToolTip.UseAnimation = true;
            FValidationToolTip.UseFading = true;

            // WriteToStatusBar(Catalog.GetString("Ready."));
        }
Exemplo n.º 13
0
 private static void CommonUIUpdatesSavingSuccessful(IFrmPetra ACallingFormOrUserControl, TFrmPetraEditUtils APetraUtilsObject,
                                                     bool ACalledFromUserControl = false)
 {
     CommonUIUpdatesNoChangesAnymore(ACallingFormOrUserControl, APetraUtilsObject,
                                     MCommonResourcestrings.StrSavingDataSuccessful, ACalledFromUserControl);
 }