private void btn_ODelete_Click(object sender, EventArgs e) { bool result; if (dtgv_Vat.SelectedRows[0].Cells["ISDEFAUT"].Value.ToString() == "1") { MessageBox.Show("Not accept delete data!", "Notice"); } else { result = Vat_BUL.DeleteVat(dtgv_Vat.SelectedRows[0].Cells["MAVAT"].Value.ToString()); if (result) { lstVatThiNghiem = Vat_BUL.LoadVat(); dtgv_Vat.DataSource = typeof(List <DungDich>); dtgv_Vat.DataSource = lstVatThiNghiem; dtgv_Vat.DataSource = lstVatThiNghiem; MessageBox.Show("Delete success!", "Notice"); } else { MessageBox.Show("Fail", "Notice"); } } }
private void btn_OAdd_Click(object sender, EventArgs e) { if (btn_OValue.Text == "" || btn_OName.Text == "") { return; } i = dtgv_Vat.RowCount; bool result; i++; Vat newVat = new Vat(); if (Validate(btn_OName.Text, btn_OValue.Text)) { newVat.MaVat = maVat + i; newVat.TenVat = btn_OName.Text; newVat.GiaTriVat = btn_OValue.Text; newVat.ISDEFAUT = "0"; result = Vat_BUL.InsertVat(newVat); if (result) { lstVatThiNghiem.Add(newVat); dtgv_Vat.DataSource = typeof(List <Vat>); dtgv_Vat.DataSource = lstVatThiNghiem; dtgv_Vat.DataSource = lstVatThiNghiem; MessageBox.Show("Insert success!", "Notice"); } else { MessageBox.Show("Fail!", "Notice"); } } }
public void LoadVatThiNghiem() { lstVatThiNghiem = Vat_BUL.LoadVat(); lstdungdichThiNghiem = DungDich_BUL.LoadDungDich(); cbx_Vat.DataSource = lstVatThiNghiem; cbx_Vat.DisplayMember = "giaTriVat"; cbx_Vat.ValueMember = "giaTriVat"; cbx_ChatLong.DataSource = lstdungdichThiNghiem; cbx_ChatLong.DisplayMember = "giaTraiDungDich"; cbx_ChatLong.ValueMember = "giaTraiDungDich"; LoadDataFlag = true; }
private void AddValue_Load(object sender, EventArgs e) { lstVatThiNghiem = Vat_BUL.LoadVat(); dtgv_Vat.DataSource = Vat_BUL.LoadVat(); dtgv_Vat.Columns[0].HeaderText = "ID"; dtgv_Vat.Columns[1].HeaderText = "Name"; dtgv_Vat.Columns[2].HeaderText = "Density"; dtgv_Vat.Columns[3].HeaderText = "Can Delete"; lstDungDich = DungDich_BUL.LoadDungDich(); dtgv_DungDich.DataSource = DungDich_BUL.LoadDungDich(); dtgv_DungDich.Columns[0].HeaderText = "ID"; dtgv_DungDich.Columns[1].HeaderText = "Name"; dtgv_DungDich.Columns[2].HeaderText = "Density"; dtgv_DungDich.Columns[3].HeaderText = "Can Delete"; }