private void button1_Click(object sender, EventArgs e) { var helper = new CustomerHelper(liteDBPath); var customer = new Customer() { firstName = firstName.Text, middleName = middleName.Text, lastName = lastName.Text, address = address.Text, phone = phone.Text, appointmentDate = DateTime.Parse(appointmentDate.Text), engine = carEngine.Text, appointmentDetails = appointmentDetails.Text, make = carMake.Text, model = carModel.Text }; if (isEdit) { customer.id = cust.id; helper.Update(customer); } else { customer.id = Guid.NewGuid(); helper.Add(customer); } pForm.RefreshGridView(helper.GetAll()); this.Close(); }
public Main() { InitializeComponent(); var customerHelper = new CustomerHelper(liteDBPath); RefreshGridView(customerHelper.GetAll()); dataGridView1.RowEnter += dataGridView1_RowEnter; dataGridView1.Columns[0].Visible = false; dataGridView1.AllowUserToAddRows = false; dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView1.MultiSelect = false; }
private void btnDelete_Click(object sender, EventArgs e) { string message = "Are you sure you want to delete?"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result; result = MessageBox.Show(message, "Delete Customer", buttons); if (result == DialogResult.Yes) { var helper = new CustomerHelper(liteDBPath); helper.Delete(selectedIssueItem); RefreshGridView(helper.GetAll()); } else { } }