コード例 #1
0
        // Grid Clicks
        private void gridCustomers_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                Customer customer = customerBindingSource.Current as Customer;
                tcntrlInfo.SelectedTab = tpageCustomer;

                clientOrderBindingSource.DataSource = ClientOrderService.GetClientOrders(customer.CustomerId, ClientType.Customer);
                tpageCustomer.Enabled      = false;
                gridCustomerOrders.Enabled = true;
            }
            catch (Exception ex)
            {
                MetroFramework.MetroMessageBox.Show(this, ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        private void gridBusinesses_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                Business business = businessBindingSource.Current as Business;
                tcntrlInfo.SelectedTab = tpageBusiness;

                clientOrderBindingSource1.DataSource = ClientOrderService.GetClientOrders(business.BusinessId, ClientType.Business);
                tpageBusiness.Enabled      = false;
                gridBusinessOrders.Enabled = true;
            }
            catch (Exception ex)
            {
                MetroFramework.MetroMessageBox.Show(this, ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                customerBindingSource.DataSource = CustomerService.GetAll();
                businessBindingSource.DataSource = BusinessService.GetAll();
                orderBindingSource.DataSource    = OrderService.GetAll();
                clientBindingSource.DataSource   = ClientService.GetAll();

                Customer customer = customerBindingSource.Current as Customer;
                Business business = businessBindingSource.Current as Business;
                Order    order    = orderBindingSource.Current as Order;
                Client   client   = clientBindingSource.Current as Client;

                // Set delivery date to order date when delivery date is null
                order = _setDeliveryDate(order);

                clientOrderBindingSource.DataSource  = ClientOrderService.GetClientOrders(customer.CustomerId, ClientType.Customer);
                clientOrderBindingSource1.DataSource = ClientOrderService.GetClientOrders(business.BusinessId, ClientType.Business);

                tcntrlLists.SelectedTab = tpageCustomers;
                tcntrlInfo.SelectedTab  = tpageCustomer;

                // Set the combo box in orders to be populated with the ClientName string form the binding source
                cboOrderClient.DataSource = ClientService.GetAll().Select(x => x.ClientName).ToList();
                // Set the combo box index the proper client name
                _setOrderComboBoxIndex(order);

                // Setup initial states of pages
                tpageCustomer.Enabled      = false;
                tpageBusiness.Enabled      = false;
                tpageOrder.Enabled         = false;
                gridCustomerOrders.Enabled = true;
                gridBusinessOrders.Enabled = true;
            }
            catch (Exception ex)
            {
                MetroFramework.MetroMessageBox.Show(this, ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); MetroFramework.MetroMessageBox.Show(this, ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }