Beispiel #1
0
        protected override void doSaveNoTransaction(EventJournal e)
        {
            try
            {
                DateTime     trDate     = DateTime.Today;
                string       codesample = AutoNumberSetupRepository.GetCodeSampleByDomainName(m_command, "SupplierInvoiceJournal");
                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, "SupplierInvoiceJournal", e.CODE, lastCode, lastDate, trDate, trCount == 0);

                SupplierInvoiceJournal stk = (SupplierInvoiceJournal)e;
                m_command.CommandText = stk.GetInsertSQL();
                m_command.ExecuteNonQuery();
                m_command.CommandText = SupplierInvoiceJournal.SelectMaxIDSQL();
                stk.ID = Convert.ToInt32(m_command.ExecuteScalar());
                foreach (SupplierInvoiceJournalItem item in stk.EVENT_JOURNAL_ITEMS)
                {
                    m_command.CommandText = item.GetInsertSQL();
                    m_command.ExecuteNonQuery();
                    m_command.CommandText = SupplierInvoiceJournalItem.SelectMaxIDSQL();
                    item.ID = Convert.ToInt32(m_command.ExecuteScalar());
                }
            }
            catch (Exception x)
            {
                e.ID = 0;
                foreach (EventJournalItem item in e.EVENT_JOURNAL_ITEMS)
                {
                    item.ID = 0;
                }
                throw x;
            }
        }
Beispiel #2
0
        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, "Receipt");
                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, "Receipt", e.CODE, lastCode, lastDate, trDate, trCount == 0);

                Receipt stk = (Receipt)e;
                m_command.CommandText = stk.GetInsertSQL();
                m_command.ExecuteNonQuery();
                m_command.CommandText = Receipt.SelectMaxIDSQL();
                stk.ID = Convert.ToInt32(m_command.ExecuteScalar());
                foreach (ReceiptItem item in stk.EVENT_JOURNAL_ITEMS)
                {
                    item.VENDOR_BALANCE_CUSTOMER_INVOICE_TYPE = item.CUSTOMER_INVOICE_JOURNAL_ITEM.GET_EVENT_JOURNAL.VENDOR_BALANCE_ENTRY_TYPE;
                    m_command.CommandText = item.GetInsertSQL();
                    m_command.ExecuteNonQuery();
                    m_command.CommandText = ReceiptItem.SelectMaxIDSQL();
                    item.ID = Convert.ToInt32(m_command.ExecuteScalar());
                    if (item.PAYMENT_TYPE == ReceiptType.ARCreditNote)
                    {
                        m_command.CommandText = ARCreditNote.UpdateUsedForReceipt(item.AR_CREDIT_NOTE.ID, true);
                        m_command.ExecuteNonQuery();
                    }
                }
                trc.Commit();
            }
            catch (Exception x)
            {
                e.ID = 0;
                foreach (EventJournalItem item in e.EVENT_JOURNAL_ITEMS)
                {
                    item.ID = 0;
                }
                trc.Rollback();
                throw x;
            }
        }
Beispiel #3
0
        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, "GoodReceiveNote");
                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, "GoodReceiveNote", e.CODE, lastCode, lastDate, trDate, trCount == 0);

                GoodReceiveNote stk = (GoodReceiveNote)e;
                m_command.CommandText = e.GetInsertSQL();
                m_command.ExecuteNonQuery();
                m_command.CommandText = GoodReceiveNote.SelectMaxIDSQL();
                stk.ID = Convert.ToInt32(m_command.ExecuteScalar());
                foreach (GoodReceiveNoteItem 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 = GoodReceiveNoteItem.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;
            }
        }
Beispiel #4
0
        protected override void doSaveNoTransaction(EventJournal e)
        {
            try
            {
                DateTime     trDate     = DateTime.Today;
                string       codesample = AutoNumberSetupRepository.GetCodeSampleByDomainName(m_command, "Payment");
                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, "Payment", e.CODE, lastCode, lastDate, trDate, trCount == 0);

                Payment stk = (Payment)e;
                m_command.CommandText = stk.GetInsertSQL();
                m_command.ExecuteNonQuery();
                m_command.CommandText = Payment.SelectMaxIDSQL();
                stk.ID = Convert.ToInt32(m_command.ExecuteScalar());
                foreach (PaymentItem item in stk.EVENT_JOURNAL_ITEMS)
                {
                    item.VENDOR_BALANCE_SUPPLIER_INVOICE_TYPE = item.SUPPLIER_INVOICE_JOURNAL_ITEM.GET_EVENT_JOURNAL.VENDOR_BALANCE_ENTRY_TYPE;
                    m_command.CommandText = item.GetInsertSQL();
                    m_command.ExecuteNonQuery();
                    m_command.CommandText = PaymentItem.SelectMaxIDSQL();
                    item.ID = Convert.ToInt32(m_command.ExecuteScalar());
                    if (item.PAYMENT_TYPE == PaymentType.APDebitNote)
                    {
                        m_command.CommandText = APDebitNote.UpdateUsedForPayment(item.AP_DEBIT_NOTE.ID, true);
                        m_command.ExecuteNonQuery();
                    }
                }
            }
            catch (Exception x)
            {
                e.ID = 0;
                foreach (EventJournalItem item in e.EVENT_JOURNAL_ITEMS)
                {
                    item.ID = 0;
                }
                throw x;
            }
        }
Beispiel #5
0
        //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, "CustomerOutStandingInvoice");
                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, "CustomerOutStandingInvoice", e.CODE, lastCode, lastDate, trDate, trCount == 0);

                CustomerOutStandingInvoice stk = (CustomerOutStandingInvoice)e;
                m_command.CommandText = stk.GetInsertSQL();
                m_command.ExecuteNonQuery();
                m_command.CommandText = CustomerOutStandingInvoice.SelectMaxIDSQL();
                stk.ID = Convert.ToInt32(m_command.ExecuteScalar());
                foreach (CustomerOutStandingInvoiceItem item in stk.EVENT_JOURNAL_ITEMS)
                {
                    m_command.CommandText = item.GetInsertSQL();
                    m_command.ExecuteNonQuery();
                    m_command.CommandText = CustomerOutStandingInvoiceItem.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;
            }
        }
        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;
            }
        }