public GetLaneForEditResponse GetLaneForEdit (WebServiceLogin login, int lane_id, string lane) { GetLaneForEditResponse response = new GetLaneForEditResponse (); using (DB db = new DB ()) { Authenticate (db, login, response); VerifyUserInRole (db, login, Roles.Administrator); response.Lane = FindLane (db, lane_id, lane); response.Lanes = db.GetAllLanes (); response.Commands = response.Lane.GetCommandsInherited (db, response.Lanes); response.Dependencies = response.Lane.GetDependencies (db); response.FileDeletionDirectives = DBFileDeletionDirective_Extensions.GetAll (db); response.LaneDeletionDirectives = DBLaneDeletionDirectiveView_Extensions.Find (db, response.Lane); response.Files = response.Lane.GetFiles (db, response.Lanes); response.LaneFiles = db.GetAllLaneFiles (); response.HostLaneViews = response.Lane.GetHosts (db); response.Hosts = db.GetHosts (); response.ExistingFiles = new List<DBLanefile> (); using (IDbCommand cmd = db.CreateCommand ()) { cmd.CommandText = @" SELECT Lanefile.* FROM Lanefile INNER JOIN Lanefiles ON Lanefiles.lanefile_id = Lanefile.id WHERE Lanefiles.lane_id <> @lane_id ORDER BY Lanefiles.lane_id, Lanefile.name ASC"; DB.CreateParameter (cmd, "lane_id", response.Lane.id); using (IDataReader reader = cmd.ExecuteReader ()) { while (reader.Read ()) response.ExistingFiles.Add (new DBLanefile (reader)); } } response.Variables = DBEnvironmentVariable_Extensions.Find (db, response.Lane.id, null, null); response.Notifications = new List<DBNotification> (); response.LaneNotifications = new List<DBLaneNotification> (); using (IDbCommand cmd = db.CreateCommand ()) { cmd.CommandText = "SELECT * FROM Notification; SELECT * FROM LaneNotification WHERE lane_id = @lane_id;"; DB.CreateParameter (cmd, "lane_id", response.Lane.id); using (IDataReader reader = cmd.ExecuteReader ()) { while (reader.Read ()) { response.Notifications.Add (new DBNotification (reader)); } if (reader.NextResult ()) { while (reader.Read ()) { response.LaneNotifications.Add (new DBLaneNotification (reader)); } } } } return response; } }