private void bt_luu_Click(object sender, EventArgs e) { if (check_null()) { ThayDoiQuyDinhDTO thaydoi = thaydoiBus.select(); int line = data_tiencong.RowCount; if (line < thaydoi.SoLoaiTienCong1) { TienCongDTO tc = new TienCongDTO(); tc.Maloaitiencong = int.Parse(tb_matiencong.Text); tc.Tenloaitiencong = tb_tenloaitc.Text; tc.Tiencong = int.Parse(tb_tiencong.Text); bool kq = tcBus.them(tc); if (kq == false) { MessageBox.Show("Thêm tiền công thất bại. Vui lòng kiểm tra lại dữ liệu"); } else { MessageBox.Show("Thêm tiền công thành công"); this.loadData_Vao_GridView(); } CurrencyManager myCurrencyManager = (CurrencyManager)this.BindingContext[data_tiencong.DataSource]; myCurrencyManager.Refresh(); } else { MessageBox.Show("Vượt quá số tiền công cho phép"); } } }
private void button_them_Click(object sender, EventArgs e) { TienCongDTO tc = new TienCongDTO(); tc.Matiencong = int.Parse(txttmtc.Text); tc.Tendichvu = txttdv.Text; tc.Tiencong = Decimal.Parse(txttc.Text); bool kq = tcBus.them(tc); if (kq == false) { MessageBox.Show("Thêm thông tin thất bại. Vui lòng kiểm tra lại dữ liệu"); } else { MessageBox.Show("Thêm thông tin thành công"); } this.loadData_Vao_GridView(); txttmtc.Text = ""; txttdv.Text = ""; txttc.Text = ""; }