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 TrickleInfo GetTrickleInfo(MessageItem message, VisitData visitData, PlanData planData) { MessageStateInfo messageStateInfo = this.GetMessageStateInfo(message); TrickleInfo info3 = new TrickleInfo(); info3.ID = messageStateInfo.ID; info3.Name = messageStateInfo.Name; info3.HasAbn = messageStateInfo.HasAbn; TrickleInfo info2 = info3; int emailCount = -1; if (planData != null) { PlanStatistics planStatistics = this.analyticsFactory.GetPlanStatistics(planData); info2.OpenRate = planStatistics.GetOpenRate(); info2.Recipients = planStatistics.GetTotal(); emailCount = planStatistics.GetActual(); } if (visitData != null) { info2.ValuePerVisit = visitData.ValuePerVisit; if (emailCount > -1) { info2.ValuePerEmail = this.analyticsFactory.GetVisitStatistics(visitData).GetValuePerEmail(emailCount); } } return(info2); }