Exemplo n.º 1
0
 private void doimk()
 {
     checkPassWord(txtmkcu.Text);
     try
     {
         if (txtmkmoi.Text != txtmkmoi2.Text)
         {
             MessageBox.Show("Mật khẩu nhập vào phải giống nhau");
             txtmkmoi.Text  = "";
             txtmkmoi2.Text = "";
             txtmkmoi.Focus();
         }
         else if (ps == false)
         {
             MessageBox.Show("Mật khẩu cũ không chính xác ");
             txtmkcu.Text = "";
             txtmkcu.Focus();
         }
         else
         {
             TaiKhoanBS bs = new TaiKhoanBS();
             bs.tk_doimkBS(txtmkmoi2.Text, txtMa.Text);
             MessageBox.Show("Đổi mật khẩu thành công!");
         }
     }
     catch
     {
         MessageBox.Show("Đã có lỗi xảy ra trong quá trình đổi mật khẩu");
     }
     ps = false;
 }
Exemplo n.º 2
0
        private void sua()
        {
            try
            {
                //sua hinh
                if (img != "0")
                {
                    //xoa file hinh anh hien tai
                    System.IO.File.Delete(@"img\" + txtMa.Text + ".jpg");

                    //coppy file hinh
                    string from1 = @"" + img + "";
                    string to1   = @"img\" + txtMa.Text + ".jpg";
                    System.IO.File.Copy((string)from1, (string)to1);
                }

                TaiKhoanBS bs1 = new TaiKhoanBS();
                bs1.tk_suaBS(txtTen.Text, txtDiachi.Text, txtsdt.Text, txtEmail.Text, txtMa.Text, txtMa.Text);

                img = "0";
                MessageBox.Show("Sửa thành công!");
            }
            catch
            {
                MessageBox.Show("Đã có lỗi xảy ra trong quá trình sửa");
            }
        }
Exemplo n.º 3
0
 private void phanquyen()
 {
     try
     {
         TaiKhoanBS bs1 = new TaiKhoanBS();
         bs1.tk_phanquyenBS(txtMa.Text, cv);
         MessageBox.Show("Phân quyền thành công!");
     }
     catch
     {
         MessageBox.Show("Đã có lỗi xảy ra trong quá trình phân quền");
     }
 }
Exemplo n.º 4
0
        private void trung_dl()
        {
            TaiKhoanBS bs = new TaiKhoanBS();

            List <TaiKhoanDB> ds = bs.loadtk();

            for (int i = 0; i < ds.Count; i++)
            {
                if (txtMa.Text == ds[i].matk.ToString())
                {
                    of = true;
                    break;
                }
            }
        }
Exemplo n.º 5
0
        private string convertToMaUser(string ten)
        {
            string     text = "";
            TaiKhoanBS bs   = new TaiKhoanBS();

            List <TaiKhoanDB> ds = bs.loadtk();

            for (int i = 0; i < ds.Count; i++)
            {
                if (user.Text == ds[i].tentk.ToString())
                {
                    text = ds[i].matk.ToString();
                    break;
                }
            }
            return(text);
        }
Exemplo n.º 6
0
        private void timkiem()
        {
            listView1.Items.Clear();
            TaiKhoanBS        bs = new TaiKhoanBS();
            List <TaiKhoanDB> ds = bs.timttk(cot, txtTimkiem.Text);

            for (int i = 0; i < ds.Count; i++)
            {
                listView1.Items.Add(ds[i].matk.ToString());
                listView1.Items[i].SubItems.Add(ds[i].tentk.ToString());
                listView1.Items[i].SubItems.Add(ds[i].chucvu.ToString());
                listView1.Items[i].SubItems.Add(ds[i].hoten.ToString());
                listView1.Items[i].SubItems.Add(ds[i].diachi.ToString());
                listView1.Items[i].SubItems.Add(ds[i].sdt.ToString());
                listView1.Items[i].SubItems.Add(ds[i].email.ToString());
                listView1.Items[i].SubItems.Add(ds[i].img.ToString());
            }
        }
Exemplo n.º 7
0
        private void them()
        {
            trung_dl();
            try
            {
                //luu vao csdl
                if (of == true)
                {
                    MessageBox.Show("Dữ liệu bạn nhập vào bị trùng ở textbox Mã sản phẩm xin vui lòng kiểm ta lại");
                    txtMa.Text = "";
                    txtMa.Focus();
                }
                else
                {
                    if (img != "0")
                    {
                        //coppy file hinh
                        string from1 = @"" + img + "";
                        string to1   = @"img\" + txtMa.Text + ".jpg";
                        System.IO.File.Copy((string)from1, (string)to1);
                    }

                    TaiKhoanBS them = new TaiKhoanBS();
                    them.menu_themBS(txtMa.Text, txtTen.Text, txtDiachi.Text, txtsdt.Text, txtEmail.Text, txtMa.Text, txtTentk.Text, txtmkmoi2.Text, convertToCV(cmbChucvu.SelectedItem.ToString()));
                    MessageBox.Show("Thêm thành công!");
                }
            }
            catch
            {
                MessageBox.Show("Một lỗi xảy ra khi ứng dụng đang cố gắng add file hình ảnh này");
            }
            of = false;

            img     = "0";
            picture = "0";
            cv      = "nv";
        }