Esempio n. 1
0
        //更新图书馆信息
        public bool SetLibraryInfo(LibraryInfo l)
        {
            StringBuilder sql = new StringBuilder();


            Dictionary <string, string> values = new Dictionary <string, string>();



            sql.Append(@"UPDATE [dbo].[tb_library]
                       SET [libraryName] = @libraryName
                          ,[curator]=@curator
                          ,[tel]=@tel
                          ,[address]=@address
                          ,[email]=@email
                          ,[net] =@net
                          ,[upbuildTime]=@upbuildTime
                          ,[remark]=@remark");

            values.Add("@libraryName", l.libraryName);
            values.Add("@curator", l.curator);
            values.Add("@tel", l.tel);
            values.Add("@address", l.address);
            values.Add("@email", l.email);
            values.Add("@net", l.net);
            values.Add("@upbuildTime", l.upbuildTime);
            values.Add("@remark", l.remark);
            return(BookInfoService.UpBookInfo(sql.ToString(), values));
        }
Esempio n. 2
0
        public static bool UpbookInfo(BookInfo bookInfo)
        {
            StringBuilder sql = new StringBuilder();


            Dictionary <string, string> values = new Dictionary <string, string>();


            sql.Append(@"UPDATE [dbo].[tb_bookInfo] SET
            [bookName] = @bookName ,
            [bookType] = @bookType,
            [bookcase] = @bookCase,
            [bookConcern] = @bookConcern,
            [author] = @bookAuthor,
            [price] = @bookPrice,
            [borrowSum] = @readNum
             WHERE[bookBarCode] = @bookBarCode ");

            values.Add("@bookName", bookInfo.BookName);
            values.Add("@bookType", bookInfo.Book_Type.typeID.ToString());
            values.Add("@bookCase", bookInfo.Book_Case.bookcaseID.ToString());
            values.Add("@bookConcern", bookInfo.BookConcern);
            values.Add("@bookAuthor", bookInfo.Author);
            values.Add("@bookPrice", bookInfo.Price.ToString());
            values.Add("@readNum", bookInfo.BorrowSum.ToString());
            values.Add("@bookBarCode", bookInfo.BookBarCode);
            return(BookInfoService.UpBookInfo(sql.ToString(), values));
        }
Esempio n. 3
0
        public static bool DeletebookInfo(BookInfo bookInfo)
        {
            StringBuilder sql = new StringBuilder();

            Dictionary <string, string> values = new Dictionary <string, string>();

            sql.Append(@"DELETE FROM [dbo].[tb_bookInfo]
                         WHERE [bookBarCode]=@bookBarCode");
            values.Add("@bookBarCode", bookInfo.BookBarCode);
            return(BookInfoService.UpBookInfo(sql.ToString(), values));
        }
Esempio n. 4
0
        /// <summary>
        /// 删除图书位置对象
        /// </summary>
        /// <param name="bookType">位置对象</param>
        /// <returns>修改结果 bool</returns>
        public static bool DeletebookCase(BookCase bookCase)
        {
            StringBuilder sql = new StringBuilder();

            Dictionary <string, string> values = new Dictionary <string, string>();

            sql.Append(@"DELETE FROM [dbo].[tb_bookcase]
                                WHERE [bookcaseID]=@id");
            values.Add("@id", bookCase.bookcaseID.ToString());
            return(BookInfoService.UpBookInfo(sql.ToString(), values));
        }
Esempio n. 5
0
        /// <summary>
        /// 增加图书位置对象
        /// </summary>
        /// <param name="bookType">位置对象</param>
        /// <returns>修改结果 bool</returns>
        public static bool AddbookCase(BookCase bookCase)
        {
            StringBuilder sql = new StringBuilder();

            Dictionary <string, string> values = new Dictionary <string, string>();

            sql.Append(@"INSERT INTO [dbo].[tb_bookcase]
                               ([bookcaseName])
                                VALUES
                               (@name)");
            values.Add("@name", bookCase.bookcaseName);
            return(BookInfoService.UpBookInfo(sql.ToString(), values));
        }
Esempio n. 6
0
        //图书的位置对象操作



        /// <summary>
        /// 修改图书位置对象
        /// </summary>
        /// <param name="bookType">修改位置对象</param>
        /// <returns>修改结果 bool</returns>
        public static bool UpbookCase(BookCase bookCase)
        {
            StringBuilder sql = new StringBuilder();


            Dictionary <string, string> values = new Dictionary <string, string>();

            sql.Append(@"UPDATE [dbo].[tb_bookcase]
                           SET [bookcaseName] =@name
                         WHERE [bookcaseID]=@id");
            values.Add("@name", bookCase.bookcaseName);
            values.Add("@id", bookCase.bookcaseID.ToString());
            return(BookInfoService.UpBookInfo(sql.ToString(), values));
        }
Esempio n. 7
0
        /// <summary>
        /// 修改某种类图书的种类
        /// </summary>
        /// <param name="ObookType">要修改的种类</param>
        /// <param name="NType">修改成的种类</param>
        /// <returns>= 修改的结果bool</returns>
        public static bool ExcbookType(int OTypeid, int NTypeid)
        {
            StringBuilder sql = new StringBuilder();


            Dictionary <string, string> values = new Dictionary <string, string>();


            sql.Append(@"UPDATE [dbo].[tb_bookInfo]
   SET  [bookType] =@ntypeid
 WHERE  [bookType] =@otypeid");
            values.Add("@otypeid", OTypeid.ToString());
            values.Add("@ntypeid", NTypeid.ToString());
            return(BookInfoService.UpBookInfo(sql.ToString(), values));
        }
Esempio n. 8
0
        //图书类型管理操作

        /// <summary>
        /// 修改图书类型对象
        /// </summary>
        /// <param name="bookType">修改类型对象</param>
        /// <returns>修改结果 bool</returns>
        public static bool UpbookType(BookType bookType)
        {
            StringBuilder sql = new StringBuilder();


            Dictionary <string, string> values = new Dictionary <string, string>();


            sql.Append(@"UPDATE [dbo].[tb_bookType]
                           SET [typeName] = @booktypeName
                              ,[borrowDay] =@readday
                               WHERE [typeID]=@typeid");
            values.Add("@booktypeName", bookType.typeName);
            values.Add("@readday", bookType.borrowDay.ToString());
            values.Add("@typeid", bookType.typeID.ToString());

            return(BookInfoService.UpBookInfo(sql.ToString(), values));
        }
Esempio n. 9
0
        public static bool AddbookType(BookType bookType)
        {
            StringBuilder sql = new StringBuilder();


            Dictionary <string, string> values = new Dictionary <string, string>();


            sql.Append(@"INSERT INTO [dbo].[tb_bookType]
                           ([typeName]
                           ,[borrowDay])
                            VALUES
                           (@booktypeName ,@readday)");
            values.Add("@booktypeName", bookType.typeName);
            values.Add("@readday", bookType.borrowDay.ToString());

            return(BookInfoService.UpBookInfo(sql.ToString(), values));
        }
Esempio n. 10
0
        /// <summary>
        /// 删除的图书类型对象
        /// </summary>
        /// <param name="bookType">所修改的图书对象</param>
        /// <param name="ExchangebookType">修改图书要转换的类型对象</param>
        /// <returns></returns>
        public static bool DeletebookType(BookType bookType)
        {
            StringBuilder sql = new StringBuilder();

            Dictionary <string, string> values = new Dictionary <string, string>();

            try
            {
                sql.Append(@"DELETE FROM [dbo].[tb_bookType]
                         WHERE [typeID]=@typeid");
                values.Add("@typeid", bookType.typeID.ToString());
            }
            catch (Exception)
            {
                throw;
            }

            return(BookInfoService.UpBookInfo(sql.ToString(), values));
        }
Esempio n. 11
0
        public static bool AddbookInfo(BookInfo bookInfo)
        {
            StringBuilder sql = new StringBuilder();



            Dictionary <string, string> values = new Dictionary <string, string>();


            sql.Append(@"INSERT INTO [dbo].[tb_bookInfo]
           ([bookBarCode]
           ,[bookName]
           ,[bookType]
           ,[bookcase]
           ,[bookConcern]
           ,[author]
           ,[price]
           ,[borrowSum])
     VALUES
           (@bookBarCode
           ,@bookName
           ,@bookType
           ,@bookCase
           ,@bookConcern
           ,@bookAuthor
           ,@bookPrice
           ,@readNum)");

            values.Add("@bookName", bookInfo.BookName);
            values.Add("@bookType", bookInfo.Book_Type.typeID.ToString());
            values.Add("@bookCase", bookInfo.Book_Case.bookcaseID.ToString());
            values.Add("@bookConcern", bookInfo.BookConcern);
            values.Add("@bookAuthor", bookInfo.Author);
            values.Add("@bookPrice", bookInfo.Price.ToString());
            values.Add("@readNum", bookInfo.BorrowSum.ToString());
            values.Add("@bookBarCode", bookInfo.BookBarCode);
            return(BookInfoService.UpBookInfo(sql.ToString(), values));
        }
Esempio n. 12
0
        public List <WCFBook> GetCatalogContent(string ID)
        {
            try
            {
                List <string> files = CatalogService.Instance.CatalogRepository
                                      .Where(p => p.IsShared && p.CatalogFilePath == ID)
                                      .SelectMany(p => p.BookInfoFilePath).ToList();

                List <WCFBook> books = new List <WCFBook>();

                BookInfoService srv = new BookInfoService();
                foreach (string file in files)
                {
                    books.Add(srv.LoadBookInfoSimple(file));
                }

                return(books);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 13
0
 public BookInfoController()
 {
     _BookInfoService = new BookInfoService();
 }