Beispiel #1
0
 private void m_cmd_sua_Click(object sender, EventArgs e)
 {
     try
     {
         DataRow v_dr = m_grv_user_name.GetDataRow(m_grv_user_name.FocusedRowHandle);
         if (v_dr != null)
         {
             if (check_du_lieu_truoc_luu())
             {
                 US_USER_NAME v_us = new US_USER_NAME(CIPConvert.ToDecimal(v_dr["ID"].ToString()));
                 v_us.strTAI_KHOAN = m_txt_tai_khoan.Text;
                 v_us.dcID_NHOM    = (decimal)m_cbo_nhom.SelectedValue;
                 v_us.Update();
                 MessageBox.Show("Cập nhật thành công tài khoản " + m_txt_tai_khoan.Text);
                 load_data_2_grid();
             }
         }
         else
         {
             MessageBox.Show("chọn 1 dòng");
         }
     }
     catch
     {
         MessageBox.Show("Đã xảy ra lỗi trong hệ thống!");
     }
 }
Beispiel #2
0
        private void m_cmd_xoa_Click(object sender, EventArgs e)
        {
            try
            {
                DataRow v_dr = m_grv_user_name.GetDataRow(m_grv_user_name.FocusedRowHandle);
                if (v_dr != null)
                {
                    US_USER_NAME v_us = new US_USER_NAME(CIPConvert.ToDecimal(v_dr["ID"].ToString()));

                    DialogResult result = new DialogResult();
                    result = MessageBox.Show("Bạn có chắc chắc muốn xóa tài khoản ?" + v_us.strTAI_KHOAN, "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 tài khoản cần xóa!");
                }
            }
            catch
            {
                MessageBox.Show("Đã xảy ra lỗi trong hệ thống!");
            }
        }
        private void update_mat_khau()
        {
            US_USER_NAME v_us = new US_USER_NAME(User.id_user);

            v_us.strMAT_KHAU = User.GetMD5(m_txt_mk_moi.Text);
            v_us.Update();
            User.mat_khau = v_us.strMAT_KHAU;
        }
Beispiel #4
0
 private void m_cmd_OK_Click(object sender, EventArgs e)
 {
     try
     {
         if (check_du_lieu())
         {
             US_USER_NAME v_us = new US_USER_NAME();
             v_us.dcID_NHOM        = CIPConvert.ToDecimal(m_cbo_nhom.SelectedValue.ToString());
             v_us.strTAI_KHOAN     = m_txt_tai_khoan.Text;
             v_us.dcTRANG_THAI_HSD = 7;
             v_us.strMAT_KHAU      = User.GetMD5(m_txt_mat_khau.Text);
             v_us.Insert();
             MessageBox.Show("Đăng ký thành công tài khoản" + v_us.strTAI_KHOAN);
             this.Close();
         }
     }
     catch
     {
         MessageBox.Show("Đã xảy ra lỗi trong hệ thống!");
     }
 }