private void buttonInsert_Click(object sender, EventArgs e) { PhuKienNo inserted = new PhuKienNo(); inserted.MaPhuKien = textBoxMaPhuKien2.Text; inserted.TenPhuKien = textBoxTenPhuKien2.Text; if (textBoxDonViTinh2.Text != String.Empty) { inserted.DonViTinh_PK = double.Parse(textBoxDonViTinh2.Text); } if (textBoxGiaThanh2.Text != String.Empty) { inserted.GiaThanh_PK = double.Parse(textBoxGiaThanh2.Text); } try { BS_PhuKienNo.ThemPhuKienNo(inserted); } catch (Exception exc) { MessageBox.Show("Lỗi - " + exc.Message); } ShowPanel(1); HienThiDuLieu_PhuKienNo(); }
private void gridViewMain_DoubleClick(object sender, EventArgs e) { ShowPanel(3); PhuKienNo focusedRow = gridViewMain.GetFocusedRow() as PhuKienNo; textBoxMaPhuKien.Text = focusedRow.MaPhuKien; textBoxTenPhuKien.Text = focusedRow.TenPhuKien; textBoxDonViTinh.Text = focusedRow.DonViTinh_PK.ToString(); textBoxGiaThanh.Text = focusedRow.GiaThanh_PK.ToString(); }
private void buttonUpdate_Click(object sender, EventArgs e) { PhuKienNo updated = gridViewMain.GetFocusedRow() as PhuKienNo; updated.TenPhuKien = textBoxTenPhuKien.Text; if (textBoxDonViTinh.Text != String.Empty) { updated.DonViTinh_PK = double.Parse(textBoxDonViTinh.Text); } if (textBoxGiaThanh.Text != String.Empty) { updated.GiaThanh_PK = double.Parse(textBoxGiaThanh.Text); } try { BS_PhuKienNo.CapNhatPhuKienNo(updated); } catch (Exception exc) { MessageBox.Show("Lỗi - " + exc.Message); } ShowPanel(1); HienThiDuLieu_PhuKienNo(); }