//private void assertConfirmedPO(EventJournal p) //{ // if (p.EVENT_STATUS.Equals(EventStatus.Entry)) // throw new Exception("PO not confirmed :" + p.CODE); //} //private void assertValidDate(EventJournal po, EventJournal grn) //{ // if (grn.TRANSACTION_DATE < po.TRANSACTION_DATE) // throw new Exception("GRN Date can not less than PO Date :" + po.CODE + " [ " + po.TRANSACTION_DATE.ToString("dd-MMM-yyyy") + " ] "); //} protected override void doSave(EventJournal e) { MySql.Data.MySqlClient.MySqlTransaction trc = m_connection.BeginTransaction(); try { m_command.Transaction = trc; DateTime trDate = DateTime.Today; string codesample = AutoNumberSetupRepository.GetCodeSampleByDomainName(m_command, "ARCreditNote"); EventJournal codeDate = FindLastCodeAndTransactionDate(codesample); string lastCode = codeDate == null ? string.Empty : codeDate.CODE; DateTime lastDate = codeDate == null ? trDate : codeDate.TRANSACTION_DATE; int trCount = RecordCount(); e.CODE = AutoNumberSetupRepository.GetAutoNumberByDomainName(m_command, "ARCreditNote", e.CODE, lastCode, lastDate, trDate, trCount == 0); ARCreditNote stk = (ARCreditNote)e; m_command.CommandText = stk.GetInsertSQL(); m_command.ExecuteNonQuery(); m_command.CommandText = ARCreditNote.SelectMaxIDSQL(); stk.ID = Convert.ToInt32(m_command.ExecuteScalar()); foreach (ARCreditNoteItem item in stk.EVENT_JOURNAL_ITEMS) { m_command.CommandText = item.GetInsertSQL(); m_command.ExecuteNonQuery(); m_command.CommandText = ARCreditNoteItem.SelectMaxIDSQL(); item.ID = Convert.ToInt32(m_command.ExecuteScalar()); } trc.Commit(); } catch (Exception x) { e.ID = 0; foreach (EventJournalItem item in e.EVENT_JOURNAL_ITEMS) { item.ID = 0; } trc.Rollback(); throw x; } }
protected override void doSave(Event e) { MySql.Data.MySqlClient.MySqlTransaction trc = m_connection.BeginTransaction(); try { m_command.Transaction = trc; DateTime trDate = DateTime.Today; string codesample = AutoNumberSetupRepository.GetCodeSampleByDomainName(m_command, "CustomerInvoice"); Event codeDate = FindLastCodeAndTransactionDate(codesample); string lastCode = codeDate == null ? string.Empty : codeDate.CODE; DateTime lastDate = codeDate == null ? trDate : codeDate.TRANSACTION_DATE; int trCount = RecordCount(); e.CODE = AutoNumberSetupRepository.GetAutoNumberByDomainName(m_command, "CustomerInvoice", e.CODE, lastCode, lastDate, trDate, trCount == 0); CustomerInvoice stk = (CustomerInvoice)e; m_command.CommandText = e.GetInsertSQL(); m_command.ExecuteNonQuery(); m_command.CommandText = CustomerInvoice.SelectMaxIDSQL(); stk.ID = Convert.ToInt32(m_command.ExecuteScalar()); foreach (CustomerInvoiceItem item in stk.EVENT_ITEMS) { item.PART.UNIT_CONVERSION_LIST = PartRepository.GetUnitConversionsStatic(m_command, item.PART.ID); m_command.CommandText = item.GetInsertSQL(); m_command.ExecuteNonQuery(); m_command.CommandText = CustomerInvoiceItem.SelectMaxIDSQL(); item.ID = Convert.ToInt32(m_command.ExecuteScalar()); } trc.Commit(); } catch (Exception x) { e.ID = 0; foreach (EventItem item in e.EVENT_ITEMS) { item.ID = 0; } trc.Rollback(); throw x; } }
public void SaveNoTransaction(Event e, MySql.Data.MySqlClient.MySqlCommand command) { try { m_command = command; DateTime trDate = DateTime.Today; string codesample = AutoNumberSetupRepository.GetCodeSampleByDomainName(m_command, "OpeningStock"); Event codeDate = FindLastCodeAndTransactionDate(codesample); string lastCode = codeDate == null ? string.Empty : codeDate.CODE; DateTime lastDate = codeDate == null ? trDate : codeDate.TRANSACTION_DATE; int trCount = RecordCount(); e.CODE = AutoNumberSetupRepository.GetAutoNumberByDomainName(m_command, "OpeningStock", e.CODE, lastCode, lastDate, trDate, trCount == 0); OpeningStock stk = (OpeningStock)e; m_command.CommandText = e.GetInsertSQL(); m_command.ExecuteNonQuery(); m_command.CommandText = OpeningStock.SelectMaxIDSQL(); stk.ID = Convert.ToInt32(m_command.ExecuteScalar()); foreach (OpeningStockItem item in stk.EVENT_ITEMS) { m_command.CommandText = item.GetInsertSQL(); m_command.ExecuteNonQuery(); m_command.CommandText = OpeningStockItem.SelectMaxIDSQL(); item.ID = Convert.ToInt32(m_command.ExecuteScalar()); } } catch (Exception x) { e.ID = 0; foreach (EventItem item in e.EVENT_ITEMS) { item.ID = 0; } throw x; } }
public bool IsAutoNumber() { AutoNumberSetup autonumber = AutoNumberSetupRepository.GetAutoNumberSetup(m_command, "SalesReturn"); return(autonumber.AUTONUMBER_SETUP_TYPE == AutoNumberSetupType.Auto); }
public bool IsAutoNumber() { AutoNumberSetup autonumber = AutoNumberSetupRepository.GetAutoNumberSetup(m_command, "SupplierInvoiceJournal"); return(autonumber.AUTONUMBER_SETUP_TYPE == AutoNumberSetupType.Auto); }
public bool IsAutoNumber() { AutoNumberSetup autonumber = AutoNumberSetupRepository.GetAutoNumberSetup(m_command, "CustomerOutStandingInvoice"); return(autonumber.AUTONUMBER_SETUP_TYPE == AutoNumberSetupType.Auto); }