public List<Author> AuthorGlobalSearch(string query) { List<Author> AuthorList = null; SqlParameter[] Params = new SqlParameter[] { new SqlParameter("@Search", query) ///SEARCH }; using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("sp_AuthorGlobalSearch", CommandType.StoredProcedure, Params)) { if (table.Rows.Count > 0) { AuthorList = new List<Author>(); foreach (DataRow row in table.Rows) { Author author = new Author(); author.AuthorID = Convert.ToInt32(row["AuthorID"]); author.Name = row["Name"].ToString(); author.Surname = row["Surname"].ToString(); AuthorList.Add(author); } } } return AuthorList; }
public Author GetAuthorDetails(int AuthorID) { Author author = null; SqlParameter[] Params = { new SqlParameter("@AuthorID", AuthorID) }; using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("sp_ViewSpecificAuthor", CommandType.StoredProcedure, Params)) { if (table.Rows.Count == 1) { DataRow row = table.Rows[0]; author = new Author(); //author.AuthorID = Convert.ToInt32(row["AuthorID"]); author.Name = row["Name"].ToString(); author.Surname = row["Surname"].ToString(); } } return author; }
public List<Author> CheckDuplicateAuthor(string name, string surname) { List<Author> authorList = null; SqlParameter[] Params = { new SqlParameter("@Name", name), new SqlParameter("@Surname", surname) }; using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("sp_CheckDuplicateAuthor", CommandType.StoredProcedure, Params)) { if (table.Rows.Count > 0) { authorList = new List<Author>(); foreach (DataRow row in table.Rows) { Author author = new Author(); author.Name = row["Name"].ToString(); author.Surname = row["Surname"].ToString(); authorList.Add(author); } } } return authorList; }
public bool UpdateAuthor(Author author) { AuthorHandler myHandler = new AuthorHandler(); return myHandler.UpdateAuthor(author); }
public bool AddAuthor(Author author) { AuthorHandler myHandler = new AuthorHandler(); return myHandler.InsertAthor(author); }
public List<Author> GetAuthorList() { List<Author> AuthorList = null; using (DataTable table = DataProvider.ExecuteSelectCommand("sp_ViewAllAuthors", CommandType.StoredProcedure)) { if (table.Rows.Count > 0) { AuthorList = new List<Author>(); foreach (DataRow row in table.Rows) { Author author = new Author(); author.AuthorID = Convert.ToInt32(row["AuthorID"]); author.Name = row["FullName"].ToString(); AuthorList.Add(author); } } } return AuthorList; }
public bool UpdateAuthor(Author author) { SqlParameter[] Params = new SqlParameter[] { new SqlParameter("@AuthorID", author.AuthorID), new SqlParameter("@Name", author.Name ), new SqlParameter("@Surname", author.Surname), }; return DataProvider.ExecuteNonQuery("sp_UpdateAuthor", CommandType.StoredProcedure, Params); }
public Author SearchAuthor(string Query) { Author author = null; SqlParameter[] Params = new SqlParameter[] { new SqlParameter("@Name", Query) ///SEARCH }; using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("uspSearchAuthor", CommandType.StoredProcedure, Params)) { if (table.Rows.Count == 1) { DataRow row = table.Rows[0]; author = new Author(); author.AuthorID = Convert.ToInt32(row["AuthorID"]); author.Name = row["Name"].ToString(); author.Surname = row["Surname"].ToString(); } } return author; }
public bool InsertAthor(Author author) { SqlParameter[] Params = new SqlParameter[] { new SqlParameter("@name", author.Name ), new SqlParameter("@surname", author.Surname), }; return DataProvider.ExecuteNonQuery("sp_InsertAuthor", CommandType.StoredProcedure, Params); }