Esempio n. 1
0
            public static void DeleteTestLedgerIfExists()
            {
                if (FLedgerDS.ALedger == null)
                {
                    // we did not create one yet
                    return;
                }

                DataView dv = new DataView(FLedgerDS.ALedger,
                                           "a_ledger_number_i=" + STANDARD_TEST_LEDGER_NUMBER.ToString(), null, DataViewRowState.CurrentRows);

                if (dv.Count > 0)
                {
                    // exists already
                    DataRowView row = dv[0];
                    row.Delete();
                    FLedgerDS.SaveChanges();
                }
            }
Esempio n. 2
0
            public static void CreateTestLedger()
            {
                FLedgerDS.LoadAll();
                DataView dv = new DataView(FLedgerDS.ALedger,
                                           "a_ledger_number_i=" + STANDARD_TEST_LEDGER_NUMBER.ToString(), null, DataViewRowState.CurrentRows);

                if (dv.Count > 0)
                {
                    // exists already
                    return;
                }

                int        NewLedgerNumber = STANDARD_TEST_LEDGER_NUMBER;
                ALedgerRow newRow          = FLedgerDS.ALedger.NewRowTyped(true);

                newRow.LedgerNumber            = NewLedgerNumber;
                newRow.LedgerName              = "TestLedger";
                newRow.BaseCurrency            = STANDARD_TEST_CURRENCY;
                newRow.ForexGainsLossesAccount = "Trash";
                newRow.PartnerKey              = NewLedgerNumber * 10000;

                FLedgerDS.ALedger.Rows.Add(newRow);
                FLedgerDS.SaveChanges();
            }