/// <summary> /// create a new batch with a consecutive batch number in the ledger /// for call inside a server function /// for performance reasons submitting (save the data in the database) is done later (not here) /// </summary> /// <param name="MainDS"></param> /// <param name="Transaction"></param> /// <param name="LedgerTable"></param> /// <param name="ALedgerNumber"></param> /// <param name="ADateEffective"></param> /// <param name="AForceEffectiveDateToFit"></param> /// <returns>the new gift batch row</returns> public static AGiftBatchRow CreateANewGiftBatchRow(ref GiftBatchTDS MainDS, ref TDBTransaction Transaction, ref ALedgerTable LedgerTable, Int32 ALedgerNumber, DateTime ADateEffective, bool AForceEffectiveDateToFit = true) { AGiftBatchRow NewRow = MainDS.AGiftBatch.NewRowTyped(true); NewRow.LedgerNumber = ALedgerNumber; LedgerTable[0].LastGiftBatchNumber++; NewRow.BatchNumber = LedgerTable[0].LastGiftBatchNumber; Int32 BatchYear, BatchPeriod; // if DateEffective is outside the range of open periods, use the most fitting date TFinancialYear.GetLedgerDatePostingPeriod(ALedgerNumber, ref ADateEffective, out BatchYear, out BatchPeriod, Transaction, AForceEffectiveDateToFit); NewRow.BatchYear = BatchYear; NewRow.BatchPeriod = BatchPeriod; NewRow.GlEffectiveDate = ADateEffective; NewRow.ExchangeRateToBase = 1.0M; NewRow.BatchDescription = "PLEASE ENTER A DESCRIPTION"; NewRow.BankAccountCode = TLedgerInfo.GetDefaultBankAccount(ALedgerNumber); NewRow.BankCostCentre = TLedgerInfo.GetStandardCostCentre(ALedgerNumber); NewRow.CurrencyCode = LedgerTable[0].BaseCurrency; MainDS.AGiftBatch.Rows.Add(NewRow); return(NewRow); }
/// <summary> /// create a new batch with a consecutive batch number in the ledger /// for call inside a server function /// for performance reasons submitting (save the data in the database) is done later (not here) /// </summary> /// <param name="AMainDS"></param> /// <param name="ATransaction"></param> /// <param name="ALedgerNumber"></param> /// <returns>the new gift batch row</returns> public static ARecurringGiftBatchRow CreateANewRecurringGiftBatchRow(ref GiftBatchTDS AMainDS, ref TDBTransaction ATransaction, Int32 ALedgerNumber) { #region Validate Arguments if (AMainDS == null) { throw new EFinanceSystemDataObjectNullOrEmptyException(String.Format(Catalog.GetString( "Function:{0} - The Gift Batch dataset is NULL!"), Utilities.GetMethodName(true))); } else if (ATransaction == null) { throw new EFinanceSystemDBTransactionNullException(String.Format(Catalog.GetString( "Function:{0} - Database Transaction must not be NULL!"), Utilities.GetMethodName(true))); } else if (ALedgerNumber <= 0) { throw new EFinanceSystemInvalidLedgerNumberException(String.Format(Catalog.GetString( "Function:{0} - The Ledger number must be greater than 0!"), Utilities.GetMethodName(true)), ALedgerNumber); } #endregion Validate Arguments TLedgerInfo info = new TLedgerInfo(ALedgerNumber, ATransaction.DataBaseObj); ALedgerAccess.LoadByPrimaryKey(AMainDS, ALedgerNumber, ATransaction); if ((AMainDS.ALedger == null) || (AMainDS.ALedger.Count == 0)) { throw new EFinanceSystemDataObjectNullOrEmptyException(String.Format(Catalog.GetString( "Function:{0} - The Ledger table is NULL or is empty!"), Utilities.GetMethodName(true))); } ARecurringGiftBatchRow NewRow = AMainDS.ARecurringGiftBatch.NewRowTyped(true); NewRow.LedgerNumber = ALedgerNumber; NewRow.BatchNumber = ++AMainDS.ALedger[0].LastRecGiftBatchNumber; NewRow.BatchDescription = Catalog.GetString("Please enter recurring batch description"); NewRow.BankAccountCode = info.GetDefaultBankAccount(); NewRow.BankCostCentre = info.GetStandardCostCentre(); NewRow.CurrencyCode = AMainDS.ALedger[0].BaseCurrency; AMainDS.ARecurringGiftBatch.Rows.Add(NewRow); return(NewRow); }
/// <summary> /// create a new batch with a consecutive batch number in the ledger /// for call inside a server function /// for performance reasons submitting (save the data in the database) is done later (not here) /// </summary> /// <param name="MainDS"></param> /// <param name="Transaction"></param> /// <param name="LedgerTable"></param> /// <param name="ALedgerNumber"></param> /// <returns>the new gift batch row</returns> public static ARecurringGiftBatchRow CreateANewRecurringGiftBatchRow(ref GiftBatchTDS MainDS, ref TDBTransaction Transaction, ref ALedgerTable LedgerTable, Int32 ALedgerNumber) { GiftBatchTDS Temp = new GiftBatchTDS(); ARecurringGiftBatchAccess.LoadViaALedger(Temp, LedgerTable[0].LedgerNumber, Transaction); DataView RecurringGiftBatchDV = new DataView(Temp.ARecurringGiftBatch); RecurringGiftBatchDV.RowFilter = string.Empty; RecurringGiftBatchDV.Sort = string.Format("{0} DESC", ARecurringGiftBatchTable.GetBatchNumberDBName()); //Recurring batch numbers can be reused so check each time for current highest number if (RecurringGiftBatchDV.Count > 0) { LedgerTable[0].LastRecGiftBatchNumber = (int)(RecurringGiftBatchDV[0][ARecurringGiftBatchTable.GetBatchNumberDBName()]); } else { LedgerTable[0].LastRecGiftBatchNumber = 0; } ARecurringGiftBatchRow NewRow = MainDS.ARecurringGiftBatch.NewRowTyped(true); NewRow.LedgerNumber = ALedgerNumber; NewRow.BatchNumber = ++LedgerTable[0].LastRecGiftBatchNumber; NewRow.BatchDescription = Catalog.GetString("Please enter recurring batch description"); NewRow.BankAccountCode = TLedgerInfo.GetDefaultBankAccount(ALedgerNumber); NewRow.BankCostCentre = TLedgerInfo.GetStandardCostCentre(ALedgerNumber); NewRow.CurrencyCode = LedgerTable[0].BaseCurrency; MainDS.ARecurringGiftBatch.Rows.Add(NewRow); return(NewRow); }
/// <summary> /// create a new batch with a consecutive batch number in the ledger /// for call inside a server function /// for performance reasons submitting (save the data in the database) is done later (not here) /// </summary> /// <param name="AMainDS"></param> /// <param name="ATransaction"></param> /// <param name="ALedgerTbl"></param> /// <param name="ALedgerNumber"></param> /// <param name="ADateEffective"></param> /// <param name="AForceEffectiveDateToFit"></param> /// <returns>the new gift batch row</returns> public static AGiftBatchRow CreateANewGiftBatchRow(ref GiftBatchTDS AMainDS, ref TDBTransaction ATransaction, ref ALedgerTable ALedgerTbl, Int32 ALedgerNumber, DateTime ADateEffective, bool AForceEffectiveDateToFit = true) { #region Validate Arguments if (AMainDS == null) { throw new EFinanceSystemDataObjectNullOrEmptyException(String.Format(Catalog.GetString( "Function:{0} - The Gift Batch dataset is NULL!"), Utilities.GetMethodName(true))); } else if (ATransaction == null) { throw new EFinanceSystemDBTransactionNullException(String.Format(Catalog.GetString( "Function:{0} - Database Transaction must not be NULL!"), Utilities.GetMethodName(true))); } else if ((ALedgerTbl == null) || (ALedgerTbl.Count == 0)) { throw new EFinanceSystemDataObjectNullOrEmptyException(String.Format(Catalog.GetString( "Function:{0} - The Ledger table is NULL or is empty!"), Utilities.GetMethodName(true))); } else if (ALedgerNumber <= 0) { throw new EFinanceSystemInvalidLedgerNumberException(String.Format(Catalog.GetString( "Function:{0} - The Ledger number must be greater than 0!"), Utilities.GetMethodName(true)), ALedgerNumber); } #endregion Validate Arguments AGiftBatchRow NewRow = null; try { NewRow = AMainDS.AGiftBatch.NewRowTyped(true); NewRow.LedgerNumber = ALedgerNumber; NewRow.BatchNumber = ++ALedgerTbl[0].LastGiftBatchNumber; Int32 BatchYear, BatchPeriod; // if DateEffective is outside the range of open periods, use the most fitting date TFinancialYear.GetLedgerDatePostingPeriod(ALedgerNumber, ref ADateEffective, out BatchYear, out BatchPeriod, ATransaction, AForceEffectiveDateToFit); NewRow.BatchYear = BatchYear; NewRow.BatchPeriod = BatchPeriod; NewRow.GlEffectiveDate = ADateEffective; NewRow.ExchangeRateToBase = 1.0M; NewRow.BatchDescription = "PLEASE ENTER A DESCRIPTION"; NewRow.BankAccountCode = TLedgerInfo.GetDefaultBankAccount(ALedgerNumber); NewRow.BankCostCentre = TLedgerInfo.GetStandardCostCentre(ALedgerNumber); NewRow.CurrencyCode = ALedgerTbl[0].BaseCurrency; AMainDS.AGiftBatch.Rows.Add(NewRow); } catch (Exception ex) { TLogging.LogException(ex, Utilities.GetMethodSignature()); throw; } return(NewRow); }
/// <summary> /// create a new batch with a consecutive batch number in the ledger /// for call inside a server function /// for performance reasons submitting (save the data in the database) is done later (not here) /// </summary> /// <param name="AMainDS"></param> /// <param name="ATransaction"></param> /// <param name="ALedgerTbl"></param> /// <param name="ALedgerNumber"></param> /// <returns>the new gift batch row</returns> public static ARecurringGiftBatchRow CreateANewRecurringGiftBatchRow(ref GiftBatchTDS AMainDS, ref TDBTransaction ATransaction, ref ALedgerTable ALedgerTbl, Int32 ALedgerNumber) { #region Validate Arguments if (AMainDS == null) { throw new EFinanceSystemDataObjectNullOrEmptyException(String.Format(Catalog.GetString( "Function:{0} - The Gift Batch dataset is NULL!"), Utilities.GetMethodName(true))); } else if (ATransaction == null) { throw new EFinanceSystemDBTransactionNullException(String.Format(Catalog.GetString( "Function:{0} - Database Transaction must not be NULL!"), Utilities.GetMethodName(true))); } else if ((ALedgerTbl == null) || (ALedgerTbl.Count == 0)) { throw new EFinanceSystemDataObjectNullOrEmptyException(String.Format(Catalog.GetString( "Function:{0} - The Ledger table is NULL or is empty!"), Utilities.GetMethodName(true))); } else if (ALedgerNumber <= 0) { throw new EFinanceSystemInvalidLedgerNumberException(String.Format(Catalog.GetString( "Function:{0} - The Ledger number must be greater than 0!"), Utilities.GetMethodName(true)), ALedgerNumber); } #endregion Validate Arguments GiftBatchTDS Temp = new GiftBatchTDS(); ARecurringGiftBatchAccess.LoadViaALedger(Temp, ALedgerNumber, ATransaction); DataView RecurringGiftBatchDV = new DataView(Temp.ARecurringGiftBatch); RecurringGiftBatchDV.RowFilter = string.Empty; RecurringGiftBatchDV.Sort = string.Format("{0} DESC", ARecurringGiftBatchTable.GetBatchNumberDBName()); //Recurring batch numbers can be reused so check each time for current highest number if (RecurringGiftBatchDV.Count > 0) { ALedgerTbl[0].LastRecGiftBatchNumber = (int)(RecurringGiftBatchDV[0][ARecurringGiftBatchTable.GetBatchNumberDBName()]); } else { ALedgerTbl[0].LastRecGiftBatchNumber = 0; } ARecurringGiftBatchRow NewRow = AMainDS.ARecurringGiftBatch.NewRowTyped(true); NewRow.LedgerNumber = ALedgerNumber; NewRow.BatchNumber = ++ALedgerTbl[0].LastRecGiftBatchNumber; NewRow.BatchDescription = Catalog.GetString("Please enter recurring batch description"); NewRow.BankAccountCode = TLedgerInfo.GetDefaultBankAccount(ALedgerNumber); NewRow.BankCostCentre = TLedgerInfo.GetStandardCostCentre(ALedgerNumber); NewRow.CurrencyCode = ALedgerTbl[0].BaseCurrency; AMainDS.ARecurringGiftBatch.Rows.Add(NewRow); return(NewRow); }