public int AddLane (WebServiceLogin login, string lane) { using (DB db = new DB ()) { VerifyUserInRole (db, login, Roles.Administrator); if (string.IsNullOrEmpty (lane)) throw new ArgumentOutOfRangeException ("name"); for (int i = 0; i < lane.Length; i++) { if (char.IsLetterOrDigit (lane [i])) { continue; } else if (lane [i] == '-' || lane [i] == '_' || lane [i] == '.') { continue; } else { throw new ArgumentOutOfRangeException (string.Format ("The character '{0}' isn't valid.", lane [i])); } } if (db.LookupLane (lane, false) != null) throw new ApplicationException (string.Format ("The lane '{0}' already exists.", lane)); DBLane dblane = new DBLane (); dblane.lane = lane; dblane.source_control = "svn"; dblane.Save (db); return dblane.id; } }