public void LayDSLoaiChiPhi() { lookupLoaiChiPhi.Properties.DisplayMember = "TenLoaiChiPhi"; lookupLoaiChiPhi.Properties.ValueMember = "LoaiChiPhiID"; lookupLoaiChiPhi.Properties.NullValuePrompt = "Chưa chọn loại chi phí"; lookupLoaiChiPhi.Properties.DataSource = LoaiChiPhiController.GetAllList(); }
private void gr_btn_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { int introw = gridView1.FocusedRowHandle; int intLoaiChiPhiID = -1; if (introw >= 0) { intLoaiChiPhiID = Convert.ToInt32(gridView1.GetRowCellValue(introw, "LoaiChiPhiID").ToString()); } if (intLoaiChiPhiID >= 0) { if (e.Button.Caption.ToUpper().Equals("DEL")) { if (MessageBox.Show("Bạn có muốn xóa loại chi phí này không?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { LoaiChiPhiController.Del(intLoaiChiPhiID); if (gridView1.GetRowCellValue(introw - 1, "LoaiChiPhiID") != null) { gridControl1.DataSource = LoaiChiPhiController.GetAllList(); gridView1.FocusedRowHandle = introw - 1; } } } } }
private void lookupLoaiChiPhi_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { if (e.Button.Caption.ToUpper().Equals("ADD")) { frmLoaiChiPhi f = new frmLoaiChiPhi(); f.ShowDialog(this); lookupLoaiChiPhi.Properties.DataSource = LoaiChiPhiController.GetAllList(); f.Dispose(); //if (f.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) //{ // lookupLoaiChiPhi.Properties.DataSource = LoaiChiPhiController.GetAllList(); // f.Dispose(); //} } }
private void simpleButton1_Click(object sender, EventArgs e) { if (txtTenLoaiChiPhi.Text == string.Empty) { MessageBox.Show("Phải nhập tên loại chi phí"); return; } LoaiChiPhi item = new LoaiChiPhi(); item.TenLoaiChiPhi = txtTenLoaiChiPhi.Text; LoaiChiPhiController.Add(item); txtTenLoaiChiPhi.Text = string.Empty; gridControl1.DataSource = LoaiChiPhiController.GetAllList(); //DialogResult = System.Windows.Forms.DialogResult.OK; }
private void frmLoaiChiPhi_Load(object sender, EventArgs e) { KhoiTaoLuoi(); gridControl1.DataSource = LoaiChiPhiController.GetAllList(); }