public void AddBookseller()
 {
     IRepositoryContext uow = new EntityFrameworkRepositoryContext();
     var repo = new BooksellerRepository(uow);
     var bookseller = new Bookseller { Contact = "张三", Name = "测试", Telephone = "123456" };
     repo.Add(bookseller);
     repo.Context.Commit();
     var result = repo.Single(t =>
         t.Contact == bookseller.Contact &&
         t.Name == bookseller.Name &&
         t.Telephone == bookseller.Telephone
         );
     Assert.IsNotNull(result.ID);
 }
        public IEnumerable<BooksellerView> GetBooksellerWithNotApproval(string loginName)
        {
            //系统用户
            var user = new TbmisUserAppl(loginName).GetUser();

            IList<Bookseller> booksellers = new List<Bookseller>();

            //如果是教务处或教材科,取全部学院
            if (user.IsInRole("教务处"))
            {
                var bookseller = _repo.Find(t =>
                    t.ApprovalState == ApprovalState.教务处审核中
                    ).SelectMany(t =>
                        t.Subscriptions
                        ).Select(t =>
                            t.Bookseller
                            ).Distinct();
                booksellers = bookseller.ToList();
            }
            else if (user.IsInRole("教材科"))
            {
                var bookseller = _repo.Find(t =>
                    t.ApprovalState == ApprovalState.教材科审核中
                    ).SelectMany(t =>
                        t.Subscriptions
                        ).Select(t =>
                            t.Bookseller
                            ).Distinct();
                booksellers = bookseller.ToList();
            }
            if (booksellers.Count == 0)
            {
                var bookseller = new Bookseller
                {
                    ID = Guid.Empty,
                    Name = "没有需要审核的书商"
                };
                booksellers.Add(bookseller);
            }

            return _adapter.Adapt<BooksellerView>(booksellers);
        }