Exemplo n.º 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));
        }
Exemplo n.º 2
0
        public ActionResult ManageSubscriptions(ManageSubscriptionsVM model)
        {
            if (!ModelState.IsValid)
            {
                model.Sites = SitesManager.GetSites();
                return(View(model));
            }
            int memberId = 0;

            Int32.TryParse(model.MemberId, out memberId);
            int siteId = 0;

            Int32.TryParse(model.SiteId, out siteId);
            int lastFourDigit = -1;

            lastFourDigit = !string.IsNullOrEmpty(model.LastFourDigit) && int.TryParse(model.LastFourDigit, out lastFourDigit) ? int.Parse(model.LastFourDigit) : -1;

            if (memberId != 0 || model.Email != null || model.Phone != null || model.Name != null || (lastFourDigit >= 0 && lastFourDigit <= 9999))
            {
                string lastFourDigitCreditCard = GenerateLastFourDigitCreditCard(lastFourDigit);

                List <CustomerDT> data = CustomersManager.GetCustomers(siteId, memberId, model.Email, model.Phone, model.Name, lastFourDigitCreditCard);
                ViewBag.Data = data;
            }

            model.Sites = SitesManager.GetSites();
            return(View(model));
        }
Exemplo n.º 3
0
        public ActionResult MagnamentActiveSite()
        {
            var sites = SitesManager.GetSites();
            var model = new CastleClub.BackEnd.Models.MagnementActivesSitesVM()
            {
                MasterEmailFormProcentage   = sites[0].MasterCardEmailFormPercentage,
                VisaEmailFormPorcentage     = sites[0].VisaEmailFormPercentage,
                DiscoverEmailFormPorcentage = sites[0].DiscoverEmailFormPercentage
            };

            model.Sites = new List <MagnementActiveSiteVM>();
            foreach (var site in sites.OrderBy(x => x.Id))
            {
                var siteRepeat = model.Sites.FirstOrDefault(x => x.Site.Name == site.Name);
                if (siteRepeat != null)
                {
                    model.Sites.Remove(siteRepeat);
                }
                model.Sites.Add(new CastleClub.BackEnd.Models.MagnementActiveSiteVM()
                {
                    Active = site.Active,
                    SiteId = site.Id,
                    Site   = site,
                    Url    = (site.OfferDomain.Contains("https://www.")) ?
                             site.SignupDomain
                            : "https://www." + site.SignupDomain.Replace("www", string.Empty).Replace("http://", string.Empty).Replace("https://", string.Empty) + "/optin.aspx"
                });
            }

            model.Sites = model.Sites.OrderBy(x => x.Site.Name).ToList();

            return(View(model));
        }
Exemplo n.º 4
0
        public ActionResult AuthorizeTransactionCompare()
        {
            AuthorizeCompareTransactionVM model = new AuthorizeCompareTransactionVM()
            {
                From  = DateTime.Today.Date,
                To    = DateTime.Today.Date,
                Sites = new List <SiteDT>()
            };

            var sites = SitesManager.GetSites();

            model.Sites.Add(new SiteDT()
            {
                Name = "All Web Sites",
                Id   = 0
            });

            foreach (var site in sites.OrderBy(x => x.Name))
            {
                if (!model.Sites.Any(x => x.Name == site.Name))
                {
                    model.Sites.Add(site);
                }
            }

            return(View(model));
        }
Exemplo n.º 5
0
        //
        // GET: /Customers/
        public ActionResult Index()
        {
            ViewBag.CustomersCount = CustomersManager.GetCustomersCount().ToString();
            ViewBag.SitesName      = SitesManager.GetSites().GroupBy(x => x.Name).Select(x => x.Key);

            return(View());
        }
Exemplo n.º 6
0
        // GET: Sites
        public ActionResult WelcomeEmail()
        {
            var model = new WelcomeEmailVM();

            model.sites    = SitesManager.GetSites();
            model.CapEmail = GlobalParameters.CapEmail;
            return(View(model));
        }
Exemplo n.º 7
0
        public ActionResult SalesReport()
        {
            var model = new SalesReportVM();

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

            return(View(model));
        }
Exemplo n.º 8
0
        public ActionResult ReportWelcomeEmail()
        {
            ReportEmailVM model = new ReportEmailVM()
            {
                Referrers = SitesManager.GetReferrers(),
                StartDate = DateTime.Now,
                EndDate   = DateTime.Now,
                Sites     = SitesManager.GetSites()
            };

            return(View(model));
        }
Exemplo n.º 9
0
        public ActionResult TestPage()
        {
            var model = new CastleClub.BackEnd.Models.TestVM();

            model.Sites = new List <SiteDT>();
            foreach (var siteDT in SitesManager.GetSites().OrderBy(x => x.Name))
            {
                if (!model.Sites.Any(x => x.Name.ToLower() == siteDT.Name.ToLower()))
                {
                    model.Sites.Add(siteDT);
                }
            }

            return(View(model));
        }
Exemplo n.º 10
0
        public ActionResult ActiveReport()
        {
            var model = new ActiveReportVM();

            var sites = SitesManager.GetSites();

            foreach (var site in sites)
            {
                var siteVm = new SiteVM {
                    Id = site.Id, Name = site.Name, ProcessCsv = false
                };
                model.sites.Add(siteVm);
            }

            return(View(model));
        }
Exemplo n.º 11
0
        public ActionResult ManageSubscriptions(string customerEmail)
        {
            if (!string.IsNullOrEmpty(customerEmail))
            {
                ManageSubscriptionsVM manageSubscription = new ManageSubscriptionsVM()
                {
                    Email = customerEmail
                };
                return(ManageSubscriptions(manageSubscription));
            }

            var model = new ManageSubscriptionsVM();

            model.Sites = SitesManager.GetSites();

            return(View(model));
        }
Exemplo n.º 12
0
        public ActionResult TestPage(TestVM model)
        {
            model.Sites = new List <SiteDT>();
            foreach (var siteDT in SitesManager.GetSites().OrderBy(x => x.Name))
            {
                if (!model.Sites.Any(x => x.Name.ToLower() == siteDT.Name.ToLower()))
                {
                    model.Sites.Add(siteDT);
                }
            }
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            model.Emails = CustomersManager.GetAllEmails(model.SiteID);

            return(View(model));
        }
Exemplo n.º 13
0
        public ActionResult Chart()
        {
            var sites = new List <SiteDT>();

            sites.Add(new SiteDT()
            {
                Name = "All Web Sites", Id = 0
            });
            sites.AddRange(SitesManager.GetSites());
            ChartReportVM model = new ChartReportVM()
            {
                Sites = sites.GroupBy(x => x.Name).Select(x => new SiteDT()
                {
                    Name = x.Key, Id = x.Max(y => y.Id)
                }).ToList()
            };

            return(View(model));
        }
Exemplo n.º 14
0
        /// <summary>
        /// Resume all transaction of range. Successfull and Fail
        /// </summary>
        /// <param name="siteID">0 for all site.</param>
        /// <param name="from">From date</param>
        /// <param name="to">To date</param>
        /// <returns>Index 0 is successfull, and index 1 is fail.</returns>
        public static decimal[] TransactionReport(int siteID, DateTime from, DateTime to)
        {
            using (CastleClubEntities entities = new CastleClubEntities())
            {
                decimal[] resp = new decimal[2];
                resp[0] = 0;
                resp[1] = 0;

                if (siteID == 0)
                {
                    var sites = SitesManager.GetSites();
                    foreach (var site in sites)
                    {
                        GetTransactionReportFromAuthorizeForSite(site, from, to.Date.AddDays(1).AddSeconds(-1), resp, entities);
                    }
                }
                else
                {
                    GetTransactionReportFromAuthorizeForSite(SitesManager.GetSite(siteID), from, to.Date.AddDays(1).AddSeconds(-1), resp, entities);
                }

                return(resp);
            }
        }
Exemplo n.º 15
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));
        }