예제 #1
0
        public static IList GetLedgerEntries(IDalSession session, ILedgerType ledgerType, DateTime dateUntil)
        {
            string query = "B4F.TotalGiro.Communicator.Exact.LedgerEntry.GetLedgerEntries";

            Hashtable parameters = new Hashtable();
            parameters.Add("LedgerType", ledgerType);
            parameters.Add("DateUntil", dateUntil);

            return session.GetListByNamedQuery(query, parameters);
        }
예제 #2
0
파일: LedgerEntry.cs 프로젝트: kiquenet/B4F
 public LedgerEntry(ILedgerType ledgerType, string journal, string bookingNumber, DateTime valueDate, Decimal amount, 
                    string kredietbeperking, bool stornoBooking)
     : this()
 {
     this.ledgerType = ledgerType;
     Journal = journal;
     BookingNumber = bookingNumber;
     ValueDate = valueDate;
     //Amount = amount;
     Kredietbeperking = kredietbeperking;
     PaymentType = "B";
     StornoBooking = stornoBooking;
     //this.Debitor = "000000";
 }
예제 #3
0
        private static void exportGrouping(BatchExecutionResults results, IDalSession session, ILedgerType ledgerType, DateTime dateUntil,
                                           string exportFilePath)
        {
            try
            {
                string fileName = string.Format("{0}_{1:yyyyMMdd}", ledgerType.Type, dateUntil);
                string fileExt = "csv";

                IList ledgerEntries = LedgerEntryMapper.GetLedgerEntries(session, ledgerType, dateUntil);
                int fileOrdinal = ExportedLedgerFileMapper.GetNextOrdinal(session, fileName);

                if ((ledgerEntries != null) && (ledgerEntries.Count > 0))
                {
                    ExportedLedgerFile exportedLedgerFile = new ExportedLedgerFile(fileName, fileExt, exportFilePath, fileOrdinal++);
                    FileStream fs = new FileStream(exportedLedgerFile.FullPathName, FileMode.Create);
                    StreamWriter sw = new StreamWriter(fs);

                    foreach (ILedgerEntry ledgerEntry in ledgerEntries)
                    {
                        string formattedEntry = formatLedgerEntry(results, ledgerEntry);

                        if (formattedEntry.Length > 0)
                        {
                            sw.Write(formattedEntry);

                            ledgerEntry.ExportedLedgerFile = exportedLedgerFile;
                            exportedLedgerFile.LedgerEntries.AddLedgerEntry(ledgerEntry);
                        }
                    }

                    sw.Close();
                    fs.Close();
                    ExportedLedgerFileMapper.Update(session, exportedLedgerFile);
                    results.MarkSuccess();
                }
            }
            catch (Exception ex)
            {
                results.MarkError(
                    new ApplicationException(string.Format("Error exporting for ledger type '{0}', currency '{1}' and transaction date {2:d}.",
                                                           ledgerType.Type, dateUntil), ex));
            }
        }