Exemplo n.º 1
0
        public long Add(Book book)
        {
            var sql =
                @"insert into Books(ISBN, Name, InDate, Price, Pinyin, BuyFrom, Remark, 
         TotalCount, AvailableCount, Publisher, Author) 
values (@ISBN, @Name, @InDate, @Price, @Pinyin, @BuyFrom, @Remark, 
        @TotalCount, @AvailableCount, @Publisher, @Author)";
            var paras = new SQLiteParameter[] {
                new SQLiteParameter("@ISBN", book.ISBN),
                new SQLiteParameter("@Name", book.Name),
                new SQLiteParameter("@InDate", book.InDate),
                new SQLiteParameter("@Price", book.Price),
                new SQLiteParameter("@Pinyin", book.Pinyin),
                new SQLiteParameter("@BuyFrom", book.BuyFrom),
                new SQLiteParameter("@Remark", book.Remark),
                new SQLiteParameter("@TotalCount", book.TotalCount),
                new SQLiteParameter("@AvailableCount", book.AvailableCount),
                new SQLiteParameter("@Publisher", book.Publisher),
                new SQLiteParameter("@Author", book.Author),
            };
            var rowid = _helper.ExecuteInsert(sql, paras);

            book.Id = rowid;
            Cache.Set <Book>(book);
            return(rowid);
        }
Exemplo n.º 2
0
        public long Add(Rent rent)
        {
            var sql   = @"insert into Rents(PersonId, BookId, StartDate, EndDate, Count) 
values (@PersonId, @BookId, @StartDate, @EndDate, @Count)";
            var paras = new SQLiteParameter[] {
                new SQLiteParameter("@PersonId", rent.Person.Id),
                new SQLiteParameter("@BookId", rent.Book.Id),
                new SQLiteParameter("@StartDate", rent.StartDate),
                new SQLiteParameter("@EndDate", rent.EndDate),
                new SQLiteParameter("@Count", rent.Count),
            };

            return(_helper.ExecuteInsert(sql, paras));
        }
Exemplo n.º 3
0
        public long Add(Person person)
        {
            var sql =
                @"insert into Persons(Name, Sex, StartDate, EndDate, Fee, Deposit, PhoneNo, Pinyin, Contacter, Remark) 
values (@Name, @Sex, @StartDate, @EndDate, @Fee, @Deposit, @PhoneNo, @Pinyin, @Contacter, @Remark)";
            var paras = new SQLiteParameter[] {
                new SQLiteParameter("@Name", person.Name),
                new SQLiteParameter("@Sex", person.Sex),
                new SQLiteParameter("@StartDate", person.StartDate),
                new SQLiteParameter("@EndDate", person.EndDate),
                new SQLiteParameter("@Fee", person.Fee),
                new SQLiteParameter("@Deposit", person.Deposit),
                new SQLiteParameter("@PhoneNo", person.PhoneNo),
                new SQLiteParameter("@Pinyin", person.Pinyin),
                new SQLiteParameter("@Contacter", person.Contacter),
                new SQLiteParameter("@Remark", person.Remark),
            };
            var rowid = _helper.ExecuteInsert(sql, paras);

            person.Id = rowid;
            Cache.Set <Person>(person);
            return(rowid);
        }