private void button11_Click(object sender, EventArgs e) { using (XmlTextReader xmlReader = new XmlTextReader(textBox4.Text)) { xmlReader.ReadToFollowing("connectionStrings"); xmlReader.ReadToFollowing("add"); connectionString = xmlReader.GetAttribute("connectionString"); xmlReader.ReadToFollowing("connectionStrings"); xmlReader.ReadToFollowing("add"); } defaultPassword = GetSomeSetting("DefaultPassword", textBox4.Text); repository = new AjourDbRepository(connectionString); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load("XLSLoader.exe.config"); XmlNodeList userNodes = xmlDoc.SelectNodes("//connectionStrings/add/@connectionString"); foreach (XmlNode node in userNodes) { node.Value = connectionString; } xmlDoc.Save("XLSLoader.exe.config"); ConfigurationManager.RefreshSection("connectionStrings"); label5.Text = connectionString; }
public override void Up() { AjourDbRepository repository = new AjourDbRepository(); //CreateTable( // "dbo.Journeys", // c => new // { // JourneyID = c.Int(nullable: false, identity: true), // BusinessTripID = c.Int(nullable: false), // Date = c.DateTime(nullable: false), // ReclaimDate = c.DateTime(), // DayOff = c.Boolean(nullable: false), // }) // .PrimaryKey(t => t.JourneyID) // .ForeignKey("dbo.BusinessTrips", t => t.BusinessTripID, cascadeDelete: true) // .Index(t => t.BusinessTripID); var btList = (from bt in repository.BusinessTrips where bt.OrderStartDate != null && bt.OrderEndDate != null select bt).ToList(); foreach (var bt in btList) { repository.CreateJourney(bt); } }