Example #1
0
        public Task <Response <List <EmailStatistic> > > EmailStatics(
            EmailStatisticsListQuery option = null)
        {
            string startDateTime = null;

            if (option?.StartTimeTimeSpan != null)
            {
                startDateTime = new DateTime(2012, 01, 01).Add(option.StartTimeTimeSpan.Value).ToString("YYYY-MM-DD");
            }

            string endDateTime = null;

            if (option?.EndTimeTimeSpan != null)
            {
                endDateTime = new DateTime(2012, 01, 01).Add(option.EndTimeTimeSpan.Value).ToString("YYYY-MM-DD");
            }

            var subUserDictionary = new Dictionary <string, string>();

            if (option?.SubUserNames != null && option.SubUserNames.Any())
            {
                foreach (var userName in option.SubUserNames)
                {
                    subUserDictionary.Add("subusers", userName);
                }
            }

            if (option?.SubUserNames?.Any() ?? false || (option?.RetrieveForAllSubUsers ?? false))
            {
                return(_context.EmailStatisticsForSubUsers(option?.PageSize, option?.PageIndex,
                                                           startDate: startDateTime,
                                                           endDate: endDateTime, subusers: subUserDictionary,
                                                           aggregatedby: option?.StatisticAggregate.ToAggregateByString()));
            }

            if (option?.Categories?.Any() ?? false || (option?.RetrieveForAllCategories ?? false))
            {
                return(_context.EmailStatisticsForCategories(option?.PageSize, option?.PageIndex,
                                                             startDate: startDateTime,
                                                             endDate: endDateTime, subusers: subUserDictionary,
                                                             aggregatedby: option?.StatisticAggregate.ToAggregateByString()));
            }

            return(_context.EmailStatisticsForSubUsers(option?.PageSize, option?.PageIndex, startDate: startDateTime,
                                                       endDate: endDateTime, subusers: subUserDictionary,
                                                       aggregatedby: option?.StatisticAggregate.ToAggregateByString()));
        }
Example #2
0
 public ICategoryListQuery EagerLoadCampaignSchedule(Action <IEmailStatisticsListQuery> queryAction = null)
 {
     EmailStatisticsListQuery =
         OptionProcessor.Process <IEmailStatisticsListQuery, EmailStatisticsListQuery>(queryAction);
     return(this);
 }