public void ReloadData() { try { Contracts_AllowancesBO aContracts_AllowancesBO = new Contracts_AllowancesBO(); colSalaryPlus.DisplayFormat.FormatType = FormatType.Numeric; colSalaryPlus.DisplayFormat.FormatString = "{0:0,0}"; colContracts_Allowances_RealSalaryPlus.DisplayFormat.FormatType = FormatType.Numeric; colContracts_Allowances_RealSalaryPlus.DisplayFormat.FormatString = "{0:0,0}"; dgvContracts_Allowances.DataSource = aContracts_AllowancesBO.Select_ByContractsAllowances_Disable(false); } catch (Exception ex) { MessageBox.Show("frmLst_Contracts_Allowances.ReloadData\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnDelete_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { int ID = Convert.ToInt32(viewContracts_Allowances.GetFocusedRowCellValue("Contracts_Allowances_ID")); DialogResult result = MessageBox.Show("Bạn có chắc chắn muốn xóa ???", "Câu hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DialogResult.Yes == result) { try { Contracts_AllowancesBO aContracts_AllowancesBO = new Contracts_AllowancesBO(); aContracts_AllowancesBO.Delete(ID); MessageBox.Show("Bạn đã xóa dữ liệu thành công .", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("frmLst_Contracts_Allowances.btnDelete_ButtonClick\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } ReloadData(); }
private void btnAddNew_Click(object sender, EventArgs e) { try { aContracts_AllowancesEN.RealSalaryPlus = Convert.ToDecimal(txtRealSalaryPlus.Text); aContracts_AllowancesEN.ApplyDate = Convert.ToDateTime(dtpApplyDate.Text); aContracts_AllowancesEN.Type = cboType.SelectedIndex + 1; aContracts_AllowancesEN.Status = cboStatus.SelectedIndex + 1; aContracts_AllowancesEN.Disable = Convert.ToBoolean(cboDisable.Text); Contracts_AllowancesBO aContracts_AllowancesBO = new Contracts_AllowancesBO(); aContracts_AllowancesBO.Insert(aContracts_AllowancesEN); MessageBox.Show("Thêm mới thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); this.afrmLst_Contracts_Allowances.ReloadData(); this.Close(); } catch (Exception ex) { MessageBox.Show("frmIns_Contracts_Allowances.btnAddNew_Click\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }