private void btn_ok_Click(object sender, EventArgs e)
        {
            NguoiDung_Ctrl  nd    = new NguoiDung_Ctrl();
            Doimatkhau_Ctrl doiMK = new Doimatkhau_Ctrl();

            if (doiMK.KiemTra(txtUser.Text, nd.Md5(txtPass_old.Text), nd.Md5(txtPass_new.Text), nd.Md5(txtPass_prenew.Text)))
            {
                NguoiDung_InFo ndinfo = new NguoiDung_InFo();
                ndinfo.MaNguoiDung = doiMK.LayMaND(txtUser.Text, nd.Md5(txtPass_old.Text));
                ndinfo.MatKhau     = nd.Md5(txtPass_new.Text);
                doiMK.DoiMatKhau(ndinfo);
            }
            frmDoimatkhau_Load(sender, e);
        }
Ejemplo n.º 2
0
        public NguoiDung_InFo DuLieu(TextBoxX ma, TextBoxX ten, TextBoxX user, TextBoxX pass, ComboBoxEx quyen)
        {
            NguoiDung_InFo nguoidung = new NguoiDung_InFo();

            nguoidung.MaNguoiDung = Convert.ToInt32(ma.Text);
            nguoidung.HoTen       = ten.Text;
            nguoidung.TenDangNhap = user.Text;
            nguoidung.MatKhau     = Md5(pass.Text);
            //nguoidung.MatKhau = Md5(repass.Text);
            nguoidung.Quyen = quyen.Text.ToString();
            //quyen.Text.ToCharArray()[0];

            return(nguoidung);
        }
Ejemplo n.º 3
0
        public bool Xoa(NguoiDung_InFo nguoidung)
        {
            SqlCommand s = new SqlCommand("Delete NguoiDung where MaNguoiDung = @ma");

            s.Parameters.Add("@ma", SqlDbType.Int).Value = nguoidung.MaNguoiDung;
            try
            {
                ds.Load(s);
                return(true);
            }
            catch (Exception e)
            {
                e.ToString();
                return(false);
            }
        }
Ejemplo n.º 4
0
        public bool Sua(NguoiDung_InFo nguoidung)
        {
            SqlCommand s = new SqlCommand("Update NguoiDung set MatKhau = @pass where MaNguoiDung = @ma");

            s.Parameters.Add("@pass", SqlDbType.VarChar, 32).Value = nguoidung.MatKhau;
            s.Parameters.Add("@ma", SqlDbType.VarChar, 50).Value   = nguoidung.MaNguoiDung;
            try
            {
                ds.Load(s);
                MsgDoiMK();
                return(true);
            }
            catch (Exception e)
            {
                e.ToString();
                return(false);
            }
        }
Ejemplo n.º 5
0
        public bool Sua(NguoiDung_InFo nguoidung)
        {
            SqlCommand s = new SqlCommand("Update NguoiDung set Hoten = @ten, TenDangNhap = @user, MatKhau = @pass, Quyen = @quyen where MaNguoiDung = @ma");

            s.Parameters.Add("@ten", SqlDbType.NVarChar, 50).Value   = nguoidung.HoTen;
            s.Parameters.Add("@user", SqlDbType.VarChar, 32).Value   = nguoidung.TenDangNhap;
            s.Parameters.Add("@pass", SqlDbType.VarChar, 32).Value   = nguoidung.MatKhau;
            s.Parameters.Add("@quyen", SqlDbType.NVarChar, 50).Value = nguoidung.Quyen;
            s.Parameters.Add("@ma", SqlDbType.Int).Value             = nguoidung.MaNguoiDung;
            try
            {
                ds.Load(s);
                return(true);
            }
            catch (Exception e)
            {
                e.ToString();
                return(false);
            }
        }
Ejemplo n.º 6
0
        public bool Them(NguoiDung_InFo nguoidung)
        {
            SqlCommand s = new SqlCommand("INSERT INTO NguoiDung(MaNguoiDung, Hoten, TenDangNhap, MatKhau, Quyen) VALUES(@ma, @ten, @user, @pass, @quyen)");

            s.Parameters.Add("@ma", SqlDbType.Int).Value             = nguoidung.MaNguoiDung;
            s.Parameters.Add("@ten", SqlDbType.NVarChar, 50).Value   = nguoidung.HoTen;
            s.Parameters.Add("@user", SqlDbType.VarChar, 32).Value   = nguoidung.TenDangNhap;
            s.Parameters.Add("@pass", SqlDbType.VarChar, 32).Value   = nguoidung.MatKhau;
            s.Parameters.Add("@quyen", SqlDbType.NVarChar, 50).Value = nguoidung.Quyen;
            try
            {
                ds.Load(s);
                return(true);
            }
            catch (Exception e)
            {
                e.ToString();
                return(false);
            }
        }
Ejemplo n.º 7
0
 //
 public void DoiMatKhau(NguoiDung_InFo info)
 {
     doiMK.Sua(info);
 }
Ejemplo n.º 8
0
        public bool Sua(NguoiDung_InFo nguoidung)
        {
            NguoiDung_Data data = new NguoiDung_Data();

            return(data.Sua(nguoidung));
        }
Ejemplo n.º 9
0
        public bool Them(NguoiDung_InFo nguoidung)
        {
            NguoiDung_Data data = new NguoiDung_Data();

            return(data.Them(nguoidung));
        }