Пример #1
0
        public bool Xoa(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(false);
            }
            var donVi = Doc(id);

            if (donVi == null)
            {
                return(false);
            }

            //Nếu đơn vị đang được sử dụng thì ko được phép xóa
            XuLyNguoiDung xlNguoiDung = new XuLyNguoiDung();
            var           nd          = xlNguoiDung.DocDanhSach(n => n.IdDonVi == id);

            if (nd.Count() > 0)
            {
                return(false);
            }
            XuLyNhomNguoiDung xlNhomNguoiDung = new XuLyNhomNguoiDung();
            var nnd = xlNhomNguoiDung.DocDanhSach(n => n.IdDonVi == id);

            if (nnd.Count() > 0)
            {
                return(false);
            }

            return(Xoa(donVi));
        }
Пример #2
0
        public bool Xoa(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(false);
            }
            var nhomNguoiDung = Doc(id);

            if (nhomNguoiDung == null)
            {
                return(false);
            }

            //Nếu nhóm người dùng đang được sử dụng thì ko được phép xóa
            XuLyNguoiDung xlNguoiDung = new XuLyNguoiDung();
            var           nd          = xlNguoiDung.DocDanhSach(n => n.DanhSachNhom.Contains(id));

            if (nd.Count() > 0)
            {
                return(false);
            }
            return(Xoa(nhomNguoiDung));
        }