private void btnAdd_Click(object sender, EventArgs e) { frmChiPhi f = new frmChiPhi(); if (f.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { f.Dispose(); gridControl1.DataSource = ChiPhiController.GetAllList(); } }
private void gridView1_DoubleClick(object sender, EventArgs e) { int intRow = gridView1.FocusedRowHandle; int intChiPhiID = -1; if (intRow > 0) { intChiPhiID = Convert.ToInt32(gridView1.GetRowCellValue(intRow, "ChiPhiID").ToString()); } if (intChiPhiID >= 0) { frmChiPhi f = new frmChiPhi(); f.editItem = ChiPhiController.GetITem(intChiPhiID); f.frmMode = "edit"; f.ShowDialog(); if ((gridView1.GetRowCellValue(intRow, "ChiPhiID")) != null) { gridControl1.DataSource = ChiPhiController.GetAllList(); gridView1.FocusedRowHandle = intRow; } } }
private void gr_btn_del_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { int intRow = gridView1.FocusedRowHandle; int intChiPhiID = -1; if (intRow >= 0) { intChiPhiID = Convert.ToInt32(gridView1.GetRowCellValue(intRow, "ChiPhiID").ToString()); } if ((intChiPhiID >= 0) && ((e.Button.Caption.ToUpper().Equals("DEL")))) { if (MessageBox.Show("Bạn có muốn xóa chi phí này không", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { ChiPhiController.Del(intChiPhiID); if ((gridView1.GetRowCellValue(intRow - 1, "ChiPhiID")) != null) { gridControl1.DataSource = ChiPhiController.GetAllList(); gridView1.FocusedRowHandle = intRow - 1; } } } }
private void frmQLChiPhi_Load(object sender, EventArgs e) { KhoiTaoLuoi(); gridControl1.DataSource = ChiPhiController.GetAllList(); }