Пример #1
0
        public ActionResult MuchListTable(int pageIndex = 1)
        {
            int    categoryId  = Request["categoryId1"].ToInt();
            string title       = Request["title1"];
            int    categoryId2 = Request["categoryId2"].ToInt();
            string title2      = Request["title2"];

            using (var fact = Wcf <BookService>())
            {
                var channel = fact.CreateChannel();

                TB_BookQueryObject bookQuery = new TB_BookQueryObject();

                bookQuery.CategoryId  = categoryId;
                bookQuery.Title       = title;
                bookQuery.CategoryId2 = categoryId2;
                bookQuery.TxtTitle2   = title2;
                if (!string.IsNullOrEmpty(title))
                {
                    bookQuery.NameFan   = Strings.StrConv(title, VbStrConv.TraditionalChinese, 0);
                    bookQuery.NameJian  = Strings.StrConv(title, VbStrConv.SimplifiedChinese, 0);
                    ViewData["KeyJian"] = bookQuery.NameJian;
                    ViewData["KeyFan"]  = bookQuery.NameFan;
                }
                if (!string.IsNullOrEmpty(title2))
                {
                    bookQuery.NameFan2   = Strings.StrConv(title2, VbStrConv.TraditionalChinese, 0);
                    bookQuery.NameJian2  = Strings.StrConv(title2, VbStrConv.SimplifiedChinese, 0);
                    ViewData["KeyJian2"] = bookQuery.NameJian2;
                    ViewData["KeyFan2"]  = bookQuery.NameFan2;
                }
                List <TB_Book> bookList = channel.QueryAll(bookQuery).Cast <List <TB_Book> >();

                List <BookViewModel> bookViewList = new List <BookViewModel>();

                foreach (var item in bookList)
                {
                    BookViewModel bookViewModel = new BookViewModel();
                    TB_CmsStatus  cmsStatus     = channel.QuerySingle(new TB_CmsStatusQueryObject {
                        QueryCondition = t => t.CmsUid == item.BookUid
                    }).Cast <TB_CmsStatus>();
                    int bookStatus = cmsStatus.StatusId;

                    if (bookStatus == opt_CmsStatus.NORMAL.ToInt())
                    {
                        bookViewModel.BookUid      = item.BookUid;
                        bookViewModel.Title        = item.Title;
                        bookViewModel.Title2       = item.Title2;
                        bookViewModel.Volume       = item.Volume;
                        bookViewModel.Dynasty      = item.Dynasty;
                        bookViewModel.CategoryId   = item.CategoryId;
                        bookViewModel.CategoryName = item.TB_Category?.CategoryName;
                        bookViewModel.Functionary  = item.Functionary;
                        bookViewModel.Publisher    = item.Publisher;
                        bookViewModel.Version      = item.Version;
                        bookViewModel.FromBF49     = item.FromBF49;
                        bookViewModel.FromAF49     = item.FromAF49;
                        bookViewModel.ImageUris    = item.ImageUris;
                        bookViewModel.Notice       = item.Notice;

                        bookViewList.Add(bookViewModel);
                    }
                }
                bookViewList = bookViewList.OrderBy(p => p.Title).ToList();
                PagedList <BookViewModel> p_list = bookViewList.ToPagedList(pageIndex, pageSize);
                ViewData["Query"] = categoryId + "," + title + "," + categoryId2 + "," + title2;
                if (Request.IsAjaxRequest())
                {
                    return(PartialView("_PartMuchTableList", p_list));
                }
                return(View(p_list));
            }
        }
Пример #2
0
        public ActionResult OldList()
        {
            int    categoryId = Request["categoryId"].ToInt();
            string title      = Request["title"];

            using (var fact = Wcf <BookService>())
            {
                var channel = fact.CreateChannel();

                TB_BookQueryObject bookQuery = new TB_BookQueryObject();

                bookQuery.CategoryId = categoryId;
                bookQuery.Title      = title;
                if (!string.IsNullOrEmpty(title))
                {
                    bookQuery.NameFan   = Strings.StrConv(title, VbStrConv.TraditionalChinese, 0);
                    bookQuery.NameJian  = Strings.StrConv(title, VbStrConv.SimplifiedChinese, 0);
                    ViewData["KeyJian"] = bookQuery.NameJian;
                    ViewData["KeyFan"]  = bookQuery.NameFan;
                    ViewData["KeyWord"] = title;
                }


                List <TB_Book> bookList = channel.QueryAll(bookQuery).Cast <List <TB_Book> >();
                Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-cn");

                bookList = bookList.OrderByDescending(p => p.Title).ThenByDescending(p => p.Title2).ToList();
                List <BookViewModel> bookViewList = new List <BookViewModel>();

                foreach (var item in bookList)
                {
                    BookViewModel bookViewModel = new BookViewModel();
                    TB_CmsStatus  cmsStatus     = channel.QuerySingle(new TB_CmsStatusQueryObject {
                        QueryCondition = t => t.CmsUid == item.BookUid
                    }).Cast <TB_CmsStatus>();
                    int bookStatus = cmsStatus.StatusId;

                    if (bookStatus == opt_CmsStatus.NORMAL.ToInt())
                    {
                        bookViewModel.BookUid      = item.BookUid;
                        bookViewModel.Title        = item.Title;
                        bookViewModel.Title2       = item.Title2;
                        bookViewModel.Volume       = item.Volume;
                        bookViewModel.Dynasty      = item.Dynasty;
                        bookViewModel.CategoryId   = item.CategoryId;
                        bookViewModel.CategoryName = item.TB_Category?.CategoryName;
                        bookViewModel.Functionary  = item.Functionary;
                        bookViewModel.Publisher    = item.Publisher;
                        bookViewModel.Version      = item.Version;
                        bookViewModel.FromBF49     = item.FromBF49;
                        bookViewModel.FromAF49     = item.FromAF49;
                        bookViewModel.ImageUris    = item.ImageUris;
                        bookViewModel.Notice       = item.Notice;

                        bookViewList.Add(bookViewModel);
                    }
                }

                return(View(bookViewList));
            }
        }
Пример #3
0
        public ActionResult MultList()
        {
            int    categoryId = Request["categoryId"].ToInt();
            string title      = Request["title"];
            string query1     = Request["con1"];
            string query2     = Request["con2"];
            string query3     = Request["con3"];
            string query4     = Request["con4"];
            string query5     = Request["con5"];

            using (var fact = Wcf <BookService>())
            {
                var channel = fact.CreateChannel();

                TB_BookQueryObject bookQuery = new TB_BookQueryObject();

                bookQuery.CategoryId = categoryId;
                bookQuery.Title      = title;
                bookQuery.Query1     = query1;
                bookQuery.Query2     = query2;
                bookQuery.Query3     = query3;
                bookQuery.Query4     = query4;
                bookQuery.Query5     = query5;
                if (!string.IsNullOrEmpty(title))
                {
                    bookQuery.NameFan   = Strings.StrConv(title, VbStrConv.TraditionalChinese, 0);
                    bookQuery.NameJian  = Strings.StrConv(title, VbStrConv.SimplifiedChinese, 0);
                    ViewData["KeyJian"] = bookQuery.NameJian;
                    ViewData["KeyFan"]  = bookQuery.NameFan;
                    ViewData["KeyWord"] = title;
                }
                ViewData["Query1"] = query1;
                ViewData["Query2"] = query2;
                ViewData["Query3"] = query3;
                ViewData["Query4"] = query4;
                ViewData["Query5"] = query5;

                List <TB_Book> bookList = channel.QueryAll(bookQuery).Cast <List <TB_Book> >();

                List <BookViewModel> bookViewList = new List <BookViewModel>();

                foreach (var item in bookList)
                {
                    BookViewModel bookViewModel = new BookViewModel();
                    TB_CmsStatus  cmsStatus     = channel.QuerySingle(new TB_CmsStatusQueryObject {
                        QueryCondition = t => t.CmsUid == item.BookUid
                    }).Cast <TB_CmsStatus>();
                    int bookStatus = cmsStatus.StatusId;

                    if (bookStatus == opt_CmsStatus.NORMAL.ToInt())
                    {
                        bookViewModel.BookUid      = item.BookUid;
                        bookViewModel.Title        = item.Title;
                        bookViewModel.Title2       = item.Title2;
                        bookViewModel.Volume       = item.Volume;
                        bookViewModel.Dynasty      = item.Dynasty;
                        bookViewModel.CategoryId   = item.CategoryId;
                        bookViewModel.CategoryName = item.TB_Category?.CategoryName;
                        bookViewModel.Functionary  = item.Functionary;
                        bookViewModel.Publisher    = item.Publisher;
                        bookViewModel.Version      = item.Version;
                        bookViewModel.FromBF49     = item.FromBF49;
                        bookViewModel.FromAF49     = item.FromAF49;
                        bookViewModel.ImageUris    = item.ImageUris;
                        bookViewModel.Notice       = item.Notice;

                        bookViewList.Add(bookViewModel);
                    }
                }

                return(View(bookViewList));
            }
        }
Пример #4
0
 public bool Delete(TB_CmsStatus TB_CmsStatus)
 {
     return(TB_CmsStatus.Delete(TB_CmsStatus));
 }
Пример #5
0
 public bool Update(TB_CmsStatus TB_CmsStatus)
 {
     return(TB_CmsStatus.Update(TB_CmsStatus));
 }
Пример #6
0
 public bool Add(TB_CmsStatus TB_CmsStatus)
 {
     return(TB_CmsStatus.Add(TB_CmsStatus));
 }
Пример #7
0
 public CmsStatusService(TB_CmsStatus TB_CmsStatus)
 {
     this._TB_CmsStatus = TB_CmsStatus;
 }