protected override Event doGet(int ID) { m_command.CommandText = CustomerInvoice.GetByIDSQL(ID); MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader(); CustomerInvoice st = CustomerInvoice.TransformReader(r); r.Close(); m_command.CommandText = CustomerInvoiceItem.GetByEventIDSQL(ID); r = m_command.ExecuteReader(); IList stis = CustomerInvoiceItem.TransformReaderList(r); r.Close(); foreach (CustomerInvoiceItem 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); if (sti.DO_ITEM.ID > 0) { sti.DO_ITEM = DeliveryOrderRepository.FindDeliveryOrderItem(m_command, sti.DO_ITEM.ID); } st.EVENT_ITEMS.Add(sti); } return(st); }
public static CustomerInvoice GetHeaderOnly(MySql.Data.MySqlClient.MySqlCommand cmd, int poID) { cmd.CommandText = CustomerInvoice.GetByIDSQL(poID); MySql.Data.MySqlClient.MySqlDataReader r = cmd.ExecuteReader(); CustomerInvoice st = CustomerInvoice.TransformReader(r); r.Close(); return(st); }
public IList FindSIbyPartAndPONo(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 = CustomerInvoiceItem.GetSearchByPartAndPONo(find, supplierID, pois, trDate); MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader(); IList result = CustomerInvoiceItem.TransformReaderList(r); r.Close(); foreach (CustomerInvoiceItem t in result) { m_command.CommandText = CustomerInvoice.GetByIDSQL(t.EVENT.ID); r = m_command.ExecuteReader(); t.EVENT = CustomerInvoice.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(((CustomerInvoice)t.EVENT).TOP.ID); r = m_command.ExecuteReader(); ((CustomerInvoice)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); }
private void assertInvoiceAlreadyGenerated(DeliveryOrderItem item) { m_command.CommandText = CustomerInvoiceItem.GetDOUseByCustomerInvoice(item.ID); MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader(); IList invs = CustomerInvoiceItem.TransformReaderList(r); r.Close(); foreach (CustomerInvoiceItem x in invs) { m_command.CommandText = CustomerInvoice.GetByIDSQL(x.EVENT.ID); r = m_command.ExecuteReader(); x.EVENT = CustomerInvoice.TransformReader(r); r.Close(); } if (invs.Count > 0) { throw new Exception("DO Part [" + item.PART.CODE + "] is used by Customer Invoice [" + ((CustomerInvoiceItem)invs[0]).EVENT.CODE + "], please delete customer invoice first."); } }