本文整理汇总了C#中GLBatchTDS.RejectChanges方法的典型用法代码示例。如果您正苦于以下问题:C# GLBatchTDS.RejectChanges方法的具体用法?C# GLBatchTDS.RejectChanges怎么用?C# GLBatchTDS.RejectChanges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLBatchTDS
的用法示例。
在下文中一共展示了GLBatchTDS.RejectChanges方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateARecurringBatch
/// <summary>
/// create a new recurring batch.
/// it is already stored to the database, to avoid problems with LastBatchNumber
/// </summary>
public static GLBatchTDS CreateARecurringBatch(Int32 ALedgerNumber)
{
bool NewTransactionStarted = false;
GLBatchTDS MainDS = null;
GLBatchTDS Temp = null;
//Error handling
string ErrorContext = "Create a recurring Batch";
string ErrorMessage = String.Empty;
//Set default type as non-critical
TResultSeverity ErrorType = TResultSeverity.Resv_Noncritical;
TVerificationResultCollection VerificationResult = null;
try
{
MainDS = new GLBatchTDS();
Temp = new GLBatchTDS();
TDBTransaction Transaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction
(IsolationLevel.Serializable, TEnforceIsolationLevel.eilMinimum, out NewTransactionStarted);
ALedgerAccess.LoadByPrimaryKey(MainDS, ALedgerNumber, Transaction);
ARecurringBatchAccess.LoadViaALedger(Temp, ALedgerNumber, Transaction);
DataView RecurringBatchDV = new DataView(Temp.ARecurringBatch);
RecurringBatchDV.RowFilter = string.Empty;
RecurringBatchDV.Sort = string.Format("{0} DESC",
ARecurringBatchTable.GetBatchNumberDBName());
//Recurring batch numbers can be reused so check each time for current highest number
if (RecurringBatchDV.Count > 0)
{
MainDS.ALedger[0].LastRecurringBatchNumber = (int)(RecurringBatchDV[0][ARecurringBatchTable.GetBatchNumberDBName()]);
}
else
{
MainDS.ALedger[0].LastRecurringBatchNumber = 0;
}
ARecurringBatchRow NewRow = MainDS.ARecurringBatch.NewRowTyped(true);
NewRow.LedgerNumber = ALedgerNumber;
NewRow.BatchNumber = ++MainDS.ALedger[0].LastRecurringBatchNumber;
MainDS.ARecurringBatch.Rows.Add(NewRow);
GLBatchTDSAccess.SubmitChanges(MainDS);
MainDS.AcceptChanges();
Temp.RejectChanges();
}
catch (Exception ex)
{
ErrorMessage =
String.Format(Catalog.GetString("Unknown error while creating a recurring batch for Ledger: {0}." +
Environment.NewLine + Environment.NewLine + ex.ToString()),
ALedgerNumber);
ErrorType = TResultSeverity.Resv_Critical;
VerificationResult = new TVerificationResultCollection();
VerificationResult.Add(new TVerificationResult(ErrorContext, ErrorMessage, ErrorType));
throw new EVerificationResultsException(ErrorMessage, VerificationResult, ex.InnerException);
}
finally
{
if (NewTransactionStarted)
{
DBAccess.GDBAccessObj.CommitTransaction();
}
}
return MainDS;
}
示例2: UpdateTotalsOfBatch
public static void UpdateTotalsOfBatch(Int32 ALedgerNumber, Int32 ABatchNumber)
{
//TVerificationResultCollection AVerificationResult = new TVerificationResultCollection();
GLBatchTDS glDS = new GLBatchTDS();
decimal sumDebits = 0.0M;
decimal sumCredits = 0.0M;
//Load all Batch, Journal and Transaction records
glDS.Merge(LoadABatchAJournalATransaction(ALedgerNumber, ABatchNumber));
if ((glDS.ABatch == null) || (glDS.ABatch.Count == 0))
{
return;
}
try
{
ABatchRow currentBatch = (ABatchRow)glDS.ABatch.Rows[0];
glDS.AJournal.DefaultView.RowFilter = string.Empty;
foreach (DataRowView journalview in glDS.AJournal.DefaultView)
{
GLBatchTDSAJournalRow journalrow = (GLBatchTDSAJournalRow)journalview.Row;
UpdateTotalsOfJournal(ref glDS, journalrow);
sumDebits += journalrow.JournalDebitTotal;
sumCredits += journalrow.JournalCreditTotal;
}
currentBatch.BatchDebitTotal = sumDebits;
currentBatch.BatchCreditTotal = sumCredits;
currentBatch.BatchRunningTotal = Math.Round(sumDebits - sumCredits, 2);
glDS.AcceptChanges();
}
catch (Exception)
{
glDS.RejectChanges();
throw;
}
}
示例3: CreateARecurringBatch
/// <summary>
/// create a new recurring batch.
/// it is already stored to the database, to avoid problems with LastBatchNumber
/// </summary>
public static GLBatchTDS CreateARecurringBatch(Int32 ALedgerNumber)
{
#region Validate Arguments
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
GLBatchTDS MainDS = new GLBatchTDS();
GLBatchTDS TempDS = new GLBatchTDS();
TDBTransaction Transaction = null;
bool SubmissionOK = false;
try
{
DBAccess.GDBAccessObj.GetNewOrExistingAutoTransaction(IsolationLevel.Serializable,
TEnforceIsolationLevel.eilMinimum,
ref Transaction,
ref SubmissionOK,
delegate
{
ALedgerAccess.LoadByPrimaryKey(MainDS, ALedgerNumber, Transaction);
#region Validate Data
if ((MainDS.ALedger == null) || (MainDS.ALedger.Count == 0))
{
throw new EFinanceSystemDataTableReturnedNoDataException(String.Format(Catalog.GetString(
"Function:{0} - Ledger data for Ledger number {1} does not exist or could not be accessed!"),
Utilities.GetMethodName(true),
ALedgerNumber));
}
#endregion Validate Data
ARecurringBatchAccess.LoadViaALedger(TempDS, ALedgerNumber, Transaction);
DataView RecurringBatchDV = new DataView(TempDS.ARecurringBatch);
RecurringBatchDV.RowFilter = string.Empty;
RecurringBatchDV.Sort = string.Format("{0} DESC",
ARecurringBatchTable.GetBatchNumberDBName());
//Recurring batch numbers can be reused so check each time for current highest number
if (RecurringBatchDV.Count > 0)
{
MainDS.ALedger[0].LastRecurringBatchNumber = (int)(RecurringBatchDV[0][ARecurringBatchTable.GetBatchNumberDBName()]);
}
else
{
MainDS.ALedger[0].LastRecurringBatchNumber = 0;
}
ARecurringBatchRow NewRow = MainDS.ARecurringBatch.NewRowTyped(true);
NewRow.LedgerNumber = ALedgerNumber;
NewRow.BatchNumber = ++MainDS.ALedger[0].LastRecurringBatchNumber;
MainDS.ARecurringBatch.Rows.Add(NewRow);
//Empty the TempDS
TempDS.RejectChanges();
//Submit changes to MainDS
GLBatchTDSAccess.SubmitChanges(MainDS);
SubmissionOK = true;
});
MainDS.AcceptChanges();
}
catch (Exception ex)
{
TLogging.Log(String.Format("Method:{0} - Unexpected error!{1}{1}{2}",
Utilities.GetMethodSignature(),
Environment.NewLine,
ex.Message));
throw ex;
}
return MainDS;
}