private static DBBuild GetBuildInfoFromDB(uint build) { var dbBuild = new DBBuild(); if (!File.Exists("connectionstring.txt")) { #if DEBUG Console.WriteLine("connectionstring.txt not found! Need this for build lookup, using hardcoded build."); dbBuild.version = "9.0.1.35078"; dbBuild.expansion = 9; dbBuild.major = 1; dbBuild.minor = 0; dbBuild.build = 38312; return(dbBuild); #else throw new Exception("connectionstring.txt not found! Need this for build lookup."); #endif } using (var connection = new MySqlConnection(File.ReadAllText("connectionstring.txt"))) { connection.Open(); using (var buildCmd = new MySqlCommand("SELECT version, expansion, major, minor, build FROM casc.wow_builds WHERE build = @build", connection)) { buildCmd.Parameters.AddWithValue("build", build); using (var reader = buildCmd.ExecuteReader()) { if (!reader.HasRows) { throw new Exception("Build " + build + " not found in DB!"); } while (reader.Read()) { dbBuild.version = reader.GetString(0); dbBuild.expansion = reader.GetInt16(1); dbBuild.major = reader.GetInt16(2); dbBuild.minor = reader.GetInt16(3); dbBuild.build = reader.GetInt32(4); } } } } return(dbBuild); }
// GET: Home public ActionResult Article(string id) { DBBuild CreateDB = new DBBuild(); // Database Create et. //CreateDB.InsertTest(); try { if (Session["LoginUser"] != null) { Login login = (Login)Session["LoginUser"]; User user = login.user; ViewBag.FullName = user.userFirstName + " " + user.userLastName; } } catch (Exception) { } BLLRepository <Article> rep_Artc = new BLLRepository <Article>(); // ViewBag.ArticleDetail = rep_Artc.List(x => x.category.categoryName == id); return(View("Index", rep_Artc.List(x => x.category.categoryName == id))); }