예제 #1
0
        private void searchToolStripButton_Click(object sender, EventArgs e)
        {
            IList result = searchToolStripTextBox.Text == string.Empty ? new ArrayList() : r_si.Search(searchToolStripTextBox.Text);

            if (result.Count == 1)
            {
                m_si          = (CustomerInvoice)result[0];
                m_si          = (CustomerInvoice)r_si.Get(m_si.ID);
                m_si.EMPLOYEE = (Employee)r_employee.GetById(m_si.EMPLOYEE);
                m_si.CURRENCY = (Currency)r_ccy.GetById(m_si.CURRENCY);
                m_si.DIVISION = (Division)r_division.GetById(m_si.DIVISION);
                m_si.TOP      = (TermOfPayment)r_top.GetById(m_si.TOP);
                m_si.TAX      = m_si.TAX == null ? null : (Tax)r_tax.GetById(m_si.TAX);
                m_si.CUSTOMER = (Customer)r_sup.GetById(m_si.CUSTOMER);
                setEditMode(EditMode.View);
                loadData();
                setEnableForm(false);
            }
            else
            {
                using (SearchCustomerInvoiceForm frm = new SearchCustomerInvoiceForm(searchToolStripTextBox.Text, result))
                {
                    frm.ShowDialog();
                    if (frm.CUSTOMER_INVOICE == null)
                    {
                        return;
                    }
                    else
                    {
                        m_si          = frm.CUSTOMER_INVOICE;
                        m_si          = (CustomerInvoice)r_si.Get(m_si.ID);
                        m_si.EMPLOYEE = (Employee)r_employee.GetById(m_si.EMPLOYEE);
                        m_si.CURRENCY = (Currency)r_ccy.GetById(m_si.CURRENCY);
                        m_si.DIVISION = (Division)r_division.GetById(m_si.DIVISION);
                        m_si.TOP      = (TermOfPayment)r_top.GetById(m_si.TOP);
                        m_si.TAX      = m_si.TAX == null ? null : (Tax)r_tax.GetById(m_si.TAX);
                        m_si.CUSTOMER = (Customer)r_sup.GetById(m_si.CUSTOMER);
                        setEditMode(EditMode.View);
                        loadData();
                        setEnableForm(false);
                        //setEditMode(EditMode.View);
                    }
                }
            }
        }