Example #1
0
        private void btnResetPassword_Click(object sender, EventArgs e)
        {
            DataRow dataRow = XacDinh_DataRowTaiKhoan_DangChon();
            int     userID  = (int)dataRow["UserID"];

            frmNhapTTTaiKhoan frm = new frmNhapTTTaiKhoan();

            frm.m_Mode        = ModeType.Other;
            frm.m_TenTaiKhoan = dataRow["UserAccount"].ToString();
            frm.m_Enable      = (bool)dataRow["Enable"];
            frm.ShowDialog();

            if (frm.m_Mode == ModeType.Cancel)
            {
                return;
            }
            string encryptPassword = MyUtility.Mahoa(frm.m_Password);
            int    kq = SqlDataAccessHelper.ExecSPNoneQuery(SPName6.NewUserAccount_ChangePassV6.ToString(),
                                                            new SqlParameter("@UserID", userID),
                                                            new SqlParameter("@NewEncryptPassword", encryptPassword));

            if (kq == 0)
            {
                ACMessageBox.Show(Resources.Text_CoLoi, Resources.Caption_Loi, 2000);
                return;
            }
        }
Example #2
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            frmNhapTTTaiKhoan frm = new frmNhapTTTaiKhoan();

            frm.m_Mode = ModeType.Them;
            frm.ShowDialog();
            if (frm.m_Mode == ModeType.Cancel)
            {
                return;
            }

            //kiểm tra kết nối csdl
            if (SqlDataAccessHelper.TestConnection(SqlDataAccessHelper.ConnectionString) == false)
            {
                ACMessageBox.Show(Resources.Text_MatKetNoiCSDL, Resources.Caption_Loi, 3000);
                return;
            }

            string encryptPass = MyUtility.Mahoa(frm.m_Password);
            int    kq          = SqlDataAccessHelper.ExecSPNoneQuery(SPName6.NewUserAccount_ThemTaiKhoanV6.ToString(),
                                                                     new SqlParameter("@UserAccount", frm.m_TenTaiKhoan),
                                                                     new SqlParameter("@Password", encryptPass),
                                                                     new SqlParameter("@Enable", frm.m_Enable));

            if (kq == 0)
            {
                ACMessageBox.Show(Resources.Text_CoLoi, Resources.Caption_Loi, 2000);
                return;
            }
            LoadDSTaiKhoan();
        }
Example #3
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            // xác định thông tin tài khoản đang chọn để thực hiện thao tác
            DataRow dataRow = XacDinh_DataRowTaiKhoan_DangChon();
            int     userID  = (int)dataRow["UserID"];

            frmNhapTTTaiKhoan frm = new frmNhapTTTaiKhoan();

            frm.m_Mode        = ModeType.Sua;
            frm.m_TenTaiKhoan = dataRow["UserAccount"].ToString();
            frm.m_Enable      = (bool)dataRow["Enable"];
            frm.ShowDialog();

            if (frm.m_Mode == ModeType.Cancel)
            {
                return;
            }

            //kiểm tra kết nối csdl
            if (SqlDataAccessHelper.TestConnection(SqlDataAccessHelper.ConnectionString) == false)
            {
                ACMessageBox.Show(Resources.Text_MatKetNoiCSDL, Resources.Caption_Loi, 3000);
                return;
            }

            int kq = SqlDataAccessHelper.ExecSPNoneQuery(SPName6.NewUserAccount_CapNhatTaiKhoanV6.ToString(),
                                                         new SqlParameter("@UserID", userID),
                                                         new SqlParameter("@UserAccount", frm.m_TenTaiKhoan),
                                                         new SqlParameter("@Enable", frm.m_Enable));

            if (kq == 0)
            {
                ACMessageBox.Show(Resources.Text_CoLoi, Resources.Caption_Loi, 2000);
                return;
            }
            LoadDSTaiKhoan();
        }