private void save_data() { US_DM_PHU_CAP v_us_dm_phu_cap = new US_DM_PHU_CAP(); form_2_us_obj(v_us_dm_phu_cap); try { switch (m_e_form_mode) { case DataEntryFormMode.InsertDataState: v_us_dm_phu_cap.BeginTransaction(); v_us_dm_phu_cap.Insert(); v_us_dm_phu_cap.CommitTransaction(); m_id_dm_phu_cap_moi_tao = v_us_dm_phu_cap.dcID; break; case DataEntryFormMode.UpdateDataState: v_us_dm_phu_cap.dcID = m_id_dm_phu_cap_4_update; v_us_dm_phu_cap.BeginTransaction(); v_us_dm_phu_cap.Update(); v_us_dm_phu_cap.CommitTransaction(); break; default: break; } CHRM_BaseMessages.MsgBox_Infor(CONST_ID_MSGBOX.INFOR_DU_LIEU_DA_DUOC_CAP_NHAT); this.Close(); } catch (Exception v_e) { throw v_e; } }
void m_cmd_delete_Click(object sender, EventArgs e) { try { if (CHRM_BaseMessages.MsgBox_Confirm(CONST_ID_MSGBOX.QUESTION_XAC_NHAN_XOA_DU_LIEU) == true) { DataRow v_dr = m_grv_dm_phu_cap.GetDataRow(m_grv_dm_phu_cap.FocusedRowHandle); decimal v_id_phu_cap = CIPConvert.ToDecimal(v_dr["ID"]); if (check_loai_pc_dang_su_dung(v_id_phu_cap)) { string v_str_error = " Không thể xóa loại phụ cấp đang được sử dụng!"; XtraMessageBox.Show(v_str_error, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } US_DM_PHU_CAP v_us = new US_DM_PHU_CAP(v_id_phu_cap); v_us.BeginTransaction(); v_us.Delete(); v_us.CommitTransaction(); XtraMessageBox.Show("Xóa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); load_data_2_grid(); } } catch (Exception v_e) { CSystemLog_301.ExceptionHandle(v_e); } }