Exemple #1
0
        public ActionResult ReportWelcomeEmail(ReportEmailVM model)
        {
            int siteID = model.SiteId;

            model.Referrers = SitesManager.GetReferrers();
            model.Sites     = SitesManager.GetSites();
            //using (CastleClub.BusinessLogic.Data.CastleClubEntities entities = new BusinessLogic.Data.CastleClubEntities())
            //{ i
            //int i = 0;
            model.delayDef            = new int[] { 0, 1, 2, 3, 7 };
            model.delayEmailSent      = new int[model.delayDef.Max() + 1, SitesManager.GetMaxID() + 1];
            model.delayActiveUsers    = new int[model.delayDef.Max() + 1, SitesManager.GetMaxID() + 1];
            model.delayCancelledUsers = new int[model.delayDef.Max() + 1, SitesManager.GetMaxID() + 1];
            foreach (var item in model.Sites)
            {
                //get total of email sent
                foreach (var delay in model.delayDef.ToList())
                {
                    if ((model.SiteId == item.Id) || model.SiteId == 0)
                    {
                        model.delayEmailSent[delay, item.Id]      = SitesManager.WelcomeEmailsSent(model.StartDate, model.EndDate, item.Id, model.ReferrerId, delay);
                        model.delayActiveUsers[delay, item.Id]    = SitesManager.WelcomeEmailsSentActive(model.StartDate, model.EndDate, item.Id, model.ReferrerId, delay);
                        model.delayCancelledUsers[delay, item.Id] = SitesManager.WelcomeEmailsSentCancelled(model.StartDate, model.EndDate, item.Id, model.ReferrerId, delay);
                    }
                }
            }

            //}


            return(View(model));
        }
Exemple #2
0
        public ActionResult SalesReport()
        {
            var model = new SalesReportVM();

            model.Referrers = SitesManager.GetReferrers();
            model.Sites     = SitesManager.GetSites();

            return(View(model));
        }
Exemple #3
0
        public ActionResult EmailReport()
        {
            EmailReportVM model = new EmailReportVM()
            {
                Referrers = SitesManager.GetReferrers(),
                StartDate = DateTime.Now,
                EndDate   = DateTime.Now
            };

            return(View(model));
        }
Exemple #4
0
        public ActionResult ReportWelcomeEmail()
        {
            ReportEmailVM model = new ReportEmailVM()
            {
                Referrers = SitesManager.GetReferrers(),
                StartDate = DateTime.Now,
                EndDate   = DateTime.Now,
                Sites     = SitesManager.GetSites()
            };

            return(View(model));
        }
Exemple #5
0
        public ActionResult EmailReport(EmailReportVM model)
        {
            if (ModelState.IsValid)
            {
                List <EmailReportDT> emailReport = new List <EmailReportDT>();
                ViewBag.data = SitesManager.GetEmailReport(model.ReferrerId, model.ReportType == "ACTIVE", model.StartDate, model.EndDate);
            }

            model.Referrers = SitesManager.GetReferrers();

            return(View(model));
        }
Exemple #6
0
        public ActionResult SalesReport(SalesReportVM model)
        {
            if (!ModelState.IsValid)
            {
                model.Referrers = SitesManager.GetReferrers();
                model.Sites     = SitesManager.GetSites();
                return(View(model));
            }

            List <KeyValuePair <string, List <ReferrerSalesInfoDT> > > data = new List <KeyValuePair <string, List <ReferrerSalesInfoDT> > >();

            if (model.ReferrerId != 0)
            {
                if (model.SiteId != 0)
                {
                    ReferrerDT referrer = SitesManager.GetReferrer(model.ReferrerId);
                    List <ReferrerSalesInfoDT> referrerData = SitesManager.GetReferrerSiteSalesInfo(model.StartDate, model.EndDate, (DateGroupBy)Enum.Parse(typeof(DateGroupBy), model.GroupBy), model.ReferrerId, model.SiteId);
                    data.Add(new KeyValuePair <string, List <ReferrerSalesInfoDT> >(referrer.Name + " - " + SitesManager.GetSite(model.SiteId).Name, referrerData));
                }
                else
                {
                    ReferrerDT referrer = SitesManager.GetReferrer(model.ReferrerId);
                    List <ReferrerSalesInfoDT> referrerData = SitesManager.GetReferrerSiteSalesInfo(model.StartDate, model.EndDate, (DateGroupBy)Enum.Parse(typeof(DateGroupBy), model.GroupBy), model.ReferrerId, model.SiteId);
                    data.Add(new KeyValuePair <string, List <ReferrerSalesInfoDT> >(referrer.Name + " - All Sites", referrerData));

                    foreach (var site in SitesManager.GetSites())
                    {
                        referrerData = SitesManager.GetReferrerSiteSalesInfo(model.StartDate, model.EndDate, (DateGroupBy)Enum.Parse(typeof(DateGroupBy), model.GroupBy), model.ReferrerId, site.Id);
                        data.Add(new KeyValuePair <string, List <ReferrerSalesInfoDT> >(referrer.Name + " - " + site.Name, referrerData));
                    }
                }
            }
            else
            {
                if (model.SiteId != 0)
                {
                    string sitenName = SitesManager.GetSite(model.SiteId).Name;
                    List <ReferrerSalesInfoDT> referrerData = SitesManager.GetReferrerSiteSalesInfo(model.StartDate, model.EndDate, (DateGroupBy)Enum.Parse(typeof(DateGroupBy), model.GroupBy), 0, model.SiteId);
                    data.Add(new KeyValuePair <string, List <ReferrerSalesInfoDT> >("All Websites - " + sitenName, referrerData));

                    foreach (ReferrerDT referrer in SitesManager.GetReferrers())
                    {
                        referrerData = SitesManager.GetReferrerSiteSalesInfo(model.StartDate, model.EndDate, (DateGroupBy)Enum.Parse(typeof(DateGroupBy), model.GroupBy), referrer.Id, model.SiteId);
                        data.Add(new KeyValuePair <string, List <ReferrerSalesInfoDT> >(referrer.Name + " - " + sitenName, referrerData));
                    }
                }
                else
                {
                    List <ReferrerSalesInfoDT> referrerData = SitesManager.GetReferrerSiteSalesInfo(model.StartDate, model.EndDate, (DateGroupBy)Enum.Parse(typeof(DateGroupBy), model.GroupBy), 0, model.SiteId);
                    data.Add(new KeyValuePair <string, List <ReferrerSalesInfoDT> >("All Websites - All Sites", referrerData));

                    foreach (var site in SitesManager.GetSites())
                    {
                        foreach (ReferrerDT referrer in SitesManager.GetReferrers())
                        {
                            referrerData = SitesManager.GetReferrerSiteSalesInfo(model.StartDate, model.EndDate, (DateGroupBy)Enum.Parse(typeof(DateGroupBy), model.GroupBy), referrer.Id, site.Id);
                            data.Add(new KeyValuePair <string, List <ReferrerSalesInfoDT> >(referrer.Name + " - " + site.Name, referrerData));
                        }
                    }
                }
            }
            ViewBag.Data = data;

            model.Referrers = SitesManager.GetReferrers();
            model.Sites     = SitesManager.GetSites();
            return(View(model));
        }