public Root Parse(string filename) { XmlDocument doc = new XmlDocument(); doc.Load(filename); XmlNode elRoot, elSodium, elOverall, elRing, elGlass, elCharge, elCut, elSquad, elSubstitute; elRoot = doc.DocumentElement.SelectSingleNode("/root"); elSodium = doc.DocumentElement.SelectSingleNode("/root/sodium"); elOverall = doc.DocumentElement.SelectSingleNode("/root/overall"); elRing = doc.DocumentElement.SelectSingleNode("/root/ring"); elGlass = doc.DocumentElement.SelectSingleNode("/root/glass"); elCharge = doc.DocumentElement.SelectSingleNode("/root/charge"); elCut = doc.DocumentElement.SelectSingleNode("/root/cut"); elSquad = doc.DocumentElement.SelectSingleNode("/root/squad"); elSubstitute = doc.DocumentElement.SelectSingleNode("/root/substitute"); XmlNodeList elExcitementList, elStepList; string innerText; string prove, skin, philosophy, leftovers, oil, horse, riot; prove = elSodium.Attributes["prove"].InnerText.ToString(); skin = elSodium.Attributes["skin"].InnerText.ToString(); philosophy = elSodium.Attributes["philosophy"].InnerText.ToString(); leftovers = elSodium.Attributes["leftovers"].InnerText.ToString(); oil = elSodium.Attributes["oil"].InnerText.ToString(); horse = elSodium.Attributes["horse"].InnerText.ToString(); riot = elSodium.Attributes["riot"].InnerText.ToString(); elStepList = elSodium.ChildNodes; List <Step> listOfSteps = new List <Step>(); List <Excitement> listOfExcitements; Step step; Excitement excitement; string affect, sell, prince, current, discuss, still; string treatment, sniff, constraint, trouble, mail, juice; foreach (XmlNode item in elStepList) { affect = item.Attributes["affect"].InnerText.ToString(); sell = item.Attributes["sell"].InnerText.ToString(); prince = item.Attributes["prince"].InnerText.ToString(); current = item.Attributes["current"].InnerText.ToString(); discuss = item.Attributes["discuss"].InnerText.ToString(); still = item.Attributes["still"].InnerText.ToString(); elExcitementList = item.ChildNodes; listOfExcitements = new List <Excitement>(); foreach (XmlNode item2 in elExcitementList) { treatment = item2.Attributes["treatment"].InnerText.ToString(); sniff = item2.Attributes["sniff"].InnerText.ToString(); constraint = item2.Attributes["constraint"].InnerText.ToString(); trouble = item2.Attributes["trouble"].InnerText.ToString(); mail = item2.Attributes["mail"].InnerText.ToString(); juice = item2.Attributes["juice"].InnerText.ToString(); innerText = item2.InnerText.ToString(); excitement = new Excitement(treatment, sniff, constraint, trouble, mail, juice, innerText); listOfExcitements.Add(excitement); } step = new Step(affect, sell, prince, current, discuss, still, listOfExcitements); listOfSteps.Add(step); } Sodium sodiumCl = new Sodium(prove, skin, philosophy, leftovers, oil, horse, riot, listOfSteps); XmlNodeList elFlowerList, elChemistryList; string moment, audience, glass, dragon, tape, carbon, servant; moment = elOverall.Attributes["moment"].InnerText.ToString(); audience = elOverall.Attributes["audience"].InnerText.ToString(); glass = elOverall.Attributes["glass"].InnerText.ToString(); dragon = elOverall.Attributes["dragon"].InnerText.ToString(); tape = elOverall.Attributes["tape"].InnerText.ToString(); carbon = elOverall.Attributes["carbon"].InnerText.ToString(); servant = elOverall.Attributes["servant"].InnerText.ToString(); elChemistryList = elOverall.ChildNodes; List <Chemistry> listOfChemistries = new List <Chemistry>(); List <Flower> listOfFlowers; Chemistry chemistry; Flower flower; string limited; string submit, opposite, wilderness, transport, circumstance; foreach (XmlNode item in elChemistryList) { limited = item.Attributes["limited"].InnerText.ToString(); elFlowerList = item.ChildNodes; listOfFlowers = new List <Flower>(); foreach (XmlNode item2 in elFlowerList) { submit = item2.Attributes["submit"].InnerText.ToString(); opposite = item2.Attributes["opposite"].InnerText.ToString(); wilderness = item2.Attributes["wilderness"].InnerText.ToString(); transport = item2.Attributes["transport"].InnerText.ToString(); circumstance = item2.Attributes["circumstance"].InnerText.ToString(); innerText = item2.InnerText.ToString(); flower = new Flower(submit, opposite, wilderness, transport, circumstance, innerText); listOfFlowers.Add(flower); } chemistry = new Chemistry(limited, listOfFlowers); listOfChemistries.Add(chemistry); } Overall overallCl = new Overall(moment, audience, glass, dragon, tape, carbon, servant, listOfChemistries); XmlNodeList elAmbiguityList, elFolkList; string spirit, mist, unit, worker, offence, echo; spirit = elRing.Attributes["spirit"].InnerText.ToString(); mist = elRing.Attributes["mist"].InnerText.ToString(); submit = elRing.Attributes["submit"].InnerText.ToString(); unit = elRing.Attributes["unit"].InnerText.ToString(); worker = elRing.Attributes["worker"].InnerText.ToString(); offence = elRing.Attributes["offence"].InnerText.ToString(); echo = elRing.Attributes["echo"].InnerText.ToString(); elFolkList = elRing.ChildNodes; List <Folk> listOfFolks = new List <Folk>(); List <Ambiguity> listOfAmbiguities; Folk folk; Ambiguity ambiguity; string divide, muscle, devote, position, call; string writer, activity, lead; foreach (XmlNode item in elFolkList) { divide = item.Attributes["divide"].InnerText.ToString(); muscle = item.Attributes["muscle"].InnerText.ToString(); devote = item.Attributes["devote"].InnerText.ToString(); position = item.Attributes["position"].InnerText.ToString(); call = item.Attributes["call"].InnerText.ToString(); elAmbiguityList = item.ChildNodes; listOfAmbiguities = new List <Ambiguity>(); foreach (XmlNode item2 in elAmbiguityList) { writer = item2.Attributes["writer"].InnerText.ToString(); activity = item2.Attributes["activity"].InnerText.ToString(); lead = item2.Attributes["lead"].InnerText.ToString(); innerText = item2.InnerText.ToString(); ambiguity = new Ambiguity(writer, activity, lead, innerText); listOfAmbiguities.Add(ambiguity); } folk = new Folk(divide, muscle, devote, position, call, listOfAmbiguities); listOfFolks.Add(folk); } Ring ringCl = new Ring(spirit, mist, submit, unit, worker, offence, echo, listOfFolks); XmlNodeList elAssociationList, elSeasonalList; string buy, violation, world, letter, band, rise; buy = elGlass.Attributes["buy"].InnerText.ToString(); violation = elGlass.Attributes["violation"].InnerText.ToString(); world = elGlass.Attributes["world"].InnerText.ToString(); letter = elGlass.Attributes["letter"].InnerText.ToString(); band = elGlass.Attributes["band"].InnerText.ToString(); rise = elGlass.Attributes["rise"].InnerText.ToString(); elAssociationList = elGlass.ChildNodes; List <Association> listOfAssociations = new List <Association>(); List <Seasonal> listOfSeasonals; Association association; Seasonal seasonal; string thin, adult, lazy, rain; foreach (XmlNode item in elAssociationList) { thin = item.Attributes["thin"].InnerText.ToString(); adult = item.Attributes["adult"].InnerText.ToString(); lazy = item.Attributes["lazy"].InnerText.ToString(); rain = item.Attributes["rain"].InnerText.ToString(); elSeasonalList = item.ChildNodes; listOfSeasonals = new List <Seasonal>(); foreach (XmlNode item2 in elSeasonalList) { innerText = item2.InnerText.ToString(); seasonal = new Seasonal(innerText); listOfSeasonals.Add(seasonal); } association = new Association(thin, adult, lazy, rain, listOfSeasonals); listOfAssociations.Add(association); } Glass glassCl = new Glass(buy, violation, world, letter, band, rise, listOfAssociations); XmlNodeList elChokeList, elBloodyList; string concrete, medium, support, angry; concrete = elCharge.Attributes["concrete"].InnerText.ToString(); medium = elCharge.Attributes["medium"].InnerText.ToString(); support = elCharge.Attributes["support"].InnerText.ToString(); angry = elCharge.Attributes["angry"].InnerText.ToString(); elChokeList = elCharge.ChildNodes; List <Choke> listOfChokes = new List <Choke>(); List <Bloody> listOfBloodies; Choke choke; Bloody bloody; string strike, punch, disguise, radical, protein; string left, awful, coincidence, expertise, good; foreach (XmlNode item in elChokeList) { strike = item.Attributes["strike"].InnerText.ToString(); punch = item.Attributes["punch"].InnerText.ToString(); disguise = item.Attributes["disguise"].InnerText.ToString(); radical = item.Attributes["radical"].InnerText.ToString(); protein = item.Attributes["protein"].InnerText.ToString(); elBloodyList = item.ChildNodes; listOfBloodies = new List <Bloody>(); foreach (XmlNode item2 in elBloodyList) { left = item2.Attributes["left"].InnerText.ToString(); awful = item2.Attributes["awful"].InnerText.ToString(); coincidence = item2.Attributes["coincidence"].InnerText.ToString(); tape = item2.Attributes["tape"].InnerText.ToString(); expertise = item2.Attributes["expertise"].InnerText.ToString(); good = item2.Attributes["good"].InnerText.ToString(); innerText = item2.InnerText.ToString(); bloody = new Bloody(left, awful, coincidence, tape, expertise, good, innerText); listOfBloodies.Add(bloody); } choke = new Choke(strike, punch, disguise, radical, protein, listOfBloodies); listOfChokes.Add(choke); } Charge chargeCl = new Charge(concrete, medium, support, angry, listOfChokes); XmlNodeList elBibleList, elCodeList; string give, sentiment, regional, run, temple; give = elCut.Attributes["give"].InnerText.ToString(); sentiment = elCut.Attributes["sentiment"].InnerText.ToString(); regional = elCut.Attributes["regional"].InnerText.ToString(); run = elCut.Attributes["run"].InnerText.ToString(); temple = elCut.Attributes["temple"].InnerText.ToString(); treatment = elCut.Attributes["treatment"].InnerText.ToString(); elBibleList = elCut.ChildNodes; List <Bible> listOfBibles = new List <Bible>(); List <Code> listOfCodes; Bible bible; Code code; string patch, animal, cell, owner; foreach (XmlNode item in elBibleList) { elCodeList = item.ChildNodes; listOfCodes = new List <Code>(); foreach (XmlNode item2 in elCodeList) { patch = item2.Attributes["patch"].InnerText.ToString(); animal = item2.Attributes["animal"].InnerText.ToString(); cell = item2.Attributes["cell"].InnerText.ToString(); owner = item2.Attributes["owner"].InnerText.ToString(); audience = item2.Attributes["audience"].InnerText.ToString(); innerText = item2.InnerText.ToString(); code = new Code(patch, animal, cell, owner, audience, innerText); listOfCodes.Add(code); } bible = new Bible(listOfCodes); listOfBibles.Add(bible); } Cut cutCl = new Cut(give, sentiment, regional, run, temple, treatment, listOfBibles); XmlNodeList elPuddingList, elCompensateList; string wait, activate; wait = elSquad.Attributes["wait"].InnerText.ToString(); activate = elSquad.Attributes["activate"].InnerText.ToString(); elPuddingList = elSquad.ChildNodes; List <Pudding> listOfPuddings = new List <Pudding>(); List <Compensate> listOfCompensates; Pudding pudding; Compensate compensate; foreach (XmlNode item in elPuddingList) { elCompensateList = item.ChildNodes; listOfCompensates = new List <Compensate>(); foreach (XmlNode item2 in elCompensateList) { innerText = item2.InnerText.ToString(); compensate = new Compensate(innerText); listOfCompensates.Add(compensate); } pudding = new Pudding(listOfCompensates); listOfPuddings.Add(pudding); } Squad squadCl = new Squad(wait, activate, listOfPuddings); XmlNodeList elLineList, elBowlList; string friendship, imagine, shareholder; friendship = elSubstitute.Attributes["friendship"].InnerText.ToString(); imagine = elSubstitute.Attributes["imagine"].InnerText.ToString(); shareholder = elSubstitute.Attributes["shareholder"].InnerText.ToString(); elLineList = elSubstitute.ChildNodes; List <Line> listOfLines = new List <Line>(); List <Bowl> listOfBowls; Line line; Bowl bowl; foreach (XmlNode item in elLineList) { elBowlList = item.ChildNodes; listOfBowls = new List <Bowl>(); foreach (XmlNode item2 in elBowlList) { innerText = item2.InnerText.ToString(); bowl = new Bowl(innerText); listOfBowls.Add(bowl); } line = new Line(listOfBowls); listOfLines.Add(line); } Substitute substituteCl = new Substitute(friendship, imagine, shareholder, listOfLines); Root root = new Root(sodiumCl, overallCl, ringCl, glassCl, chargeCl, cutCl, squadCl, substituteCl); return(root); }
public Root LoadDataFromXmlDatabase() { try { if (this.TestConnection(SERVER, XMLDATABASE)) { SqlConnection connection = new SqlConnection(ConnectionString(SERVER, XMLDATABASE)); connection.Open(); string query; SqlCommand cmd; DataTable dt, innerDt; SqlDataAdapter dataAdapter; query = "SELECT * FROM XMLData.dbo.TSodiumStep;"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); dt = new DataTable("TSodiumStep"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(dt); List <Step> listOfSteps = new List <Step>(); List <Excitement> listOfExcitements; int stepId; string affect, sell, prince, current, discuss, still; string treatment, sniff, constraint, trouble, mail, juice, innerText; for (int i = 0; i < dt.Rows.Count; i++) { stepId = Convert.ToInt32(dt.Rows[i]["ID"].ToString()); affect = dt.Rows[i]["affect"].ToString(); sell = dt.Rows[i]["sell"].ToString(); prince = dt.Rows[i]["prince"].ToString(); current = dt.Rows[i]["current"].ToString(); discuss = dt.Rows[i]["discuss"].ToString(); still = dt.Rows[i]["still"].ToString(); listOfExcitements = new List <Excitement>(); query = "SELECT * FROM XMLData.dbo.TSodiumStepExcitement WHERE stepID = " + stepId + ";"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); innerDt = new DataTable("TSodiumStepExcitement"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(innerDt); for (int j = 0; j < innerDt.Rows.Count; j++) { treatment = innerDt.Rows[j]["treatment"].ToString(); sniff = innerDt.Rows[j]["sniff"].ToString(); constraint = innerDt.Rows[j]["constraint"].ToString(); trouble = innerDt.Rows[j]["trouble"].ToString(); mail = innerDt.Rows[j]["mail"].ToString(); juice = innerDt.Rows[j]["juice"].ToString(); innerText = innerDt.Rows[j]["innerText"].ToString(); listOfExcitements.Add(new Excitement(treatment, sniff, constraint, trouble, mail, juice, innerText)); } listOfSteps.Add(new Step(affect, sell, prince, current, discuss, still, listOfExcitements)); } query = "SELECT * FROM XMLData.dbo.TSodium;"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); dt = new DataTable("TSodium"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(dt); string prove, skin, philosophy, leftovers, oil, horse, riot; prove = dt.Rows[0]["prove"].ToString(); skin = dt.Rows[0]["skin"].ToString(); philosophy = dt.Rows[0]["philosophy"].ToString(); leftovers = dt.Rows[0]["leftovers"].ToString(); oil = dt.Rows[0]["oil"].ToString(); horse = dt.Rows[0]["horse"].ToString(); riot = dt.Rows[0]["riot"].ToString(); Sodium sodium = new Sodium(prove, skin, philosophy, leftovers, oil, horse, riot, listOfSteps); query = "SELECT * FROM XMLData.dbo.TOverallChemistry;"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); dt = new DataTable("TOverallChemistry"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(dt); List <Chemistry> listOfChemistries = new List <Chemistry>(); List <Flower> listOfFlowers; int chemistryId; string limited; string submit, opposite, wilderness, transport, circumstance; for (int i = 0; i < dt.Rows.Count; i++) { chemistryId = Convert.ToInt32(dt.Rows[i]["ID"].ToString()); limited = dt.Rows[i]["limited"].ToString(); listOfFlowers = new List <Flower>(); query = "SELECT * FROM XMLData.dbo.TOverallChemistryFlower WHERE chemistryID = " + chemistryId + ";"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); innerDt = new DataTable("TOverallChemistryFlower"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(innerDt); for (int j = 0; j < innerDt.Rows.Count; j++) { submit = innerDt.Rows[j]["submit"].ToString(); opposite = innerDt.Rows[j]["opposite"].ToString(); wilderness = innerDt.Rows[j]["wilderness"].ToString(); transport = innerDt.Rows[j]["transport"].ToString(); circumstance = innerDt.Rows[j]["circumstance"].ToString(); innerText = innerDt.Rows[j]["innerText"].ToString(); listOfFlowers.Add(new Flower(submit, opposite, wilderness, transport, circumstance, innerText)); } listOfChemistries.Add(new Chemistry(limited, listOfFlowers)); } query = "SELECT * FROM XMLData.dbo.TOverall;"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); dt = new DataTable("TOverall"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(dt); string moment, audience, glassStr, dragon, tape, carbon, servant; moment = dt.Rows[0]["moment"].ToString(); audience = dt.Rows[0]["audience"].ToString(); glassStr = dt.Rows[0]["glass"].ToString(); dragon = dt.Rows[0]["dragon"].ToString(); tape = dt.Rows[0]["tape"].ToString(); carbon = dt.Rows[0]["carbon"].ToString(); servant = dt.Rows[0]["servant"].ToString(); Overall overall = new Overall(moment, audience, glassStr, dragon, tape, carbon, servant, listOfChemistries); query = "SELECT * FROM XMLData.dbo.TRingFolk;"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); dt = new DataTable("TRingFolk"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(dt); List <Folk> listOfFolks = new List <Folk>(); List <Ambiguity> listOfAmbiguities; int folkId; string divide, muscle, devote, position, call; string writer, activity, lead; for (int i = 0; i < dt.Rows.Count; i++) { folkId = Convert.ToInt32(dt.Rows[i]["ID"].ToString()); divide = dt.Rows[i]["divide"].ToString(); muscle = dt.Rows[i]["muscle"].ToString(); devote = dt.Rows[i]["devote"].ToString(); position = dt.Rows[i]["position"].ToString(); call = dt.Rows[i]["call"].ToString(); listOfAmbiguities = new List <Ambiguity>(); query = "SELECT * FROM XMLData.dbo.TRingFolkAmbiguity WHERE folkID = " + folkId + ";"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); innerDt = new DataTable("TRingFolkAmbiguity"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(innerDt); for (int j = 0; j < innerDt.Rows.Count; j++) { writer = innerDt.Rows[j]["writer"].ToString(); activity = innerDt.Rows[j]["activity"].ToString(); lead = innerDt.Rows[j]["lead"].ToString(); innerText = innerDt.Rows[j]["innerText"].ToString(); listOfAmbiguities.Add(new Ambiguity(writer, activity, lead, innerText)); } listOfFolks.Add(new Folk(divide, muscle, devote, position, call, listOfAmbiguities)); } query = "SELECT * FROM XMLData.dbo.TRing;"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); dt = new DataTable("TRing"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(dt); string spirit, mist, unit, worker, offence, echo; spirit = dt.Rows[0]["spirit"].ToString(); mist = dt.Rows[0]["mist"].ToString(); submit = dt.Rows[0]["submit"].ToString(); unit = dt.Rows[0]["unit"].ToString(); worker = dt.Rows[0]["worker"].ToString(); offence = dt.Rows[0]["offence"].ToString(); echo = dt.Rows[0]["echo"].ToString(); Ring ring = new Ring(spirit, mist, submit, unit, worker, offence, echo, listOfFolks); query = "SELECT * FROM XMLData.dbo.TGlassAssociation;"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); dt = new DataTable("TGlassAssociation"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(dt); List <Association> listOfAssociations = new List <Association>(); List <Seasonal> listOfSeasonals; int associationId; string thin, adult, lazy, rain; for (int i = 0; i < dt.Rows.Count; i++) { associationId = Convert.ToInt32(dt.Rows[i]["ID"].ToString()); thin = dt.Rows[i]["thin"].ToString(); adult = dt.Rows[i]["adult"].ToString(); lazy = dt.Rows[i]["lazy"].ToString(); rain = dt.Rows[i]["rain"].ToString(); listOfSeasonals = new List <Seasonal>(); query = "SELECT * FROM XMLData.dbo.TGlassAssociationSeasonal WHERE associationID = " + associationId + ";"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); innerDt = new DataTable("TGlassAssociationSeasonal"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(innerDt); for (int j = 0; j < innerDt.Rows.Count; j++) { innerText = innerDt.Rows[j]["innerText"].ToString(); listOfSeasonals.Add(new Seasonal(innerText)); } listOfAssociations.Add(new Association(thin, adult, lazy, rain, listOfSeasonals)); } query = "SELECT * FROM XMLData.dbo.TGlass;"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); dt = new DataTable("TGlass"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(dt); string buy, violation, world, letter, band, rise; buy = dt.Rows[0]["buy"].ToString(); violation = dt.Rows[0]["violation"].ToString(); world = dt.Rows[0]["world"].ToString(); letter = dt.Rows[0]["letter"].ToString(); band = dt.Rows[0]["band"].ToString(); rise = dt.Rows[0]["rise"].ToString(); Glass glass = new Glass(buy, violation, world, letter, band, rise, listOfAssociations); query = "SELECT * FROM XMLData.dbo.TChargeChoke;"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); dt = new DataTable("TChargeChoke"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(dt); List <Choke> listOfChokes = new List <Choke>(); List <Bloody> listOfBloodies; int chokeId; string strike, punch, disguise, radical, protein; string left, awful, coincidence, expertise, good; for (int i = 0; i < dt.Rows.Count; i++) { chokeId = Convert.ToInt32(dt.Rows[i]["ID"].ToString()); strike = dt.Rows[i]["strike"].ToString(); punch = dt.Rows[i]["punch"].ToString(); disguise = dt.Rows[i]["disguise"].ToString(); radical = dt.Rows[i]["radical"].ToString(); protein = dt.Rows[i]["protein"].ToString(); listOfBloodies = new List <Bloody>(); query = "SELECT * FROM XMLData.dbo.TChargeChokeBloody WHERE chokeID = " + chokeId + ";"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); innerDt = new DataTable("TChargeChokeBloody"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(innerDt); for (int j = 0; j < innerDt.Rows.Count; j++) { left = innerDt.Rows[j]["left"].ToString(); awful = innerDt.Rows[j]["awful"].ToString(); coincidence = innerDt.Rows[j]["coincidence"].ToString(); tape = innerDt.Rows[j]["tape"].ToString(); expertise = innerDt.Rows[j]["expertise"].ToString(); good = innerDt.Rows[j]["good"].ToString(); innerText = innerDt.Rows[j]["innerText"].ToString(); listOfBloodies.Add(new Bloody(left, awful, coincidence, tape, expertise, good, innerText)); } listOfChokes.Add(new Choke(strike, punch, disguise, radical, protein, listOfBloodies)); } query = "SELECT * FROM XMLData.dbo.TCharge;"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); dt = new DataTable("TCharge"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(dt); string concrete, medium, support, angry; concrete = dt.Rows[0]["concrete"].ToString(); medium = dt.Rows[0]["medium"].ToString(); support = dt.Rows[0]["support"].ToString(); angry = dt.Rows[0]["angry"].ToString(); Charge charge = new Charge(concrete, medium, support, angry, listOfChokes); query = "SELECT * FROM XMLData.dbo.TCutBible;"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); dt = new DataTable("TCutBible"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(dt); List <Bible> listOfBibles = new List <Bible>(); List <Code> listOfCodes; int bibleId; string patch, animal, cell, owner; for (int i = 0; i < dt.Rows.Count; i++) { bibleId = Convert.ToInt32(dt.Rows[i]["ID"].ToString()); listOfCodes = new List <Code>(); query = "SELECT * FROM XMLData.dbo.TCutBibleCode WHERE bibleID = " + bibleId + ";"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); innerDt = new DataTable("TCutBibleCode"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(innerDt); for (int j = 0; j < innerDt.Rows.Count; j++) { patch = innerDt.Rows[j]["patch"].ToString(); animal = innerDt.Rows[j]["animal"].ToString(); cell = innerDt.Rows[j]["cell"].ToString(); owner = innerDt.Rows[j]["owner"].ToString(); audience = innerDt.Rows[j]["audience"].ToString(); innerText = innerDt.Rows[j]["innerText"].ToString(); listOfCodes.Add(new Code(patch, animal, cell, owner, audience, innerText)); } listOfBibles.Add(new Bible(listOfCodes)); } query = "SELECT * FROM XMLData.dbo.TCut;"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); dt = new DataTable("TCut"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(dt); string give, sentiment, regional, run, temple; give = dt.Rows[0]["give"].ToString(); sentiment = dt.Rows[0]["sentiment"].ToString(); regional = dt.Rows[0]["regional"].ToString(); run = dt.Rows[0]["run"].ToString(); temple = dt.Rows[0]["temple"].ToString(); treatment = dt.Rows[0]["treatment"].ToString(); Cut cut = new Cut(give, sentiment, regional, run, temple, treatment, listOfBibles); query = "SELECT * FROM XMLData.dbo.TSquadPudding;"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); dt = new DataTable("TSquadPudding"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(dt); List <Pudding> listOfPuddings = new List <Pudding>(); List <Compensate> listOfCompensates; int puddingId; for (int i = 0; i < dt.Rows.Count; i++) { puddingId = Convert.ToInt32(dt.Rows[i]["ID"].ToString()); listOfCompensates = new List <Compensate>(); query = "SELECT * FROM XMLData.dbo.TSquadPuddingCompensate WHERE puddingID = " + puddingId + ";"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); innerDt = new DataTable("TSquadPuddingCompensate"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(innerDt); for (int j = 0; j < innerDt.Rows.Count; j++) { innerText = innerDt.Rows[j]["innerText"].ToString(); listOfCompensates.Add(new Compensate(innerText)); } listOfPuddings.Add(new Pudding(listOfCompensates)); } query = "SELECT * FROM XMLData.dbo.TSquad;"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); dt = new DataTable("TSquad"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(dt); string wait, activate; wait = dt.Rows[0]["wait"].ToString(); activate = dt.Rows[0]["activate"].ToString(); Squad squad = new Squad(wait, activate, listOfPuddings); query = "SELECT * FROM XMLData.dbo.TSubstituteLine;"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); dt = new DataTable("TSubstituteLine"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(dt); List <Line> listOfLines = new List <Line>(); List <Bowl> listOfBowls; int lineId; for (int i = 0; i < dt.Rows.Count; i++) { lineId = Convert.ToInt32(dt.Rows[i]["ID"].ToString()); listOfBowls = new List <Bowl>(); query = "SELECT * FROM XMLData.dbo.TSubstituteLineBowl WHERE lineID = " + lineId + ";"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); innerDt = new DataTable("TSubstituteLineBowl"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(innerDt); for (int j = 0; j < innerDt.Rows.Count; j++) { innerText = innerDt.Rows[j]["innerText"].ToString(); listOfBowls.Add(new Bowl(innerText)); } listOfLines.Add(new Line(listOfBowls)); } query = "SELECT * FROM XMLData.dbo.TSubstitute;"; cmd = new SqlCommand(query, connection); cmd.ExecuteNonQuery(); dt = new DataTable("TSubstitute"); dataAdapter = new SqlDataAdapter(cmd); dataAdapter.Fill(dt); string friendship, imagine, shareholder; friendship = dt.Rows[0]["friendship"].ToString(); imagine = dt.Rows[0]["imagine"].ToString(); shareholder = dt.Rows[0]["shareholder"].ToString(); Substitute substitute = new Substitute(friendship, imagine, shareholder, listOfLines); connection.Close(); Root root = new Root(sodium, overall, ring, glass, charge, cut, squad, substitute); return(root); } return(null); } catch (Exception e) { Console.WriteLine(e.Message); Console.ReadLine(); return(null); } }