protected override Event doGet(int ID) { m_command.CommandText = SupplierInvoice.GetByIDSQL(ID); MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader(); SupplierInvoice st = SupplierInvoice.TransformReader(r); r.Close(); m_command.CommandText = SupplierInvoiceItem.GetByEventIDSQL(ID); r = m_command.ExecuteReader(); IList stis = SupplierInvoiceItem.TransformReaderList(r); r.Close(); foreach (SupplierInvoiceItem 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.GRN_ITEM.ID > 0) { sti.GRN_ITEM = GoodReceiveNoteRepository.FindGoodReceiveNoteItem(m_command, sti.GRN_ITEM.ID); } st.EVENT_ITEMS.Add(sti); } return(st); }
public override Event FindLastCodeAndTransactionDate(string codesample) { m_command.CommandText = SupplierInvoice.FindLastCodeAndTransactionDate(codesample); MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader(); Event e = SupplierInvoice.TransformReader(r); r.Close(); return(e); }
public static SupplierInvoice GetHeaderOnly(MySql.Data.MySqlClient.MySqlCommand cmd, int poID) { cmd.CommandText = SupplierInvoice.GetByIDSQL(poID); MySql.Data.MySqlClient.MySqlDataReader r = cmd.ExecuteReader(); SupplierInvoice st = SupplierInvoice.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 = SupplierInvoiceItem.GetSearchByPartAndPONo(find, supplierID, pois, trDate); MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader(); IList result = SupplierInvoiceItem.TransformReaderList(r); r.Close(); foreach (SupplierInvoiceItem t in result) { m_command.CommandText = SupplierInvoice.GetByIDSQL(t.EVENT.ID); r = m_command.ExecuteReader(); t.EVENT = SupplierInvoice.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(((SupplierInvoice)t.EVENT).TOP.ID); r = m_command.ExecuteReader(); ((SupplierInvoice)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(GoodReceiveNoteItem item) { m_command.CommandText = SupplierInvoiceItem.GetGRNUseBySupplierInvoice(item.ID); MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader(); IList invs = SupplierInvoiceItem.TransformReaderList(r); r.Close(); foreach (SupplierInvoiceItem x in invs) { m_command.CommandText = SupplierInvoice.GetByIDSQL(x.EVENT.ID); r = m_command.ExecuteReader(); x.EVENT = SupplierInvoice.TransformReader(r); r.Close(); } if (invs.Count > 0) { throw new Exception("GRN Part [" + item.PART.CODE + "] is used by Supplier Invoice [" + ((SupplierInvoiceItem)invs[0]).EVENT.CODE + "], please delete supplier invoice first."); } }