public void Reload() { AllowancesBO aAllowancesBO = new AllowancesBO(); colSalaryPlus.DisplayFormat.FormatType = FormatType.Numeric; colSalaryPlus.DisplayFormat.FormatString = "{0:0,0}"; dgvAllowances.DataSource = aAllowancesBO.Select_All(); dgvAllowances.RefreshDataSource(); }
private void btnDelete_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { AllowancesBO aAllowancesBO = new AllowancesBO(); int ID = int.Parse(grvAllowance.GetFocusedRowCellValue("ID").ToString()); DialogResult result = MessageBox.Show("Bạn có muốn xóa Allowance " + Name + " này không?", "Xóa Allowance", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { aAllowancesBO.Delete(ID); MessageBox.Show("Xóa thành công"); this.Reload(); } } catch (Exception ex) { MessageBox.Show("frmLst_Allowances.btnDelete_ButtonClick\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmIns_Contracts_Allowances_Load(object sender, EventArgs e) { try { AllowancesBO aAllowancesBO = new AllowancesBO(); List<Allowances> aListAllowances = aAllowancesBO.Select_All(); lueIDAllowances.Properties.DataSource = aListAllowances; lueIDAllowances.Properties.DisplayMember = "ID"; lueIDAllowances.Properties.ValueMember = "ID"; if (aListAllowances.Count > 0) { lueIDAllowances.EditValue = aListAllowances[0].ID; } LoadData(); } catch (Exception ex) { MessageBox.Show("frmIns_Contracts_Allowances.frmIns_Contracts_Allowances_Load\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }