private void buttonUpdate_Click(object sender, EventArgs e) { MayKhoan updated = gridViewMain.GetFocusedRow() as MayKhoan; updated.TenMayKhoan = textBoxTenMayKhoan.Text; if (textBoxDuongKinhLK.Text != String.Empty) { updated.DuongKinhLoKhoan = double.Parse(textBoxDuongKinhLK.Text); } updated.HuongKhoan = textBoxHuongKhoan.Text; if (textBoxChieuSau.Text != String.Empty) { updated.ChieuSau = double.Parse(textBoxChieuSau.Text); } try { BS_MayKhoan.CapNhatMayKhoan(updated); } catch (Exception exc) { MessageBox.Show("Lỗi - " + exc.Message); } ShowPanel(1); HienThiDuLieu_MayKhoan(); }
private void buttonInsert_Click(object sender, EventArgs e) { MayKhoan inserted = new MayKhoan(); inserted.MaMayKhoan = textBoxMaMayKhoan2.Text; inserted.TenMayKhoan = textBoxTenMayKhoan2.Text; if (textBoxDuongKinhLK2.Text != String.Empty) { inserted.DuongKinhLoKhoan = double.Parse(textBoxDuongKinhLK2.Text); } inserted.HuongKhoan = textBoxHuongKhoan2.Text; if (textBoxChieuSau2.Text != String.Empty) { inserted.ChieuSau = double.Parse(textBoxChieuSau2.Text); } try { BS_MayKhoan.ThemMayKhoan(inserted); } catch (Exception exc) { MessageBox.Show("Lỗi - " + exc.Message); } ShowPanel(1); HienThiDuLieu_MayKhoan(); }
private void gridViewMain_DoubleClick(object sender, EventArgs e) { ShowPanel(3); MayKhoan focusedRow = gridViewMain.GetFocusedRow() as MayKhoan; textBoxMaMayKhoan.Text = focusedRow.MaMayKhoan; textBoxTenMayKhoan.Text = focusedRow.TenMayKhoan; textBoxDuongKinhLK.Text = focusedRow.DuongKinhLoKhoan.ToString(); textBoxHuongKhoan.Text = focusedRow.HuongKhoan; textBoxChieuSau.Text = focusedRow.ChieuSau.ToString(); }