Exemplo n.º 1
0
        public static List <Model.bookModel> Getbook()
        {
            List <Model.bookModel> modelList = new List <Model.bookModel>();
            string        sql = "";
            SqlDataReader dr  = DbHepler.ExecuteReader(sql);

            while (dr.Read())
            {
                modelList.Add(new Model.bookModel()
                {
                    ID            = (int)dr["ID"],
                    bookName      = dr["bookName"].ToString(),
                    author        = dr["author"].ToString(),
                    publisher     = dr["publisher"].ToString(),
                    publisherDate = (DateTime)dr["publisherDate"],
                    price         = (decimal)dr["price"],
                    ISBN          = dr["ISBN"].ToString(),
                    pages         = (int)dr["pages"],
                    context       = dr["context"].ToString()
                });
            }

            DbHepler.Close();
            return(modelList);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 读取图书信息方法()
        /// </summary>
        /// <returns>查询到图书信息数据集合</returns>
        public static List <Model.Book> GetBooksInfor()
        {
            List <Model.Book> modelList = new List <Model.Book>();
            string            sql       = " select * from book";
            SqlDataReader     dr        = DbHepler.ExecuteReader(sql, System.Data.CommandType.Text);

            while (dr.Read())
            {
                modelList.Add(new Model.Book()
                {
                    Author     = dr["Author"].ToString(),
                    AuthorDesc = dr["AuthorDesc"].ToString(),
                    CategoryID = (int)dr["CategoryID"],
                    //  CategoryName = dr["CategoryName"].ToString(),
                    Clicks        = (int)dr["Clicks"],
                    ContentDesc   = dr["ContentDesc"].ToString(),
                    EditorComment = dr["EditorComment"].ToString(),
                    ID            = dr["ID"].ToString(),
                    ISBN          = dr["ISBN"].ToString(),
                    Price         = (decimal)dr["Price"],
                    PublishDate   = (DateTime)dr["PublishDate"],
                    PublisherID   = (int)dr["PublisherID"],
                    // PublisherName = dr["PublisherName"].ToString(),
                    State      = (int)dr["State"],
                    Title      = dr["Title"].ToString(),
                    TOC        = dr["TOC"].ToString(),
                    WordsCount = (int)dr["WordsCount"],
                });
            }
            DbHepler.Close();
            return(modelList);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 读取用户信息方法()
        /// </summary>
        /// <returns>读取到的用户信息数据集合</returns>
        public static List <Model.Customer> GetCustomerInfor()
        {
            List <Model.Customer> modelList = new List <Model.Customer>();
            string        sql = "  select * from Customer";
            SqlDataReader dr  = DbHepler.ExecuteReader(sql, System.Data.CommandType.Text);

            while (dr.Read())
            {
                modelList.Add(new Model.Customer()
                {
                    Answer       = dr["Answer"].ToString(),
                    State        = (int)dr["State"],
                    Question     = dr["Question"].ToString(),
                    Birthday     = (DateTime)dr["Birthday"],
                    CustomerName = dr["CustomerName"].ToString(),
                    Email        = dr["Email"].ToString(),
                    Gender       = dr["Gender"].ToString(),
                    ID           = dr["ID"].ToString(),
                    LastLogDate  = (DateTime)dr["LastLogDate"],
                    //LoginInfo = dr["LoginInfo"].ToString(),
                    LoginName = dr["LoginName"].ToString(),
                    Password  = dr["Password"].ToString(),
                    Phone     = dr["Phone"].ToString(),
                    QQMSN     = dr["QQMSN"].ToString(),
                });
            }
            DbHepler.Close();
            return(modelList);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取图书分类信息的方法
        /// </summary>
        /// <returns>得到图书分类信息的数据集合</returns>
        public static List <Model.Category> GetCategory()
        {
            List <Model.Category> category = new List <Model.Category>();
            string        sql = "  select * from Category";
            SqlDataReader dr  = DbHepler.ExecuteReader(sql, System.Data.CommandType.Text);

            while (dr.Read())
            {
                category.Add(new Model.Category()
                {
                    ID = (int)dr["ID"], CategoryName = dr["CategoryName"] as string, ParentID = 0, ParentName = "", Remark = dr["Remark"] as string, State = (int)dr["State"]
                });
            }
            DbHepler.Close();
            return(category);
        }
Exemplo n.º 5
0
        public static List <Model.Brand> GetBrand()
        {
            List <Model.Brand> modelList = new List <Model.Brand>();
            string             sql       = "";
            SqlDataReader      dr        = DbHepler.ExecuteReader(sql);

            while (dr.Read())
            {
                modelList.Add(new Model.Brand()
                {
                    ID        = (int)dr["ID"],
                    brandName = dr["brandName"].ToString(),
                });
            }
            DbHepler.Close();
            return(modelList);
        }
Exemplo n.º 6
0
        public static List <Model.typeSecondModel> GetSecond()
        {
            List <Model.typeSecondModel> modelList = new List <Model.typeSecondModel>();
            string        sql = "select * from typeSecond";
            SqlDataReader dr  = DbHepler.ExecuteReader(sql);

            while (dr.Read())
            {
                modelList.Add(new Model.typeSecondModel()
                {
                    ID         = (int)dr["ID"],
                    fsID       = (int)dr["fsID"],
                    secondType = dr["secondType"].ToString()
                });
            }
            DbHepler.Close();
            return(modelList);
        }
Exemplo n.º 7
0
        public static List <Model.Commodity> GetCommodity()
        {
            List <Model.Commodity> modelList = new List <Model.Commodity>();
            string        sql = "select *from Commodity";
            SqlDataReader dr  = DbHepler.ExecuteReader(sql);

            while (dr.Read())
            {
                modelList.Add(new Model.Commodity()
                {
                    ID              = (int)dr["ID"],
                    Name            = dr["Name"].ToString(),
                    Powersupplymode = dr["Powersupplymode"].ToString(),
                    Price           = (decimal)dr["Price"],
                });
            }
            DbHepler.Close();
            return(modelList);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 读取图书信息方法()
        /// </summary>
        /// <param name="pagenum">显示的条数</param>
        /// <param name="pageindex">当前页码</param>
        /// <returns>查询到图书信息数据集合</returns>
        public static List <Model.Book> BOOK(int pagenum, int pageindex, out int pagesCount)
        {
            List <Model.Book> modelList = new List <Model.Book>();

            SqlParameter [] P =
            {
                new SqlParameter("@pageIndex",      pageindex),
                new SqlParameter("@pageCount",      pagenum),
                new SqlParameter("@pageTotalCount", SqlDbType.Int),
            };
            P[2].Direction = ParameterDirection.Output;

            SqlDataReader dr = DbHepler.ExecuteReader("WY", System.Data.CommandType.StoredProcedure, P);

            pagesCount = Convert.ToInt32(P[2].Value);
            while (dr.Read())
            {
                modelList.Add(new Model.Book()
                {
                    Author     = dr["Author"].ToString(),
                    AuthorDesc = dr["AuthorDesc"].ToString(),
                    CategoryID = (int)dr["CategoryID"],
                    //  CategoryName = dr["CategoryName"].ToString(),
                    Clicks        = (int)dr["Clicks"],
                    ContentDesc   = dr["ContentDesc"].ToString(),
                    EditorComment = dr["EditorComment"].ToString(),
                    ID            = dr["ID"].ToString(),
                    ISBN          = dr["ISBN"].ToString(),
                    Price         = (decimal)dr["Price"],
                    PublishDate   = (DateTime)dr["PublishDate"],
                    PublisherID   = (int)dr["PublisherID"],
                    // PublisherName = dr["PublisherName"].ToString(),
                    State      = (int)dr["State"],
                    Title      = dr["Title"].ToString(),
                    TOC        = dr["TOC"].ToString(),
                    WordsCount = (int)dr["WordsCount"],
                });
            }

            DbHepler.Close();
            return(modelList);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 查询图书出版社信息方法()
        /// </summary>
        /// <returns>查找到出版社信息数据集合</returns>
        public static List <Model.Publisher> GetPublisher()
        {
            List <Model.Publisher> modelList = new List <Model.Publisher>();
            string        sql = "  select * from Publisher";
            SqlDataReader dr  = DbHepler.ExecuteReader(sql, System.Data.CommandType.Text);

            while (dr.Read())
            {
                modelList.Add(new Model.Publisher()
                {
                    ID            = (int)dr["ID"],
                    ImageUrl      = dr["ImageUrl"].ToString(),
                    PublisherName = dr["PublisherName"].ToString(),
                    Remark        = dr["Remark"].ToString(),
                    State         = (int)dr["State"],
                    WebUrl        = dr["WebUrl"].ToString(),
                });
            }
            DbHepler.Close();
            return(modelList);
        }