public LibraryClassification GetLibraryClassThree(int classId, string userID) { LibraryClassification retVal = new LibraryClassification(); MySqlConnection con = new MySqlConnection(DbCon.connectionString); string sqlInsert = "SELECT `id`, `classoneid`, `classtwoid`, `code`, `title`, `active` FROM `libraryclassthree` WHERE `id` = @classId "; MySqlDataReader dr = null; MySqlCommand cmd; con.Open(); cmd = new MySqlCommand(sqlInsert, con); cmd.Parameters.AddWithValue("@classId", classId); dr = cmd.ExecuteReader(); while (dr.Read()) //iterate through the records in the result dataset { LibraryClassification Mod = new LibraryClassification(); Mod.ID = dr.GetInt32(0); Mod.IDclassOne = dr.GetInt32(1); Mod.IDclassTwo = dr.GetInt32(2); Mod.CodeStack = dr.GetString(3); Mod.TitleStack = dr.GetString(4) + " ( " + dr.GetString(3) + " )"; Mod.Active = dr.GetInt32(5); //retVal.Add(Mod); } con.Close(); return(retVal); }
public List <LibraryClassification> GetAllLibraryClassification(string userID) { List <LibraryClassification> retVal = new List <LibraryClassification>(); MySqlConnection con = new MySqlConnection(DbCon.connectionString); string sqlInsert = "SELECT libraryclassone.id,libraryclassone.`code`,libraryclassone.title,libraryclasstwo.id,libraryclasstwo.`code`,libraryclasstwo.title,libraryclassthree.id,libraryclassthree.`code`,libraryclassthree.title FROM libraryclassone INNER JOIN libraryclasstwo ON libraryclassone.id = libraryclasstwo.classoneid INNER JOIN libraryclassthree ON libraryclasstwo.id = libraryclassthree.classtwoid WHERE libraryclassone.active = 1 AND libraryclasstwo.active = 1 AND libraryclassthree.active = 1 ORDER BY libraryclassone.id "; MySqlDataReader dr = null; MySqlCommand cmd; con.Open(); cmd = new MySqlCommand(sqlInsert, con); //cmd.Parameters.AddWithValue("@active", Active); dr = cmd.ExecuteReader(); while (dr.Read()) //iterate through the records in the result dataset { LibraryClassification Mod = new LibraryClassification(); Mod.ID = dr.GetInt32(0); Mod.CodeBlock = dr.GetString(1); Mod.TitleBlock = dr.GetString(2) + " ( " + dr.GetString(1) + " )"; Mod.IDclassTwo = dr.GetInt32(3); Mod.CodeShelve = dr.GetString(4); Mod.TitleShelve = dr.GetString(5) + " ( " + dr.GetString(4) + " )"; Mod.IDclassThree = dr.GetInt32(6); Mod.CodeStack = dr.GetString(7); Mod.TitleStack = dr.GetString(8) + " ( " + dr.GetString(7) + " )"; retVal.Add(Mod); } con.Close(); return(retVal); }
public List <LibraryClassification> GetAllLibraryClassTwo(int Active, string userID) { List <LibraryClassification> retVal = new List <LibraryClassification>(); MySqlConnection con = new MySqlConnection(DbCon.connectionString); string sqlInsert = "SELECT `id`, `classoneid`, `code`, `title`, `active` FROM `libraryclasstwo` WHERE `active` = @active "; MySqlDataReader dr = null; MySqlCommand cmd; con.Open(); cmd = new MySqlCommand(sqlInsert, con); cmd.Parameters.AddWithValue("@active", Active); dr = cmd.ExecuteReader(); while (dr.Read()) //iterate through the records in the result dataset { LibraryClassification Mod = new LibraryClassification(); Mod.ID = dr.GetInt32(0); Mod.IDclassOne = dr.GetInt32(1); Mod.CodeShelve = dr.GetString(2); Mod.TitleShelve = dr.GetString(3) + " ( " + dr.GetString(2) + " )"; Mod.Active = dr.GetInt32(4); retVal.Add(Mod); } con.Close(); return(retVal); }