private void gridViewMain_DoubleClick(object sender, EventArgs e) { ShowPanel(3); CapDoNo focusedRow = gridViewMain.GetFocusedRow() as CapDoNo; textBoxMaCapDo.Text = focusedRow.MaCapDo; textBoxTenCapDo.Text = focusedRow.TenCapDo; textBoxChiTieuThuocNo.Text = focusedRow.ChiTieuThuocNo.ToString(); textBoxDoCungDatDa.Text = focusedRow.DoCungDatDa; }
private void buttonUpdate_Click(object sender, EventArgs e) { CapDoNo updated = gridViewMain.GetFocusedRow() as CapDoNo; updated.TenCapDo = textBoxTenCapDo.Text; if (textBoxChiTieuThuocNo.Text != String.Empty) { updated.ChiTieuThuocNo = double.Parse(textBoxChiTieuThuocNo.Text); } updated.DoCungDatDa = textBoxDoCungDatDa.Text; try { BS_CapDoNo.CapNhatCapDoNo(updated); } catch (Exception exc) { MessageBox.Show("Lỗi - " + exc.Message); } ShowPanel(1); HienThiDuLieu_CapDoNo(); }
private void buttonInsert_Click(object sender, EventArgs e) { CapDoNo inserted = new CapDoNo(); inserted.MaCapDo = textBoxMaCapDo2.Text; inserted.TenCapDo = textBoxTenCapDo2.Text; if (textBoxChiTieuThuocNo2.Text != String.Empty) { inserted.ChiTieuThuocNo = double.Parse(textBoxChiTieuThuocNo2.Text); } inserted.DoCungDatDa = textBoxDoCungDatDa2.Text; try { BS_CapDoNo.ThemCapDoNo(inserted); } catch (Exception exc) { MessageBox.Show("Lỗi - " + exc.Message); } ShowPanel(1); HienThiDuLieu_CapDoNo(); }