Пример #1
0
		public GetBuildBotStatusResponse GetBuildBotStatus (WebServiceLogin login)
		{
			GetBuildBotStatusResponse response = new GetBuildBotStatusResponse ();

			using (DB db = new DB ()) {
				Authenticate (db, login, null, true);

				response.Status = new List<DBBuildBotStatus> ();
				response.Hosts = new List<DBHost> ();
				response.Releases = new List<DBRelease> ();
				using (IDbCommand cmd = db.CreateCommand ()) {
					cmd.CommandText = "SELECT * FROM BuildBotStatus; SELECT * FROM Host; SELECT * FROM Release;";
					using (IDataReader reader = cmd.ExecuteReader ()) {
						while (reader.Read ()) {
							response.Status.Add (new DBBuildBotStatus (reader));
						}
						if (reader.NextResult ()) {
							while (reader.Read ()) {
								response.Hosts.Add (new DBHost (reader));
							}
							if (reader.NextResult ()) {
								while (reader.Read ()) {
									response.Releases.Add (new DBRelease (reader));
								}
							}
						}
					}
				}
			}

			return response;
		}
Пример #2
0
		public GetBuildBotStatusResponse GetBuildBotStatus (WebServiceLogin login)
		{
			GetBuildBotStatusResponse response = new GetBuildBotStatusResponse ();

			try {
				using (DB db = new DB ()) {
					VerifyUserInRole (db, login, Roles.Administrator, true);

					response.Status = new List<DBBuildBotStatus> ();
					response.Hosts = new List<DBHost> ();
					response.Releases = new List<DBRelease> ();
					using (IDbCommand cmd = db.CreateCommand ()) {
						cmd.CommandText = "SELECT * FROM BuildBotStatus; SELECT * FROM Host; SELECT * FROM Release;";
						using (IDataReader reader = cmd.ExecuteReader ()) {
							while (reader.Read ()) {
								response.Status.Add (new DBBuildBotStatus (reader));
							}
							if (reader.NextResult ()) {
								while (reader.Read ()) {
									response.Hosts.Add (new DBHost (reader));
								}
								if (reader.NextResult ()) {
									while (reader.Read ()) {
										response.Releases.Add (new DBRelease (reader));
									}
								}
							}
						}
					}
				}
			} catch (Exception ex) {
				response.Exception = new WebServiceException (ex);
			}

			return response;
		}