Esempio n. 1
0
        private void bt_xoa_Click(object sender, EventArgs e)
        {
            int currentRowIndex = data_vtpt.CurrentCellAddress.Y;// 'current row selected

            //'Verify that indexing OK
            if (-1 < currentRowIndex && currentRowIndex < data_vtpt.RowCount)
            {
                VatTuPhuTungDTO vtpt = new VatTuPhuTungDTO();
                vtpt.Maloaivattu = int.Parse(tb_mavtpt.Text);

                //2. Kiểm tra data hợp lệ or not

                //3. Thêm vào DB
                bool kq = vtptBus.xoa(vtpt);
                if (kq == false)
                {
                    MessageBox.Show("Xóa vật tư phụ tùng thất bại. Vui lòng kiểm tra lại dũ liệu");
                }
                else
                {
                    MessageBox.Show("Xóa vật tư phụ tùng thành công");
                    this.loadData_Vao_GridView();
                    tb_mavtpt.Clear();
                    tb_tenvtpt.Clear();
                    tb_soluongton.Clear();
                    tb_dongia.Clear();
                }
            }
            CurrencyManager myCurrencyManager = (CurrencyManager)this.BindingContext[data_vtpt.DataSource];

            myCurrencyManager.Refresh();
        }