Beispiel #1
0
        private void FPetraUtilsObject_DataSaved(object Sender, Common.TDataSavedEventArgs e)
        {
            if (!e.Success)
            {
                return;
            }

            // Data was saved successfully so do we need to broadcast anything??
            if (FIncludesLocalisedCountyLabel != null)
            {
                TFormsMessage broadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcLocalisedCountyLabelChanged);
                broadcastMessage.SetMessageDataName(FIncludesLocalisedCountyLabel.DefaultValue);
                TFormsList.GFormsList.BroadcastFormMessage(broadcastMessage);
            }

            if (FIncludesDonorZero != null)
            {
                TFormsMessage broadcastMessage   = new TFormsMessage(TFormsMessageClassEnum.mcGiftPartnerZeroChanged);
                Dictionary <string, object> data = new Dictionary <string, object>();
                data.Add(FIncludesDonorZero.DefaultCode, StringHelper.StrToBool(FIncludesDonorZero.DefaultValue));
                broadcastMessage.SetMessageDataSimpleDictionary(data);
                TFormsList.GFormsList.BroadcastFormMessage(broadcastMessage);
            }

            if (FIncludesRecipientZero != null)
            {
                TFormsMessage broadcastMessage   = new TFormsMessage(TFormsMessageClassEnum.mcGiftPartnerZeroChanged);
                Dictionary <string, object> data = new Dictionary <string, object>();
                data.Add(FIncludesRecipientZero.DefaultCode, StringHelper.StrToBool(FIncludesRecipientZero.DefaultValue));
                broadcastMessage.SetMessageDataSimpleDictionary(data);
                TFormsList.GFormsList.BroadcastFormMessage(broadcastMessage);
            }
        }
Beispiel #2
0
        private void FPetraUtilsObject_DataSaved(object Sender, TDataSavedEventArgs e)
        {
            if (e.Success)
            {
                // Reload details on successful save. This is so dtpDetailDateEffective can be made readonly
                if (!FPetraUtilsObject.HasChanges)
                {
                    ShowDetailsManual(FPreviouslySelectedDetailRow);
                }

                if (!this.Modal)
                {
                    // Broadcast message to update partner's Partner Edit screen if open
                    TFormsMessage BroadcastMessage;

                    BroadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcGiftDestinationChanged);

                    BroadcastMessage.SetMessageDataGiftDestination(
                        FPartnerKey,
                        FMainDS.PPartnerGiftDestination);

                    TFormsList.GFormsList.BroadcastFormMessage(BroadcastMessage);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Will be called by TFormsList to inform any Form that is registered in TFormsList
        /// about any 'Forms Messages' that are broadcasted.
        /// </summary>
        /// <remarks>This form 'listens' to such 'Forms Message' broadcasts by
        /// implementing this virtual Method. This Method will be called each time a
        /// 'Forms Message' broadcast occurs.
        /// </remarks>
        /// <param name="AFormsMessage">An instance of a 'Forms Message'. This can be
        /// inspected for parameters in the Method Body and the Form can use those to choose
        /// to react on the Message, or not.</param>
        /// <returns>True if I acted on the Message.</returns>
        public bool ProcessFormsMessage(TFormsMessage AFormsMessage)
        {
            bool MessageProcessed = false;

            if (AFormsMessage.MessageClass == TFormsMessageClassEnum.mcAPSupplierChanged)
            {
                IsSupplierDataChanged = true;  // Suppliers list will be refreshed when next shown.

                if (tabSearchResult.SelectedTab == tpgSuppliers)
                {
                    ucoSuppliers.LoadSuppliers();  // Refresh the list now.
                }

                MessageProcessed = true;
            }
            else if (AFormsMessage.MessageClass == TFormsMessageClassEnum.mcAPTransactionChanged)
            {
                // Refresh the outstanding invoices
                IsInvoiceDataChanged = true;

                if (tabSearchResult.SelectedTab == tpgOutstandingInvoices)
                {
                    ucoOutstandingInvoices.LoadInvoices();
                }
                else if (tabSearchResult.SelectedTab == tpgSupplierTransactionHistory)
                {
                    TabChange(null, null);
                }

                MessageProcessed = true;
            }

            return(MessageProcessed);
        }
        // carry out the adjustment
        /// <summary>
        /// Carry out a Tax Deductible Pct adjustment.
        /// </summary>
        /// <param name="ARecipientKey"></param>
        /// <param name="ANewPct"></param>
        /// <param name="AValidFrom"></param>
        /// <param name="ANoReceipt"></param>
        /// <param name="AParentForm"></param>
        public static void TaxDeductiblePctAdjustment(Int64 ARecipientKey, decimal ANewPct, DateTime AValidFrom, bool ANoReceipt, Form AParentForm)
        {
            GiftBatchTDS GiftBatchDS = new GiftBatchTDS();

            // get all the data needed for this Field Adjustment
            if (!GetAllDataNeeded(ref GiftBatchDS, ARecipientKey, ANewPct, AValidFrom, AParentForm))
            {
                return;
            }

            // show the list of gifts to be adjusted and ask the user for confirmation
            TFrmGiftFieldAdjustmentConfirmation ConfirmationForm = new TFrmGiftFieldAdjustmentConfirmation(AParentForm);

            ConfirmationForm.MainDS = GiftBatchDS;
            ConfirmationForm.Text   = Catalog.GetString("Confirm Tax Deductible Percentage Adjustment");

            if (ConfirmationForm.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            // Carry out the gift adjustment
            TFrmGiftFieldAdjustment.GiftAdjustment(GiftBatchDS, ANewPct, ANoReceipt, AParentForm);

            // refresh gift batch screen
            TFormsMessage broadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcRefreshGiftBatches, AParentForm.ToString());

            TFormsList.GFormsList.BroadcastFormMessage(broadcastMessage);
        }
        /// <summary>
        /// Will be called by TFormsList to inform any Form that is registered in TFormsList
        /// about any 'Forms Messages' that are broadcasted.
        /// </summary>
        /// <remarks>The Partner Edit 'listens' to such 'Forms Message' broadcasts by
        /// implementing this virtual Method. This Method will be called each time a
        /// 'Forms Message' broadcast occurs.
        /// </remarks>
        /// <param name="AFormsMessage">An instance of a 'Forms Message'. This can be
        /// inspected for parameters in the Method Body and the Form can use those to choose
        /// to react on the Message, or not.</param>
        /// <returns>Returns True if the Form reacted on the specific Forms Message,
        /// otherwise false.</returns>
        public bool ProcessFormsMessage(TFormsMessage AFormsMessage)
        {
            bool MessageProcessed = false;

            if (AFormsMessage.MessageClass == TFormsMessageClassEnum.mcExtractCreated)
            {
                FPetraUtilsObject.GetForm().BringToFront();

                if (FDelegateRefreshExtractList())
                {
                    // this is required as extracts are created on a different thread
                    if (this.InvokeRequired)
                    {
                        this.BeginInvoke((MethodInvoker) delegate()
                        {
                            // show filter panel
                            MniFilterFind_Click(GetPetraUtilsObject().GetForm(), null);
                            // show the screen in case it has been hidden
                            FPetraUtilsObject.GetForm().Show();
                            // filter results to show the new extract
                            ((TextBox)FFilterAndFindObject.FilterPanelControls.FindControlByName("txtExtractName")).Text =
                                ((TFormsMessage.FormsMessageName)AFormsMessage.MessageObject).Name;
                        });
                    }
                }

                MessageProcessed = true;
            }

            return(MessageProcessed);
        }
Beispiel #6
0
        /// <summary>
        /// Will be called by TFormsList to inform any Form that is registered in TFormsList
        /// about any 'Forms Messages' that are broadcasted.
        /// </summary>
        /// <remarks>The Partner Edit 'listens' to such 'Forms Message' broadcasts by
        /// implementing this virtual Method. This Method will be called each time a
        /// 'Forms Message' broadcast occurs.
        /// </remarks>
        /// <param name="AFormsMessage">An instance of a 'Forms Message'. This can be
        /// inspected for parameters in the Method Body and the Form can use those to choose
        /// to react on the Message, or not.</param>
        /// <returns>Returns True if the Form reacted on the specific Forms Message,
        /// otherwise false.</returns>
        public bool ProcessFormsMessage(TFormsMessage AFormsMessage)
        {
            bool MessageProcessed = false;

            // update gift destination
            if (AFormsMessage.MessageClass == TFormsMessageClassEnum.mcGiftDestinationChanged)
            {
                ucoTransactions.ProcessGiftDetainationBroadcastMessage(AFormsMessage);

                MessageProcessed = true;
            }
            else if (AFormsMessage.MessageClass == TFormsMessageClassEnum.mcUnitHierarchyChanged)
            {
                ucoTransactions.ProcessUnitHierarchyBroadcastMessage(AFormsMessage);

                MessageProcessed = true;
            }
            else if (AFormsMessage.MessageClass == TFormsMessageClassEnum.mcRefreshGiftBatches)
            {
                this.RefreshAll(false);

                MessageProcessed = true;
            }

            return(MessageProcessed);
        }
Beispiel #7
0
        /// <summary>
        /// Will be called by TFormsList to inform any Form that is registered in TFormsList
        /// about any 'Forms Messages' that are broadcasted.
        /// </summary>
        /// <remarks>The Partner Edit 'listens' to such 'Forms Message' broadcasts by
        /// implementing this virtual Method. This Method will be called each time a
        /// 'Forms Message' broadcast occurs.
        /// </remarks>
        /// <param name="AFormsMessage">An instance of a 'Forms Message'. This can be
        /// inspected for parameters in the Method Body and the Form can use those to choose
        /// to react on the Message, or not.</param>
        /// <returns>Returns True if the Form reacted on the specific Forms Message,
        /// otherwise false.</returns>
        public bool ProcessFormsMessage(TFormsMessage AFormsMessage)
        {
            bool MessageProcessed = false;

            if ((AFormsMessage.MessageClass == TFormsMessageClassEnum.mcNewPartnerSaved) ||
                (AFormsMessage.MessageClass == TFormsMessageClassEnum.mcExistingPartnerSaved) ||
                (AFormsMessage.MessageClass == TFormsMessageClassEnum.mcPartnerDeleted))
            {
                // Refreshes the Suppliers list on the Suppliers tab
                FIsSupplierDataChanged = true;

                if (tabSearchResult.SelectedTab == tpgSuppliers)
                {
                    ucoSuppliers.LoadSuppliers();
                }

                MessageProcessed = true;
            }
            else if (AFormsMessage.MessageClass == TFormsMessageClassEnum.mcAPTransactionChanged)
            {
                // Refresh the outstanding invoices
                FIsInvoiceDataChanged = true;

                if (tabSearchResult.SelectedTab == tpgOutstandingInvoices)
                {
                    ucoOutstandingInvoices.LoadInvoices();
                }

                MessageProcessed = true;
            }

            return(MessageProcessed);
        }
Beispiel #8
0
        /// <summary>
        /// Will be called by TFormsList to inform any Form that is registered in TFormsList
        /// about any 'Forms Messages' that are broadcasted.
        /// </summary>
        /// <remarks>This screen 'listens' to such 'Forms Message' broadcasts by
        /// implementing this virtual Method. This Method will be called each time a
        /// 'Forms Message' broadcast occurs.
        /// </remarks>
        /// <param name="AFormsMessage">An instance of a 'Forms Message'. This can be
        /// inspected for parameters in the Method Body and the Form can use those to choose
        /// to react on the Message, or not.</param>
        /// <returns>Returns True if the Form reacted on the specific Forms Message,
        /// otherwise false.</returns>
        public bool ProcessFormsMessage(TFormsMessage AFormsMessage)
        {
            bool MessageProcessed = false;

            if (AFormsMessage.MessageClass == TFormsMessageClassEnum.mcAccountsChanged)
            {
                string CurrentlySelectedAccountCode = FPreviouslySelectedDetailRow.AccountCode;
                Type   DataTableType;

                // Load Data
                DataTable CacheDT = TDataCache.GetSpecificallyFilteredCacheableDataTableFromCache("AccountList", "Ledger", FFilter, out DataTableType);
                FMainDS.AAccount.Merge(CacheDT);

                GetData();

                // reapply filter
                FFilterAndFindObject.ApplyFilter();

                // reselect the last selected account code
                if (FPreviouslySelectedDetailRow != null)
                {
                    SelectAccountInGrid(CurrentlySelectedAccountCode);
                }

                UpdateRecordNumberDisplay();

                MessageProcessed = true;
            }

            return(MessageProcessed);
        }
 private void FPetraUtilsObject_DataSaved(object Sender, TDataSavedEventArgs e)
 {
     if (e.Success)
     {
         // We need to notify a listener such as the Form Letter dialog
         TFormsMessage broadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcMailingSetupSaved, this.ToString());
         TFormsList.GFormsList.BroadcastFormMessage(broadcastMessage);
     }
 }
 /// <summary>
 /// When this document is saved in the database, I can check whether
 /// my calling form should be updated.
 /// </summary>
 /// <param name="Sender"></param>
 /// <param name="e"></param>
 private void OnDataSaved(object Sender, TDataSavedEventArgs e)
 {
     if (e.Success)
     {
         TFormsMessage broadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcAPTransactionChanged);
         broadcastMessage.SetMessageDataAPTransaction(txtSupplierName.Text);
         TFormsList.GFormsList.BroadcastFormMessage(broadcastMessage);
     }
 }
Beispiel #11
0
 private void FPetraUtilsObject_DataSaved(object sender, TDataSavedEventArgs e)
 {
     if (e.Success && FLatestSaveIncludedForex)
     {
         // Notify the exchange rate screen, if it is there
         TFormsMessage broadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcGLOrGiftBatchSaved, this.ToString());
         TFormsList.GFormsList.BroadcastFormMessage(broadcastMessage);
     }
 }
Beispiel #12
0
        /// <summary>
        /// this is where all the calculations take place
        /// </summary>
        /// <returns>
        /// true if the report was successfully generated
        /// </returns>
        public Boolean GenerateResultRemoteClient()
        {
            Boolean ReturnValue;
            Thread  ProgressCheckThread;

            ReturnValue          = false;
            FReportingGenerator  = TRemote.MReporting.UIConnectors.ReportGenerator();
            FKeepUpProgressCheck = true;

            try
            {
                this.Results = new TResultList();
                FReportingGenerator.Start(this.Parameters.ToDataTable());
                ProgressCheckThread = new Thread(new ThreadStart(AsyncProgressCheckThread));
                ProgressCheckThread.Start();
            }
            catch (Exception e)
            {
                TLogging.Log(e.Message);

                // Release the server object
                FReportingGenerator = null;

                return(false);
            }

            // todo: allow canceling of the calculation of a report
            while (FKeepUpProgressCheck)
            {
                Thread.Sleep(500);
            }

            ReturnValue = FReportingGenerator.GetSuccess();

            // Do not release the server object, we still might want to send an email...
            // FReportingGenerator = null;

            if (ReturnValue)
            {
                if (FCalculatesExtract)
                {
                    TLogging.Log("Extract calculation finished. Look for extract '" +
                                 Parameters.Get("param_extract_name").ToString() +
                                 "' in Extract Master List.", TLoggingType.ToStatusBar);

                    TFormsMessage BroadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcExtractCreated);
                    BroadcastMessage.SetMessageDataName(Parameters.Get("param_extract_name").ToString());
                    TFormsList.GFormsList.BroadcastFormMessage(BroadcastMessage);
                }
                else
                {
                    TLogging.Log("Report calculation finished.", TLoggingType.ToStatusBar);
                }
            }

            return(ReturnValue);
        }
Beispiel #13
0
        /// <summary>
        /// Will be called by TFormsList to inform any Form that is registered in TFormsList
        /// about any 'Forms Messages' that are broadcasted.
        /// </summary>
        /// <remarks>The Partner Edit 'listens' to such 'Forms Message' broadcasts by
        /// implementing this virtual Method. This Method will be called each time a
        /// 'Forms Message' broadcast occurs.
        /// </remarks>
        /// <param name="AFormsMessage">An instance of a 'Forms Message'. This can be
        /// inspected for parameters in the Method Body and the Form can use those to choose
        /// to react on the Message, or not.</param>
        /// <returns>Returns True if the Form reacted on the specific Forms Message,
        /// otherwise false.</returns>
        public bool ProcessFormsMessage(TFormsMessage AFormsMessage)
        {
            bool MessageProcessed = false;

            if (AFormsMessage.MessageClass == TFormsMessageClassEnum.mcRefreshGLBatches)
            {
                this.RefreshAll(true);

                MessageProcessed = true;
            }

            return(MessageProcessed);
        }
        // once an extract has been created, this will refresh extract master screen and open maintainance screen for extract
        private static void NewExtractCreated(string AExtractName, int AExtractId, Form AParentForm)
        {
            // refresh extract master screen if it is open
            TFormsMessage BroadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcExtractCreated);

            BroadcastMessage.SetMessageDataName(AExtractName);
            TFormsList.GFormsList.BroadcastFormMessage(BroadcastMessage);

            // now open Screen for new extract so user can add partner records manually
            TFrmExtractMaintain frm = new TFrmExtractMaintain(AParentForm);

            frm.ExtractId   = AExtractId;
            frm.ExtractName = AExtractName;
            frm.Show();
        }
        /// <summary>
        /// Will be called by TFormsList to inform any Form that is registered in TFormsList
        /// about any 'Forms Messages' that are broadcasted.
        /// </summary>
        /// <remarks>This screen 'listens' to such 'Forms Message' broadcasts by
        /// implementing this virtual Method. This Method will be called each time a
        /// 'Forms Message' broadcast occurs.
        /// </remarks>
        /// <param name="AFormsMessage">An instance of a 'Forms Message'. This can be
        /// inspected for parameters in the Method Body and the Form can use those to choose
        /// to react on the Message, or not.</param>
        /// <returns>Returns True if the Form reacted on the specific Forms Message,
        /// otherwise false.</returns>
        public bool ProcessFormsMessage(TFormsMessage AFormsMessage)
        {
            bool MessageProcessed = false;

            if ((((IFormsMessagePartnerInterface)AFormsMessage.MessageObject).PartnerClass == TPartnerClass.BANK) &&
                ((AFormsMessage.MessageClass == TFormsMessageClassEnum.mcNewPartnerSaved) ||
                 (AFormsMessage.MessageClass == TFormsMessageClassEnum.mcExistingPartnerSaved)))
            {
                FMainDS         = null;
                FBankPartnerKey = ((IFormsMessagePartnerInterface)AFormsMessage.MessageObject).PartnerKey;
                LoadDataGrid(false);

                MessageProcessed = true;
            }

            return(MessageProcessed);
        }
Beispiel #16
0
        /// <summary>
        /// Will be called by TFormsList to inform any Form that is registered in TFormsList
        /// about any 'Forms Messages' that are broadcasted.
        /// </summary>
        /// <remarks>The Partner Edit 'listens' to such 'Forms Message' broadcasts by
        /// implementing this virtual Method. This Method will be called each time a
        /// 'Forms Message' broadcast occurs.
        /// </remarks>
        /// <param name="AFormsMessage">An instance of a 'Forms Message'. This can be
        /// inspected for parameters in the Method Body and the Form can use those to choose
        /// to react on the Message, or not.</param>
        /// <returns>Returns True if the Form reacted on the specific Forms Message,
        /// otherwise false.</returns>
        public bool ProcessFormsMessage(TFormsMessage AFormsMessage)
        {
            bool MessageProcessed = false;

            if (AFormsMessage.MessageClass == TFormsMessageClassEnum.mcGiftDestinationChanged) // update gift destination
            {
                ucoTransactions.ProcessGiftDestinationBroadcastMessage(AFormsMessage);

                MessageProcessed = true;
            }
            else if (AFormsMessage.MessageClass == TFormsMessageClassEnum.mcUnitHierarchyChanged)
            {
                ucoTransactions.ProcessUnitHierarchyBroadcastMessage(AFormsMessage);

                MessageProcessed = true;
            }
            else if (AFormsMessage.MessageClass == TFormsMessageClassEnum.mcRefreshGiftBatches)
            {
                this.RefreshAll(false, true);

                MessageProcessed = true;
            }
            else if (AFormsMessage.MessageClass == TFormsMessageClassEnum.mcGiftPartnerZeroChanged)
            {
                Dictionary <string, object> messageItems = ((IFormsMessageSimpleDictionaryInterface)AFormsMessage.MessageObject).MessageItems;

                foreach (KeyValuePair <string, object> kvp in messageItems)
                {
                    if (kvp.Key == SharedConstants.SYSDEFAULT_DONORZEROISVALID)
                    {
                        FDonorZeroIsValid = Convert.ToBoolean(kvp.Value);
                    }
                    else if (kvp.Key == SharedConstants.SYSDEFAULT_RECIPIENTZEROISVALID)
                    {
                        FRecipientZeroIsValid = Convert.ToBoolean(kvp.Value);
                    }
                }

                MessageProcessed = true;
            }

            return(MessageProcessed);
        }
Beispiel #17
0
        /// <summary>
        /// Will be called by TFormsList to inform any Form that is registered in TFormsList
        /// about any 'Forms Messages' that are broadcasted.
        /// </summary>
        /// <remarks>The Partner Edit 'listens' to such 'Forms Message' broadcasts by
        /// implementing this virtual Method. This Method will be called each time a
        /// 'Forms Message' broadcast occurs.
        /// </remarks>
        /// <param name="AFormsMessage">An instance of a 'Forms Message'. This can be
        /// inspected for parameters in the Method Body and the Form can use those to choose
        /// to react on the Message, or not.</param>
        /// <returns>Returns True if the Form reacted on the specific Forms Message,
        /// otherwise false.</returns>
        public bool ProcessFormsMessage(TFormsMessage AFormsMessage)
        {
            bool MessageProcessed = false;

            if (AFormsMessage.MessageClass == TFormsMessageClassEnum.mcAPTransactionChanged)
            {
                // The message is relevant if the supplier name is empty (=any supplier) or our specific supplier
                if ((((TFormsMessage.FormsMessageAP)AFormsMessage.MessageObject).SupplierName == this.lblSupplierName.Text) ||
                    (((TFormsMessage.FormsMessageAP)AFormsMessage.MessageObject).SupplierName == String.Empty))
                {
                    // Reload the screen data
                    Reload();
                }

                MessageProcessed = true;
            }

            return(MessageProcessed);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void FileSave(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            if (SaveChanges())
            {
                // Broadcast message to update partner's Partner Edit screen if open
                TFormsMessage BroadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcUnitHierarchyChanged);
                BroadcastMessage.SetMessageDataUnitHierarchy(FChangedParents);
                TFormsList.GFormsList.BroadcastFormMessage(BroadcastMessage);

                FChangedParents = new List <Tuple <string, long, long> >();

                FPetraUtilsObject.HasChanges = false;
                FPetraUtilsObject.DisableSaveButton();
            }

            this.Cursor = Cursors.Default;
        }
        /// <summary>
        /// Will be called by TFormsList to inform any Form that is registered in TFormsList
        /// about any 'Forms Messages' that are broadcasted.
        /// </summary>
        /// <remarks>The Partner Edit 'listens' to such 'Forms Message' broadcasts by
        /// implementing this virtual Method. This Method will be called each time a
        /// 'Forms Message' broadcast occurs.
        /// </remarks>
        /// <param name="AFormsMessage">An instance of a 'Forms Message'. This can be
        /// inspected for parameters in the Method Body and the Form can use those to choose
        /// to react on the Message, or not.</param>
        /// <returns>Returns True if the Form reacted on the specific Forms Message,
        /// otherwise false.</returns>
        public bool ProcessFormsMessage(TFormsMessage AFormsMessage)
        {
            bool MessageProcessed = false;

            // update gift destination
            if (AFormsMessage.MessageClass == TFormsMessageClassEnum.mcGiftDestinationChanged)
            {
                ucoRecurringTransactions.ProcessGiftDestinationBroadcastMessage(AFormsMessage);

                MessageProcessed = true;
            }
            else if (AFormsMessage.MessageClass == TFormsMessageClassEnum.mcUnitHierarchyChanged)
            {
                ucoRecurringTransactions.ProcessUnitHierarchyBroadcastMessage(AFormsMessage);

                MessageProcessed = true;
            }

            return(MessageProcessed);
        }
        /// <summary>
        /// Post document as a GL Batch
        /// See very similar function in TFrmAPSupplierTransactions
        /// </summary>
        private void PostDocument(object sender, EventArgs e)
        {
            if (FPetraUtilsObject.HasChanges)
            {
                MessageBox.Show(Catalog.GetString("Document should be saved before posting."), Catalog.GetString(
                                    "Post Document"), MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            GetDataFromControls(FMainDS.AApDocument[0]);

            // TODO: make sure that there are uptodate exchange rates

            if (!ApDocumentCanPost(FMainDS, FMainDS.AApDocument[0]))
            {
                return;
            }

            List <Int32> TaggedDocuments = new List <Int32>();

            TaggedDocuments.Add(FMainDS.AApDocument[0].ApDocumentId);

            if (PostApDocumentList(FMainDS, FMainDS.AApDocument[0].LedgerNumber, TaggedDocuments, this))
            {
                // TODO: print reports on successfully posted batch
                MessageBox.Show(Catalog.GetString("The AP document has been posted successfully!"));

                //
                // Refresh by re-loading the document from the server
                Int32 DocumentId = FMainDS.AApDocument[0].ApDocumentId;
                FMainDS.Clear();
                FPreviouslySelectedDetailRow = null;
                LoadAApDocument(FDocumentLedgerNumber, DocumentId);

                //
                // Also refresh the opener?
                TFormsMessage broadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcAPTransactionChanged);
                broadcastMessage.SetMessageDataAPTransaction(lblSupplierName.Text);
                TFormsList.GFormsList.BroadcastFormMessage(broadcastMessage);
            }
        }
        /// <summary>
        /// Deletes the currently selected Partner.
        /// </summary>
        public bool DeletePartner()
        {
            TFormsMessage BroadcastMessage;

            if (TPartnerMain.DeletePartner(FPartnerKey, ((UserControl)this.ParentForm).ParentForm))
            {
                BroadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcPartnerDeleted,
                                                     null);

                BroadcastMessage.SetMessageDataPartner(
                    FPartnerKey,
                    SharedTypes.PartnerClassStringToEnum(DetermineCurrentPartnerClass()),
                    "",
                    DetermineCurrentPartnerStatus());

                TFormsList.GFormsList.BroadcastFormMessage(BroadcastMessage);

                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Approve Document for posting.
        /// See very similar function in TFrmAPSupplierTransactions
        /// </summary>
        ///
        private void ApproveDocument(object sender, EventArgs e)
        {
            if (FPetraUtilsObject.HasChanges)
            {
                MessageBox.Show(Catalog.GetString("Document should be saved before approving."), Catalog.GetString(
                                    "Approve Document"), MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            List <Int32> DocsList = new List <int>();

            DocsList.Add(FMainDS.AApDocument[0].ApDocumentId);
            this.Cursor = Cursors.WaitCursor;
            TVerificationResultCollection verificationResult;
            string MsgTitle = Catalog.GetString("Document Approval");

            if (TRemote.MFinance.AP.WebConnectors.ApproveAPDocuments(FMainDS.AApDocument[0].LedgerNumber, DocsList, out verificationResult))
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show(Catalog.GetString("Document has been approved."), MsgTitle);

                FMainDS.AApDocument[0].DocumentStatus = MFinanceConstants.AP_DOCUMENT_APPROVED; // The "changed" light isn't lit by this, because the change
                                                                                                // already took place on the server.
                EnableControls();

                //
                // Also refresh the opener
                TFormsMessage broadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcAPTransactionChanged);
                broadcastMessage.SetMessageDataAPTransaction(lblSupplierName.Text);
                TFormsList.GFormsList.BroadcastFormMessage(broadcastMessage);
            }
            else
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show(verificationResult.BuildVerificationResultString(), MsgTitle);
            }
        }
Beispiel #23
0
        /// <summary>
        /// Will be called by TFormsList to inform any Form that is registered in TFormsList
        /// about any 'Forms Messages' that are broadcasted.
        /// </summary>
        /// <remarks>Theis screen 'listens' to such 'Forms Message' broadcasts by
        /// implementing this virtual Method. This Method will be called each time a
        /// 'Forms Message' broadcast occurs.
        /// </remarks>
        /// <param name="AFormsMessage">An instance of a 'Forms Message'. This can be
        /// inspected for parameters in the Method Body and the Form can use those to choose
        /// to react on the Message, or not.</param>
        /// <returns>Returns True if the Form reacted on the specific Forms Message,
        /// otherwise false.</returns>
        public bool ProcessFormsMessage(TFormsMessage AFormsMessage)
        {
            bool MessageProcessed = false;

            if ((AFormsMessage.MessageClass == TFormsMessageClassEnum.mcPersonnelCommitmentChanged) &&
                (((IFormsMessagePartnerInterface)AFormsMessage.MessageObject).PartnerKey == FPartnerKey))
            {
                TSearchCriteria[] Search = new TSearchCriteria[1];
                Search[0] = new TSearchCriteria(PPartnerGiftDestinationTable.GetPartnerKeyDBName(), FPartnerKey);

                FMainDS = new TLocalMainTDS();
                Ict.Common.Data.TTypedDataTable TypedTable;
                TRemote.MCommon.DataReader.WebConnectors.GetData(PPartnerGiftDestinationTable.GetTableDBName(), Search, out TypedTable);
                FMainDS.PPartnerGiftDestination.Merge(TypedTable);

                SetupGrid();
                UpdateRecordNumberDisplay();
                SelectRowInGrid(1);

                MessageProcessed = true;
            }

            return(MessageProcessed);
        }
Beispiel #24
0
        /// <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
        /// </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);
        }
Beispiel #26
0
 /// <summary>
 /// Will be called by TFormsList to inform any Form that is registered in TFormsList
 /// about any 'Forms Messages' that are broadcasted.
 /// </summary>
 /// <remarks>The Partner Edit 'listens' to such 'Forms Message' broadcasts by
 /// implementing this virtual Method. This Method will be called each time a
 /// 'Forms Message' broadcast occurs.
 /// </remarks>
 /// <param name="AFormsMessage">An instance of a 'Forms Message'. This can be
 /// inspected for parameters in the Method Body and the Form can use those to choose
 /// to react on the Message, or not.</param>
 /// <returns>Returns True if the Form reacted on the specific Forms Message,
 /// otherwise false.</returns>
 public bool ProcessFormsMessage(TFormsMessage AFormsMessage)
 {
     return(ucoExtractMasterList.ProcessFormsMessage(AFormsMessage));
 }
Beispiel #27
0
        /// <summary>
        /// this submits the given Batch number
        /// Each line starts with a type specifier, B for batch, J for journal, T for transaction
        /// </summary>
        private void SubmitBatch(object sender, EventArgs e)
        {
            String SubmitErrorMessage = string.Empty;
            String ErrorMessageTitle  = "Submit Recurring Batch " + FBatchNumber.ToString();

            if ((dtpEffectiveDate.Date < FStartDateCurrentPeriod) ||
                (dtpEffectiveDate.Date > FEndDateLastForwardingPeriod))
            {
                SubmitErrorMessage =
                    String.Format(Catalog.GetString("The batch date is outside the allowed posting period start/end date range: {0} to {1}"),
                                  FStartDateCurrentPeriod.ToShortDateString(),
                                  FEndDateLastForwardingPeriod.ToShortDateString());

                MessageBox.Show(SubmitErrorMessage, ErrorMessageTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                dtpEffectiveDate.Focus();
                dtpEffectiveDate.SelectAll();
                return;
            }

            // Check for any non-set exchange rates:
            DataView JournalDV = new DataView(FMainDS.ARecurringJournal);

            JournalDV.RowFilter = String.Format("{0}={1}",
                                                ARecurringJournalTable.GetBatchNumberDBName(),
                                                FBatchNumber);

            if (JournalDV.Count > 0)
            {
                string currencyCode      = string.Empty;
                bool   isForeignCurrency = false;

                foreach (DataRowView drv in JournalDV)
                {
                    ARecurringJournalRow jr = (ARecurringJournalRow)drv.Row;

                    currencyCode      = jr.TransactionCurrency;
                    isForeignCurrency = (currencyCode != FBaseCurrencyCode);

                    if (isForeignCurrency && (jr.ExchangeRateToBase <= 0))
                    {
                        if (SubmitErrorMessage.Length == 0)
                        {
                            SubmitErrorMessage = Catalog.GetString("The following foreign currency Journals need a valid exchange rate:") +
                                                 Environment.NewLine;
                        }

                        SubmitErrorMessage += string.Format("{0}Journal no.: {1:00} requires a rate for {2} to {3}",
                                                            Environment.NewLine,
                                                            jr.JournalNumber,
                                                            jr.TransactionCurrency,
                                                            FBaseCurrencyCode);
                    }
                    else if (isForeignCurrency)
                    {
                        FExchangeRateDictionary[currencyCode] = jr.ExchangeRateToBase;
                    }
                }

                if (SubmitErrorMessage.Length > 0)
                {
                    MessageBox.Show(SubmitErrorMessage, ErrorMessageTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }

            Hashtable requestParams = new Hashtable();

            requestParams.Add("ALedgerNumber", FLedgerNumber);
            requestParams.Add("ABatchNumber", FBatchNumber);
            requestParams.Add("AEffectiveDate", dtpEffectiveDate.Date.Value);
            requestParams.Add("AExchangeRateIntlToBase", FExchangeRateIntlToBase);

            TVerificationResultCollection Verifications = new TVerificationResultCollection();
            Int32 NewGLBatchNumber = TRemote.MFinance.GL.WebConnectors.SubmitRecurringGLBatch(ref FMainDS,
                                                                                              requestParams,
                                                                                              ref FExchangeRateDictionary,
                                                                                              ref Verifications);

            if (NewGLBatchNumber > 0)
            {
                string successMessage =
                    String.Format(Catalog.GetString(
                                      "Your Recurring GL Batch was submitted successfully as new GL Batch: {0}!{1}{1}" +
                                      "If the GL Batches form is open it will try to refresh its data."),
                                  NewGLBatchNumber,
                                  Environment.NewLine);

                MessageBox.Show(successMessage,
                                Catalog.GetString("Submit Recurring GL Batch"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);

                // refresh gl batch screen
                TFormsMessage broadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcRefreshGLBatches, this.ToString());
                TFormsList.GFormsList.BroadcastFormMessage(broadcastMessage);

                SaveChanges();
                Close();
            }
            else
            {
                string errorMessages = String.Empty;

                foreach (TVerificationResult verif in Verifications)
                {
                    errorMessages += "[" + verif.ResultContext + "] " +
                                     verif.ResultTextCaption + ": " +
                                     verif.ResultText + Environment.NewLine;
                }

                MessageBox.Show(errorMessages, Catalog.GetString("Submit Recurring GL Batch"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);

                SaveChanges();
            }
        }
 /// <summary>
 /// Refreshes the Family Members list on the Family tab
 /// </summary>
 public void RefreshFamilyMembersList(TFormsMessage AFormsMessage)
 {
     ucoPartnerTabSet.RefreshFamilyMembersList(AFormsMessage);
 }
        private void RunRevaluation(object btn, EventArgs e)
        {
            String ToCostCentre = cmbCostCentres.GetSelectedString();

            if (ToCostCentre == "")
            {
                MessageBox.Show(Catalog.GetString("You must select a revaluation Cost Centre."));
                return;
            }

            int intUsedEntries = 0;

            for (int i = 0; i < FcurrencyExchangeList.Count; ++i)
            {
                if (FcurrencyExchangeList[i].DoRevaluation && (FcurrencyExchangeList[i].mExchangeRate == 0))
                {
                    MessageBox.Show(String.Format(Catalog.GetString("Revaluation of {0} disabled because no exchange rate is available."),
                                                  FcurrencyExchangeList[i].AccountCode));
                    FcurrencyExchangeList[i].DoRevaluation = false;
                    grdDetails.Refresh();
                }

                if (FcurrencyExchangeList[i].DoRevaluation)
                {
                    ++intUsedEntries;
                }
            }

            if (intUsedEntries == 0)
            {
                MessageBox.Show(Catalog.GetString("No Revaluation operation required."));
                return;
            }

            string[]  foreignAccounts   = new string[intUsedEntries];
            string[]  foreignCurrencies = new string[intUsedEntries];
            decimal[] rates             = new decimal[intUsedEntries];
            int       j = 0;

            for (int i = 0; i < FcurrencyExchangeList.Count; ++i)
            {
                if (FcurrencyExchangeList[i].DoRevaluation)
                {
                    foreignAccounts[j]   = FcurrencyExchangeList[i].AccountCode;
                    foreignCurrencies[j] = FcurrencyExchangeList[i].Currency;
                    rates[j]             = FcurrencyExchangeList[i].mExchangeRate;
                    j++;
                }
            }

            this.Cursor = Cursors.WaitCursor;
            this.Refresh();
            TVerificationResultCollection verificationResult;
            Int32 forexBatchNumber;
            bool  blnRevalutationState =
                TRemote.MFinance.GL.WebConnectors.Revaluate(FLedgerNumber,
                                                            foreignAccounts, foreignCurrencies, rates, ToCostCentre, out forexBatchNumber, out verificationResult);

            this.Cursor = Cursors.Default;

            String Message = verificationResult.BuildVerificationResultString();

            if (blnRevalutationState)
            {
                TFrmBatchPostingRegister glReportGui = new TFrmBatchPostingRegister(this);
                glReportGui.PrintReportNoUi(FLedgerNumber, forexBatchNumber);

                // Notify the exchange rate screen, if it is there
                TFormsMessage broadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcGLOrGiftBatchSaved, this.ToString());
                TFormsList.GFormsList.BroadcastFormMessage(broadcastMessage);
            }

            if (Message == "")
            {
                Message = Catalog.GetString("Revaluation Successful.");
            }

            MessageBox.Show(Message, Catalog.GetString("Revaluation"));

            this.Close();
        }
        /// <summary>
        /// this submits the given Batch number
        /// Each line starts with a type specifier, B for batch, T for transaction
        /// </summary>
        private void SubmitBatch(object sender, EventArgs e)
        {
            DateTime TheDateValue;
            string   TheDateString      = dtpEffectiveDate.Text;
            string   LedgerBaseCurrency = FMainDS.ALedger[0].BaseCurrency;
            string   LedgerIntlCurrency = FMainDS.ALedger[0].IntlCurrency;

            if (DateTime.TryParse(TheDateString, out TheDateValue))
            {
                LookupCurrencyExchangeRates(TheDateValue);
            }
            else
            {
                MessageBox.Show(Catalog.GetString("Invalid date entered!"));
                dtpEffectiveDate.Focus();
                dtpEffectiveDate.SelectAll();
                return;
            }

            // This should never happen - but ...
            if (txtExchangeRateToBase.NumberValueDecimal <= 0.0m)
            {
                MessageBox.Show(Catalog.GetString("The exchange rate must be a number greater than 0.0!"),
                                Catalog.GetString("Submit Recurring Gift Batch"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);

                btnGetSetExchangeRate.Enabled = true;
                return;
            }
            else if (FExchangeRateIntlToBase == 0)
            {
                string intlRateErrorMessage =
                    String.Format(Catalog.GetString("No Corporate Exchange rate exists for {0} to {1} for the month: {2:MMMM yyyy}!"),
                                  LedgerBaseCurrency,
                                  LedgerIntlCurrency,
                                  TheDateValue);

                MessageBox.Show(intlRateErrorMessage, "Lookup Corporate Exchange Rate", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                dtpEffectiveDate.Focus();
                dtpEffectiveDate.SelectAll();
                return;
            }
            //check the gift batch date
            else if ((dtpEffectiveDate.Date < FStartDateCurrentPeriod) ||
                     (dtpEffectiveDate.Date > FEndDateLastForwardingPeriod))
            {
                MessageBox.Show(String.Format(Catalog.GetString(
                                                  "The batch date is outside the allowed posting period start/end date range: {0} to {1}!"),
                                              FStartDateCurrentPeriod.ToShortDateString(),
                                              FEndDateLastForwardingPeriod.ToShortDateString()),
                                Catalog.GetString("Submit Recurring Gift Batch"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);

                dtpEffectiveDate.Focus();
                dtpEffectiveDate.SelectAll();
                return;
            }

            Hashtable requestParams = new Hashtable();

            requestParams.Add("ALedgerNumber", FLedgerNumber);
            requestParams.Add("ABatchNumber", FBatchNumber);
            requestParams.Add("AEffectiveDate", TheDateValue);
            requestParams.Add("AReference", txtReference.Text);
            requestParams.Add("AExchangeRateToBase", FExchangeRateToBase);
            requestParams.Add("AExchangeRateIntlToBase", FExchangeRateIntlToBase);

            int CreatedGiftBatchNumber = 0;

            try
            {
                Cursor = Cursors.WaitCursor;

                if (TRemote.MFinance.Gift.WebConnectors.SubmitRecurringGiftBatch(requestParams, out CreatedGiftBatchNumber))
                {
                    Cursor = Cursors.Default;

                    string successMessage =
                        String.Format(Catalog.GetString(
                                          "Your recurring batch was submitted successfully as new Gift Batch {0}!{1}{1}" +
                                          "If the Gift Batches form is open it will try to refresh its data."),
                                      CreatedGiftBatchNumber,
                                      Environment.NewLine);

                    MessageBox.Show(successMessage,
                                    Catalog.GetString("Submit Recurring Gift Batch"),
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);

                    // refresh gift batch screen
                    TFormsMessage broadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcRefreshGiftBatches, this.ToString());
                    TFormsList.GFormsList.BroadcastFormMessage(broadcastMessage);

                    Close();
                }
                else
                {
                    Cursor = Cursors.Default;

                    MessageBox.Show(Catalog.GetString("The recurring Gift Batch failed to submit!"),
                                    Catalog.GetString("Submit Recurring Gift Batch"),
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                string errMsg = String.Format(Catalog.GetString("Unexpected error trying to submit recurring Gift Batch: {0}:{1}{1}{2}{1}{1}{3}"),
                                              FBatchNumber,
                                              Environment.NewLine,
                                              ex.Message,
                                              Catalog.GetString("Refer to the Server.Log text file for more details."));

                MessageBox.Show(errMsg,
                                Catalog.GetString("Submit Recurring Gift Batch"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);

                TLogging.LogException(ex, Utilities.GetMethodSignature());
                throw;
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }