⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 schedulingcontroller.cs

📁 SharpNuke源代码
💻 CS
字号:
using System;
using System.Data;
using System.Collections;
using System.Configuration;
using System.Xml;

using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Services.Scheduling;

//
// DotNetNuke -  http://www.dotnetnuke.com
// Copyright (c) 2002-2005
// by Shaun Walker ( sales@perpetualmotion.ca ) of Perpetual Motion Interactive Systems Inc. ( http://www.perpetualmotion.ca )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions
// of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//

namespace DotNetNuke.Services.Scheduling.DNNScheduling
{
	
	public class SchedulingController
	{
		
		public ArrayList GetSchedule()
		{
			ArrayList arrSource = CBO.FillCollection(DataProvider.Instance().GetSchedule(), typeof(ScheduleHistoryItem));
			ArrayList arrDest = new ArrayList();
			foreach (ScheduleItem scheduleItem in arrSource)
			{
				arrDest.Add(scheduleItem);
			}
			return arrDest;
		}

		public ArrayList GetSchedule(string server)
		{
			ArrayList arrSource = CBO.FillCollection(DataProvider.Instance().GetSchedule(server), typeof(ScheduleHistoryItem));
			ArrayList arrDest = new ArrayList();
			foreach (ScheduleItem scheduleItem in arrSource)
			{
				arrDest.Add(scheduleItem);
			}
			return arrDest;
		}
		
		public ScheduleItem GetSchedule(string typeFullName, string server)
		{
			return ((ScheduleItem) CBO.FillObject(DataProvider.Instance().GetSchedule(typeFullName, server), typeof(ScheduleItem)));
		}
		
		public ScheduleItem GetSchedule(int scheduleID)
		{
			return ((ScheduleItem) CBO.FillObject(DataProvider.Instance().GetSchedule(scheduleID), typeof(ScheduleItem)));
		}
		
		public ScheduleItem GetNextScheduledTask(string server)
		{
			return ((ScheduleItem) CBO.FillObject(DataProvider.Instance().GetNextScheduledTask(server), typeof(ScheduleItem)));			
		}
		
		public ArrayList GetScheduleByEvent(string eventName, string server)
		{
			ArrayList arrSource = CBO.FillCollection(DataProvider.Instance().GetScheduleByEvent(eventName, server), typeof(ScheduleHistoryItem));
			ArrayList arrDest = new ArrayList();
			foreach (ScheduleItem scheduleItem in arrSource)
			{
				arrDest.Add(scheduleItem);
			}
			return arrDest;
		}
		
		public ArrayList GetScheduleHistory(int scheduleID)
		{
			return CBO.FillCollection(DataProvider.Instance().GetScheduleHistory(scheduleID), typeof(ScheduleHistoryItem));
		}
		
		public ArrayList GetScheduleQueue()
		{
			return Scheduler.CoreScheduler.GetScheduleQueue();
		}
		
		public ArrayList GetScheduleProcessing()
		{
			return Scheduler.CoreScheduler.GetScheduleInProgress();
		}
		
		public ScheduleStatus GetScheduleStatus()
		{
			return Scheduler.CoreScheduler.GetScheduleStatus();
		}
		
		public int GetFreeThreadCount()
		{
			return Scheduler.CoreScheduler.GetFreeThreadCount();
		}
		
		public int GetActiveThreadCount()
		{
			return Scheduler.CoreScheduler.GetActiveThreadCount();
		}
		
		public int GetMaxThreadCount()
		{
			return Scheduler.CoreScheduler.GetMaxThreadCount();
		}
		
		public void ReloadSchedule ()
		{
			Scheduler.CoreScheduler.ReloadSchedule();
		}
		
		public int AddSchedule(string typeFullName, int timeLapse, string timeLapseMeasurement, int retryTimeLapse, 
			string retryTimeLapseMeasurement, int retainHistoryNum, string attachToEvent, bool catchUpEnabled, bool enabled, 
			string objectDependencies, string servers)
		{
			return DataProvider.Instance().AddSchedule(typeFullName, timeLapse, timeLapseMeasurement, retryTimeLapse, 
				retryTimeLapseMeasurement, retainHistoryNum, attachToEvent, catchUpEnabled, enabled, objectDependencies, servers);
		}
		
		public void UpdateSchedule (int scheduleID, string typeFullName, int timeLapse, string timeLapseMeasurement, 
			int retryTimeLapse, string retryTimeLapseMeasurement, int retainHistoryNum, string attachToEvent, bool catchUpEnabled, 
			bool enabled, string objectDependencies, string servers)
		{
			DataProvider.Instance().UpdateSchedule(scheduleID, typeFullName, timeLapse, timeLapseMeasurement, retryTimeLapse, 
				retryTimeLapseMeasurement, retainHistoryNum, attachToEvent, catchUpEnabled, enabled, objectDependencies, servers);
		}
		
		public void DeleteSchedule (int scheduleID)
		{
			DataProvider.Instance().DeleteSchedule(scheduleID);
		}
		
		public int AddScheduleHistory(ScheduleHistoryItem scheduleHistoryItem)
		{
			return DataProvider.Instance().AddScheduleHistory(scheduleHistoryItem.ScheduleID, scheduleHistoryItem.StartDate, Globals.ServerName);
		}
		
		public void UpdateScheduleHistory (ScheduleHistoryItem scheduleHistoryItem)
		{
			DataProvider.Instance().UpdateScheduleHistory(scheduleHistoryItem.ScheduleHistoryID, scheduleHistoryItem.EndDate, 
				scheduleHistoryItem.Succeeded, scheduleHistoryItem.LogNotes, scheduleHistoryItem.NextStart);
		}
		
		public Hashtable GetScheduleItemSettings(int scheduleID)
		{
			Hashtable hashtable = new Hashtable();
			IDataReader dr = DataProvider.Instance().GetScheduleItemSettings(scheduleID);
			while (dr.Read())
			{
				hashtable.Add(dr["SettingName"], dr["SettingValue"]);
			}
			
			// close datareader
			if (dr != null)
			{
				dr.Close();
			}
			
			return hashtable;
		}
		
		public void PurgeScheduleHistory ()
		{
			DataProvider.Instance().PurgeScheduleHistory();
		}
		
	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -