示例#1
0
            /// <summary>
            ///
            /// </summary>
            public static bool CheckList(TagReadDataEventArgs e)
            {
                DataTable dt = DBHelper.GetDT();

                foreach (DataRow row in dt.Rows)
                {
                    if (row["Book_RFID_EPC"].ToString() == e.TagReadData.EpcString)
                    {
                        DBHelper.updateBook(e);
                        Console.WriteLine("Update Book call from checklist");
                    }
                }
                if (BookList.Any(p => p.EPC == e.TagReadData.EpcString))
                {
                    var list  = BookList.First(f => f.EPC == e.TagReadData.EpcString);
                    var index = BookList.IndexOf(list);
                    BookList[index].timeStamp = e.TagReadData.Time.ToString();
                    BookList[index].RSSI      = e.TagReadData.Rssi.ToString();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        public async Task <IActionResult> OnGetAsync(string BibleId, int Id)
        {
            IdentityUser user = await _userManager.GetUserAsync(User);

            PBEUser = await QuizUser.GetOrAddPBEUserAsync(_context, user.Email); // Static method not requiring an instance

            if (!PBEUser.IsQuizModerator())
            {
                return(RedirectToPage("/error", new { errorMessage = "Sorry! You do not have sufficient rights to edit a PBE BookList" }));
            }

            BookList = await _context.QuizBookLists.FindAsync(Id);

            if (BookList == null)
            {
                return(RedirectToPage("/error", new { errorMessage = "That's Odd! We weren't able to find this Book List" }));
            }

            this.BibleId = await Bible.GetValidPBEBibleIdAsync(_context, BibleId);

            //Initialize Books
            await _context.Entry(BookList).Collection(L => L.QuizBookListBookMaps).LoadAsync();

            BookList.PadBookListBookMapsForEdit();
            Books = BookList.QuizBookListBookMaps.ToList();
            Name  = BookList.BookListName;
            ViewData["BookSelectList"] = await BibleBook.GetBookSelectListAsync(_context, BibleId);

            return(Page());
        }
示例#3
0
        private async void BookList_Refreshing(object sender, EventArgs e)
        {
            await BookFetching();

            BookList.ItemsSource = _listOfISBN;
            BookList.EndRefresh();
        }
示例#4
0
        public void addbBookIntoList()
        {
            string sqlQuery = "Select * From Book";

            using (SqlCommand selectCommand = new SqlCommand(sqlQuery, dbConnection))
            {
                SqlDataAdapter adapter = new SqlDataAdapter();
                adapter.SelectCommand = selectCommand;
                DataSet BookDataset = new DataSet();
                adapter.Fill(BookDataset, "Book");
                DataTable BookDataTable = BookDataset.Tables["Book"];
                foreach (DataRow row in BookDataTable.Rows)
                {
                    Book book = new Book
                    {
                        BookID    = int.Parse(row[0].ToString()),
                        Title     = row[2].ToString(),
                        Author    = row[3].ToString(),
                        Genere    = row[4].ToString(),
                        Price     = int.Parse(row[5].ToString()),
                        NoOfPages = int.Parse(row[6].ToString())
                    };
                    BookList.Add(book.BookID, book);
                }
            };
        }
        // GET: BookListController/Edit/5
        public async Task <ActionResult> Edit(int id)
        {
            try
            {
                if (JwtMethods.IsExpired())
                {
                    var result = await JwtMethods.RefreshToken(User);

                    MyToken.expiration = result.expiration;
                    MyToken.token      = result.token;
                }
                httpClient.BaseAddress = MyToken.BaseUrl;

                httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + MyToken.token);
                BookList book = await httpClient.GetFromJsonAsync <BookList>("BookLists/" + id);

                if (book != null)
                {
                    return(View(book));
                }
                else
                {
                    return(RedirectToAction(nameof(Index)));
                }
            }
            catch
            {
                return(RedirectToAction(nameof(Index)));
            }
        }
        public BookPresenter(BookList model, BookFormView view)
        {
            this.model = model;
            this.view  = view;

            view.Presenter = this;
        }
        public async Task <ActionResult> Edit(int id, BookList book)
        {
            try
            {
                book.Udate = DateTime.Now;
                if (JwtMethods.IsExpired())
                {
                    var result = await JwtMethods.RefreshToken(User);

                    MyToken.expiration = result.expiration;
                    MyToken.token      = result.token;
                }
                httpClient.BaseAddress = MyToken.BaseUrl;

                httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + MyToken.token);
                var res = await httpClient.PutAsJsonAsync <BookList>("BookLists/" + id, book);

                if (res.IsSuccessStatusCode)
                {
                    return(RedirectToAction(nameof(Index)));
                }

                return(View());
            }
            catch
            {
                return(View());
            }
        }
示例#8
0
        private static bool GetItem(int num, out BookList[] bookList, out string[] content)
        {
            bookList = new BookList[num];
            content  = new string[num];
            Console.WriteLine("請輸入標題、價錢、數量(用逗號隔開):");
            for (int i = 0; i < content.Length; i++)//存入輸入的內容至字串陣列中
            {
                content[i] = Console.ReadLine();
                string[] item = content[i].Split(',');
                if (item.Length != 3)
                {
                    Console.WriteLine("Enter Again!");
                    return(false);
                }
                if (!(int.TryParse(item[2], out bookList[i].amount) && int.TryParse(item[1], out bookList[i].price)))
                {
                    Console.WriteLine("Enter Again!");
                    return(false);
                }

                bookList[i].title  = item[0];
                bookList[i].price  = int.Parse(item[1]);
                bookList[i].amount = int.Parse(item[2]);
            }
            return(true);
        }
示例#9
0
文件: Program.cs 项目: AdinaGh/7Tema1
        private static BookList Top10Books(SqlConnection connection)
        {
            const string query = "select top 10 * from Book";

            using (var command = new SqlCommand(query, connection))
            {
                Console.WriteLine("Top 10 Books:");
                using (var dataReader = command.ExecuteReader())
                {
                    var list = new BookList();
                    while (dataReader.Read())
                    {
                        var currentRow = dataReader;

                        var title = currentRow["Title"];
                        var year  = currentRow["Year"];
                        var price = currentRow["Price"];

                        list.Add(int.Parse(currentRow["BookId"].ToString()), currentRow["Title"].ToString(),
                                 int.Parse(currentRow["Year"].ToString()), decimal.Parse(currentRow["Price"].ToString()));
                    }
                    return(list);
                }
            }
        }
示例#10
0
        private void LeaseBook()
        {
            Action redo = () =>
            {
                SelectedBook.LeasedTo = Session.Current.LoggedInUser;

                LeaseCommand.RaiseCanExecuteChanged();
                OnPropertyChanged("SelectedBook");
                BookList.Refresh();
            };
            Action undo = () =>
            {
                SelectedBook.LeasedTo = string.Empty;

                LeaseCommand.RaiseCanExecuteChanged();
                OnPropertyChanged("SelectedBook");
                BookList.Refresh();
            };

            history.AddAndExecute(new RevertableCommand(redo, undo));
            UndoCommand.RaiseCanExecuteChanged();
            RedoCommand.RaiseCanExecuteChanged();

            ClientLogger.Log($"{Session.Current.LoggedInUser} leased book {selectedBook.BookName}", Common.LogLevel.Info);
        }
示例#11
0
文件: Program.cs 项目: AdinaGh/7Tema1
        private static BookList BookMaxYear(SqlConnection connection, int maxYear)
        {
            const string query = "select * from Book where Year<=@MaxYear";

            using (var command = new SqlCommand(query, connection))
            {
                command.Parameters.Add(new SqlParameter("@MaxYear", maxYear));
                Console.WriteLine($"Books with max {maxYear}:");
                using (var dataReader = command.ExecuteReader())
                {
                    var list = new BookList();
                    while (dataReader.Read())
                    {
                        var currentRow = dataReader;

                        var bookId = currentRow["BookId"];
                        var title  = currentRow["Title"];
                        var year   = currentRow["Year"];
                        var price  = currentRow["Price"];

                        list.Add(int.Parse(currentRow["BookId"].ToString()), currentRow["Title"].ToString(),
                                 int.Parse(currentRow["Year"].ToString()), decimal.Parse(currentRow["Price"].ToString()));
                    }
                    return(list);
                }
            }
        }
示例#12
0
        public string Output()
        {
            WinFormOutputAuthoredItem output = new WinFormOutputAuthoredItem();
            SetItem bookSetter = new SetItem();

            return(output.ListOutput(BookList.GetBookList(bookSetter).GenerateList()).ToString());
        }
示例#13
0
 public MainWindow()
 {
     InitializeComponent();
     bookList = new BookList();
     bookList.AddBook(new Book("111-222-333-4444", "ferfe", "freferf", "freferf", 344, 34, "43"));
     bookListView.ItemsSource = bookList.Books;
 }
示例#14
0
        public void Call()
        {
            #region older versions without generics, code redundancy
            var numbers = new List();
            numbers.Add(2);

            var booksList = new BookList();
            booksList.Add(new Book());
            #endregion

            var numbersList = new GenericList <int>();
            numbers.Add(10);

            var books = new GenericList <Book>();
            books.Add(new Book());

            var dictionary = new GenericDictionary <string, Book>();
            dictionary.Add("1234", new Book());

            var number = new Nullable <int>(5);
            Console.WriteLine("Has value? " + number.HasValue);
            Console.WriteLine("Value: " + number.GetValueOrDefault());

            var numberTwo = new Nullable <int>();
            Console.WriteLine("Has value? " + numberTwo.HasValue);
            Console.WriteLine("Value: " + numberTwo.GetValueOrDefault());
        }
        public async Task <ActionResult> Create(BookList model)
        {
            if (ModelState.IsValid)
            {
                model.Udate = DateTime.Now;
                try
                {
                    if (JwtMethods.IsExpired())
                    {
                        var result = await JwtMethods.RefreshToken(User);

                        MyToken.expiration = result.expiration;
                        MyToken.token      = result.token;
                    }
                    httpClient.BaseAddress = MyToken.BaseUrl;

                    httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + MyToken.token);
                    var res = await httpClient.PostAsJsonAsync <BookList>("BookLists", model);

                    if (res.IsSuccessStatusCode)
                    {
                        return(RedirectToAction(nameof(Index)));
                    }
                    else
                    {
                        return(View());
                    }
                }
                catch
                {
                    return(View());
                }
            }
            return(View());
        }
示例#16
0
        static void Main(string[] args)
        {
            int  num      = 0;
            bool isOK_num = false;

            while (!isOK_num)//輸入筆數防呆
            {
                Console.Write("請輸入欲鍵入的筆數(至少三筆):");
                isOK_num = InputNum(int.Parse(Console.ReadLine()), ref num);
            }

            BookList[] bookList = new BookList[0];
            string[]   content;

            bool isOK_Item = false;

            while (!isOK_Item)
            {
                isOK_Item = GetItem(num, out bookList, out content);//輸入所有item
            }

            StringBuilder builder = GetBuilder(bookList);//將結果存入StringBuilder

            try
            {
                SaveFile(builder);//存入檔案
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }
示例#17
0
        public void SetUp()
        {
            b1  = new Book("A Tale Of Two Cities", "Charles Dickens", 1859, 3.76);
            b2  = new Book("The Great Gatsby", "F. Scott Fitzgerald", 1925, 3.85);
            b3  = new Book("Pride and Prejudice", "Jane Austen", 1813, 4.23);
            b4  = new Book("To Kill A Mockingbird", "Harper Lee", 1960, 4.23);
            b5  = new Book("Jane Eyre", "Charlotte Bronte", 1847, 4.07);
            b6  = new Book("The Catcher and the Rye", "J.D. Salinger", 1951, 3.77);
            b7  = new Book("Sense and Sensibility", "Jane Austen", 1811, 4.04);
            b8  = new Book("Emma", "Jane Austen", 1815, 3.97);
            b9  = new Book("1984", "George Orwell", 1949, 4.09);
            b10 = new Book("Oliver Twist", "Charles Dickens", 1838, 3.82);

            books = new BookList();
            books.AddBook(b1);
            books.AddBook(b2);
            books.AddBook(b3);
            books.AddBook(b4);
            books.AddBook(b5);
            books.AddBook(b6);
            books.AddBook(b7);
            books.AddBook(b8);
            books.AddBook(b9);
            books.AddBook(b10);
        }
示例#18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        bookList = BookList.getBookList();
        User u = (User)Session["user"];

        if (u != null)
        {
            string username = Session["username"].ToString();
            if (u.accessLevel == 1)
            {
                Page.Visible = true;
                if (!IsPostBack)
                {
                    this.displayBooks();
                }
            }
            else
            {
                Page.Visible = false;
                Response.Redirect("~/Login.aspx");
            }
        }
        else
        {
            Page.Visible = false;
            Response.Redirect("~/Login.aspx");
        }
    }
示例#19
0
        ////Id, Title, Author, PublisherId, PublishDate, ISBN, WordsCount, UnitPrice, ContentDescription, AuthorDescription, EditorComment, TOC, CategoryId, Clicks

        public BookList GetBookInfo(int id)
        {
            string    sql      = "select * from BookList where Id=@Id";
            DataTable dt       = SqlHelper.ExecuteTable(sql, new SqlParameter("@Id", id));
            BookList  booklist = new BookList();

            if (dt.Rows.Count > 0)
            {
                booklist.Author             = dt.Rows[0]["Author"].ToString();
                booklist.AuthorDescription  = dt.Rows[0]["AuthorDescription"].ToString();
                booklist.CategoryId         = Convert.ToInt32(dt.Rows[0]["CategoryId"]);
                booklist.Clicks             = Convert.ToInt32(dt.Rows[0]["Clicks"]);
                booklist.ContentDescription = dt.Rows[0]["ContentDescription"].ToString();
                booklist.EditorComment      = dt.Rows[0]["EditorComment"].ToString();
                booklist.Id          = Convert.ToInt32(dt.Rows[0]["Id"]);
                booklist.ISBN        = dt.Rows[0]["ISBN"].ToString();
                booklist.PublishDate = Convert.ToDateTime(dt.Rows[0]["PublishDate"]);
                booklist.PublisherId = Convert.ToInt32(dt.Rows[0]["PublisherId"]);
                booklist.Title       = dt.Rows[0]["Title"].ToString();
                booklist.TOC         = dt.Rows[0]["TOC"].ToString();
                booklist.UnitPrice   = Convert.ToDecimal(dt.Rows[0]["UnitPrice"]);
                booklist.WordsCount  = Convert.ToInt32(dt.Rows[0]["WordsCount"]);
            }
            return(booklist);
        }
        public async Task <IActionResult> PutBookList(int id, BookList bookList)
        {
            if (id != bookList.Id)
            {
                return(BadRequest());
            }

            _context.Entry(bookList).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BookListExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#21
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string         text   = tbSearch.Text;
            OpKnjigaSelect knjiga = new OpKnjigaSelect();

            knjiga.Kriterijum = new KriterijumKnjiga();
            knjiga.Kriterijum.Knjiga_pretraga = text;
            OperacijaRezultat obj = OperationManager.Singleton.izvrsiOperaciju(knjiga);


            if ((obj == null) || (!obj.Status))
            {
                return;
            }

            else
            {
                if (obj.DbItems.Count() == 0)
                {
                    noBooks.Visible = true;
                }
                else
                {
                    noBooks.Visible = false;
                }
                this.DataPager1.SetPageProperties(0, DataPager1.PageSize, false);
                BookList.DataSource = obj.DbItems;
                BookList.DataBind();
                ddlZanr.SelectedValue = "0";
            }
        }
示例#22
0
        public void Update_UpdatesPropertiesOfEntityWhichNotMarkedWithIgnoreUpdateAttribute()
        {
            const int          id      = 1;
            const string       name    = "Default";
            const BookListType type    = BookListType.Private;
            const int          ownerId = 1;

            var bookList = new BookList
            {
                Id      = id,
                Name    = name,
                Type    = type,
                OwnerId = ownerId
            };

            var source = new Dictionary <string, object>
            {
                [nameof(BookList.Id)]      = 2,
                [nameof(BookList.Name)]    = "Updated",
                [nameof(BookList.Type)]    = BookListType.Shared,
                [nameof(BookList.OwnerId)] = 2
            };

            bookList.Update(source);

            Assert.True(bookList.Id == id);
            Assert.True(bookList.Name == (string)source[nameof(BookList.Name)]);
            Assert.True(bookList.Type == type);
            Assert.True(bookList.OwnerId == ownerId);
        }
        protected void btnContinue3_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            var badge = LoadBadgeObject();

            badge.Insert();

            try
            {
                var badgePath = string.Format(Server.MapPath("~/images/Badges/"));
                System.IO.File.Copy(string.Format("{0}no_badge.png", badgePath),
                                    string.Format("{0}{1}.png", badgePath, badge.BID));
                System.IO.File.Copy(string.Format("{0}no_badge_sm.png", badgePath),
                                    string.Format("{0}sm_{1}.png", badgePath, badge.BID));
            }
            catch (Exception ex)
            {
                this.Log().Error("Couldn't copy no_badge images into new badge: {0}",
                                 ex.Message);
            }

            new SessionTools(Session).RemoveCache(Cache, CacheKey.BadgesActive);
            lblBID.Text = badge.BID.ToString();
            var bl = BookList.FetchObject(int.Parse(lblPK.Text));

            bl.AwardBadgeID = badge.BID;
            bl.Update();
            FileUploadCtl.FileName = lblBID.Text;
            FileUploadCtl.ProcessRender();
            OpenBadgesBadgeMaker.FileName = lblBID.Text;

            pnlLast.Visible      = true;
            pnlBadgeMore.Visible = false;
        }
示例#24
0
        protected void ddlZanr_SelectedIndexChanged(object sender, EventArgs e)
        {
            string vrednost = ddlZanr.SelectedValue;

            OpKnjigaSelect knjsort = new OpKnjigaSelect();

            if (vrednost != "0")
            {
                knjsort.Kriterijum      = new KriterijumKnjiga();
                knjsort.Kriterijum.Zanr = vrednost;
            }



            OperacijaRezultat objsort = OperationManager.Singleton.izvrsiOperaciju(knjsort);

            DbItem[]   itemsort = objsort.DbItems;
            KnjigaDb[] knj      = itemsort.Cast <KnjigaDb>().ToArray();
            if (knj.Count() == 0)
            {
                this.DataPager1.SetPageProperties(0, DataPager1.PageSize, false);

                BookList.DataSource = knj;
                BookList.DataBind();
                noBooks.Visible = true;
            }
            else
            {
                noBooks.Visible = false;
                this.DataPager1.SetPageProperties(0, DataPager1.PageSize, false);

                BookList.DataSource = knj;
                BookList.DataBind();
            }
        }
        public async Task <ActionResult <BookList> > PostBookList(BookList bookList)
        {
            _context.BookLists.Add(bookList);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetBookList", new { id = bookList.Id }, bookList));
        }
示例#26
0
 public void DeleteTemporaryBL()
 {
     try {
         var e = BookList.FetchObject(int.Parse(lblPK.Text));
         e.Delete();
     } catch { }
 }
示例#27
0
 // Constructor
 public MainPage()
 {
     InitializeComponent();
     appSettings = new AppSettings();
     bookList = new BookList();
     BibleHubListBox.ItemsSource = bookList;
 }
        public BooksViewModel()
        {
            List <BookList> listOfBooks = new List <BookList>();

            listOfBooks = getBooksFromDB();


            List <BookList> listToAddToGrid = new List <BookList>();

            BookList = new ObservableCollection <BookList>();

            foreach (BookList book in listOfBooks)
            {
                BookList itemToAddToList = new BookList();
                itemToAddToList.Title  = book.Title;
                itemToAddToList.Author = book.Author;
                listToAddToGrid.Add(itemToAddToList);
            }



            foreach (BookList book in listToAddToGrid)
            {
                BookList.Add(book);
            }
        }
        public ActionResult EditBook(BookList book)
        {
            Session["userId"] = book.U_Id;
            ViewBag.bookName  = book.bookName;
            ViewBag.episode   = book.episode;
            if (string.IsNullOrEmpty(book.bookName) ||
                string.IsNullOrEmpty(book.episode))
            {
                ViewBag.show = "請輸入書名或集數";
                return(View());
            }
            else
            {
                SqlConnection cn = new SqlConnection(@"server=.\SQLExpress_2;database=collectBooksManageList;Integrated Security=true");

                SqlCommand cmd = new SqlCommand("select * from BookList where bookName=@name AND episode=@no", cn);
                cmd.Parameters.AddWithValue("@name", book.bookName);
                cmd.Parameters.AddWithValue("@no", book.episode);
                cn.Open();
                int num = Convert.ToInt32(cmd.ExecuteScalar());
                cn.Close();
                if (num == 0)
                {
                    db.BookLists.Add(book);
                    db.SaveChanges();
                    return(RedirectToAction("BookList"));
                }
                else
                {
                    ViewBag.show = "書籍重複登記";
                    return(View());
                }
            }
        }
示例#30
0
    static void Main()
    {
        Application.EnableVisualStyles();
        var data = new BookList {
            new BookDetails {
                Title = "abc", TotalRating = 3, Occurrence = 2, Rating = new List <int> {
                    1, 2, 1
                }
            },
            new BookDetails {
                Title = "def", TotalRating = 3, Occurrence = 2, Rating = null
            },
            new BookDetails {
                Title = "ghi", TotalRating = 3, Occurrence = 2, Rating = new List <int> {
                    3, 2
                }
            },
            new BookDetails {
                Title = "jkl", TotalRating = 3, Occurrence = 2, Rating = new List <int>()
            },
        };

        Application.Run(new Form
        {
            Controls =
            {
                new DataGridView {
                    Dock       = DockStyle.Fill,
                    DataSource = data
                }
            }
        });
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            MasterPage.RequiredPermission = 4400;
            MasterPage.IsSecure           = true;

            if (!IsPostBack)
            {
                SetPageRibbon(StandardModuleRibbons.SetupRibbon());

                lblPK.Text = Session["BLL"] == null ? "" : Session["BLL"].ToString(); //Session["BLL"]= string.Empty;
                var bl = BookList.FetchObject(int.Parse(lblPK.Text));
                MasterPage.PageTitle = string.Format("Tasks in the \"{0}\" Challenge", bl.AdminName);
            }


            _mStrSortExp = String.Empty;
            if (!IsPostBack)
            {
                _mStrSortExp = String.Empty;
            }
            else
            {
                if (null != ViewState["_SortExp_"])
                {
                    _mStrSortExp = ViewState["_SortExp_"] as String;
                }

                if (null != ViewState["_Direction_"])
                {
                    _mSortDirection = (SortDirection)ViewState["_Direction_"];
                }
            }
        }
示例#32
0
 public void AddOrUpdate(Book entity)
 {
     BookList tmp = new BookList();
     tmp.Books = GetAll().ToList();
     var rep = tmp.Books.FirstOrDefault(x => x.Id == entity.Id);
     tmp.Books.Remove(rep);
     tmp.Books.Add(entity);
     PersistXml(tmp);
 }
示例#33
0
        public void Delete(int id)
        {
            BookList tmp = new BookList();
            tmp.Books = GetAll().ToList();
            var rep = tmp.Books.FirstOrDefault(x => x.Id == id);

            lock (locker)
            {
                tmp.Books.Remove(rep);
                PersistXml(tmp);
            }
        }
示例#34
0
        public List<BookList> GetBookList()
        {
            List<BookList> BooksList = new List<BookList>();
            BookList Record = new BookList();

            BookData DataList = new BookData(ConnectionString);

            var Query = from Table in DataList.BookList
                        select Table;

            BooksList = Query.ToList<BookList>();

            return BooksList;
        }
示例#35
0
        public List<BookList> GetBookList(string Keyword)
        {
            List<BookList> BooksList = new List<BookList>();
            BookList Record = new BookList();

            BookData DataList = new BookData(ConnectionString);

            var Query = from Table in DataList.BookList
                        where
                        Table.BookName.Contains(Keyword)
                        select Table;

            BooksList = Query.ToList<BookList>();

            return BooksList;
        }
示例#36
0
 private static void PersistXml(BookList tmp)
 {
     XmlSerializer serializer = new XmlSerializer(typeof(BookList));
     using (
         StreamWriter writer =
             new StreamWriter(Path.Combine(HttpContext.Current.Server.MapPath(@"~/App_Data"),
                 _booksSampleXml)))
     {
         serializer.Serialize(writer, tmp);
     }
 }
示例#37
0
 public void Merge(IEnumerable<Book> entities)
 {
     BookList tmp = new BookList();
     tmp.Books = GetAll().ToList();
     var seedId = tmp.Books.Max(x => x.Id) + 1;
     foreach (var book in entities)
     {
         if (book.Id == 0) book.Id = ++seedId;
     }
     tmp.Books = tmp.Books.Union(entities).ToList();
     PersistXml(tmp);
 }
示例#38
0
 public async Task<ActionResult>Index(BookFilter cFilter)
 {
     var books = await FilterAsync(cFilter);
     var model = new BookList { Books = books, Filter = cFilter };
     return View(model);
 }
示例#39
0
 public Window1()
 {
     InitializeComponent();
     myBookList = new BookList();
 }