Example #1
0
        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);
            }
        }
Example #2
0
 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);
     }
 }