Ejemplo n.º 1
0
        private static void AddIncompleteSite()
        {
            var siteManager = new SitesManager();

            // Test with invalid required parameters
            siteManager.addSite("", null);
        }
Ejemplo n.º 2
0
        private static void getSiteFromId()
        {
            var siteManager = new SitesManager();

            siteManager.setTokenAuth("XYZ");

            var sites = siteManager.getSiteFromId(1);

            Console.WriteLine(sites.Count + " sites found");

            foreach (Hashtable site in sites)
            {
                Console.WriteLine(
                    site[SitesManager.ID] + " " +
                    site[SitesManager.NAME] + " " +
                    site[SitesManager.MAIN_URL] + " " +
                    site[SitesManager.TS_CREATED] + " " +
                    site[SitesManager.TIMEZONE] + " " +
                    site[SitesManager.CURRENCY] + " " +
                    site[SitesManager.EXCLUDED_IPS] + " " +
                    site[SitesManager.EXCLUDED_PARAMETERS] + " " +
                    site[SitesManager.FEEDBURNER_NAME] + " " +
                    site[SitesManager.GROUP] + " " +
                    site[SitesManager.ECOMMERCE]
                    );
            }
        }
Ejemplo n.º 3
0
        public override void Execute(INotification notification)
        {
            if (LastExecutuion > Time.time)
            {
                return;
            }

            LastExecutuion = Time.time + 1f; // PREVENT SPAM

            if (!Lock)
            {
                Lock = true;
                SiteClass[] Added   = SitesManager.Added();
                SiteClass[] Changed = SitesManager.Changed();
                int[]       Deleted = SitesManager.Deleted();

                bool IsSend = Added.Length != 0 | Changed.Length != 0 | Deleted.Length != 0;
                if (IsSend)
                {
                    NetworkManager.Send(NetworkConstants.UPDATE_SITE_DATA, new SubmitDataForUpdate()
                    {
                        Code    = ErrorCodes.SUCCESS,
                        Added   = Added,
                        Changed = Changed,
                        Deleted = Deleted,
                    });
                }
                Lock = false;
            }
        }
Ejemplo n.º 4
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));
        }
Ejemplo n.º 5
0
        public ActionResult Synchronize(AuthorizeFileVM model)
        {
            if (!ModelState.IsValid)
            {
                model.Upload = false;
                return View(model);
            }

            string fileName = CastleClub.BusinessLogic.Data.GlobalParameters.ExcelOutPath + "\\" + Guid.NewGuid().ToString();
            byte[] content= new byte[model.File.InputStream.Length];

            model.File.InputStream.Read(content, 0, model.File.ContentLength);

            System.IO.File.WriteAllBytes(fileName, content);

            bool result=AuthorizeManager.ReadReportFile(fileName, model.OnlyRefund);
            if (result)
            {
                SitesManager.UpdateTotalsReferrers();
            }

            model.File = null;
            model.Upload = result;

            return View(model);
        }
Ejemplo n.º 6
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));
        }
Ejemplo n.º 7
0
        private static void UpdateSite()
        {
            var siteManager = new SitesManager();

            siteManager.setTokenAuth("XYZ");

            string[] urls                    = { "http://brandNew", "http://shinyNew" };
            string[] excludedIps             = { "123.123.11.1", "212.21.11.2" };
            string[] excludedQueryParameters = { "key1", "key2" };

            var status = siteManager.updateSite(
                5,
                "Brand New Site",
                urls,
                true,
                excludedIps,
                excludedQueryParameters,
                "UTC-4",
                "USD",
                "group2",
                new DateTime(2011, 01, 10)
                );

            if (status)
            {
                Console.WriteLine("Site updated");
            }
        }
Ejemplo n.º 8
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));
        }
Ejemplo n.º 9
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));
        }
Ejemplo n.º 10
0
 private void BtnDelete_Click(object sender, EventArgs e)
 {
     if (Block)
     {
         return;
     }
     if (SitesDataGrid.CurrentCell != null && SitesDataGrid.CurrentCell.RowIndex >= 0)
     {
         int selected = (int)SitesDataGrid.Rows[SitesDataGrid.CurrentCell.RowIndex].Tag;
         if (ConfirmDelete() == true)
         {
             SiteClass site = SitesManager.GetByIndex(selected);
             if (site != null)
             {
                 if (site.operation == UpdateOperation.ADD_NEW)
                 {
                     SitesManager.Delete(site);
                 }
                 else
                 {
                     site.operation = UpdateOperation.DELETE;
                     SitesManager.UpdateSite(site);
                 }
             }
             InitializeEditor();
         }
     }
     else
     {
         MessageBox.Show("Please select a site!");
     }
 }
Ejemplo n.º 11
0
        private void BtnPause_Click(object sender, EventArgs e)
        {
            if (Block)
            {
                return;
            }
            if (SitesDataGrid.CurrentCell != null && SitesDataGrid.CurrentCell.RowIndex >= 0)
            {
                int       selected = (int)SitesDataGrid.Rows[SitesDataGrid.CurrentCell.RowIndex].Tag;
                SiteClass site     = SitesManager.GetByIndex(selected);
                if (site != null)
                {
                    site.IsActive = site.IsActive ? false : true;
                    if (site.operation != UpdateOperation.ADD_NEW)
                    {
                        site.operation = UpdateOperation.CHANGED;
                    }

                    SitesManager.UpdateSite(site);
                }
            }
            else
            {
                MessageBox.Show("Please select a site!");
            }
        }
Ejemplo n.º 12
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());
        }
Ejemplo n.º 13
0
 static void Main(string[] args)
 {
     using (CastleClub.BusinessLogic.Data.CastleClubEntities entities = new BusinessLogic.Data.CastleClubEntities())
     {
         var sites    = entities.Sites.ToList();
         int capEmail = int.Parse(System.Configuration.ConfigurationManager.AppSettings["CapEmail"]);
         foreach (var site in sites)
         {
             if ((site.SendWelcomeEmail == true) && (site.WelcomeEmailDelay != null) && (site.WelcomeEmailDelay > 0))
             {
                 int      delay        = site.WelcomeEmailDelay == null ? 0: (int)site.WelcomeEmailDelay;
                 DateTime mindate      = DateTime.Now.Date.AddDays(-1 * (delay));
                 DateTime maxdate      = DateTime.Now.Date.AddDays(-1 * (delay - 1));
                 var      customerlist = entities.Customers.Where(x => x.CreatedAt >= mindate && x.CreatedAt < maxdate && x.WelcomeEmail != true && x.SiteId == site.Id && x.StatusId == "ACTIVE").ToList();
                 foreach (var customer in customerlist)
                 {
                     if (capEmail == 0 || SitesManager.GetEmailSentToday() < capEmail)
                     {
                         CustomerDT cust = customer.GetDT(false);
                         SendEmail(site.Id, cust, cust.UnEncryptPass);
                         //customer.Password = cust.Password;
                         customer.WelcomeEmail      = true;
                         customer.WelcomeEmailDelay = delay;
                         customer.WelcomeEmailSent  = DateTime.Now;
                         customer.UnEncryptPass     = "";
                         entities.SaveChanges();
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 14
0
    private void OnLogin(JHSNetworkMessage netMsg)
    {
        LoginResponse packet = netMsg.ReadMessage <LoginResponse>();

        if (packet != null)
        {
            switch (packet.Code)
            {
            case ErrorCodes.SUCCESS:
                MainCache.Credit = packet.Credits;
                SitesManager.Init(packet.sites);
                MainCache.MemberType  = packet.MemberType;
                MainCache.SurfedSites = packet.SurfedSites;
                MainCache.LoggedIn    = true;
                MainComponent.Core.SendNotification(ProgramConst.SHOW_MAIN);
                MainComponent.state = ProgramState.LOGGED_IN;
                break;

            case ErrorCodes.WRONG_PASSWORD:
                string msg = "Wrong username or password!";
                MainComponent.Core.SendNotification(ProgramConst.SHOW_PROPMPT, msg);
                MainComponent.Core.SendNotification(ProgramConst.SHOW_BOX, msg);
                break;
            }
        }
    }
Ejemplo n.º 15
0
 public void SetManager(SitesManager sitesManager)
 {
     this._sitesManager = sitesManager;
     this._sitesManager.UpdateBookmakers((IEnumerable <Bookmaker>) this._settigs.UserSettings.BookmakersList);
     this._sitesManager.Logined        += new WorkerDelegates.LoginChangedDelegate(this.SitesManagerLogined);
     this._sitesManager.BalanceChanged += new WorkerDelegates.BalanceChangedDelegate(this._sitesManager_BalanceChanged);
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Get list of application for pool
 /// </summary>
 /// <param name="poolName">Applciation pool name</param>
 /// <returns></returns>
 public IEnumerable <Application> GetApplicationsByPool(string poolName)
 {
     using (var siteManager = new SitesManager())
     {
         return(siteManager.GetApplicationsByPool(poolName));
     }
 }
Ejemplo n.º 17
0
        // GET: Sites
        public ActionResult WelcomeEmail()
        {
            var model = new WelcomeEmailVM();

            model.sites    = SitesManager.GetSites();
            model.CapEmail = GlobalParameters.CapEmail;
            return(View(model));
        }
Ejemplo n.º 18
0
        private static void AddUnthorizedSite()
        {
            var siteManager = new SitesManager();

            // Test with valid required parameters but without the token auth
            string[] urls = { "http://brandNew", "http://shinyNew" };
            siteManager.addSite("Brand New Site", urls);
        }
Ejemplo n.º 19
0
        public ActionResult SalesReport()
        {
            var model = new SalesReportVM();

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

            return(View(model));
        }
 // Start is called before the first frame update
 new void Start()
 {
     player            = GameObject.FindGameObjectWithTag("Player").transform;
     seeker            = GetComponent <Seeker>();
     rb                = GetComponent <Rigidbody2D>();
     destinationSetter = GetComponent <AIDestinationSetter>();
     sitesM            = FindObjectOfType <SitesManager>();
     GoToWalk();
 }
Ejemplo n.º 21
0
        private void AddVisit(int siteId, string queryString, string CCinfo)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            int        visitId = SitesManager.NewVisit(Request.UserHostAddress, Request.UserAgent, siteId, queryString, CCinfo);
            HttpCookie cookie  = new HttpCookie("visitId");

            cookie.Value   = visitId.ToString();
            cookie.Expires = DateTime.Now.AddDays(1);
            Response.Cookies.Add(cookie);
        }
Ejemplo n.º 22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         string localPath = RoleEnvironment.GetLocalResource("Sites").RootPath.TrimEnd('\\');
         var manager = new SitesManager(localPath);
         this.grdSites.DataSource = manager.GetSitesInformation();
         this.grdSites.DataBind();
     }
 }
Ejemplo n.º 23
0
        public ActionResult SitesInfo(SiteInfoFilterVM model)
        {
            if (!ModelState.IsValid)
            {
                throw new Exception();
            }

            model.SitesInfo = SitesManager.GetSitesInfo(model.From, model.To);

            return(View(model));
        }
Ejemplo n.º 24
0
        public ActionResult EmailReport()
        {
            EmailReportVM model = new EmailReportVM()
            {
                Referrers = SitesManager.GetReferrers(),
                StartDate = DateTime.Now,
                EndDate   = DateTime.Now
            };

            return(View(model));
        }
Ejemplo n.º 25
0
        public void SendEmail(TestVM model)
        {
            if (ModelState.IsValid && !string.IsNullOrEmpty(model.EmailToSend) && !string.IsNullOrEmpty(model.Name))
            {
                string body = "";


                #region Generate random string (result in result variable)

                // var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
                //var random = new Random();
                var result = "";// new string(Enumerable.Repeat(chars, 8).Select(s => s[random.Next(s.Length)]).ToArray());

                #endregion

                SiteDT siteDT = SitesManager.GetSite(model.SiteID);
                using (CastleClubEntities entities = new CastleClubEntities())
                {
                    Customer customer = entities.Customers.Where(c => c.Email == model.EmailToSend && c.SiteId == siteDT.Id).FirstOrDefault();
                    if (customer != null)
                    {
                        result = customer.UnEncryptPass;

                        if (result == null)
                        {
                            var chars  = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
                            var random = new Random();
                            result = new string(Enumerable.Repeat(chars, 8).Select(s => s[random.Next(s.Length)]).ToArray());

                            Password p = new Password(result);
                            customer.Password      = p.SaltedPassword;
                            customer.UnEncryptPass = p.ClearPassword;
                            //customer.
                            customer.SaltKey = p.SaltKey;

                            entities.SaveChanges();
                        }
                    }
                }
                body = string.Format(Email.WelcomeBodyEmail(), model.Name,
                                     model.EmailToSend, result, siteDT.Name, siteDT.Name, "PartsGeek",
                                     siteDT.Price, siteDT.PricePerQuarter, siteDT.Phone, siteDT.Email, siteDT.OfferDomain);

                string subject = string.Format(Email.WelcomeSubjectEmail(), siteDT.Name);
                CastleClub.BusinessLogic.Utils.Email.SendEmailWithBCC(siteDT.Email, siteDT.PasswordEmail, siteDT.SmtpAddress, subject, body
                                                                      , new List <string>()
                {
                    model.EmailToSend
                }, new List <string>()
                {
                    siteDT.WelcomeEmailBCC
                }, true);
            }
        }
Ejemplo n.º 26
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));
        }
Ejemplo n.º 27
0
        private static void AddMinimalSite()
        {
            var siteManager = new SitesManager();

            siteManager.setTokenAuth("XYZ");

            string[] urls = { "http://brandNew", "http://shinyNew" };

            var newSiteId = siteManager.addSite("Brand New Site", urls);

            Console.WriteLine("Brand New Site correctly created with id = " + newSiteId);
        }
Ejemplo n.º 28
0
        public ActionResult ReportWelcomeEmail()
        {
            ReportEmailVM model = new ReportEmailVM()
            {
                Referrers = SitesManager.GetReferrers(),
                StartDate = DateTime.Now,
                EndDate   = DateTime.Now,
                Sites     = SitesManager.GetSites()
            };

            return(View(model));
        }
Ejemplo n.º 29
0
    private void OnDataUpdatedSuccesfuly(JHSNetworkMessage netMsg)
    {
        SubmitDataForUpdate data = netMsg.ReadMessage <SubmitDataForUpdate>();

        if (data != null && data.Code == ErrorCodes.JUST_DATA_UPDATE)
        {
            SitesManager.Init(data.Changed);
        }
        else
        {
            SitesManager.UpdateSuccess();
        }
    }
Ejemplo n.º 30
0
        private static void DeleteSite()
        {
            var siteManager = new SitesManager();

            siteManager.setTokenAuth("XYZ");

            var status = siteManager.deleteSite(23);

            if (status)
            {
                Console.WriteLine("Site removed");
            }
        }
Ejemplo n.º 31
0
        /// <summary>
        /// Delete application and related files/site/database.
        /// </summary>
        /// <param name="dto">Delete params</param>
        /// <returns>async task</returns>
        public async Task DeleteApplicationAsync(DeleteApplicationDto dto)
        {
            var rootPath            = "";
            var applicationPoolName = "";

            if (dto.DeleteStates.NeedDeleteApplication)
            {
                var siteManager = new SitesManager();
                switch (dto.SiteType)
                {
                case IISSiteType.Site:
                    var site            = siteManager.GetSiteByName(dto.Name);
                    var applicationRoot =
                        site.Applications.SingleOrDefault(a => a.Path == "/");
                    var virtualRoot =
                        applicationRoot?.VirtualDirectories.SingleOrDefault(v => v.Path == "/");
                    rootPath            = virtualRoot?.PhysicalPath;
                    applicationPoolName = applicationRoot?.ApplicationPoolName;
                    siteManager.DeleteSite(dto.Name);
                    break;

                case IISSiteType.Application:
                    var app = siteManager.GetApplicationByPath(dto.Name, dto.SiteName);
                    applicationPoolName = app.ApplicationPoolName;
                    rootPath            = app.VirtualDirectories.SingleOrDefault(v => v.Path == "/")?.PhysicalPath;
                    siteManager.DeleteApplication(app.Path, dto.SiteName);
                    break;
                }
                siteManager.Dispose();
            }

            if (dto.DeleteStates.NeedDeleteApplicationPool)
            {
                DeleteApplicationPool(applicationPoolName);
            }

            if (dto.DeleteStates.NeedDeleteDatabase && !string.IsNullOrEmpty(dto.Database))
            {
                await DeleteDatabase(dto.Database);
            }

            if (dto.DeleteStates.NeedDeleteFiles)
            {
                DeleteFolder(rootPath);
            }

            if (dto.DeleteStates.NeedDeleteChildApplications)
            {
            }
        }
Ejemplo n.º 32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WindowSwitcherJob"/> class.
 /// </summary>
 public WindowSwitcherJob()
 {
     sitesManager = SitesManager.Instance;
 }