예제 #1
0
        void sua()
        {
            string   manv    = txt_idql.Text;
            string   hovaten = txt_hovaten.Text;
            DateTime namsinh = dt_nsinh.Value;
            string   sdt     = txt_sdt.Text;
            string   uname   = txt_username.Text;

            if (manv == "" || hovaten == "" || sdt == "" || uname == "")
            {
                MessageBox.Show("không được để trống");
            }
            else
            {
                DAONhanVien nv = new DAONhanVien();
                NhanVien    NV = nv.getNhanVienByID(Globals.NV);
                NV.Sdt      = txt_sdt.Text;
                NV.MaNv     = int.Parse(txt_idql.Text);
                NV.Hoten    = txt_hovaten.Text;
                NV.Sdt      = txt_sdt.Text;
                NV.Ngaysinh = Convert.ToDateTime(dt_nsinh.Value);
                NV.Username = txt_username.Text;
                nv.suaNV(NV);
                MessageBox.Show("Sua thong tin thanh cong");
            }
        }
예제 #2
0
 private void btn_doimk_Click(object sender, EventArgs e)
 {
     try
     {
         if (txt_mkcu.Text == "" || txt_mkmoi.Text == "" || txt_mkmoi2.Text == "")
         {
             MessageBox.Show("không được để rỗng");
         }
         else
         {
             if (txt_mkmoi.Text != txt_mkmoi2.Text)
             {
                 MessageBox.Show("mật khẩu mới phải có độ dài bằng nhau");
             }
             else
             {
                 DAONhanVien nv = new DAONhanVien();
                 NhanVien    NV = nv.getNhanVienByID(Globals.NV);
                 //MessageBox.Show(NV.Password);
                 //MessageBox.Show(HashPasswordUsingMD5(txt_mkcu.Text));
                 if (txt_mkcu.Text == NV.Password && txt_mkmoi.Text == txt_mkmoi2.Text)
                 {
                     //MessageBox.Show(NV.Password);
                     NV.Password = txt_mkmoi.Text;
                     nv.suaNV(NV);
                     MessageBox.Show("Doi mat khau thanh cong");
                 }
                 else
                 {
                     MessageBox.Show(" sai mat khau cu");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #3
0
 private void btn_sua_Click(object sender, EventArgs e)
 {
     if (rong())
     {
         MessageBox.Show("không được để rỗng");
     }
     else
     {
         DAONhanVien nv = new DAONhanVien();
         NhanVien    NV = new NhanVien();
         int         d  = int.Parse(txt_idnv.Text);
         NV = nv.getNhanVienByID(d);
         if (txt_password.Text == NV.Password || txt_password.Text == NV.Password.ToLower())
         {
             NV.Sdt      = txt_sdt.Text;
             NV.MaNv     = int.Parse(txt_idnv.Text);
             NV.Hoten    = txt_hovaten.Text;
             NV.Luong    = float.Parse(txt_luong.Text);
             NV.Sdt      = txt_sdt.Text;
             NV.Ngaysinh = Convert.ToDateTime(dt_nsinh.Value);
             NV.Username = txt_username.Text;
             nv.SuaNVkhongmk(NV);
             MessageBox.Show("Sua thong tin nhan vien thanh cong");
         }
         else
         {
             NV.Sdt      = txt_sdt.Text;
             NV.MaNv     = int.Parse(txt_idnv.Text);
             NV.Hoten    = txt_hovaten.Text;
             NV.Luong    = float.Parse(txt_luong.Text);
             NV.Sdt      = txt_sdt.Text;
             NV.Ngaysinh = Convert.ToDateTime(dt_nsinh.Value);
             NV.Username = txt_username.Text;
             NV.Password = txt_password.Text;
             nv.suaNV(NV);
             MessageBox.Show("Sua thong tin nhan vien thanh cong");
         }
     }
 }