public static void SetupRegistrationTypes(RegTypes model) { using (var site = new SCBWIContext()) { site.Prices.Add(new Price { Name = "Early Member Price", Category = Category.Reg, Value = model.EarlyMemberPrice }); site.Prices.Add(new Price { Name = "Late Member Price", Category = Category.RegLate, Value = model.LateMemberPrice }); site.Prices.Add(new Price { Name = "Early Non Member Price", Value = model.EarlyNonMemberPrice, Category = Category.Reg }); site.Prices.Add(new Price { Name = "Late Non Member Price", Value = model.LateNonMemberPrice, Category = Category.RegLate }); site.SaveChanges(); } }
/// <summary> /// Figures out if this copy is registered /// </summary> /// <returns></returns> public static bool IsRegistered() { lock (LockKey) { RegisteredCalled = true; _unlocked = false; _regType = RegTypes.Free; if (!File.Exists(RegisterFile)) { return(false); } string key = File.ReadAllText(RegisterFile); var encodedKey = EncodeKey(ProKey); if (key == encodedKey) { _regType = RegTypes.Professional; _unlocked = true; return(true); } return(false); } }
/// <summary> /// Writes out the registration information /// </summary> public static bool Register(string key) { lock (LockKey) { string rawKey = key; _regType = RegTypes.Free; _unlocked = false; if (rawKey != ProKey) { return(false); } _unlocked = true; key = EncodeKey(key); try { // this can fail due to permissions in the install folder File.WriteAllText(RegisterFileInstall, key); } catch { // write in the common folder File.WriteAllText(RegisterFile, key); } _regType = RegTypes.Professional; } return(true); }
internal static void UnRegister() { _unlocked = false; _regType = RegTypes.Free; LanguageUtils.IgnoreErrors(() => File.Delete(RegisterFile)); LanguageUtils.IgnoreErrors(() => File.Delete(RegisterFileInstall)); }
public ActionResult RegistrationTypes(RegTypes model) { if (ModelState.IsValid) { DAL.SetupRegistrationTypes(model); return(RedirectToAction("Intensives")); } ModelState.AddModelError("", "Your values must all be digits only."); return(View(model)); }
/// <summary> /// Figures out if this copy is registered. /// /// Checks: /// * install folder first (since machine specific) /// * common folder (can be problematic if shared across machines with dropbox/onedrive etc.) /// </summary> /// <returns></returns> internal static bool IsAppRegistered() { lock (LockKey) { RegisteredCalled = true; _unlocked = false; _regType = RegTypes.Free; string key = null; // install location first - since the key is machine specific // this can fail if user installed to a non-writable location (ie. Program Files) if (File.Exists(RegisterFileInstall)) { key = File.ReadAllText(RegisterFileInstall); } if (string.IsNullOrEmpty(key)) { // Check in common folder second if (File.Exists(RegisterFile)) { key = File.ReadAllText(RegisterFile); } } if (string.IsNullOrEmpty(key)) { return(false); } var encodedKey = EncodeKey(ProKey); if (key == encodedKey) { _regType = RegTypes.Professional; _unlocked = true; return(true); } return(false); } }
/// <summary> /// Writes out the registration information /// </summary> public static bool Register(string key) { lock (LockKey) { string rawKey = key; _regType = RegTypes.Free; _unlocked = false; if (rawKey != ProKey) return false; _unlocked = true; key = EncodeKey(key); File.WriteAllText(RegisterFile, key); //if (RawKey == ProKey) _regType = RegTypes.Professional; } return true; }
/// <summary> /// Figures out if this copy is registered /// </summary> /// <returns></returns> internal static bool IsAppRegistered() { lock (LockKey) { RegisteredCalled = true; _unlocked = false; _regType = RegTypes.Free; string key = null; if (File.Exists(RegisterFileInstall)) { key = File.ReadAllText(RegisterFileInstall); } if (string.IsNullOrEmpty(key)) { if (File.Exists(RegisterFile)) { key = File.ReadAllText(RegisterFile); } } if (string.IsNullOrEmpty(key)) { return(false); } var encodedKey = EncodeKey(ProKey); if (key == encodedKey) { _regType = RegTypes.Professional; _unlocked = true; return(true); } return(false); } }
/// <summary> /// Writes out the registration information /// </summary> internal static bool Register(string key) { lock (LockKey) { string rawKey = key; _regType = RegTypes.Free; _unlocked = false; if (rawKey != ProKey) { return(false); } _unlocked = true; key = EncodeKey(key); File.WriteAllText(RegisterFile, key); _regType = RegTypes.Professional; } return(true); }
public static void UnRegister() { _unlocked = false; _regType = RegTypes.Free; File.WriteAllText(RegisterFile, ""); }
/// <summary> /// Figures out if this copy is registered /// </summary> /// <returns></returns> public static bool IsRegistered() { lock (LockKey) { RegisteredCalled = true; _unlocked = false; _regType = RegTypes.Free; if (!File.Exists(RegisterFile)) return false; string key = File.ReadAllText(RegisterFile); if (key == EncodeKey(ProKey)) { _regType = RegTypes.Professional; _unlocked = true; return true; } return false; } }
/// <summary> /// Writes out the registration information /// </summary> public static bool Register(string key) { lock (LockKey) { string rawKey = key; _regType = RegTypes.Free; _unlocked = false; if (rawKey != ProKey) return false; _unlocked = true; key = EncodeKey(key); File.WriteAllText(RegisterFile,key); //if (RawKey == ProKey) _regType = RegTypes.Professional; } return true; }