public static PurchaseReturn GetHeaderOnly(MySql.Data.MySqlClient.MySqlCommand cmd, int prnID) { cmd.CommandText = PurchaseReturn.GetByIDSQL(prnID); MySql.Data.MySqlClient.MySqlDataReader r = cmd.ExecuteReader(); PurchaseReturn st = PurchaseReturn.TransformReader(r); r.Close(); return(st); }
public static PurchaseReturnItem FindGRNItem(MySql.Data.MySqlClient.MySqlCommand cmd, int grnIID) { cmd.CommandText = PurchaseReturnItem.FindByGrnItemIDSQL(grnIID); MySql.Data.MySqlClient.MySqlDataReader r = cmd.ExecuteReader(); PurchaseReturnItem res = PurchaseReturnItem.TransformReader(r); r.Close(); if (res == null) { return(null); } cmd.CommandText = PurchaseReturn.GetByIDSQL(res.EVENT.ID); r = cmd.ExecuteReader(); res.EVENT = PurchaseReturn.TransformReader(r); r.Close(); return(res); }
protected override Event doGet(int ID) { m_command.CommandText = PurchaseReturn.GetByIDSQL(ID); MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader(); PurchaseReturn st = PurchaseReturn.TransformReader(r); r.Close(); m_command.CommandText = PurchaseReturnItem.GetByEventIDSQL(ID); r = m_command.ExecuteReader(); IList stis = PurchaseReturnItem.TransformReaderList(r); r.Close(); foreach (PurchaseReturnItem sti in stis) { sti.EVENT = st; sti.PART = PartRepository.GetByID(m_command, sti.PART.ID); sti.STOCK_CARD_ENTRY = StockCardEntryRepository.FindStockCardEntryByEventItem(m_command, sti.ID, sti.STOCK_CARD_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); st.EVENT_ITEMS.Add(sti); } return(st); }