public static ObservableCollection <AddedBook> GetAllListAddedBook(int id)
        {
            ObservableCollection <AddedBook> result = null;

            try
            {
                var reader = DataConnector.ExecuteQuery("select MaPhieuNhap,MaSach,SoLuong from ChiTietPhieuNhap where MaPhieuNhap = " + id);
                if (reader != null)
                {
                    result = new ObservableCollection <AddedBook>();
                    while (reader.Read())
                    {
                        var ID   = reader.GetInt32(0);
                        var item = new AddedBook(ID);
                        item.BeginInit();
                        item.Book   = BookAdapter.GetBook(reader.GetInt32(1));
                        item.Number = reader.GetInt32(2);
                        item.EndInit();
                        result.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorManager.Current.DataCantBeRead.Call(ex.Message);
            }
            return(result);
        }
        public static ObservableCollection <BillItem> GetBillItems(int billid)
        {
            ObservableCollection <BillItem> result = null;

            try
            {
                var reader = DataConnector.ExecuteQuery("select MaSach, SoLuong, DonGia from ChiTietHoaDon where MaHoaDon = " + billid);
                if (reader != null)
                {
                    result = new ObservableCollection <BillItem>();
                    while (reader.Read())
                    {
                        var item = new BillItem(BookAdapter.GetBook(reader.GetInt32(0)), reader.GetInt32(1), reader.GetInt32(2));
                        result.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorManager.Current.DataCantBeRead.Call(ex.Message);
            }
            return(result);
        }
        public static ObservableCollection <BillItem> GetAllBeforeDate(DateTime date)
        {
            ObservableCollection <BillItem> result = null;

            try
            {
                var reader = DataConnector.ExecuteQuery(string.Format("select ct.MaSach, ct.SoLuong, ct.DonGia from ChiTietHoaDon ct, HoaDon hd where ct.MaHoaDon = hd.MaHoaDon and DATEDIFF(day, '{0}', hd.NgayLap) <= 0", date));
                if (reader != null)
                {
                    result = new ObservableCollection <BillItem>();
                    while (reader.Read())
                    {
                        var item = new BillItem(BookAdapter.GetBook(reader.GetInt32(0)), reader.GetInt32(1), reader.GetInt32(2));
                        result.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorManager.Current.DataCantBeRead.Call(ex.Message);
            }
            return(result);
        }