/// <summary> /// Check for ExWorkers before saving or cancelling /// </summary> /// <param name="AAction"></param> /// <param name="AGetOnlyTransDataFromControls"></param> /// <param name="ABatchLevelAction"></param> /// <returns>True if Save is successful</returns> public bool SaveChangesManual(TExtraGiftBatchChecks.GiftBatchAction AAction, bool AGetOnlyTransDataFromControls = false, bool ABatchLevelAction = true) { if (AAction == TExtraGiftBatchChecks.GiftBatchAction.NONE) { AAction = TExtraGiftBatchChecks.GiftBatchAction.SAVING; FCurrentGiftBatchAction = AAction; } if ((AAction != TExtraGiftBatchChecks.GiftBatchAction.DELETING) && (AAction != TExtraGiftBatchChecks.GiftBatchAction.DELETINGTRANS)) { GetDataFromControls(); } else if (ABatchLevelAction && AGetOnlyTransDataFromControls) //Only applicable when cancelling current batch { //If in deletion but trans tab is showing data from an earlier viewed batch with changes // then still need to get data from controls on Transaction tab. ucoRecurringTransactions.GetDataFromControls(); } //First alert the user to any recipients who are Ex-Workers // For deleted batches this data would already have been deleted and so will // only affect other unsaved batches. if (TExtraGiftBatchChecks.CanContinueWithAnyExWorkers(AAction, FMainDS, FPetraUtilsObject)) { return(SaveChanges()); } return(false); }
/// <summary> /// Check for ExWorkers before saving or cancelling /// </summary> /// <returns>True if Save is successful</returns> public bool SaveChangesManual(TExtraGiftBatchChecks.GiftBatchAction AAction) { GetDataFromControls(); // first alert the user to any recipients who are Ex-Workers if (TExtraGiftBatchChecks.CanContinueWithAnyExWorkers(AAction, FMainDS, FPetraUtilsObject)) { return(SaveChanges()); } return(false); }
/// <summary> /// Check for Ex-Worker before saving and submitting /// </summary> /// <param name="ASubmittingGiftDetails">GiftDetails for the recurring batch that is to be submitted</param> /// <param name="ACancelledDueToExWorker">True if batch posting has been cancelled by the user because of an Ex-Worker recipient</param> /// <returns>True if Save is successful</returns> public bool SaveChangesForSubmitting(DataTable ASubmittingGiftDetails, out bool ACancelledDueToExWorker) { GetDataFromControls(); // first alert the user to any recipients who are Ex-Workers ACancelledDueToExWorker = !TExtraGiftBatchChecks.CanContinueWithAnyExWorkers( TExtraGiftBatchChecks.GiftBatchAction.SUBMITTING, FMainDS, FPetraUtilsObject, ASubmittingGiftDetails); if (!ACancelledDueToExWorker) { return(SaveChanges()); } return(false); }
/// <summary> /// Check for ex-worker or anonymous gift /// </summary> /// <param name="AGiftDetailsDT">GiftDetails for the recurring batch that is to be submitted</param> /// <returns></returns> public bool GiftHasExWorkerOrAnon(DataTable AGiftDetailsDT) { // alert the user to any recipients who are Ex-Workers // or alert the user to any gift that are not marked confidential but have an anonymous donor if (!TExtraGiftBatchChecks.CanContinueWithAnyExWorkers(TExtraGiftBatchChecks.GiftBatchAction.SUBMITTING, FMainDS, FPetraUtilsObject, AGiftDetailsDT) || !TExtraGiftBatchChecks.CanContinueWithAnyAnonymousDonors(FMainDS) ) { return(true); } return(false); }
/// <summary> /// add a new batch /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NewRow(System.Object sender, EventArgs e) { GetDataFromControls(); if (!TExtraGiftBatchChecks.CanContinueWithAnyExWorkers(TExtraGiftBatchChecks.GiftBatchAction.NEWBATCH, FMainDS, FPetraUtilsObject)) { return; } this.CreateNewARecurringGiftBatch(); txtDetailBatchDescription.Focus(); UpdateRecordNumberDisplay(); ((TFrmRecurringGiftBatch)this.ParentForm).SaveChanges(); }
/// <summary> /// Checks to be made before saving and posting /// </summary> /// <param name="APostingGiftDetails">GiftDetails for the batch that is to be posted</param> /// <param name="ACancelledDueToExWorkerOrAnonDonor">True if batch posting has been cancelled by the user because of an Ex-Worker recipient /// or an anonymous donor for a gift that is not marked as confidential</param> /// <returns>True if Save is successful</returns> public bool SaveChangesForPosting(DataTable APostingGiftDetails, out bool ACancelledDueToExWorkerOrAnonDonor) { // first alert the user to any recipients who are Ex-Workers ACancelledDueToExWorkerOrAnonDonor = !TExtraGiftBatchChecks.CanContinueWithAnyExWorkers(TExtraGiftBatchChecks.GiftBatchAction.POSTING, FMainDS, FPetraUtilsObject, APostingGiftDetails); // if save is continuing then alert the user to any gift that are not marked confidential but have an anonymous donor if (!ACancelledDueToExWorkerOrAnonDonor) { ACancelledDueToExWorkerOrAnonDonor = !TExtraGiftBatchChecks.CanContinueWithAnyAnonymousDonors(FMainDS); } if (!ACancelledDueToExWorkerOrAnonDonor) { return(SaveChanges()); } return(false); }
/// <summary> /// add a new batch /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NewRow(System.Object sender, EventArgs e) { GetDataFromControls(); if (!TExtraGiftBatchChecks.CanContinueWithAnyExWorkers(TExtraGiftBatchChecks.GiftBatchAction.NEWBATCH, FMainDS, FPetraUtilsObject)) { return; } if (CreateNewAGiftBatch()) { if (!EnsureNewBatchIsVisible()) { return; } pnlDetails.Enabled = true; // NOTE: we need to suppress change detection here because otherwise the DateChanged event fires off // It would not normally be a problem although it can give strange effects of focussing the date box AND the description (!) // and also may sometimes give problems with running some tests. // So do not remove change detection suppression so we do not run UpdateGiftBatchPeriod() FPetraUtilsObject.SuppressChangeDetection = true; FPreviouslySelectedDetailRow.GlEffectiveDate = FDefaultDate; dtpDetailGlEffectiveDate.Date = FDefaultDate; FPetraUtilsObject.SuppressChangeDetection = false; Int32 yearNumber = 0; Int32 periodNumber = 0; if (GetAccountingYearPeriodByDate(FLedgerNumber, FDefaultDate, out yearNumber, out periodNumber)) { FPreviouslySelectedDetailRow.BatchPeriod = periodNumber; } UpdateRecordNumberDisplay(); ((TFrmGiftBatch)ParentForm).SaveChanges(); } }
/// <summary> /// add a new batch /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NewRow(System.Object sender, EventArgs e) { GetDataFromControls(); if (!TExtraGiftBatchChecks.CanContinueWithAnyExWorkers(TExtraGiftBatchChecks.GiftBatchAction.NEWBATCH, FMainDS, FPetraUtilsObject)) { return; } if (CreateNewARecurringGiftBatch()) { if (!EnsureNewBatchIsVisible()) { return; } pnlDetails.Enabled = true; UpdateRecordNumberDisplay(); ((TFrmRecurringGiftBatch)this.ParentForm).SaveChanges(); } }