Ejemplo n.º 1
0
        //Bind Customer Grid to show data
        private void BindGridCustomer()
        {
            DataTable ds = new CustomerAction().GetAllCustomers();

            CustomersDataGridView.DataSource = ds;
            CustomersDataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
        }
Ejemplo n.º 2
0
 private void _CurrentCellDirtyStateChanged(object sender, EventArgs e)
 {
     CustomersDataGridView.CurrentCellDirtyStateChanged -= _CurrentCellDirtyStateChanged;
     CustomersDataGridView.CommitEdit(DataGridViewDataErrorContexts.Commit);
     CustomersDataGridView.CurrentCellDirtyStateChanged += _CurrentCellDirtyStateChanged;
     CurrentValuesView();
 }
Ejemplo n.º 3
0
        public void MainScreenForm_Load(object sender, EventArgs e)
        {
            //Fills the CustomersDataGridView
            MySqlConnection con = new MySqlConnection(ConfigurationManager.ConnectionStrings["U04i5a"].ConnectionString); //Creates the connection and passes in the connection string parameter
            MySqlCommand    cmd = new MySqlCommand("SELECT customerName, customerId, addressId FROM customer ;", con);    //Creates the command and passes it in the parameters (Cmd, connection)

            con.Open();
            MySqlDataAdapter adapter = new MySqlDataAdapter(cmd);   //instantiates the connection and passes in the Sql cmd
            DataTable        ds      = new DataTable();

            adapter.Fill(ds);
            CustomersDataGridView.DataSource = ds;
            CustomersDataGridView.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            con.Close();
            CustomersDataGridView.ClearSelection();
            CustomersDataGridView.CurrentCell = null;

            //Fills the AppointmentsDataGridView
            AllAppointmentsRadioButton.Checked = true;
        }
Ejemplo n.º 4
0
        private async void CustomersDataGridViewTestForm_Shown(object sender, EventArgs e)
        {
            var customerEntities = await CustomersTestOperations.AllCustomersForDataGridViewAsync();

            _customerView = new SortableBindingList <CustomerEntity>(customerEntities);
            _customerBindingSource.DataSource = _customerView;

            CountryColumn.DisplayMember    = "Name";
            CountryColumn.ValueMember      = "CountryIdentifier";
            CountryColumn.DataPropertyName = "CountryIdentifier";
            CountryColumn.DataSource       = CustomersTestOperations.CountryList();
            CountryColumn.DisplayStyle     = DataGridViewComboBoxDisplayStyle.Nothing;


            ContactTitleColumn.DisplayMember    = "ContactTitle";
            ContactTitleColumn.ValueMember      = "ContactTypeIdentifier";
            ContactTitleColumn.DataPropertyName = "ContactTypeIdentifier";
            ContactTitleColumn.DataSource       = CustomersTestOperations.ContactTypeList();
            ContactTitleColumn.DisplayStyle     = DataGridViewComboBoxDisplayStyle.Nothing;

            CustomersDataGridView.DataSource = _customerBindingSource;
            CustomersDataGridView.ExpandColumns();

            CustomersBindingNavigator.BindingSource = _customerBindingSource;
            CurrentCustomerDetails.Enabled          = true;
            SaveChangesButton.Enabled            = true;
            CompanyNameStartsWithTextBox.Enabled = true;

            CustomersDataGridView.CellValueChanged += CustomersDataGridView_CellValueChanged;
            CustomersDataGridView.UserDeletingRow  += CustomersDataGridView_UserDeletingRow;


            _customerView.ListChanged += _customerView_ListChanged;
            _customerView.AddingNew   += _customerView_AddingNew;

            DeleteCustomerBindingNavigatorButton.Enabled = true;

            CustomersDataGridView.RowPrePaint += CustomersDataGridView_RowPrePaint;
            CustomersDataGridView.ExpandColumns();
        }
Ejemplo n.º 5
0
 private void CustomersDataGridView_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
 {
     CustomersDataGridView.Sort(CustomersDataGridView.Columns["NAME"], ListSortDirection.Ascending);
 }