public static PurchaseOrder GetHeaderOnly(MySql.Data.MySqlClient.MySqlCommand cmd, int poID) { cmd.CommandText = PurchaseOrder.GetByIDSQL(poID); MySql.Data.MySqlClient.MySqlDataReader r = cmd.ExecuteReader(); PurchaseOrder st = PurchaseOrder.TransformReader(r); r.Close(); return(st); }
public IList FindPObyPartAndPONo(string find, IList exceptPOI, int supplierID, DateTime trDate) { StringBuilder poisSB = new StringBuilder(); foreach (int i in exceptPOI) { poisSB.Append(i.ToString()); poisSB.Append(','); } string pois = poisSB.ToString(); pois = exceptPOI.Count > 0?pois.Substring(0, pois.Length - 1):""; m_command.CommandText = PurchaseOrderItem.GetSearchByPartAndPONo(find, supplierID, pois, trDate); MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader(); IList result = PurchaseOrderItem.TransformReaderList(r); r.Close(); foreach (PurchaseOrderItem t in result) { m_command.CommandText = PurchaseOrder.GetByIDSQL(t.EVENT.ID); r = m_command.ExecuteReader(); t.EVENT = PurchaseOrder.TransformReader(r); r.Close(); m_command.CommandText = Part.GetByIDSQLStatic(t.PART.ID); r = m_command.ExecuteReader(); t.PART = Part.GetPart(r); r.Close(); m_command.CommandText = Unit.GetByIDSQLstatic(t.UNIT.ID); r = m_command.ExecuteReader(); t.UNIT = Unit.GetUnit(r); r.Close(); m_command.CommandText = TermOfPayment.GetByIDSQLStatic(((PurchaseOrder)t.EVENT).TOP.ID); r = m_command.ExecuteReader(); ((PurchaseOrder)t.EVENT).TOP = TermOfPayment.GetTOP(r); r.Close(); m_command.CommandText = Warehouse.GetByIDSQLStatic(t.WAREHOUSE.ID); r = m_command.ExecuteReader(); t.WAREHOUSE = Warehouse.GetWarehouse(r); r.Close(); m_command.CommandText = Unit.GetByIDSQLstatic(t.PART.UNIT.ID); r = m_command.ExecuteReader(); t.PART.UNIT = Unit.GetUnit(r); r.Close(); } return(result); }
protected override Event doGet(int ID) { m_command.CommandText = PurchaseOrder.GetByIDSQL(ID); MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader(); PurchaseOrder st = PurchaseOrder.TransformReader(r); r.Close(); m_command.CommandText = PurchaseOrderItem.GetByEventIDSQL(ID); r = m_command.ExecuteReader(); IList stis = PurchaseOrderItem.TransformReaderList(r); r.Close(); foreach (PurchaseOrderItem 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); st.EVENT_ITEMS.Add(sti); } return(st); }