static void Main(string[] args) { Customer customer1 = new Customer(); customer1.Id = 1; customer1.Name = "Monica"; customer1.Surname = "Geller"; customer1.Age = 27; Customer customer2 = new Customer(); customer2.Id = 2; customer2.Name = "Chandler"; customer2.Surname = "Bing"; customer2.Age = 30; CustomerManager customerManager = new CustomerManager(); customerManager.Add(customer1); customerManager.Add(customer2); customerManager.List(); customerManager.Delete(customer1); customerManager.List(); }
private void deleteButton_Click(object sender, EventArgs e) { if (_customerManager.Delete(id)) { MessageBox.Show("Deleted"); showDataGridView.DataSource = _customerManager.Display(); } else { MessageBox.Show("Not Deleted"); } }
private void deleteButton_Click(object sender, EventArgs e) { Cus cus = new Cus(); if (nameTextBox.Text == "") { MessageBox.Show("Please enter Name."); return; } cus.Code = codeTextBox.Text; cus.Name = nameTextBox.Text; cus.Contact = contactTextBox.Text; cus.Address = addressTextBox.Text; cus.District = districtComboBox.Text; try { if (_customerManager.Delete(cus)) { MessageBox.Show("Deleted"); } else { MessageBox.Show("Not Deleted"); } Clear(); } catch (Exception excp) { MessageBox.Show(excp.Message); } }
static void Main(string[] args) { Customer customer1 = new Customer(); customer1.Id = "11111111111"; customer1.Name = "Ayse"; customer1.Surname = "xxx"; Customer customer2 = new Customer(); customer2.Id = "222222222"; customer2.Name = "Ali"; customer2.Surname = "yyy"; Customer customer3 = new Customer(); customer3.Id = "333333333"; customer3.Name = "Emre"; customer3.Surname = "zzz"; Customer[] customers = new Customer[] { customer1, customer2, customer3 }; CustomerManager customerManager = new CustomerManager(); foreach (var i in customers) { customerManager.Add(i); } Console.WriteLine("-----------------------"); foreach (var i in customers) { customerManager.List(i); } Console.WriteLine("-----------------------"); customerManager.Delete(customer2); }