/// <summary> /// Verify and if necessary update partner data in an extract /// </summary> public static void VerifyAndUpdateExtract(System.Windows.Forms.Form AForm, int AExtractId) { ExtractTDSMExtractTable ExtractTable; bool ChangesMade; // retrieve contents of extract from server ExtractTable = TRemote.MPartner.Partner.WebConnectors.GetExtractRowsWithPartnerData(AExtractId); VerifyAndUpdateExtract(AForm, ref ExtractTable, out ChangesMade); foreach (DataRow InspectDR in ExtractTable.Rows) { InspectDR.EndEdit(); } TSubmitChangesResult SubmissionResult; MExtractTable SubmitDT = new MExtractTable(); if (ExtractTable.GetChangesTyped() != null) { SubmitDT.Merge(ExtractTable.GetChangesTyped()); } if ((SubmitDT.Rows.Count == 0) || !ChangesMade) { MessageBox.Show(Catalog.GetString("Extract was already up to date"), Catalog.GetString("Verify and Update Extract"), MessageBoxButtons.OK, MessageBoxIcon.Information); // return if no changes were made return; } // Submit changes to the PETRAServer SubmissionResult = TRemote.MPartner.Partner.WebConnectors.SaveExtract (AExtractId, ref SubmitDT); if (SubmissionResult == TSubmitChangesResult.scrError) { MessageBox.Show(Catalog.GetString("Verify and Update of Extract failed"), Catalog.GetString("Verify and Update Extract"), MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show(Catalog.GetString("Verification and Update of Extract was successful"), Catalog.GetString("Verify and Update Extract"), MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// save the changes on the screen (code is copied from auto-generated code) /// </summary> /// <returns></returns> public bool SaveChanges() { FPetraUtilsObject.OnDataSavingStart(this, new System.EventArgs()); if (FPetraUtilsObject.VerificationResultCollection.Count == 0) { foreach (DataRow InspectDR in FMainDS.MExtract.Rows) { InspectDR.EndEdit(); } if (!FPetraUtilsObject.HasChanges) { return(true); } else { FPetraUtilsObject.WriteToStatusBar("Saving data..."); this.Cursor = Cursors.WaitCursor; TSubmitChangesResult SubmissionResult; //Ict.Common.Data.TTypedDataTable SubmitDT = FMainDS.MExtract.GetChangesTyped(); MExtractTable SubmitDT = new MExtractTable(); SubmitDT.Merge(FMainDS.MExtract.GetChangesTyped()); if (SubmitDT == null) { // There is nothing to be saved. // Update UI FPetraUtilsObject.WriteToStatusBar(Catalog.GetString("There is nothing to be saved.")); this.Cursor = Cursors.Default; // We don't have unsaved changes anymore FPetraUtilsObject.DisableSaveButton(); return(true); } // Submit changes to the PETRAServer try { SubmissionResult = TRemote.MPartner.Partner.WebConnectors.SaveExtract (FExtractId, ref SubmitDT); } catch (System.Net.Sockets.SocketException) { FPetraUtilsObject.WriteToStatusBar("Data could not be saved!"); this.Cursor = Cursors.Default; MessageBox.Show("The PETRA Server cannot be reached! Data cannot be saved!", "No Server response", MessageBoxButtons.OK, MessageBoxIcon.Stop); bool ReturnValue = false; // TODO OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); return(ReturnValue); } /* TODO ESecurityDBTableAccessDeniedException * catch (ESecurityDBTableAccessDeniedException Exp) * { * FPetraUtilsObject.WriteToStatusBar("Data could not be saved!"); * this.Cursor = Cursors.Default; * // TODO TMessages.MsgSecurityException(Exp, this.GetType()); * bool ReturnValue = false; * // TODO OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); * return ReturnValue; * } */ catch (EDBConcurrencyException) { FPetraUtilsObject.WriteToStatusBar("Data could not be saved!"); this.Cursor = Cursors.Default; // TODO TMessages.MsgDBConcurrencyException(Exp, this.GetType()); bool ReturnValue = false; // TODO OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); return(ReturnValue); } catch (Exception exp) { FPetraUtilsObject.WriteToStatusBar("Data could not be saved!"); this.Cursor = Cursors.Default; TLogging.Log( Catalog.GetString( "An error occurred while trying to connect to the OpenPetra Server!") + Environment.NewLine + exp.ToString(), TLoggingType.ToLogfile); MessageBox.Show( Catalog.GetString("An error occurred while trying to connect to the OpenPetra Server!") + Environment.NewLine + "For details see the log file: " + TLogging.GetLogFileName(), "Server connection error", MessageBoxButtons.OK, MessageBoxIcon.Stop); // TODO OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); return(false); } switch (SubmissionResult) { case TSubmitChangesResult.scrOK: // Call AcceptChanges to get rid now of any deleted columns before we Merge with the result from the Server FMainDS.MExtract.AcceptChanges(); // Merge back with data from the Server (eg. for getting Sequence values) FMainDS.MExtract.Merge(SubmitDT, false); // need to accept the new modification ID FMainDS.MExtract.AcceptChanges(); // Update UI FPetraUtilsObject.WriteToStatusBar("Data successfully saved."); this.Cursor = Cursors.Default; // TODO EnableSave(false); // We don't have unsaved changes anymore FPetraUtilsObject.DisableSaveButton(); SetPrimaryKeyReadOnly(true); // TODO OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); return(true); case TSubmitChangesResult.scrError: // TODO scrError this.Cursor = Cursors.Default; break; case TSubmitChangesResult.scrNothingToBeSaved: // TODO scrNothingToBeSaved this.Cursor = Cursors.Default; return(true); case TSubmitChangesResult.scrInfoNeeded: // TODO scrInfoNeeded this.Cursor = Cursors.Default; break; } } } return(false); }
/// <summary> /// Save the changes on the screen /// </summary> /// <returns></returns> public bool SaveChanges() { Boolean ReturnValue; // Be sure to fire the OnLeave event on the active control of any user control FPetraUtilsObject.ForceOnLeaveForActiveControl(); FPetraUtilsObject.OnDataSavingStart(this, new System.EventArgs()); // Don't allow saving if user is still editing a Detail of a List if (FPetraUtilsObject.InDetailEditMode()) { ReturnValue = false; return(ReturnValue); } // Clear any validation errors so that the following call to ValidateAllData starts with a 'clean slate'. FPetraUtilsObject.VerificationResultCollection.Clear(); if (ValidateAllData(false, TErrorProcessingMode.Epm_IgnoreNonCritical)) { // Ask the user about non-critical warnings, if they are the only 'errors' in the collection if (FPetraUtilsObject.VerificationResultCollection.HasOnlyNonCriticalErrors && (TDataValidation.ProcessAnyDataValidationWarnings(FPetraUtilsObject.VerificationResultCollection, MCommonResourcestrings.StrFormSaveDataAnywayQuestion, this.GetType()) == false)) { return(false); } FMainDS.AApSupplier.Rows[0].BeginEdit(); GetDataFromControls(FMainDS.AApSupplier[0]); if (FMainDS.AApSupplier[0].IsDefaultApAccountNull()) { MessageBox.Show(Catalog.GetString("Please select an AP account (eg. 9100)")); FMainDS.AApSupplier.Rows[0].EndEdit(); ReturnValue = false; return(ReturnValue); } // The account would usually be 9100-AP account. if (FMainDS.AApSupplier[0].DefaultApAccount != "9100") { if (MessageBox.Show(Catalog.GetString("You are not using the standard AP account (9100) - is this OK?"), "Verification", MessageBoxButtons.YesNo) != System.Windows.Forms.DialogResult.Yes) { FMainDS.AApSupplier.Rows[0].EndEdit(); return(false); } } // Don't store with invalid currency value. // if (FMainDS.AApSupplier[0].CurrencyCode == "") { FMainDS.AApSupplier[0].CurrencyCode = FLedgerRow.BaseCurrency; } // If this is a foreign currency supplier, it must be linked to accounts in that currency. // (And if it's not, it mustn't be!) if (!ValidateAccountCurrency(FMainDS.AApSupplier[0].DefaultBankAccount, "Bank")) { return(false); } /* * If we wanted to have only expense accounts in a single currency, we could have this, * but that's probably not what we want... * * if (!ValidateAccountCurrency(FMainDS.AApSupplier[0].DefaultExpAccount, "Expense")) * { * return false; * } */ } ReturnValue = TDataValidation.ProcessAnyDataValidationErrors(false, FPetraUtilsObject.VerificationResultCollection, this.GetType()); if (ReturnValue) { // Fire the DataSavingValidated event, which is the last chance to cancel the save System.ComponentModel.CancelEventArgs eCancel = new System.ComponentModel.CancelEventArgs(false); FPetraUtilsObject.OnDataSavingValidated(this, eCancel); if (eCancel.Cancel == true) { return(false); } foreach (DataTable InspectDT in FMainDS.Tables) { foreach (DataRow InspectDR in InspectDT.Rows) { InspectDR.EndEdit(); } } if (FPetraUtilsObject.HasChanges) { FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataInProgress); this.Cursor = Cursors.WaitCursor; AccountsPayableTDS SubmitDS = FMainDS.GetChangesTyped(true); TSubmitChangesResult SubmissionResult; TVerificationResultCollection VerificationResult = new TVerificationResultCollection(); // Submit changes to the PETRAServer try { SubmissionResult = FUIConnector.SubmitChanges(ref SubmitDS); } catch (ESecurityDBTableAccessDeniedException Exp) { FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataException); this.Cursor = Cursors.Default; TMessages.MsgSecurityException(Exp, this.GetType()); ReturnValue = false; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); return(ReturnValue); } catch (EDBConcurrencyException Exp) { FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataException); this.Cursor = Cursors.Default; TMessages.MsgDBConcurrencyException(Exp, this.GetType()); ReturnValue = false; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); return(ReturnValue); } catch (Exception) { FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataException); this.Cursor = Cursors.Default; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); throw; } switch (SubmissionResult) { case TSubmitChangesResult.scrOK: // Call AcceptChanges to get rid now of any deleted columns before we Merge with the result from the Server FMainDS.AcceptChanges(); // Merge back with data from the Server (eg. for getting Sequence values) if (SubmitDS != null) { FMainDS.Merge(SubmitDS, false); // need to accept the new modification ID FMainDS.AcceptChanges(); } // Update UI FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataSuccessful); this.Cursor = Cursors.Default; // We don't have unsaved changes anymore FPetraUtilsObject.DisableSaveButton(); TFormsMessage broadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcAPSupplierChanged); TFormsList.GFormsList.BroadcastFormMessage(broadcastMessage); ReturnValue = true; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); break; case TSubmitChangesResult.scrError: this.Cursor = Cursors.Default; FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataErrorOccured); MessageBox.Show(Messages.BuildMessageFromVerificationResult(null, VerificationResult)); FPetraUtilsObject.SubmitChangesContinue = false; ReturnValue = false; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); break; case TSubmitChangesResult.scrNothingToBeSaved: this.Cursor = Cursors.Default; FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataNothingToSave); // We don't have unsaved changes anymore FPetraUtilsObject.DisableSaveButton(); ReturnValue = true; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); break; case TSubmitChangesResult.scrInfoNeeded: // TODO scrInfoNeeded this.Cursor = Cursors.Default; break; } } else { // Update UI FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataNothingToSave); this.Cursor = Cursors.Default; FPetraUtilsObject.DisableSaveButton(); // We don't have unsaved changes anymore FPetraUtilsObject.HasChanges = false; ReturnValue = true; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); } } else { FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(false)); } return(ReturnValue); }
/// <summary> /// save the changes on the screen (code is copied from auto-generated code) /// </summary> /// <returns></returns> public bool SaveChanges() { bool ReturnValue = false; FPetraUtilsObject.OnDataSavingStart(this, new System.EventArgs()); if (FPetraUtilsObject.VerificationResultCollection.Count == 0) { foreach (DataRow InspectDR in FMainDS.MExtract.Rows) { InspectDR.EndEdit(); } if (!FPetraUtilsObject.HasChanges) { return(true); } else { FPetraUtilsObject.WriteToStatusBar("Saving data..."); this.Cursor = Cursors.WaitCursor; TSubmitChangesResult SubmissionResult; //Ict.Common.Data.TTypedDataTable SubmitDT = FMainDS.MExtract.GetChangesTyped(); MExtractTable SubmitDT = new MExtractTable(); ExtractTDSMExtractTable ChangesDT = FMainDS.MExtract.GetChangesTyped(); if (ChangesDT != null) { SubmitDT.Merge(ChangesDT); } else { SubmitDT = null; } if (SubmitDT == null) { // There is nothing to be saved. // Update UI FPetraUtilsObject.WriteToStatusBar(Catalog.GetString("There is nothing to be saved.")); this.Cursor = Cursors.Default; // We don't have unsaved changes anymore FPetraUtilsObject.DisableSaveButton(); return(true); } // Submit changes to the PETRAServer try { SubmissionResult = TRemote.MPartner.Partner.WebConnectors.SaveExtract (FExtractId, ref SubmitDT); } catch (ESecurityDBTableAccessDeniedException Exp) { FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataException); this.Cursor = Cursors.Default; TMessages.MsgSecurityException(Exp, this.GetType()); ReturnValue = false; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); return(ReturnValue); } catch (EDBConcurrencyException Exp) { FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataException); this.Cursor = Cursors.Default; TMessages.MsgDBConcurrencyException(Exp, this.GetType()); ReturnValue = false; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); return(ReturnValue); } catch (Exception) { FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataException); this.Cursor = Cursors.Default; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); throw; } switch (SubmissionResult) { case TSubmitChangesResult.scrOK: // Call AcceptChanges to get rid now of any deleted columns before we Merge with the result from the Server FMainDS.MExtract.AcceptChanges(); // Merge back with data from the Server (eg. for getting Sequence values) FMainDS.MExtract.Merge(SubmitDT, false); // need to accept the new modification ID FMainDS.MExtract.AcceptChanges(); // Update UI FPetraUtilsObject.WriteToStatusBar("Data successfully saved."); this.Cursor = Cursors.Default; // TODO EnableSave(false); // We don't have unsaved changes anymore FPetraUtilsObject.DisableSaveButton(); SetPrimaryKeyReadOnly(true); // refresh extract master screen if it is open TFormsMessage BroadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcExtractCreated); BroadcastMessage.SetMessageDataName(ExtractName); TFormsList.GFormsList.BroadcastFormMessage(BroadcastMessage); this.Focus(); // keeps the focus on the current form // TODO OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); return(true); case TSubmitChangesResult.scrError: // TODO scrError this.Cursor = Cursors.Default; break; case TSubmitChangesResult.scrNothingToBeSaved: // TODO scrNothingToBeSaved this.Cursor = Cursors.Default; return(true); case TSubmitChangesResult.scrInfoNeeded: // TODO scrInfoNeeded this.Cursor = Cursors.Default; break; } } } return(false); }
/// <summary> /// save the changes on the screen (code is copied from auto-generated code) /// </summary> /// <returns></returns> public bool SaveChanges() { bool ReturnValue = false; FPetraUtilsObject.OnDataSavingStart(this, new System.EventArgs()); if (ValidateAllData(false, Common.Verification.TErrorProcessingMode.Epm_IgnoreNonCritical)) { foreach (DataRow InspectDR in FMainDS.MExtractMaster.Rows) { InspectDR.EndEdit(); } if (!FPetraUtilsObject.HasChanges) { return(true); } else { FPetraUtilsObject.WriteToStatusBar("Saving data..."); this.Cursor = Cursors.WaitCursor; TSubmitChangesResult SubmissionResult; MExtractMasterTable SubmitDT = new MExtractMasterTable(); if (FMainDS.MExtractMaster.GetChangesTyped() != null) { SubmitDT.Merge(FMainDS.MExtractMaster.GetChangesTyped()); } else { // There is nothing to be saved. // Update UI FPetraUtilsObject.WriteToStatusBar(Catalog.GetString("There is nothing to be saved.")); this.Cursor = Cursors.Default; // We don't have unsaved changes anymore FPetraUtilsObject.DisableSaveButton(); return(true); } // Submit changes to the PETRAServer try { SubmissionResult = TRemote.MPartner.Partner.WebConnectors.SaveExtractMaster (ref SubmitDT); } catch (ESecurityDBTableAccessDeniedException Exp) { FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataException); this.Cursor = Cursors.Default; TMessages.MsgSecurityException(Exp, this.GetType()); ReturnValue = false; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); return(ReturnValue); } catch (EDBConcurrencyException Exp) { FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataException); this.Cursor = Cursors.Default; TMessages.MsgDBConcurrencyException(Exp, this.GetType()); ReturnValue = false; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); return(ReturnValue); } catch (Exception) { FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataException); this.Cursor = Cursors.Default; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); throw; } switch (SubmissionResult) { case TSubmitChangesResult.scrOK: // Call AcceptChanges to get rid now of any deleted columns before we Merge with the result from the Server FMainDS.MExtractMaster.AcceptChanges(); // Merge back with data from the Server (eg. for getting Sequence values) FMainDS.MExtractMaster.Merge(SubmitDT, false); // need to accept the new modification ID FMainDS.MExtractMaster.AcceptChanges(); // Update UI FPetraUtilsObject.WriteToStatusBar("Data successfully saved."); this.Cursor = Cursors.Default; // TODO EnableSave(false); // We don't have unsaved changes anymore FPetraUtilsObject.DisableSaveButton(); SetPrimaryKeyReadOnly(true); // TODO OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); return(true); case TSubmitChangesResult.scrError: // TODO scrError this.Cursor = Cursors.Default; break; case TSubmitChangesResult.scrNothingToBeSaved: // TODO scrNothingToBeSaved this.Cursor = Cursors.Default; return(true); case TSubmitChangesResult.scrInfoNeeded: // TODO scrInfoNeeded this.Cursor = Cursors.Default; break; } } } return(false); }
/// <summary> /// save the changes on the screen /// </summary> /// <returns></returns> public bool SaveChanges() { Boolean ReturnValue; FPetraUtilsObject.OnDataSavingStart(this, new System.EventArgs()); // Don't allow saving if user is still editing a Detail of a List if (FPetraUtilsObject.InDetailEditMode()) { ReturnValue = false; return(ReturnValue); } // Clear any validation errors so that the following call to ValidateAllData starts with a 'clean slate'. FPetraUtilsObject.VerificationResultCollection.Clear(); if (ValidateAllData(false, true)) { FMainDS.AApSupplier.Rows[0].BeginEdit(); GetDataFromControls(FMainDS.AApSupplier[0]); if (FMainDS.AApSupplier[0].IsDefaultApAccountNull()) { MessageBox.Show(Catalog.GetString("Please select an AP account (eg. 9100)")); FMainDS.AApSupplier.Rows[0].EndEdit(); ReturnValue = false; return(ReturnValue); } // The account would usually be 9100-AP account. if (FMainDS.AApSupplier[0].DefaultApAccount != "9100") { if (MessageBox.Show(Catalog.GetString("You are not using the standard AP account (9100) - is this OK?"), "Verification", MessageBoxButtons.YesNo) != System.Windows.Forms.DialogResult.Yes) { FMainDS.AApSupplier.Rows[0].EndEdit(); return(false); } } // Don't store with invalid currency value. // if (FMainDS.AApSupplier[0].CurrencyCode == "") { FMainDS.AApSupplier[0].CurrencyCode = FLedgerRow.BaseCurrency; } // If this is a foreign currency supplier, it must be linked to accounts in that currency. // (And if it's not, it mustn't be!) if (!ValidateAccountCurrency(FMainDS.AApSupplier[0].DefaultBankAccount, "Bank")) { return(false); } /* * If we wanted to have only expense accounts in a single currency, we could have this, * but that's probably not what we want... * * if (!ValidateAccountCurrency(FMainDS.AApSupplier[0].DefaultExpAccount, "Expense")) * { * return false; * } */ } ReturnValue = TDataValidation.ProcessAnyDataValidationErrors(false, FPetraUtilsObject.VerificationResultCollection, this.GetType()); if (ReturnValue) { foreach (DataTable InspectDT in FMainDS.Tables) { foreach (DataRow InspectDR in InspectDT.Rows) { InspectDR.EndEdit(); } } if (FPetraUtilsObject.HasChanges) { FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataInProgress); this.Cursor = Cursors.WaitCursor; AccountsPayableTDS SubmitDS = FMainDS.GetChangesTyped(true); TSubmitChangesResult SubmissionResult; TVerificationResultCollection VerificationResult = new TVerificationResultCollection(); // Submit changes to the PETRAServer try { SubmissionResult = FUIConnector.SubmitChanges(ref SubmitDS); } catch (ESecurityDBTableAccessDeniedException Exp) { FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataException); this.Cursor = Cursors.Default; TMessages.MsgSecurityException(Exp, this.GetType()); ReturnValue = false; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); return(ReturnValue); } catch (EDBConcurrencyException Exp) { FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataException); this.Cursor = Cursors.Default; TMessages.MsgDBConcurrencyException(Exp, this.GetType()); ReturnValue = false; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); return(ReturnValue); } catch (Exception exp) { FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataException); this.Cursor = Cursors.Default; TLogging.Log( Catalog.GetString( "An error occurred while trying to connect to the OpenPetra Server!") + Environment.NewLine + exp.ToString(), TLoggingType.ToLogfile); MessageBox.Show( Catalog.GetString("An error occurred while trying to connect to the OpenPetra Server!") + Environment.NewLine + "For details see the log file: " + TLogging.GetLogFileName(), "Server connection error", MessageBoxButtons.OK, MessageBoxIcon.Stop); ReturnValue = false; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); return(ReturnValue); } switch (SubmissionResult) { case TSubmitChangesResult.scrOK: // Call AcceptChanges to get rid now of any deleted columns before we Merge with the result from the Server FMainDS.AcceptChanges(); // Merge back with data from the Server (eg. for getting Sequence values) FMainDS.Merge(SubmitDS, false); // need to accept the new modification ID FMainDS.AcceptChanges(); // Update UI FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataSuccessful); this.Cursor = Cursors.Default; // We don't have unsaved changes anymore FPetraUtilsObject.DisableSaveButton(); ReturnValue = true; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); break; case TSubmitChangesResult.scrError: this.Cursor = Cursors.Default; FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataErrorOccured); MessageBox.Show(Messages.BuildMessageFromVerificationResult(null, VerificationResult)); FPetraUtilsObject.SubmitChangesContinue = false; ReturnValue = false; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); break; case TSubmitChangesResult.scrNothingToBeSaved: this.Cursor = Cursors.Default; FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataNothingToSave); // We don't have unsaved changes anymore FPetraUtilsObject.DisableSaveButton(); ReturnValue = true; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); break; case TSubmitChangesResult.scrInfoNeeded: // TODO scrInfoNeeded this.Cursor = Cursors.Default; break; } } else { // Update UI FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataNothingToSave); this.Cursor = Cursors.Default; FPetraUtilsObject.DisableSaveButton(); // We don't have unsaved changes anymore FPetraUtilsObject.HasChanges = false; ReturnValue = true; FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(ReturnValue)); } } else { FPetraUtilsObject.OnDataSaved(this, new TDataSavedEventArgs(false)); } return(ReturnValue); }