Пример #1
0
        //onLoad
        private void NewOrder_Load(object sender, EventArgs e)
        {
            //get status combobox options
            ((DataGridViewComboBoxColumn)dgvLineItems.Columns["Status"]).DataSource = Enum.GetNames(typeof(LineItemStatus));
            //get payment type options
            paymentTypeComboBox.DataSource = Enum.GetNames(typeof(PaymentType));

            //get names for autocomplete
            customerNames              = DatabaseAccess.getCustomerNames();
            txtName.AutoCompleteMode   = AutoCompleteMode.Suggest;
            txtName.AutoCompleteSource = AutoCompleteSource.CustomSource;
            AutoCompleteStringCollection collection = new AutoCompleteStringCollection();

            collection.AddRange(customerNames);
            txtName.AutoCompleteCustomSource = collection;

            //parse input for correct format for access
            customerNoTextBox.DataBindings[0].Parse       += new ConvertEventHandler(ParseNumeric);
            showNoTextBox.DataBindings[0].Parse           += new ConvertEventHandler(ParseNumeric);
            orderDateDateTimePicker.DataBindings[0].Parse += new ConvertEventHandler(ShortDate);

            // TODO: This line of code loads data into the 'pineSpringsPotteryDataSet.ORDERS' table. You can move, or remove it, as needed.
            this.oRDERSTableAdapter.Fill(this.pineSpringsPotteryDataSet.ORDERS);

            //new Order
            if (order.orderNo == 0)
            {
                bindingNavigatorAddNewItem.PerformClick();
                editable();
            }
            //displaying existing order
            else
            {
                newOrder = false;
                int index = ordersBindingNavigator.BindingSource.Find("OrderNo", order.orderNo);
                ordersBindingNavigator.BindingSource.Position = index;
                getOrderInfo();
                uneditable();
            }
        }