Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtil.CheckPrivilege(WebConfig.FunctionAutomationAddStrategy, OpType.READ, Session))
        {
            Response.Redirect(WebConfig.PageNotEnoughPrivilege, true);
        }

        string op = Request.Params[WebConfig.ParamOperation];

        if (op != null && op == WebConfig.OpTypeModify && Session[WebConfig.SessionStrategy] != null)
        {
            _opType   = PageOpType.Modify;
            _strategy = Session[WebConfig.SessionStrategy] as Strategy;
            //要修改策略需要在StrategyManager上有写权限
            if (!WebUtil.CheckPrivilege(TheAdminServer.StrategyManager.SecurityObject, OpType.WRITE, Session))
            {
                Response.Redirect(WebConfig.PageNotEnoughPrivilege, true);
            }
        }
        else
        {
            _opType = PageOpType.Add;
            //要添加策略需要在StrategyManager上有写权限
            if (!WebUtil.CheckPrivilege(TheAdminServer.StrategyManager.SecurityObject, OpType.WRITE, Session))
            {
                Response.Redirect(WebConfig.PageNotEnoughPrivilege, true);
            }
        }

        if (!IsPostBack)
        {
            if (_opType == PageOpType.Modify)
            {
                AutomationEditorStrategy.Automation = _strategy.Automation;
                TextBoxName.Text    = _strategy.SecurityObject.Name;
                TextBoxComment.Text = _strategy.SecurityObject.Comment;
                LabelOpType.Text    = StringDef.ModifyStrategy;
            }
            else if (_opType == PageOpType.Add)
            {
                AutomationEditorStrategy.Automation = null;
                LabelOpType.Text = StringDef.AddStrategy;
            }
            ListEvent();
        }

        LabelSuccess.Visible = false;
        LabelOpMsg.Visible   = false;
    }
Example #2
0
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!WebUtil.CheckPrivilege(WebConfig.FunctionAutomationAddStrategy, OpType.READ, Session))
		{
			Response.Redirect(WebConfig.PageNotEnoughPrivilege, true);
		}

		string op = Request.Params[WebConfig.ParamOperation];
		if (op != null && op == WebConfig.OpTypeModify && Session[WebConfig.SessionStrategy] != null)
		{
			_opType = PageOpType.Modify;
			_strategy = Session[WebConfig.SessionStrategy] as Strategy;
            //要修改策略需要在StrategyManager上有写权限
            if (!WebUtil.CheckPrivilege(TheAdminServer.StrategyManager.SecurityObject, OpType.WRITE, Session))
            {
                Response.Redirect(WebConfig.PageNotEnoughPrivilege, true);
            }
		}
		else
		{
			_opType = PageOpType.Add;
            //要添加策略需要在StrategyManager上有写权限
            if (!WebUtil.CheckPrivilege(TheAdminServer.StrategyManager.SecurityObject, OpType.WRITE, Session))
            {
                Response.Redirect(WebConfig.PageNotEnoughPrivilege, true);
            }
		}

		if (!IsPostBack)
		{			
			if (_opType == PageOpType.Modify)
			{
				AutomationEditorStrategy.Automation = _strategy.Automation;
				TextBoxName.Text = _strategy.SecurityObject.Name;
				TextBoxComment.Text = _strategy.SecurityObject.Comment;
				LabelOpType.Text = StringDef.ModifyStrategy;
			}
			else if (_opType == PageOpType.Add)
			{
				AutomationEditorStrategy.Automation = null;
				LabelOpType.Text = StringDef.AddStrategy;
			}
			ListEvent();
		}

        LabelSuccess.Visible = false;
        LabelOpMsg.Visible = false;
	}
Example #3
0
	protected void Page_Load(object sender, EventArgs e)
	{
        if (!WebUtil.CheckPrivilege(WebConfig.FunctionAutomationAddScheduledTask, OpType.READ, Session))
        {
            Response.Redirect(WebConfig.PageNotEnoughPrivilege, true);
        }

		string op = Request.Params[WebConfig.ParamOperation];
		if (op != null && op == WebConfig.OpTypeModify && Session[WebConfig.SessionScheduledTask] != null)
		{
			_opType = PageOpType.Modify;
            _taskUnit = Session[WebConfig.SessionScheduledTask] as ScheduledTaskUnit;
            
            if (_taskUnit == null) return;
            
            //修改自动化作业需要对ScheduledTaskManager有写权限
            if (!WebUtil.CheckPrivilege(TheAdminServer.ScheduledTaskManager.SecurityObject, OpType.WRITE, Session))
            {
                Response.Redirect(WebConfig.PageNotEnoughPrivilege, true);
            }
		}
		else
		{
			_opType = PageOpType.Add;

            //添加自动化作业需要对ScheduledTaskManager有写权限
            if (!WebUtil.CheckPrivilege(TheAdminServer.ScheduledTaskManager.SecurityObject, OpType.WRITE, Session))
            {
                Response.Redirect(WebConfig.PageNotEnoughPrivilege, true);
            }
		}
		
		if (!IsPostBack)
		{
			ListScheduledTaskType();

			if (_opType == PageOpType.Modify)
			{
				LabelOpType.Text = StringDef.EditScheduledTask;
                if (_taskUnit != null)
				{
                    AutomationEditor1.Automation = _taskUnit.Task.Automation;
                    TextBoxName.Text = _taskUnit.Task.SecurityObject.Name;
                    TextBoxComment.Text = _taskUnit.Task.SecurityObject.Comment;

                    switch (_taskUnit.Task.Type)
					{
						case ScheduledTaskType.Once:
							{
                                OnceScheduledTask task = _taskUnit.Task as OnceScheduledTask;
								TextBoxExecuteTime.Text = task.ExecuteTime.ToString();
							}
							break;
						case ScheduledTaskType.Repeat:
							{
                                RepeatScheduledTask task = _taskUnit.Task as RepeatScheduledTask;
								TextBoxStartTime.Text = task.StartTime.ToString();
								TextBoxEndTime.Text = task.EndTime.ToString();
								TextBoxInterval.Text = task.Interval.ToString();
							}
							break;
                        case ScheduledTaskType.DayOfWeek:
                            {
                                DayOfWeekScheduledTask task = _taskUnit.Task as DayOfWeekScheduledTask;
                                TextBoxDayOfWeekExecuteTime.Text = task.TimeOfDay.ToString();
                                foreach (DayOfWeek day in task.DayOfWeek)
                                    CheckBoxListDayOfWeek.Items[(int)day].Selected = true;
                            }
                            break;
					}

                    SetScheduledTaskType(_taskUnit.Task.Type);
				}
			}
			else if (_opType == PageOpType.Add)
			{
				AutomationEditor1.Automation = null;
				LabelOpType.Text = StringDef.AddScheduledTask;
			}
            LabelOnceExecuteTime.Text += "[yyyy-mm-dd hh:mm:ss]";
            LabelRepeatStartTime.Text += "[hh:mm:ss]";
            LabelRepeatEndTime.Text += "[hh:mm:ss]";
            LabelIntervalTime.Text += "[hh:mm:ss]";
            LabelDayOfWeekExecuteTime.Text += "[hh:mm:ss]";
		}
        OperateResult.Text = string.Empty;
	}
Example #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtil.CheckPrivilege(WebConfig.FunctionAutomationAddScheduledTask, OpType.READ, Session))
        {
            Response.Redirect(WebConfig.PageNotEnoughPrivilege, true);
        }

        string op = Request.Params[WebConfig.ParamOperation];

        if (op != null && op == WebConfig.OpTypeModify && Session[WebConfig.SessionScheduledTask] != null)
        {
            _opType   = PageOpType.Modify;
            _taskUnit = Session[WebConfig.SessionScheduledTask] as ScheduledTaskUnit;

            if (_taskUnit == null)
            {
                return;
            }

            //修改自动化作业需要对ScheduledTaskManager有写权限
            if (!WebUtil.CheckPrivilege(TheAdminServer.ScheduledTaskManager.SecurityObject, OpType.WRITE, Session))
            {
                Response.Redirect(WebConfig.PageNotEnoughPrivilege, true);
            }
        }
        else
        {
            _opType = PageOpType.Add;

            //添加自动化作业需要对ScheduledTaskManager有写权限
            if (!WebUtil.CheckPrivilege(TheAdminServer.ScheduledTaskManager.SecurityObject, OpType.WRITE, Session))
            {
                Response.Redirect(WebConfig.PageNotEnoughPrivilege, true);
            }
        }

        if (!IsPostBack)
        {
            ListScheduledTaskType();

            if (_opType == PageOpType.Modify)
            {
                LabelOpType.Text = StringDef.EditScheduledTask;
                if (_taskUnit != null)
                {
                    AutomationEditor1.Automation = _taskUnit.Task.Automation;
                    TextBoxName.Text             = _taskUnit.Task.SecurityObject.Name;
                    TextBoxComment.Text          = _taskUnit.Task.SecurityObject.Comment;

                    switch (_taskUnit.Task.Type)
                    {
                    case ScheduledTaskType.Once:
                    {
                        OnceScheduledTask task = _taskUnit.Task as OnceScheduledTask;
                        TextBoxExecuteTime.Text = task.ExecuteTime.ToString();
                    }
                    break;

                    case ScheduledTaskType.Repeat:
                    {
                        RepeatScheduledTask task = _taskUnit.Task as RepeatScheduledTask;
                        TextBoxStartTime.Text = task.StartTime.ToString();
                        TextBoxEndTime.Text   = task.EndTime.ToString();
                        TextBoxInterval.Text  = task.Interval.ToString();
                    }
                    break;

                    case ScheduledTaskType.DayOfWeek:
                    {
                        DayOfWeekScheduledTask task = _taskUnit.Task as DayOfWeekScheduledTask;
                        TextBoxDayOfWeekExecuteTime.Text = task.TimeOfDay.ToString();
                        foreach (DayOfWeek day in task.DayOfWeek)
                        {
                            CheckBoxListDayOfWeek.Items[(int)day].Selected = true;
                        }
                    }
                    break;
                    }

                    SetScheduledTaskType(_taskUnit.Task.Type);
                }
            }
            else if (_opType == PageOpType.Add)
            {
                AutomationEditor1.Automation = null;
                LabelOpType.Text             = StringDef.AddScheduledTask;
            }
            LabelOnceExecuteTime.Text      += "[yyyy-mm-dd hh:mm:ss]";
            LabelRepeatStartTime.Text      += "[hh:mm:ss]";
            LabelRepeatEndTime.Text        += "[hh:mm:ss]";
            LabelIntervalTime.Text         += "[hh:mm:ss]";
            LabelDayOfWeekExecuteTime.Text += "[hh:mm:ss]";
        }
        OperateResult.Text = string.Empty;
    }