private void btnModify_Click(object sender, EventArgs e) { parseData(); bool success = BikeDAL.GetInstance().UpdateBike(bike); if (success) { MessageBox.Show("Update Success"); } else { MessageBox.Show("Update fail"); } }
private void btnAdd_Click(object sender, EventArgs e) { parseData(); bool success = BikeDAL.GetInstance().InsertBike(bike); if (success) { MessageBox.Show("Insert Success"); } else { MessageBox.Show("Insert fail"); } }
private void btnDelete_Click(object sender, EventArgs e) { int selectedRowIndex = dgvListBike.CurrentRow.Index; DataGridViewRow row = dgvListBike.Rows[selectedRowIndex]; var id = (long)row.Cells[0].Value; var success = BikeDAL.GetInstance().Delete(id); if (success) { MessageBox.Show("Delete success"); btnSearch_Click(null, null); } else { MessageBox.Show("Delete Fail"); } }
private void btnSearch_Click(object sender, EventArgs e) { var engine = txtEngine.Text; var chassis = txtChassis.Text; bike = BikeDAL.GetInstance().SearchBike(engine, chassis); if (bike == null) { MessageBox.Show("Bike not found"); lblID.Text = ""; return; } else { lblID.Text = bike.ID + ""; } }
private void btnSearch_Click(object sender, EventArgs e) { dataSource = BikeDAL.GetInstance().FilterBike(txtEngine.Text, txtChassis.Text, txtCode.Text); dgvListBike.DataSource = dataSource; }
private void btnGetAll_Click(object sender, EventArgs e) { dataSource = BikeDAL.GetInstance().GetAllBikes(); dgvListBike.DataSource = dataSource; }