コード例 #1
0
        public void Setup()
        {
            var peterAccount = new LibLogic.Accounts.CreateAccount(
                new LibLogic.Accounts.CreateAccountInfo()
            {
                Email           = emailAddress,
                EmailConfirm    = emailAddress,
                Firstname       = "Bobby",
                Lastname        = "Smith",
                Password        = "******",
                PasswordConfirm = "Password54",
                BetaKey         = ""
            }
                , false, LibLogic.Setup.Email);

            this.userid = peterAccount.Execute();

            var region = new LibLogic.Admin.Regions();

            regionid = region.Insert("Test region", true);

            var vpnserver = new LibLogic.Admin.VpnServers();

            vpnseverid = vpnserver.Insert("localhost", 5678, "a fake vpnserver for testing", regionid, true);
        }
コード例 #2
0
        public ActionResult EditServers()
        {
            if (Helpers.SessionVariables.Instance.LoggedIn == false || Helpers.SessionVariables.Instance.IsAdmin == false)
            {
                return(null);
            }

            int  id;
            bool isNumeric = int.TryParse(VpnSite.Helpers.GlobalHelper.RequestParam("id").Trim().ToLower(), out id);

            try
            {
                string description  = VpnSite.Helpers.GlobalHelper.RequestParam("desc").Trim();
                string address      = VpnSite.Helpers.GlobalHelper.RequestParam("address").Trim();
                string activeString = VpnSite.Helpers.GlobalHelper.RequestParam("active");
                bool   active       = false;
                if (activeString != null)
                {
                    active = true;
                }
                int region = int.Parse(VpnSite.Helpers.GlobalHelper.RequestParam("region"));
                int port   = int.Parse(VpnSite.Helpers.GlobalHelper.RequestParam("port"));

                var vpns = new LibLogic.Admin.VpnServers();
                if (isNumeric)
                {
                    vpns.Update(id, address,
                                port,
                                description,
                                region,
                                active);
                }
                else
                {
                    vpns.Insert(address,
                                port,
                                description,
                                region,
                                active);
                }
            }
            catch (Exception ex)
            {
                LibLogic.Helpers.Logging.Log(ex);
            }

            return(View());
        }
コード例 #3
0
 public AdminVpnServers()
 {
     _vpnServersList = new LibLogic.Admin.VpnServers().Select();
 }