public static string GetProductKey(int id) { ProductKey productKey = new ProductKey(); var product = productKey.Single(where : "Id = @0", args: id); return(Security.Decrypt(product.Key, User.GetPassword())); }
public static void Parse(XDocument document, string password) { var keys = document.Descendants(Utility.Format2012Header).Descendants().Where(x => x.Name == Utility.Format2012Element); if (keys.Count() > 0) { foreach (var productKey in keys) { string productName = Utility.GetAttributeValue(productKey.Attribute("Name"), string.Empty); foreach (var key in productKey.Elements("Key")) { var productTable = new ProductKey(); var newKey = new { Name = productName, KeyType = Utility.GetAttributeValue(key.Attribute("Type"), string.Empty), Key = Security.Encrypt(Utility.GetElementValue(key, string.Empty), password), ClaimedDate = DateTime.Parse(Utility.ReformatDate(Utility.GetAttributeValue(key.Attribute("ClaimeDate"), "1/1/1900"), '/', '-')) }; productTable.Insert(newKey); } } } return; }
private void ProductList_SelectedIndexChanged(object sender, EventArgs e) { if (!loadingList) { ProductName.Text = ProductList.Text; Key.Text = ProductKey.GetProductKey((int)ProductList.SelectedValue); } }
private void LoadProducts() { loadingList = true; ProductList.DataSource = null; List <ProductKey> products = ProductKey.GetProducts(); ProductList.DataSource = products; ProductList.DisplayMember = "Name"; ProductList.ValueMember = "Id"; loadingList = false; }
public static List<ProductKey> GetProducts() { ProductKey productKey = new ProductKey(); List<ProductKey> returnProducts = new List<ProductKey>(); var products = productKey.All(orderBy: "Name"); foreach (var product in products) { returnProducts.Add(new ProductKey { Id = (int)product.Id, Name = product.Name }); } return returnProducts; }
public static List <ProductKey> GetProducts() { ProductKey productKey = new ProductKey(); List <ProductKey> returnProducts = new List <ProductKey>(); var products = productKey.All(orderBy: "Name"); foreach (var product in products) { returnProducts.Add(new ProductKey { Id = (int)product.Id, Name = product.Name }); } return(returnProducts); }
public static void Parse(XDocument document, string password) { var keys = document.Descendants(Utility.Format2008Header).Descendants().Where(x => x.Name == Utility.Format2008Element); if (keys.Count() > 0) { foreach (var key in keys) { var productTable = new ProductKey(); var productKey = new { Name = Utility.GetAttributeValue(key.Attribute("Name"), string.Empty), KeyType = Utility.GetAttributeValue(key.Attribute("Key_Type"), string.Empty), Key = Security.Encrypt(Utility.GetAttributeValue(key.Attribute("Key"), string.Empty), password), ClaimedDate = DateTime.Parse(Utility.GetAttributeValue(key.Attribute("Date_Key_Claimed"), "1900-01-01")) }; productTable.Insert(productKey); } } return; }
public static string GetProductKey(int id) { ProductKey productKey = new ProductKey(); var product = productKey.Single(where: "Id = @0", args: id); return Security.Decrypt(product.Key, User.GetPassword()); }