public List<SearchBookResultDTO> SearchAdvanceBooks(SearchBookDTO dto, int sRow, int eRow) { string param1 = GetParamInfor(dto.Field1, dto.Type1, dto.Info1); string param2 = dto.Ano1 + " " + GetParamInfor(dto.Field2, dto.Type2, dto.Info2); string param3 = dto.Ano2 + " " + GetParamInfor(dto.Field3, dto.Type3, dto.Info3); List<SearchBookResultDTO> listResult = new List<SearchBookResultDTO>(); SearchBookResultDTO resultDto; try { SqlDataReader reader = ConnectionManager.GetCommand("sp0001advance", new Dictionary<string, SqlDbType>() { {"@param1",SqlDbType.NVarChar}, {"@param2",SqlDbType.NVarChar}, {"@param3",SqlDbType.NVarChar}, {"@sRow",SqlDbType.NVarChar}, {"@eRow",SqlDbType.NVarChar} }, new List<object>() { param1, param2, param3, sRow.ToString(), eRow.ToString() }). ExecuteReader(); while(reader.Read()) { resultDto = new SearchBookResultDTO(); resultDto.ISBN = reader["ISBN"].ToString(); resultDto.AuthorName = reader["AuthorName"].ToString(); resultDto.CategoryName = reader["CategoryName"].ToString(); resultDto.Image = reader["Image"].ToString(); resultDto.PublisherName = reader["PublisherName"].ToString(); resultDto.Title = reader["Title"].ToString(); resultDto.ShortDescription = reader["ShortDescription"].ToString(); resultDto.No = int.Parse(reader["No"].ToString()); listResult.Add(resultDto); } //int count = result.Rows.Count; reader.Close(); } catch (Exception e) { Log.Logger.Error("Error at SearchBookDAO - SearchAdvanceBooks", e); return null; } return listResult; }
public void EditCatalogue(SearchBookResultDTO dto) { Saved = false; EditCatalogueForm editCatalogueForm = new EditCatalogueForm(this, dto.ISBN); editCatalogueForm.ShowDialog(); if (Saved) { dto.ISBN = ReturnCatalogue.ISBN; dto.Title = ReturnCatalogue.Title; dto.ShortDescription = ReturnCatalogue.ShortDescription; dto.AuthorName = ReturnCatalogue.Authors; dto.CategoryName = ReturnCatalogue.Category.CategoryName; dto.PublisherName = ReturnCatalogue.Publisher.PublisherName; dto.Image = ReturnCatalogue.Image; } }
public List<SearchBookResultDTO> SearchDetailBooks(string title, string categoryId, string shortdesc, string authorname, int sRow, int eRow) { List<SearchBookResultDTO> listResult = new List<SearchBookResultDTO>(); SearchBookResultDTO resultDto; try { SqlDataReader reader = ConnectionManager.GetCommand("sp0001detail", new Dictionary<string, SqlDbType>() { {"@title", SqlDbType.NVarChar}, {"@categoryId", SqlDbType.NVarChar}, {"@shortdescription", SqlDbType.NVarChar}, {"@authorname", SqlDbType.NVarChar}, {"@rowStart", SqlDbType.Int}, {"@rowEnd", SqlDbType.Int} }, new List<object>() { title, categoryId, shortdesc, authorname, sRow, eRow }). ExecuteReader(); while (reader.Read()) { resultDto = new SearchBookResultDTO(); resultDto.ISBN = reader["ISBN"].ToString(); resultDto.AuthorName = reader["AuthorName"].ToString(); resultDto.CategoryName = reader["CategoryName"].ToString(); resultDto.Image = reader["Image"].ToString(); resultDto.PublisherName = reader["PublisherName"].ToString(); resultDto.Title = reader["Title"].ToString(); resultDto.ShortDescription = reader["ShortDescription"].ToString(); resultDto.No = int.Parse(reader["No"].ToString()); listResult.Add(resultDto); } reader.Close(); } catch (Exception e) { Log.Error("Error at SearchBooksDAO - SearchDetailBooks", e); return null; } return listResult; }