Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 public bool UpdateAuthor(Author author)
 {
     AuthorHandler myHandler = new AuthorHandler(); return myHandler.UpdateAuthor(author);
 }
Exemplo n.º 5
0
 public bool AddAuthor(Author author)
 {
     AuthorHandler myHandler = new AuthorHandler();
     return myHandler.InsertAthor(author);
 }
Exemplo n.º 6
0
        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;
        }
Exemplo n.º 7
0
 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);
 }
Exemplo n.º 8
0
        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;
        }
Exemplo n.º 9
0
 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);
 }