private void m_cmd_xoa_Click(object sender, EventArgs e) { try { //lay ra du lieu cua dong muon xoa bang thay da bam vao DataRow v_dr = m_grv.GetDataRow(m_grv.FocusedRowHandle); // lay ra id cua dong du lieu vua chon gan vao v_id duoi dang chuoi decimal v_id = CIPConvert.ToDecimal(v_dr["ID"].ToString()); US_DM_CAU_HOI v_us = new US_DM_CAU_HOI(v_id); DialogResult result = new DialogResult(); result = MessageBox.Show("Bạn chắc chắn muốn xóa?","Xác nhận", MessageBoxButtons.YesNo,MessageBoxIcon.Question,MessageBoxDefaultButton.Button2); if (result == DialogResult.Yes) { v_us.Delete(); MessageBox.Show("Bạn vừa xóa thành công"); load_data_2_grid(); } } catch (Exception v_ex) { CSystemLog_301.ExceptionHandle(v_ex); } }
private void us_to_form(IPCOREUS.US_DM_CAU_HOI v_us_cau_hoi, IPCOREUS.US_DM_CAU_TRA_LOI v_us_cau_tra_loi) { load_data_cbo(); m_cbo_nhom_cau_hoi.SelectedValue = CIPConvert.ToDecimal(v_us_cau_hoi.dcID_NHOM_CAU_HOI.ToString()); txt_cau_hoi.Text = v_us_cau_hoi.strNOI_DUNG_CAU_HOI; txt_cau_tra_loi.Text = v_us_cau_tra_loi.strCAU_TRA_LOI; }
internal void DisPlayForUpdate(IPCOREUS.US_DM_CAU_HOI v_us_cau_hoi, IPCOREUS.US_DM_CAU_TRA_LOI v_us_cau_tra_loi) { m_e_form_mode = DataEntryFormMode.UpdateDataState; m_cbo_nhom_cau_hoi.Enabled = false; m_us_cau_hoi = v_us_cau_hoi; m_us_cau_tra_loi = v_us_cau_tra_loi; us_to_form(v_us_cau_hoi, v_us_cau_tra_loi); if (us_user.dcIDNhom == 1) { txt_cau_hoi.ReadOnly = true; m_pan_luu.Visible = false; } this.ShowDialog(); }
private void DoRowDoubleClick(GridView view, Point pt) { GridHitInfo info = view.CalcHitInfo(pt); if (info.InRow || info.InRowCell) { DataRow v_dr_grv = m_grv_dm_cau_hoi.GetDataRow(m_grv_dm_cau_hoi.FocusedRowHandle); if (v_dr_grv == null) { try { f100_dm_cau_hoi_de v_f = new f100_dm_cau_hoi_de(); v_f.DisPlayForInsert(); load_data_grid(); } catch (Exception v_e) { CSystemLog_301.ExceptionHandle(v_e); } } else { try { DataRow v_dr = m_grv_dm_cau_hoi.GetDataRow(m_grv_dm_cau_hoi.FocusedRowHandle); US_DM_CAU_HOI v_us_cau_hoi = new US_DM_CAU_HOI(CIPConvert.ToDecimal(v_dr[DM_CAU_HOI.ID].ToString())); US_DM_CAU_TRA_LOI v_us_cau_tra_loi = new US_DM_CAU_TRA_LOI(CIPConvert.ToDecimal(v_dr["ID_CAU_TRA_LOI"].ToString())); f100_dm_cau_hoi_de v_f = new f100_dm_cau_hoi_de(); v_f.DisPlayForUpdate(v_us_cau_hoi, v_us_cau_tra_loi); load_data_grid(); } catch (Exception v_e) { CSystemLog_301.ExceptionHandle(v_e); } } } }
private void simpbtn_xoa_Click(object sender, EventArgs e) { try { DataRow v_dr = m_grv_dm_cau_hoi.GetDataRow(m_grv_dm_cau_hoi.FocusedRowHandle); decimal v_id = CIPConvert.ToDecimal(v_dr[DM_CAU_HOI.ID].ToString()); US_DM_CAU_HOI v_us = new US_DM_CAU_HOI(v_id); // xóa bảng câu trả lời DataSet v_ds = new DataSet(); v_ds.Tables.Add(new DataTable()); US_DUNG_CHUNG v_us_dc = new US_DUNG_CHUNG(); v_us_dc.FillDatasetWithQuery(v_ds, "select * from dm_cau_tra_loi where id_cau_hoi=" + v_id.ToString()); for (int i = 0; i < v_ds.Tables[0].Rows.Count; i++) { decimal v_datarow = CIPConvert.ToDecimal(v_ds.Tables[0].Rows[i]["ID"].ToString()); US_DM_CAU_TRA_LOI v_d_r = new US_DM_CAU_TRA_LOI(v_datarow); v_d_r.Delete(); } // xóa bảng câu hỏi v_us.Delete(); MessageBox.Show("Da xoa thanh cong " + v_dr[DM_CAU_HOI.ID].ToString()); load_data_grid(); } catch (Exception v_e) { CSystemLog_301.ExceptionHandle(v_e); } }