Ejemplo n.º 1
0
        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");
            }
        }
Ejemplo n.º 2
0
        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");
            }
        }
Ejemplo n.º 3
0
        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 + "";
            }
        }
Ejemplo n.º 5
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     dataSource             = BikeDAL.GetInstance().FilterBike(txtEngine.Text, txtChassis.Text, txtCode.Text);
     dgvListBike.DataSource = dataSource;
 }
Ejemplo n.º 6
0
 private void btnGetAll_Click(object sender, EventArgs e)
 {
     dataSource             = BikeDAL.GetInstance().GetAllBikes();
     dgvListBike.DataSource = dataSource;
 }