当前位置: 首页>>代码示例>>C#>>正文


C# DB.GetHosts方法代码示例

本文整理汇总了C#中DB.GetHosts方法的典型用法代码示例。如果您正苦于以下问题:C# DB.GetHosts方法的具体用法?C# DB.GetHosts怎么用?C# DB.GetHosts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DB的用法示例。


在下文中一共展示了DB.GetHosts方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Any

		public object Any (BuildBots request)
		{
			List<DBHost> hosts = null;
			using (DB db = new DB ())
				hosts = db.GetHosts ();

			return new BuildBotsResponse {
				BuildBots = hosts.Select (h => new BuildBot {
					ID = h.id,
					Name = h.host,
					Arch = h.architecture,
					Description = h.description
				}).ToList ()
			};
		}
开发者ID:vargaz,项目名称:monkeywrench,代码行数:15,代码来源:BuildBots.cs

示例2: GetHostForEdit

		public GetHostForEditResponse GetHostForEdit (WebServiceLogin login, int? host_id, string host)
		{
			GetHostForEditResponse response = new GetHostForEditResponse ();

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

				response.Host = FindHost (db, host_id, host);
				response.Lanes = db.GetAllLanes ();
				if (response.Host != null) {
					response.Person = FindPerson (db, response.Host.host);
					response.HostLaneViews = response.Host.GetLanes (db);
					response.Variables = DBEnvironmentVariable_Extensions.Find (db, null, response.Host.id, null);
					response.MasterHosts = GetMasterHosts (db, response.Host);
					response.SlaveHosts = GetSlaveHosts (db, response.Host);
				}
				response.Hosts = db.GetHosts ();
			}

			return response;
		}
开发者ID:joewstroman,项目名称:monkeywrench,代码行数:21,代码来源:WebServices.asmx.cs

示例3: GetHosts

		public GetHostsResponse GetHosts (WebServiceLogin login)
		{
			GetHostsResponse response = new GetHostsResponse ();

			using (DB db = new DB ()) {
				Authenticate (db, login, response);
				response.Hosts = db.GetHosts ();
			}

			return response;
		}
开发者ID:joewstroman,项目名称:monkeywrench,代码行数:11,代码来源:WebServices.asmx.cs

示例4: ExecuteScheduler

		public static bool ExecuteScheduler (bool forcefullupdate)
		{
			DateTime start;
			Lock scheduler_lock = null;
			List<DBLane> lanes;

			List<DBHost> hosts;
			List<DBHostLane> hostlanes;
			List<XmlDocument> reports;
			
			try {
				scheduler_lock = Lock.Create ("MonkeyWrench.Scheduler");
				if (scheduler_lock == null) {
					log.Info ("Could not aquire scheduler lock.");
					return false;
				}

				log.Info ("Scheduler lock aquired successfully.");
				
				is_executing = true;
				start = DateTime.Now;

				// SVNUpdater.StartDiffThread ();

				// Check reports
				reports = GetReports (forcefullupdate);

				using (DB db = new DB (true)) {
					lanes = db.GetAllLanes ();
					hosts = db.GetHosts ();
					hostlanes = db.GetAllHostLanes ();

					log.InfoFormat ("Updater will now update {0} lanes.", lanes.Count);

					GITUpdater git_updater = null;
					// SVNUpdater svn_updater = null;

					foreach (DBLane lane in lanes) {
						if (!lane.enabled) {
							log.InfoFormat ("Schedule: lane {0} is disabled, skipping it.", lane.lane);
							continue;
						}

						SchedulerBase updater;
						switch (lane.source_control) {
							/*
						case "svn":
							if (svn_updater == null)
								svn_updater = new SVNUpdater (forcefullupdate);
							updater = svn_updater;
							break;
							 * */
						case "git":
							if (git_updater == null)
								git_updater = new GITUpdater (forcefullupdate);
							updater = git_updater;
							break;
						default:
							log.ErrorFormat ("Unknown source control: {0} for lane {1}", lane.source_control, lane.lane);
							continue;
						}
						updater.Clear ();
						updater.AddChangeSets (reports);
						updater.UpdateRevisionsInDB (db, lane, hosts, hostlanes);
					}

					AddRevisionWork (db);
					AddWork (db, hosts, lanes, hostlanes);
					CheckDependencies (db, hosts, lanes, hostlanes);
				}

				// SVNUpdater.StopDiffThread ();

				log.InfoFormat ("Update finished successfully in {0} seconds.", (DateTime.Now - start).TotalSeconds);

				return true;
			} catch (Exception ex) {
				log.ErrorFormat ("An exception occurred: {0}", ex);
				return false;
			} finally {
				if (scheduler_lock != null)
					scheduler_lock.Unlock ();
				is_executing = false;
			}
		}
开发者ID:modulexcite,项目名称:monkeywrench,代码行数:85,代码来源:Scheduler.cs

示例5: ExecuteScheduler

		public static bool ExecuteScheduler (bool forcefullupdate)
		{
			Lock scheduler_lock = null;
			List<DBLane> lanes;

			List<DBHost> hosts;
			List<DBHostLane> hostlanes;
			List<XmlDocument> reports;
			
			try {
				scheduler_lock = Lock.Create ("MonkeyWrench.Scheduler");
				if (scheduler_lock == null) {
					Logger.Log ("Could not aquire scheduler lock.");
					return false;
				}

				Logger.Log ("Scheduler lock aquired successfully.");
				
				is_executing = true;

				SVNUpdater.StartDiffThread ();

				// Check reports
				reports = GetReports (forcefullupdate);

				using (DB db = new DB (true)) {
					lanes = db.GetAllLanes ();
					hosts = db.GetHosts ();
					hostlanes = db.GetAllHostLanes ();
					Logger.Log ("Updater will now update {0} lanes.", lanes.Count);
					foreach (DBLane lane in lanes) {
						SchedulerBase updater;
						switch (lane.source_control) {
						case "svn":
							updater = new SVNUpdater (forcefullupdate);
							break;
						case "git":
							updater = new GITUpdater (forcefullupdate);
							break;
						default:
							Logger.Log ("Unknown source control: {0} for lane {1}", lane.source_control, lane.lane);
							continue;
						}
						updater.AddChangeSets (reports);
						updater.UpdateRevisionsInDB (db, lane, hosts, hostlanes);
						UpdateBuildLogDB (db, lane, hosts, hostlanes);
					}
				}

				Logger.Log ("Update done, waiting for diff thread to finish...");

				SVNUpdater.StopDiffThread ();

				Logger.Log ("Update finished successfully.");

				return true;
			} catch (Exception ex) {
				Logger.Log ("An exception occurred: {0}", ex.ToString ());
				return false;
			} finally {
				if (scheduler_lock != null)
					scheduler_lock.Unlock ();
				is_executing = false;
			}
		}
开发者ID:rolfbjarne,项目名称:monkeywrench,代码行数:65,代码来源:Scheduler.cs

示例6: GetLaneForEdit

		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.Commands = response.Lane.GetCommands (db);
				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.HostLaneViews = response.Lane.GetHosts (db);
				response.Hosts = db.GetHosts ();
				response.Lanes = db.GetAllLanes ();

				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;
			}
		}
开发者ID:DavidS,项目名称:monkeywrench,代码行数:54,代码来源:WebServices.asmx.cs


注:本文中的DB.GetHosts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。