Esempio n. 1
0
        private void searchToolStripButton_Click(object sender, EventArgs e)
        {
            IList result = searchToolStripTextBox.Text == string.Empty ? new ArrayList() : r_grn.Search(searchToolStripTextBox.Text);

            if (result.Count == 1)
            {
                m_do          = (DeliveryOrder)result[0];
                m_do          = (DeliveryOrder)r_grn.Get(m_do.ID);
                m_do.EMPLOYEE = (Employee)r_employee.GetById(m_do.EMPLOYEE);
                m_do.CUSTOMER = (Customer)r_sup.GetById(m_do.CUSTOMER);
                setEditMode(EditMode.View);
                loadData();
                setEnableForm(false);
            }
            else
            {
                using (SearchDeliveryOrderForm frm = new SearchDeliveryOrderForm(searchToolStripTextBox.Text, result))
                {
                    frm.ShowDialog();
                    if (frm.DELIVERY_ORDER == null)
                    {
                        return;
                    }
                    else
                    {
                        m_do          = frm.DELIVERY_ORDER;
                        m_do          = (DeliveryOrder)r_grn.Get(m_do.ID);
                        m_do.EMPLOYEE = (Employee)r_employee.GetById(m_do.EMPLOYEE);
                        setEditMode(EditMode.View);
                        loadData();
                        setEnableForm(false);
                    }
                }
            }
        }