Exemplo n.º 1
0
        public void xoa1TaiKhoan(string tenDN)
        {
            QLNguoiDung nd = qlcf.QLNguoiDungs.Where(m => m.TenDangNhap == tenDN).FirstOrDefault();

            qlcf.QLNguoiDungs.DeleteOnSubmit(nd);
            qlcf.SubmitChanges();
        }
Exemplo n.º 2
0
        private void btnIn_Click(object sender, EventArgs e)
        {
            ExcelExport    excel    = new ExcelExport();
            SaveFileDialog saveFile = new SaveFileDialog();

            if (dgvNguoiDung.Rows.Count == 0)
            {
                MessageBox.Show("Không có dữ liệu để xuất", "ERROR");
                return;
            }
            List <QLNguoiDung> pList = new List <QLNguoiDung>();

            foreach (DataGridViewRow item in dgvNguoiDung.Rows)
            {
                QLNguoiDung i = new QLNguoiDung();
                //i.STT = int.Parse(item.Cells[0].Value.ToString());
                i.TenDangNhap = item.Cells[0].Value.ToString();
                i.MatKhau     = item.Cells[1].Value.ToString();
                i.HoatDong    = bool.Parse(item.Cells[2].Value.ToString());
                i.MaNV        = item.Cells[3].Value.ToString();
                //i.HinhAnh = item.Cells[5].Value.ToString();
                pList.Add(i);
            }
            string path = string.Empty;

            excel.ExportNguoiDung(pList, ref path, false);
            if (!string.IsNullOrEmpty(path) && MessageBox.Show("Bạn có muốn mở file không?", "Thông tin", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
            {
                System.Diagnostics.Process.Start(path);
            }
        }
Exemplo n.º 3
0
        public void them1TaiKhoan(string tenDN, string mk, bool hoatDong, string maNV)
        {
            QLNguoiDung kh = new QLNguoiDung();

            kh.TenDangNhap = tenDN;
            kh.MatKhau     = mk;
            kh.HoatDong    = hoatDong;
            kh.MaNV        = maNV;

            qlcf.QLNguoiDungs.InsertOnSubmit(kh);
            qlcf.SubmitChanges();
        }