private void simpleButtonXoa_Click(object sender, EventArgs e) { DataRow currentRow = gridViewDSTho.GetDataRow(gridViewDSTho.FocusedRowHandle); if (currentRow != null) { DialogResult result = MessageBox.Show(Resources.DetailMessageBox_XacNhanXoa, Resources.TitleMessageBox_ThongBao, MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { int id = Int32.Parse(currentRow[1].ToString()); try { _bulTho = null; _bulTho = new BUL_Tho(); _bulTho.DeleteWorker(id); FillGridView(); } catch (DbUpdateException dbUpdateException) { SqlException eSqlException = ((SqlException)((UpdateException)dbUpdateException.InnerException).InnerException); if (eSqlException.Message.Contains("FK_PGC_THO")) { MessageBox.Show(Resources.DanhSachTho_DelError, Resources.TitleMessageBox_Error, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } }
public DanhSachTho() { InitializeComponent(); _bulTho = new BUL_Tho(); CreateDataTable(); FillGridView(); }
public DanhSachPGC() { InitializeComponent(); _bulNhanVien = new BUL_NhanVien(); _bulTho = new BUL_Tho(); CreateDataTable(); }
public SuaTho(int id) { InitializeComponent(); _bulTho = new BUL_Tho(); _tho = _bulTho.GetWorkerById(id); textEditTenTho.Text = _tho.TenTho; textEditDiaChi.Text = _tho.DiaChi; textEditSDT.Text = _tho.SDT; }
private void OpenEditDialog() { DataRow currentRow = gridViewDSTho.GetDataRow(gridViewDSTho.FocusedRowHandle); if (currentRow != null) { int id = Int32.Parse(currentRow[1].ToString()); SuaTho sua = new SuaTho(id); DialogResult dialogResult = sua.ShowDialog(); if (dialogResult == DialogResult.OK) { _bulTho = null; _bulTho = new BUL_Tho(); FillGridView(); } } }
private void LoadDanhSachTho() { BUL_Tho bulTho = new BUL_Tho(); List <THO> listThos = bulTho.GetAllWorkerList(); comboBoxEditTenTho.Properties.TextEditStyle = TextEditStyles.DisableTextEditor; _comboboxItemsTho = comboBoxEditTenTho.Properties.Items; _comboboxItemsTho.BeginUpdate(); try { foreach (var item in listThos) { ContainerItem tho = new ContainerItem(); tho.Text = item.TenTho; tho.Value = item; _comboboxItemsTho.Add(tho); } } finally { _comboboxItemsTho.EndUpdate(); } }
private void LoadTho(int matho) { BUL_Tho bulTho = new BUL_Tho(); List <THO> listThos = bulTho.GetAllWorkerList(); comboBoxEditTenTho.Properties.TextEditStyle = TextEditStyles.DisableTextEditor; _comboboxItemsTho = comboBoxEditTenTho.Properties.Items; _comboboxItemsTho.BeginUpdate(); try { foreach (var item in listThos) { ContainerItem tho = new ContainerItem(); tho.Text = item.TenTho; tho.Value = item; _comboboxItemsTho.Add(tho); } } finally { _comboboxItemsTho.EndUpdate(); } comboBoxEditTenTho.SelectedIndex = listThos.IndexOf(listThos.Find(i => i.MaTho == matho)); }
public NhapTho() { InitializeComponent(); _bulTho = new BUL_Tho(); }