コード例 #1
0
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            DataManager.ConnectionString = ParentWorkflow.Parameters["ConnectionString"].ToString();
            DataManager.CommandTimeout   = 0;

            //Run the stored procedure, based on the params we have.
            try
            {
                string channelID = ParentWorkflow.Parameters["ChannelID"].ToString();

                //Create the command.
                using (DataManager.Current.OpenConnection())
                {
                    SqlCommand accounts = BuildCommand();
                    accounts.ExecuteNonQuery();

                    Easynet.Edge.Alerts.Core.AlertMeasures measures = AlertMeasures;

                    //Now we need to loop on the table and build the list of campaigns and deltas.
                    SqlDataReader             sdr         = GetMeasuredData(ParentWorkflow.Parameters);
                    string                    accountName = String.Empty;
                    List <AccountAllMeasures> accountList = new List <AccountAllMeasures>();
                    while (sdr.Read())
                    {
                        AccountAllMeasures aam = new AccountAllMeasures(sdr, measures, _alertType);
                        accountList.Add(aam);
                    }

                    sdr.Close();
                    sdr.Dispose();

                    foreach (AccountAllMeasures aams in accountList)
                    {
                        AccountAlertFilters filters = new AccountAlertFilters(aams.AccountID);
                        aams.Filter(measures, filters);
                        accountName          = aams.AccountName;
                        aams.TimeMeasurement = this.TimeMeasurement;
                        aams.MeasurementType = this.MeasurementType;

                        //Only add if we're going to include it in the list (i.e. passed the min)
                        if (aams.Include)
                        {
                            _results.Add(aams);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception at Account Campaigns: " + ex.ToString());
                throw ex;
            }

            return(ActivityExecutionStatus.Closed);
        }
コード例 #2
0
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            DataManager.ConnectionString = ParentWorkflow.Parameters["ConnectionString"].ToString();
            DataManager.CommandTimeout   = 0;

            //Run the stored procedure, based on the params we have.
            try
            {
                int accountID = Convert.ToInt32(ParentWorkflow.Parameters["AccountID"]);
                int channelID = Convert.ToInt32(ParentWorkflow.Parameters["ChannelID"]);

                //Create the command.
                using (DataManager.Current.OpenConnection())
                {
                    SqlCommand accountCampaigns = BuildCommand();
                    accountCampaigns.ExecuteNonQuery();

                    AccountAlertFilters filters = Filters;
                    Easynet.Edge.Alerts.Core.AlertMeasures measures = AlertMeasures;

                    //Now we need to loop on the table and build the list of campaigns and deltas.
                    SqlDataReader sdr         = GetMeasuredData(ParentWorkflow.Parameters);
                    string        accountName = String.Empty;
                    while (sdr.Read())
                    {
                        CampaignAllMeasures cam = new CampaignAllMeasures(sdr, filters, measures, _alertType);
                        accountName         = cam.AccountName;
                        cam.TimeMeasurement = this.TimeMeasurement;
                        cam.MeasurementType = this.MeasurementType;

                        //Only add if we're going to include it in the list (i.e. passed the min)
                        if (cam.Include)
                        {
                            _results.Add(cam);
                        }
                    }

                    ParentWorkflow.InternalParameters.Add("AccountName", accountName);

                    //Add a list of all campaign GK's we have, so in case someone wants to use
                    //ad groups after us without giving a specific campaign GK. They'll have them.
                    BuildCampaignGKList();

                    sdr.Close();
                    sdr.Dispose();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception at Account Campaigns: " + ex.ToString());
                throw ex;
            }

            return(ActivityExecutionStatus.Closed);
        }