Ejemplo n.º 1
0
        public static string GetNextLedgerEntryNumber(IDalSession session, string exactLedger)
        {
            string sqlQuery = "SELECT TOP 1 {E.*} FROM LEDGER E WHERE E.JOURNAL = '" + exactLedger + "' order by E.BookingNumber DESC";
            IList ledgerEntries = session.GetListbySQLQuery(sqlQuery, "E", typeof(LedgerEntry));

            if (ledgerEntries.Count > 0)
                return (int.Parse(((ILedgerEntry)ledgerEntries[0]).BookingNumber) + 1).ToString().PadLeft(8, '0');
            else
                return (("8" + exactLedger.PadLeft(3, '0')).PadRight(7, '0')) + "1";
        }
Ejemplo n.º 2
0
        public static int GetNextOrdinal(IDalSession session, string fileName)
        {
            string sqlQuery = string.Format("SELECT TOP 1 {0} FROM ExportedLedgerFile E WHERE E.Name = '{1}' ORDER BY E.Ordinal DESC",
                                            "{E.*}", fileName);
            IList exportedLedgerFiles = session.GetListbySQLQuery(sqlQuery, "E", typeof(ExportedLedgerFile));

            if (exportedLedgerFiles.Count > 0)
                return ((IExportedLedgerFile)exportedLedgerFiles[0]).Ordinal + 1;
            else
                return 0;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Get latest historical exchange rate
 /// </summary>
 /// <param name="DataSession">Data access object</param>
 /// <returns>Date</returns>
 public static DateTime GetMaxHistoricalExRateDate(IDalSession DataSession)
 {
     string Query = @"select top 1 {HistoricalExRates.*} from dbo.HistoricalExRates where ratedate = (Select max(RateDate) from dbo.HistoricalExRates)";
     IList returnValues = DataSession.GetListbySQLQuery(Query, "HistoricalExRates", typeof(HistoricalExRate));
     if (returnValues.Count > 0)
         return ((HistoricalExRate)returnValues[0]).RateDate;
     else
         return DateTime.MinValue;
 }