• 大小: 3.57MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-30
  • 语言: C#
  • 标签: C#  三层架构  

资源简介

用c#三层架构实现的一个简单图书管理实例,学习三层架构,同时也学习了C#。附加MyBookShop.mdf数据库文件到sqlserver

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Book_BLL;
using Book_Model;
//Download by http://wwww.codefans.net
namespace BookShop
{
    public partial class frm_Book : Form
    {
        public frm_Book()
        {
            InitializeComponent();
        }

        private TreeNode root;
        private TreeNode tnode;
        private void CreateTree(DataSet tempds)
        {
            root=new TreeNode(“图书类别“);
            this.treeView1.Nodes.Add(root);
            for (int i = 0; i < tempds.Tables[0].Rows.Count; i++)
            {
                tnode=new TreeNode();
                tnode.Text = tempds.Tables[0].Rows[i][“Name“].ToString();
                tnode.Tag = tempds.Tables[0].Rows[i][“Id“].ToString();
                root.Nodes.Add(tnode);
            }
        }

        private DataSet ds;
        private BLL_BookType btype;
        private void GetBookType()
        {
            btype=new BLL_BookType();
            ds = btype.GetBookType();
            CreateTree(ds);
        }

        private void frm_Book_Load(object sender EventArgs e)
        {
            GetBookType();
            this.button1.Focus();
        }

        private BLL_Book book;
        private string typeid=““;
        private string order=“id“;
        private string pageindx = “1“;
        private void treeView1_AfterSelect(object sender TreeViewEventArgs e)
        {
            book=new BLL_Book();
            if (this.treeView1.SelectedNode.Tag != null)
            {
                typeid = this.treeView1.SelectedNode.Tag.ToString();
                order = “id“;
                pageindx = “1“;
                ds = book.GetBook(typeid order pageindx);
                this.dataGridView1.DataSource = ds.Tables[0];
                //获取总页数  并设置标志大小
                this.trackBar1.Minimum = 1;
                this.trackBar1.Maximum = book.GetBookPageByTypeId(typeid);
                this.trackBar1.Value = 1;
            }
        }

        public void SetBook(string booktypeidstring order)
        {
            pageindx = “1“;
            ds = book.GetBook(booktypeid order pageindx);
            this.dataGridView1.DataSource = ds.Tables[0];
        }

        private void button1_Click(object sender EventArgs e)
        {
            SetBook(typeid (sender as Button).Tag.ToString());
            this.trackBar1.Value = 1;
        }

        private void trackBar1_Scroll(object sender EventArgs e)
        {
            pageindx = this.trackBar1.Value.ToString();
            ds = book.GetBook(typeid order pageindx);
            this.dataGridView1.DataSource = ds.Tables[0];
        }

        private void textBox2_TextChanged(object sender EventArgs e)
        {

        }

        private void checkBox1_CheckedChanged(objec

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        236  2009-02-07 16:08  c#中简单三层架构实例\Demo\BookShop\BookShop\App.config

     文件      12086  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\7121024586.jpg

     文件      16384  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\7121025388.jpg

     文件      22200  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\7121028832.jpg

     文件      15122  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\7121032465.jpg

     文件       9482  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\7302075972.jpg

     文件      17737  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\7302108536.jpg

     文件      16767  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\7302114145.jpg

     文件      15593  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\83021085361111.jpg

     文件      10009  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787505384514.jpg

     文件      22292  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787505386365.jpg

     文件      16170  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787505387133.jpg

     文件      10470  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787505390195.jpg

     文件       9330  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787505391109.jpg

     文件       7338  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787505392328.jpg

     文件      22511  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787505393929.jpg

     文件      20178  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787505394193.jpg

     文件      15644  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787505396050.jpg

     文件      14917  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787505396159.jpg

     文件       8745  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787505397477.jpg

     文件      11842  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787505398245.jpg

     文件       7585  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787505398368.jpg

     文件       7612  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787505399570.jpg

     文件      18455  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787506022286.jpg

     文件      13337  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787506283205.jpg

     文件      17659  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787506283311.jpg

     文件      14691  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787508037295.jpg

     文件      13725  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787508037356.jpg

     文件      13058  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787508040516.jpg

     文件       6728  2009-02-07 16:01  c#中简单三层架构实例\Demo\BookShop\BookShop\bin\Debug\BookCovers\9787508308470.jpg

............此处省略230个文件信息

评论

共有 条评论