public List <AuthorPaintingCategories> GetAuthorPaintingCategoriesInList() { SqlConnection con = new SqlConnection(DBHelper.GetConnectionString()); if (con.State == System.Data.ConnectionState.Closed) { con.Open(); } string query = " Select paintingcategoryid,authorid From tblauthorpaintingcategories"; SqlCommand cmd = new SqlCommand(query, con); SqlDataReader reader = cmd.ExecuteReader(); List <AuthorPaintingCategories> lstauthorpaintingcategories = new List <AuthorPaintingCategories>(); while (reader.Read()) { AuthorPaintingCategories authorpaintingcategories = new AuthorPaintingCategories(); authorpaintingcategories.PaintingCategoryID = Convert.ToInt32(reader["paintingcategoryid"]); authorpaintingcategories.AuthorID = Convert.ToInt32(reader["authorid"]); lstauthorpaintingcategories.Add(authorpaintingcategories); } reader.Close(); if (con.State == System.Data.ConnectionState.Open) { con.Close(); } cmd.Dispose(); return(lstauthorpaintingcategories); }
public AuthorPaintingCategories GetAuthorPaintingCategoriesInObjectUsingID(AuthorPaintingCategories authorpaintingcategories) { SqlConnection con = new SqlConnection(DBHelper.GetConnectionString()); if (con.State == System.Data.ConnectionState.Closed) { con.Open(); } string query = " Select paintingcategoryid,authorid From tblauthorpaintingcategories where paintingcategoryid=" + authorpaintingcategories.PaintingCategoryID + ""; SqlCommand cmd = new SqlCommand(query, con); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { authorpaintingcategories.PaintingCategoryID = Convert.ToInt32(reader["paintingcategoryid"]); authorpaintingcategories.AuthorID = Convert.ToInt32(reader["authorid"]); } reader.Close(); if (con.State == System.Data.ConnectionState.Open) { con.Close(); } cmd.Dispose(); return(authorpaintingcategories); }
public System.Data.DataTable GetActiveAuthorPaintingCategoriesInDataTable(AuthorPaintingCategories authorpaintingcategories, string MatchWith) { SqlConnection con = new SqlConnection(DBHelper.GetConnectionString()); if (con.State == System.Data.ConnectionState.Closed) { con.Open(); } string query = " Select paintingcategoryid,authorid From tblauthorpaintingcategories "; switch (MatchWith.ToLower()) { case "paintingcategoryid": query += " where paintingcategoryid=" + authorpaintingcategories.PaintingCategoryID + " and Is_Active='true' "; break; case "authorid": query += " where authorid=" + authorpaintingcategories.AuthorID + " and Is_Active='true' "; break; } SqlDataAdapter da = new SqlDataAdapter(query, con); System.Data.DataTable tblauthorpaintingcategories = new System.Data.DataTable(); da.Fill(tblauthorpaintingcategories); if (con.State == System.Data.ConnectionState.Open) { con.Close(); } return(tblauthorpaintingcategories); }
public bool InsertUpdate(AuthorPaintingCategories authorpaintingcategories) { SqlConnection con = new SqlConnection(DBHelper.GetConnectionString()); if (con.State == System.Data.ConnectionState.Closed) { con.Open(); } string query = " select count(*) from tblAuthorPaintingCategories where paintingcategoryid=" + authorpaintingcategories.PaintingCategoryID + ""; SqlCommand cmd = new SqlCommand(query, con); int c = cmd.ExecuteScalar() == DBNull.Value?0:Convert.ToInt32(cmd.ExecuteScalar()); if (con.State == System.Data.ConnectionState.Open) { con.Close(); } cmd.Dispose(); return(c == 0?this.Insert(authorpaintingcategories):this.Update(authorpaintingcategories)); }
public bool Insert(AuthorPaintingCategories authorpaintingcategories) { SqlConnection con = new SqlConnection(DBHelper.GetConnectionString()); if (con.State == System.Data.ConnectionState.Closed) { con.Open(); } string query = " insert into tblAuthorPaintingCategories(paintingcategoryid,authorid)values(" + authorpaintingcategories.PaintingCategoryID + "," + authorpaintingcategories.AuthorID + ")"; SqlCommand cmd = new SqlCommand(query, con); cmd.ExecuteNonQuery(); if (con.State == System.Data.ConnectionState.Open) { con.Close(); } cmd.Dispose(); return(true); }
public bool Update(AuthorPaintingCategories authorpaintingcategories) { SqlConnection con = new SqlConnection(DBHelper.GetConnectionString()); if (con.State == System.Data.ConnectionState.Closed) { con.Open(); } string query = " update tblAuthorPaintingCategories set authorid=" + authorpaintingcategories.AuthorID + " where paintingcategoryid=" + authorpaintingcategories.PaintingCategoryID + ""; SqlCommand cmd = new SqlCommand(query, con); cmd.ExecuteNonQuery(); if (con.State == System.Data.ConnectionState.Open) { con.Close(); } cmd.Dispose(); return(true); }
public List <AuthorPaintingCategories> GetAuthorPaintingCategoriesInList(AuthorPaintingCategories authorpaintingcategories, string MatchWith) { string query = " Select paintingcategoryid,authorid From tblauthorpaintingcategories "; switch (MatchWith.ToLower()) { case "paintingcategoryid": query += " where paintingcategoryid=" + authorpaintingcategories.PaintingCategoryID + ""; break; case "authorid": query += " where authorid=" + authorpaintingcategories.AuthorID + ""; break; } SqlConnection con = new SqlConnection(DBHelper.GetConnectionString()); if (con.State == System.Data.ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand(query, con); SqlDataReader reader = cmd.ExecuteReader(); List <AuthorPaintingCategories> lstauthorpaintingcategories = new List <AuthorPaintingCategories>(); while (reader.Read()) { authorpaintingcategories = new AuthorPaintingCategories(); authorpaintingcategories.PaintingCategoryID = Convert.ToInt32(reader["paintingcategoryid"]); authorpaintingcategories.AuthorID = Convert.ToInt32(reader["authorid"]); lstauthorpaintingcategories.Add(authorpaintingcategories); } reader.Close(); if (con.State == System.Data.ConnectionState.Open) { con.Close(); } cmd.Dispose(); return(lstauthorpaintingcategories); }
public System.Data.DataTable GetAuthorPaintingCategoriesInDataTable(AuthorPaintingCategories authorpaintingcategories, string MatchWith) { return(new DAL.AuthorPaintingCategoriesDAL().GetAuthorPaintingCategoriesInDataTable(authorpaintingcategories, MatchWith)); }
///<summary> ///This Method will Get record of AuthorPaintingCategories From your database in a Single Object of Class AuthorPaintingCategories. ///Return Object if record Found other wise will throw an Execption of Type SQLExecption or return false in any other Problem ///Your are using Beta Version of Rapid Development (by Raees Ul Islam 0345-7294449 ///</summary> ///</param name=AuthorPaintingCategories>This is an Object of your Class AuthorPaintingCategories</param> public AuthorPaintingCategories GetAuthorPaintingCategoriesInObjectUsingID(AuthorPaintingCategories authorpaintingcategories) { return(new DAL.AuthorPaintingCategoriesDAL().GetAuthorPaintingCategoriesInObjectUsingID(authorpaintingcategories)); }
///<summary> ///This Method will Delete and record of AuthorPaintingCategories in your database. ///Return true when data will Delete to your Data base other wise will throw an Execption of Type SQLExecption or return false in any other Problem ///Your are using Beta Version of Rapid Development (by Raees Ul Islam 0345-7294449 ///</summary> ///</param name=AuthorPaintingCategories>This is an Object of your Class AuthorPaintingCategories</param> public bool Delete(AuthorPaintingCategories authorpaintingcategories) { return(new DAL.AuthorPaintingCategoriesDAL().Delete(authorpaintingcategories)); }
///<summary> ///This Method will insert and record of AuthorPaintingCategories in your database. ///Return true when data will insert to your Data base other wise will throw an Execption of Type SQLExecption or return false in any other Problem ///Your are using Beta Version of Rapid Development (by Raees Ul Islam 0345-7294449 ///</summary> ///</param name=AuthorPaintingCategories>This is an Object of your Class AuthorPaintingCategories</param> public bool Insert(AuthorPaintingCategories authorpaintingcategories) { return(new DAL.AuthorPaintingCategoriesDAL().Insert(authorpaintingcategories)); }
public List <AuthorPaintingCategories> GetAuthorPaintingCategoriesInList(AuthorPaintingCategories authorpaintingcategories, string MatchWith) { return(new DAL.AuthorPaintingCategoriesDAL().GetAuthorPaintingCategoriesInList(authorpaintingcategories, MatchWith)); }