Ejemplo n.º 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        public AgentOperator(CDataContainer dataContainer, AgentOperatorInfo operatorInfo)
        {
            try
            {
                if (dataContainer == null)
                {
                    throw new ArgumentNullException("dataContainer");
                }

                if (operatorInfo == null)
                {
                    throw new ArgumentNullException("operatorInfo");
                }

                this.operatorInfo  = operatorInfo;
                this.DataContainer = dataContainer;

                STParameters parameters = new STParameters();
                parameters.SetDocument(dataContainer.Document);

                string agentOperatorName = null;
                if (parameters.GetParam("operator", ref agentOperatorName))
                {
                    this.operatorsData = new AgentOperatorsData(dataContainer, agentOperatorName);
                }
                else
                {
                    throw new ArgumentNullException("agentOperatorName");
                }
            }
            catch (Exception e)
            {
                throw new ApplicationException("AgentOperatorsSR.FailedToCreateInitializeAgentOperatorDialog", e);
            }
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public AgentOperatorActions(
            CDataContainer dataContainer,
            AgentOperatorInfo operatorInfo,
            ConfigAction configAction)
        {
            if (dataContainer == null)
            {
                throw new ArgumentNullException("dataContainer");
            }

            if (operatorInfo == null)
            {
                throw new ArgumentNullException("operatorInfo");
            }

            this.operatorInfo  = operatorInfo;
            this.DataContainer = dataContainer;
            this.configAction  = configAction;

            STParameters parameters = new STParameters();

            parameters.SetDocument(dataContainer.Document);

            string agentOperatorName = null;

            if (parameters.GetParam("operator", ref agentOperatorName))
            {
                this.operatorsData = new AgentOperatorsData(
                    dataContainer,
                    agentOperatorName,
                    createMode: configAction == ConfigAction.Create);
            }
            else
            {
                throw new ArgumentNullException("agentOperatorName");
            }
        }