public static Dictionary <string, Segment> GetSegments(Account account, Channel channel, SqlConnection connection, SegmentOptions options, OptionsOperator @operator = OptionsOperator.And) { return(new Dictionary <string, Segment>() { { Common.Campaign, new Segment() { ID = -875, Name = Common.Campaign } }, { Common.AdGroup, new Segment() { ID = -876, Name = Common.AdGroup } }, { Common.Tracker, new Segment() { ID = -977, Name = Common.Tracker } }, { Common.LandingPage, new Segment() { ID = -823, Name = Common.LandingPage } }, { Common.USP, new Segment() { ID = -824, Name = Common.USP } }, { Common.Region, new Segment() { ID = -825, Name = Common.Region } }, { Common.Language, new Segment() { ID = -826, Name = Common.Language } }, { Common.Theme, new Segment() { ID = -827, Name = Common.Theme } }, }); }
public static Dictionary <string, Measure> GetMeasures(Account account, Channel channel, SqlConnection connection, MeasureOptions?options = null, OptionsOperator @operator = OptionsOperator.Or, bool includeBase = false) { SqlCommand cmd = DataManager.CreateCommand(AppSettings.Get(typeof(Measure), "GetMeasures.SP"), System.Data.CommandType.StoredProcedure); cmd.Connection = connection; cmd.Parameters["@accountID"].Value = account == null ? DBNull.Value : (object)account.ID; cmd.Parameters["@channelID"].Value = channel == null ? DBNull.Value : (object)channel.ID; cmd.Parameters["@flags"].Value = options; cmd.Parameters["@operator"].Value = @operator; cmd.Parameters["@includeBase"].Value = includeBase; List <Measure> measures = new List <Measure>(); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { Measure m = new Measure() { ID = (int)reader["MeasureID"], BaseMeasureID = (int)reader["BaseMeasureID"], Account = reader.Get <int>("AccountID") == -1 ? null : account, Channel = reader.Get <int>("ChannelID") == -1 ? null : (channel ?? new Channel() { ID = reader.Get <int>("ChannelID") }), Name = reader["Name"] is DBNull ? string.Empty : (string)reader["Name"], DisplayName = reader["DisplayName"] is DBNull ? string.Empty : (string)reader["DisplayName"], SourceName = reader["SourceName"] is DBNull ? string.Empty : (string)reader["SourceName"], OltpName = reader["FieldName"] is DBNull ? string.Empty : (string)reader["FieldName"], StringFormat = reader["StringFormat"] is DBNull ? string.Empty : (string)reader["StringFormat"], AcquisitionNum = reader["AcquisitionNum"] is DBNull ? null : (int?)reader["AcquisitionNum"], Options = (MeasureOptions)reader["Flags"] }; measures.Add(m); } } return(measures.ToDictionary(m => m.Name)); }
public static Dictionary <string, Segment> GetSegments(Account account, Channel channel, SqlConnection connection, SegmentOptions options, OptionsOperator @operator = OptionsOperator.And) { return(new Dictionary <string, Segment>() { { Common.Campaign, new Segment() { ID = -875, Name = Common.Campaign } }, { Common.AdGroup, new Segment() { ID = -876, Name = Common.AdGroup } }, { Common.Tracker, new Segment() { ID = -977, Name = Common.Tracker } } }); }