コード例 #1
0
 private void PurchasesButton_Click(object sender, EventArgs e)
 {
     customer.customerNo = Convert.ToInt32(customerNoTextBox.Text);
     if (orderHistory == null || orderHistory.IsDisposed)
     {
         orderHistory = new CustomerPurchases(customer.customerNo);
     }
     orderHistory.Show();
     orderHistory.BringToFront();
 }
コード例 #2
0
        //get value of selected entry, used to open a new window to the info based on the search
        private void ViewInfoButton_Click(object sender, EventArgs e)
        {
            //opens to customer info
            if (cUSTOMERDataGridView.Visible == true)
            {
                int row       = cUSTOMERDataGridView.CurrentRow.Index;
                int pCustomer = (int)cUSTOMERDataGridView[0, row].Value;

                if (customerInfoForm == null || IsDisposed)
                {
                    customerInfoForm = new CustomerInformation(pCustomer);
                }
                customerInfoForm.Show();
                customerInfoForm.BringToFront();
            }
            //opens to show info
            else if (sHOWDataGridView.Visible == true)
            {
                int row   = sHOWDataGridView.CurrentRow.Index;
                int pShow = (int)sHOWDataGridView[0, row].Value;

                if (showForm == null || IsDisposed)
                {
                    showForm = new NewShow(pShow);
                }
                showForm.Show();
                showForm.BringToFront();
            }
            //opens to order info unless search was done by customer, which opens customers order history
            else if (oRDERSDataGridView.Visible == true)
            {
                int row = oRDERSDataGridView.CurrentRow.Index;
                if (SearchByComboBox.SelectedIndex == 5)
                {
                    int pCustomer = (int)oRDERSDataGridView[6, row].Value;

                    if (customerPurchases == null || IsDisposed)
                    {
                        customerPurchases = new CustomerPurchases(pCustomer);
                    }
                    customerPurchases.Show();
                    customerPurchases.BringToFront();
                }
                else
                {
                    int pOrder = (int)oRDERSDataGridView[0, row].Value;

                    if (orderForm == null || IsDisposed)
                    {
                        orderForm = new NewOrder(pOrder);
                    }
                    orderForm.Show();
                    orderForm.BringToFront();
                }
            }
            //opens customer info
            else //(receivablesQueryDataGridView.Visible == true)
            {
                int row       = receivablesQueryDataGridView.CurrentRow.Index;
                int pCustomer = (int)receivablesQueryDataGridView[0, row].Value;

                if (customerInfoForm == null || IsDisposed)
                {
                    customerInfoForm = new CustomerInformation(pCustomer);
                }
                customerInfoForm.Show();
                customerInfoForm.BringToFront();
            }
        }