示例#1
0
        private DispatchedMessageInfo BuildDispatchMessageInfo(MessageItem message, PlanData planData, VisitData visitData)
        {
            MessageStateInfo      info  = new MessageStateInfo(message);
            DispatchedMessageInfo info3 = new DispatchedMessageInfo();

            info3.ID          = info.ID;
            info3.Name        = info.Name;
            info3.MessageType = info.Type;
            info3.Date        = info.StartDate;
            info3.State       = info.Status;
            DispatchedMessageInfo info2 = info3;

            if (planData != null)
            {
                DateTime       time;
                DateTime       time2;
                PlanStatistics planStatistics = AnalyticsFactory.Instance.GetPlanStatistics(planData);
                AnalyticsHelper.TryGetCampaignDates(message.CampaignId.ToGuid(), out time, out time2);
                info2.Sent      = (time != time2) ? planStatistics.GetTotal() : 0;
                info2.OpenRate  = planStatistics.GetOpenRate();
                info2.ClickRate = planStatistics.GetClickRate();
            }
            if (visitData != null)
            {
                info2.ValuePerVisit = visitData.ValuePerVisit;
                info2.Value         = visitData.Value;
            }
            return(info2);
        }
        private DispatchedMessageInfo GetDispatchedInfo(MessageItem message, VisitData visitData, PlanData planData)
        {
            MessageStateInfo      messageStateInfo = this.GetMessageStateInfo(message);
            DispatchedMessageInfo info3            = new DispatchedMessageInfo();

            info3.ID             = messageStateInfo.ID;
            info3.Name           = messageStateInfo.Name;
            info3.State          = messageStateInfo.Status;
            info3.Date           = messageStateInfo.Updated;
            info3.Sent           = messageStateInfo.Sent;
            info3.NumSubscribers = messageStateInfo.NumSubscribers;
            info3.MessageState   = messageStateInfo.MessageState;
            DispatchedMessageInfo info2 = info3;
            int emailCount = -1;

            if (planData != null)
            {
                PlanStatistics planStatistics = AnalyticsFactory.Instance.GetPlanStatistics(planData);
                info2.OpenRate  = planStatistics.GetOpenRate();
                info2.ClickRate = planStatistics.GetClickRate();
                emailCount      = planStatistics.GetActual();
            }
            if (visitData != null)
            {
                info2.ValuePerVisit = visitData.ValuePerVisit;
                if (emailCount > -1)
                {
                    VisitStatistics visitStatistics = AnalyticsFactory.Instance.GetVisitStatistics(visitData);
                    info2.ValuePerEmail  = visitStatistics.GetValuePerEmail(emailCount);
                    info2.VisitsPerEmail = visitStatistics.GetVisitPerEmail(emailCount);
                }
            }
            return(info2);
        }