private void btnDelete_g_Click(object sender, EventArgs e) { try { if (groupErrId != 0) { if (MessageBox.Show("Bạn có muốn xoá không?", "Xoá đối tượng", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { var result = BLLGroupError.Delete(groupErrId); if (result.IsSuccess) { LoadDataForGridGroupError(); ResetGroupErrorForm(); } MessageBox.Show(result.Messages[0].msg, result.Messages[0].Title); } } else { MessageBox.Show("Bạn chưa chọn đối tượng để xoá"); } } catch (Exception ex) { MessageBox.Show("Lỗi: " + ex.Message); } }
private void LoadDataForGridGroupError() { try { gridErrorGroup.DataSource = BLLGroupError.GetAll(); } catch (Exception ex) { throw ex; } }
private void SaveGroupError() { try { GroupError groupError = GetGroupErrorModel(); var result = BLLGroupError.InsertOrUpdate(groupError); if (result.IsSuccess) { LoadDataForGridGroupError(); ResetGroupErrorForm(); } MessageBox.Show(result.Messages[0].msg, result.Messages[0].Title); } catch (Exception ex) { MessageBox.Show("Lỗi: " + ex.Message); } }
private void LoadDataToCbbGroupError() { try { cbbGroupError.DataSource = null; var listGError = BLLGroupError.GetAll(); if (listGError != null) { cbbGroupError.DataSource = listGError; cbbGroupError.ValueMember = "Id"; cbbGroupError.DisplayMember = "Name"; } } catch (Exception ex) { throw ex; } }