当前位置: 首页>>代码示例>>C#>>正文


C# IService.All方法代码示例

本文整理汇总了C#中IService.All方法的典型用法代码示例。如果您正苦于以下问题:C# IService.All方法的具体用法?C# IService.All怎么用?C# IService.All使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IService的用法示例。


在下文中一共展示了IService.All方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LibraryForm

        public LibraryForm()
        {
            InitializeComponent();

            // Uncomment the line you wish to use
            // Use a derived strategy with a Seed-method
            Database.SetInitializer<LibraryContext>(new LibraryDbInit());

            // Recreate the database only if the models change
            //Database.SetInitializer<LibraryContext>(new DropCreateDatabaseIfModelChanges<LibraryContext>());

            // Always drop and recreate the database
            //Database.SetInitializer<LibraryContext>(new DropCreateDatabaseAlways<LibraryContext>());

            //instatiate services
            authorService = serviceFactory.GetAuthorService();
            bookCopyService = serviceFactory.GetBookCopyService();
            bookService = serviceFactory.GetBookService();
            loanService = serviceFactory.GetLoanService();
            memberService = serviceFactory.GetMemberService();
            searchService = serviceFactory.GetSearchService();

            //set event subscriptions
            authorService.Updated += libraryService_Updated;
            bookCopyService.Updated += libraryService_Updated;
            bookService.Updated += libraryService_Updated;
            loanService.Updated += libraryService_Updated;
            memberService.Updated += libraryService_Updated;

            cmbxSearchBy.Items.Add(searchComboEnum.AllBooks);
            cmbxSearchBy.Items.Add(searchComboEnum.BookTitle);
            cmbxSearchBy.Items.Add(searchComboEnum.AuthorName);
            cmbxSearchBy.Items.Add(searchComboEnum.ISBN);
            cmbxSearchBy.SelectedIndex = 0;

            cmbxLoanDisplay.Items.Add(loanSearchEnum.AllActiveLoans);
            cmbxLoanDisplay.Items.Add(loanSearchEnum.ByMember);
            cmbxLoanDisplay.Items.Add(loanSearchEnum.LoansOverdue);
            cmbxLoanDisplay.Items.Add(loanSearchEnum.MemberLoansOverdue);
            cmbxLoanDisplay.SelectedIndex = 0;

            cbbxAction.Items.Add(addRemoveEnum.AddBook);
            cbbxAction.Items.Add(addRemoveEnum.AddAuthor);
            cbbxAction.Items.Add(addRemoveEnum.AddBookCopy);
            cbbxAction.Items.Add(addRemoveEnum.RemoveBook);
            cbbxAction.Items.Add(addRemoveEnum.RemoveAuthor);
            cbbxAction.Items.Add(addRemoveEnum.RemoveBookCopy);
            cbbxAction.Items.Add(addRemoveEnum.AddMember);
            cbbxAction.SelectedIndex = 0;

            searchListView.Columns.Add("Local Id", 50);
            searchListView.Columns.Add("ISBN", 90);
            searchListView.Columns.Add("Title",100);
            searchListView.Columns.Add("Author", 100);
            searchListView.Columns.Add("Copies",50);

            loanListView.Columns.Add("Local Id", 50);
            loanListView.Columns.Add("Title", 120);
            loanListView.Columns.Add("Due date", 90);
            loanListView.Columns.Add("Member SSNR", 90);

            mtxtbxSSNR1.Click += new EventHandler(maskedTextBox_Click);
            mtxtbxSSNRadd.Click += new EventHandler(maskedTextBox2_Click);
            mtxtbxSSNRloan.Click += new EventHandler(maskedTextBox1_Click);

            //Fill searchlistview with all books
            foreach (Book b in bookService.All())
            {
                ListViewItem item = new ListViewItem(new[] { Convert.ToString(b.Id), b.Isbn, b.Title, b.Author.Name, b.Copies.Where(c => c.IsLoaned == false).Count().ToString() });

                searchListView.Items.Add(item);
            }
        }
开发者ID:kindchri,项目名称:LibraryApplication,代码行数:73,代码来源:LibraryForm.cs


注:本文中的IService.All方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。