private void EditCustomer() { if (dataGridCustomers.SelectedRows.Count == 0) { return; } Customer customer = new Customer(); int.TryParse(Convert.ToString(dataGridCustomers.SelectedRows[0].Cells[0].Value), out customer.CustomerID); customer.CustomerName = dataGridCustomers.SelectedRows[0].Cells[1].Value.ToString(); //TODO customer.WorkDescription = dataGridCustomers.SelectedRows[0].Cells[2].Value.ToString(); customer.NumberOfEmployees = int.Parse(dataGridCustomers.SelectedRows[0].Cells[3].Value.ToString()); customer.ContactPerson = dataGridCustomers.SelectedRows[0].Cells[4].Value.ToString(); customer.PhoneNumber = dataGridCustomers.SelectedRows[0].Cells[5].Value.ToString(); customer.Called = bool.Parse(dataGridCustomers.SelectedRows[0].Cells[6].Value.ToString()); customer.Waiting = bool.Parse(dataGridCustomers.SelectedRows[0].Cells[7].Value.ToString()); customer.Contract = bool.Parse(dataGridCustomers.SelectedRows[0].Cells[8].Value.ToString()); customer.Done = bool.Parse(dataGridCustomers.SelectedRows[0].Cells[9].Value.ToString()); customer.Notes = dataGridCustomers.SelectedRows[0].Cells[10].Value.ToString(); AddEdit_Firmu dlg = new AddEdit_Firmu(customer); if (dlg.ShowDialog() == DialogResult.OK) { PopulateCustomerList(); } }
private void AddCustomer() { AddEdit_Firmu customers = new AddEdit_Firmu(new Customer()); customers.ShowDialog(); PopulateCustomerList(); }