Exemplo n.º 1
0
        public void DoAction()
        {
            this.DataUpdateAction.Settings = this.Settings;

            ActionData tData = new ActionData();

            List <DataUpdate> dataUpdates = new List <DataUpdate>();

            Type actionType = this.DataUpdateAction.GetType();

            object[] attrs = actionType.GetCustomAttributes(typeof(MonitorDataUpdate), true);
            for (int i = 0; i < attrs.Length; i++)
            {
                MonitorDataUpdate attribute = (MonitorDataUpdate)attrs[i];

                SqlDataReader reader = tData.GetDataUpdatesForAction(this.ActionId, attribute.DataType);
                while (reader.Read())
                {
                    dataUpdates.Add(new DataUpdate(reader));
                }
                reader.Close();
            }

            foreach (DataUpdate update in dataUpdates)
            {
                if (DataUpdateAction.PerformAction(update))
                {
                    tData.SaveDataActionProcessed(update.DataUpdateGuid, this.ActionId);
                }
            }
        }