public void SaveSiteInfo() { if (Helpers.SessionVariables.Instance.LoggedIn == false || Helpers.SessionVariables.Instance.IsAdmin == false) { return; } try { string adminemail = Helpers.GlobalHelper.RequestEncodedParam("adminemail"); bool islivesite = false; string livesite = Helpers.GlobalHelper.RequestEncodedParam("livesite"); if (livesite == "on") { // means no beta key required islivesite = true; } int id = int.Parse(Helpers.GlobalHelper.RequestParam("siteid")); string sitename = Helpers.GlobalHelper.RequestEncodedParam("sitename"); string siteurl = Helpers.GlobalHelper.RequestEncodedParam("siteurl"); int sshport = int.Parse(Helpers.GlobalHelper.RequestEncodedParam("sshport")); string stripeapisecretkey = Helpers.GlobalHelper.RequestEncodedParam("stripeapisecretkey"); string stripeapipublickey = Helpers.GlobalHelper.RequestEncodedParam("stripeapipublickey"); string vpnsshpassword = Helpers.GlobalHelper.RequestEncodedParam("vpnsshpassword"); string vpnsshuser = Helpers.GlobalHelper.RequestEncodedParam("vpnsshuser"); string currency = Helpers.GlobalHelper.RequestEncodedParam("currency"); string stripeplanid = Helpers.GlobalHelper.RequestEncodedParam("stripeplanid"); decimal montlypaymentrate = decimal.Parse(Helpers.GlobalHelper.RequestEncodedParam("monthlypaymentrate")); decimal yearlypaymentrate = decimal.Parse(Helpers.GlobalHelper.RequestEncodedParam("yearlypaymentrate")); var info = new LibPoco.SiteInfo() { Id = id, AdminEmail = adminemail, LiveSite = islivesite, SiteName = sitename, SiteUrl = siteurl, SshPort = sshport, StripeAPISecretKey = stripeapisecretkey, StripeAPIPublicKey = stripeapipublickey, VpnSshPassword = vpnsshpassword, VpnSshUser = vpnsshuser, StripePlanId = stripeplanid, Currency = currency }; LibLogic.Helpers.SiteInfo.InitializeSimple(info, montlypaymentrate, yearlypaymentrate); LibLogic.Helpers.SiteInfo.SaveCurrentSettingsToDb(); Response.Redirect("/admin/siteinfo?status=ok", false); } catch (Exception ex) { LibLogic.Helpers.Logging.Log(ex); Response.Redirect("/admin/siteinfo?status=" + HttpUtility.HtmlEncode(ex.Message), false); } }
public static void InitializeSimple(LibPoco.SiteInfo info, decimal currentMonthlyRate, decimal currentYearlyRate) { SiteInfo.info = info; SiteInfo.CurrentMonthlyRate = currentMonthlyRate; SiteInfo.CurrentMonthlyRateInCents = (int)currentMonthlyRate * 100; SiteInfo.CurrentYearlyRate = currentYearlyRate; }
public void Setup() { using (var cn = LibLogic.Setup.DbFactory) { cn.Open(); sinfo = cn.Query <LibPoco.SiteInfo>("SELECT * FROM SiteInfo").First(); prates = cn.Query <LibPoco.PaymentRates>("SELECT * FROM PaymentRates").First(); } }
public static void Initialize(LibPoco.SiteInfo info, int monthlyPaymentId, decimal currentMonthlyRate, decimal currentYearlyRate, int yearlyPaymentId) { SiteInfo.info = info; SiteInfo.MonthlyPaymentId = monthlyPaymentId; SiteInfo.CurrentMonthlyRate = currentMonthlyRate; SiteInfo.CurrentMonthlyRateInCents = (int)currentMonthlyRate * 100; SiteInfo.CurrentYearlyRate = currentYearlyRate; SiteInfo.YearlyPaymentId = yearlyPaymentId; }