protected override EventJournal doGet(int ID) { m_command.CommandText = APDebitNote.GetByIDSQL(ID); MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader(); APDebitNote st = APDebitNote.TransformReader(r); r.Close(); m_command.CommandText = APDebitNoteItem.GetByEventIDSQL(ID); r = m_command.ExecuteReader(); IList stis = APDebitNoteItem.TransformReaderList(r); r.Close(); foreach (APDebitNoteItem sti in stis) { sti.EVENT_JOURNAL = st; //sti.VENDOR = PartRepository.GetByID(m_command, sti.PART.ID); sti.VENDOR_BALANCE_ENTRY = VendorBalanceEntryRepository.FindVendorBalanceEntryByEventItem(m_command, sti.ID, sti.VENDOR_BALANCE_ENTRY_TYPE); //sti.GRN_ITEM = GoodReceiveNoteRepository.FindGoodReceiveNoteItem(m_command, sti.GRN_ITEM.ID); //sti.GRN_ITEM.PART = PartRepository.GetByID(m_command, sti.GRN_ITEM.PART.ID); if (sti.PURCHASE_RETURN != null) { if (sti.PURCHASE_RETURN.ID > 0) { sti.PURCHASE_RETURN = PurchaseReturnRepository.GetPurchaseReturnForDebitNote(m_command, sti.PURCHASE_RETURN); } } st.EVENT_JOURNAL_ITEMS.Add(sti); } return(st); }
internal static IList FindAPDNByPurchaseReturn(MySql.Data.MySqlClient.MySqlCommand cmd, int prID) { cmd.CommandText = APDebitNoteItem.GetAPDNItemByPRID(prID); MySql.Data.MySqlClient.MySqlDataReader r = cmd.ExecuteReader(); IList result = APDebitNoteItem.TransformReaderList(r); r.Close(); foreach (APDebitNoteItem i in result) { cmd.CommandText = APDebitNote.GetByIDSQL(i.EVENT_JOURNAL.ID); r = cmd.ExecuteReader(); i.EVENT_JOURNAL = APDebitNote.TransformReader(r); r.Close(); } return(result); }