コード例 #1
0
 private void barButtonItem29_ItemClick(object sender, ItemClickEventArgs e)
 {
     if (mk.EditValue != null)
     {
         QUANLYND tk = new QUANLYND();
         tk.TENDN = tendn.EditValue.ToString();
         tk.MK    = mk.EditValue.ToString();
         if (bll.ktkc(tk) == false)
         {
             if (bll.suatk(tk) == true)
             {
                 MessageBox.Show("Đồi mật khẩu thành công");
             }
             else
             {
                 MessageBox.Show("thất bại");
             }
         }
         else
         {
             MessageBox.Show("Tài khoản không tồn tại");
         }
     }
     else
     {
         MessageBox.Show("vui lòng nhập mật khẩu mới");
     }
 }
コード例 #2
0
ファイル: TAOTAIKHOAN.cs プロジェクト: BuiThiNinh/Shopgiay
        private void button1_Click(object sender, EventArgs e)
        {
            QUANLYND nd = new QUANLYND();

            nd.TENDN = textBox1.Text.ToString();
            nd.MK    = textBox2.Text.ToString();
            if (radioButton1.Checked == true)
            {
                nd.HOATDONG = true;
            }
            else
            {
                nd.HOATDONG = false;
            }
            if (bll.ktkc(nd) == true)
            {
                if (bll.themtk(nd) == true)
                {
                    MessageBox.Show("thêm thành công");
                }
                else
                {
                    MessageBox.Show("thất bại");
                }
            }
            else
            {
                MessageBox.Show("trùng mã");
            }
        }
コード例 #3
0
 private void btn_xacnhan_Click(object sender, EventArgs e)
 {
     if (txtmkc.Text == string.Empty && txt_matkhaumoi.Text == string.Empty && txt_xacnhanmk.Text == string.Empty)
     {
         MessageBox.Show("Không được để trống");
         return;
     }
     if (txt_xacnhanmk.Text == txt_matkhaumoi.Text)
     {
         QUANLYND nd = new QUANLYND();
         nd.TENDN    = txtmanv.Text;
         nd.MK       = txt_xacnhanmk.Text;
         nd.HOATDONG = true;
         if (qlnd.sua_ND(nd) == true)
         {
             MessageBox.Show("Thành công");
         }
         txt_xacnhanmk.Clear();
         txtmkc.Clear();
         txt_matkhaumoi.Clear();
         frm_main form = new frm_main();
         form.Close();
     }
     else
     {
         MessageBox.Show("Mật khẩu và mật khẩu xác nhận không giống nhau");
     }
 }
コード例 #4
0
 public bool them_nguoidung(QUANLYND lp)
 {
     try
     {
         data.QUANLYNDs.InsertOnSubmit(lp);
         data.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #5
0
 public bool them(QUANLYND pmh)
 {
     try
     {
         data.QUANLYNDs.InsertOnSubmit(pmh);
         data.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #6
0
 public bool xoa(QUANLYND pmh)
 {
     try
     {
         QUANLYND mh = data.QUANLYNDs.Where(t => t.TENDN == pmh.TENDN.ToString()).FirstOrDefault();
         data.QUANLYNDs.DeleteOnSubmit(mh);
         data.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #7
0
 public bool sua1(QUANLYND pmh)
 {
     try
     {
         QUANLYND thanhvien = data.QUANLYNDs.Where(t => t.TENDN == pmh.TENDN.ToString()).FirstOrDefault();
         thanhvien.HOATDONG = pmh.HOATDONG;
         data.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #8
0
 //xóa quản lý người dùng
 public bool xoa_QLND(string ptendn)
 {
     try
     {
         QUANLYND tendn = data.QUANLYNDs.Where(t => t.TENDN == ptendn).FirstOrDefault();
         data.QUANLYNDs.DeleteOnSubmit(tendn);
         data.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #9
0
        private void gridView_qlnguoidung_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            qlnd = new QUANLYND();
            int position = gridView_qlnguoidung.FocusedRowHandle;

            qlnd.HOATDONG        = Convert.ToBoolean(gridView_qlnguoidung.GetRowCellValue(position, "HOATDONG").ToString());
            ckb_hoatdong.Checked = qlnd.HOATDONG.Value;
            if (ckb_hoatdong.Checked == true)
            {
                ckb_hoatdong.Text = "Đang hoạt động";
            }
            else
            {
                ckb_hoatdong.Text = "Không hoạt động";
            }
        }
コード例 #10
0
        public bool ktkc(QUANLYND ma)
        {
            int r = data.QUANLYNDs.Count(t => t.TENDN == ma.TENDN.ToString());

            try
            {
                if (r == 0)
                {
                    return(true);
                }
                return(false);
            }
            catch
            {
                return(false);
            }
        }
コード例 #11
0
 // sua người dùng
 public bool sua_QLND(QUANLYND pqlnd)
 {
     try
     {
         QUANLYND qlnd = data.QUANLYNDs.Where(t => t.TENDN == pqlnd.TENDN).FirstOrDefault();
         if (qlnd != null)
         {
             qlnd.MK       = pqlnd.MK;
             qlnd.HOATDONG = pqlnd.HOATDONG;
             data.SubmitChanges();
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #12
0
 public bool suatk1(QUANLYND n)
 {
     return(data.sua1(n));
 }
コード例 #13
0
 public bool xoatk(QUANLYND n)
 {
     return(data.xoa(n));
 }
コード例 #14
0
 public bool themtk(QUANLYND n)
 {
     return(data.them(n));
 }
コード例 #15
0
 public bool ktkc(QUANLYND n)
 {
     return(data.ktkc(n));
 }
コード例 #16
0
        private void btn_luu_Click(object sender, EventArgs e)
        {
            nv         = new NHANVIEN();
            qlnd       = new QUANLYND();
            nv.MANV    = txt_manv.Text;
            nv.TENNV   = txt_tennv.Text;
            nv.CMND_NV = txt_scm.Text;
            nv.SODT_CT = txt_sdt.Text;
            nv.DIACHI  = txt_diachi.Text;

            qlnd.TENDN    = txt_manv.Text;
            qlnd.MK       = "123456789";
            qlnd.HOATDONG = false;
            if (rdb_nam.Checked == true)
            {
                nv.GIOITINH = "Nam";
            }
            else
            {
                nv.GIOITINH = "Nữ";
            }
            if (btn_them.Enabled == true && btn_sua.Enabled == false)
            {
                if (txt_manv.Text == string.Empty && txt_tennv.Text == string.Empty &&
                    txt_scm.Text == string.Empty && txt_sdt.Text == string.Empty && txt_diachi.Text == string.Empty)
                {
                    MessageBox.Show("không được để trống");
                    return;
                }
                //kiểm tra khóa chính
                if (bnv.ktkc_nhanvien(nv.MANV) == true)
                {
                    MessageBox.Show("TRùng khóa chính");
                    return;
                }
                if (bnv.ThemNV(nv) == true && bqlnd.them_nguoidung(qlnd) == true)
                {
                    MessageBox.Show("Thành công");
                }
                else
                {
                    MessageBox.Show("Thất bại");
                }
                frm_nhanvien_Load(sender, e);
            }
            else if (btn_them.Enabled == false && btn_sua.Enabled == true)
            {
                try
                {
                    if (txt_tennv.Text == string.Empty &&
                        txt_scm.Text == string.Empty && txt_sdt.Text == string.Empty && txt_diachi.Text == string.Empty)
                    {
                        MessageBox.Show(" không được để trống");
                        return;
                    }

                    if (bnv.sua_nhanvien(nv) == true)
                    {
                        MessageBox.Show("Thành công");
                    }
                }
                catch
                {
                    MessageBox.Show("thất bại");
                }
                frm_nhanvien_Load(sender, e);
            }
            else
            {
                MessageBox.Show("Lỗi");
            }
        }
コード例 #17
0
 //Sửa
 public bool sua_ND(QUANLYND pnd)
 {
     return(nd.sua_QLND(pnd));
 }
コード例 #18
0
ファイル: frm_QLTaiKhoan.cs プロジェクト: BuiThiNinh/Shopgiay
        private void dataGridView_QLND_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 1)
            {
                QUANLYND tk = new QUANLYND();
                tk.TENDN = dataGridView_QLND.CurrentRow.Cells[4].Value.ToString();
                if (bll.ktkc(tk) == false)
                {
                    if (bll.xoatk(tk) == true)
                    {
                        MessageBox.Show("xóa thành công");
                        dataGridView_QLND.DataSource = bll.LoadbangQUANLYND();
                    }
                    else
                    {
                        MessageBox.Show("bạn không có quyền xóa");
                    }
                }
                else
                {
                    MessageBox.Show("Tài khoản không tồn tại");
                }
            }
            else
            {
                if (e.ColumnIndex == 2)
                {
                    QUANLYND tk = new QUANLYND();
                    tk.TENDN = dataGridView_QLND.CurrentRow.Cells[4].Value.ToString();
                    tk.MK    = "123456789";
                    if (bll.ktkc(tk) == false)
                    {
                        if (bll.suatk(tk) == true)
                        {
                            MessageBox.Show("reset thành công");
                            dataGridView_QLND.DataSource = bll.LoadbangQUANLYND();
                        }
                        else
                        {
                            MessageBox.Show("thất bại");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Tài khoản không tồn tại");
                    }
                }
            }
            if (e.ColumnIndex == 3)
            {
                QUANLYND tk = new QUANLYND();
                tk.TENDN = dataGridView_QLND.CurrentRow.Cells[4].Value.ToString();

                tk.HOATDONG = true;
                if (bll.ktkc(tk) == false)
                {
                    if (bll.suatk1(tk) == true)
                    {
                        MessageBox.Show("tài khoản bắt đầu hoạt động");
                        dataGridView_QLND.DataSource = bll.LoadbangQUANLYND();
                    }
                    else
                    {
                        MessageBox.Show("thất bại");
                    }
                }
                else
                {
                    MessageBox.Show("Tài khoản không tồn tại");
                }
            }
        }
コード例 #19
0
 public bool them_nguoidung(QUANLYND pnd)
 {
     return(nd.them_nguoidung(pnd));
 }