Exemplo n.º 1
0
        public IEnumerable<BooksellerView> GetBookseller(string loginName)
        {
            IList<Bookseller> booksellers = new List<Bookseller>();
            if (string.IsNullOrWhiteSpace(loginName))
            {
                booksellers.Add(
                    new Bookseller
                    {
                        ID = Guid.Empty,
                        Name = "你没有权限"
                    });
            }
            else
            {
                var user = new TbmisUserAppl(loginName).GetUser();

                if (user.IsInRole("教材科"))
                {
                    booksellers = new BooksellerAppl().GetAll().ToList();
                }
                else
                {
                    booksellers.Add(
                        new Bookseller
                        {
                            ID = (Guid)user.SchoolId,
                            Name = user.SchoolName
                        });
                }
            }
            return _adapter.Adapt<BooksellerView>(booksellers);
        }
        /// <summary>
        /// 根据登录名取学院
        /// </summary>
        /// <param name="loginName"></param>
        /// <returns></returns>
        public IEnumerable<SchoolView> GetSchoolByLoginName(string loginName)
        {
            //取学院
            var schools = new BooksellerAppl().GetSchoolByLoginName(loginName);

            return _adapter.Adapt<SchoolView>(schools);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 根据登录名取学院
        /// </summary>
        /// <param name="loginName"></param>
        /// <returns></returns>
        public IEnumerable <SchoolView> GetSchoolByLoginName(string loginName)
        {
            //取学院
            var schools = new BooksellerAppl().GetSchoolByLoginName(loginName);

            return(_adapter.Adapt <SchoolView>(schools));
        }
Exemplo n.º 4
0
        public IEnumerable <BooksellerView> GetBookseller(string loginName)
        {
            IList <Bookseller> booksellers = new List <Bookseller>();

            if (string.IsNullOrWhiteSpace(loginName))
            {
                booksellers.Add(
                    new Bookseller
                {
                    ID   = Guid.Empty,
                    Name = "你没有权限"
                });
            }
            else
            {
                var user = new TbmisUserAppl(loginName).GetUser();


                if (user.IsInRole("教材科"))
                {
                    booksellers = new BooksellerAppl().GetAll().ToList();
                }
                else
                {
                    booksellers.Add(
                        new Bookseller
                    {
                        ID   = (Guid)user.SchoolId,
                        Name = user.SchoolName
                    });
                }
            }
            return(_adapter.Adapt <BooksellerView>(booksellers));
        }