Beispiel #1
0
        private void m_cmd_sua_Click(object sender, EventArgs e)
        {
            try
            {
                 DataRow v_dr = m_grv_dm_khoa.GetDataRow(m_grv_dm_khoa.FocusedRowHandle);
                 if (v_dr != null)
                 {
                     if (check_du_lieu_truoc_luu())
                     {
                         US_DM_KHOA v_us = new US_DM_KHOA((decimal)v_dr["ID"]);
                         v_us.strKHOA = m_txt_khoa.Text;
                         v_us.dcTRANG_THAI_HSD = 7;
                         v_us.dcNAM_BAT_DAU = CIPConvert.ToDecimal(m_txt_nam_bat_dau.Text);
                         v_us.Update();
                         MessageBox.Show("Cập nhật thành công khóa:" + m_txt_khoa.Text);
                         load_data_2_grid();
                     }
                 }
                else
                 {
                     MessageBox.Show("Chọn 1 dòng!");
                 }
            }
            catch
            {

                MessageBox.Show("Đã xảy ra lỗi trong quá trình xử lý!");
            }
        }
Beispiel #2
0
        private void m_cmd_xoa_Click(object sender, EventArgs e)
        {
            try
            {
                DataRow v_dr = m_grv_dm_khoa.GetDataRow(m_grv_dm_khoa.FocusedRowHandle);
                if (v_dr != null)
                {
                    US_DM_KHOA v_us = new US_DM_KHOA(CIPConvert.ToDecimal(v_dr["ID"].ToString()));

                    DialogResult result = new DialogResult();
                    result = MessageBox.Show("Bạn có chắc chắc muốn xóa khóa ?" + v_us.strKHOA, "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                    if (result == DialogResult.Yes)
                    {
                        v_us.dcTRANG_THAI_HSD = 10;
                        v_us.Update();
                        MessageBox.Show("Bạn vừa xóa thành công!");
                        load_data_2_grid();
                    }
                }
                else
                {
                    MessageBox.Show("Hãy chọn khoa khóa cần xóa!");
                }
            }
            catch
            {
                MessageBox.Show("Đã xảy ra lỗi trong hệ thống!");
            }
        }