Example #1
0
        private void GetLicenseKeys(Product product)
        {
            lV_licenses.Items.Clear();
            using (MySqlDataReader reader = MainForm.MySql.Query(
                       Resources.SqlStrings.GetLicensesByProduct,
                       new MySqlDataParameter("file", product.FileId),
                       new MySqlDataParameter("productid", product.ProductId)))
            {
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        User user = null;

                        ListViewItem item = new ListViewItem(reader["licensekey"].ToString());
                        item.SubItems.Add(reader["multi"].ToString());
                        item.SubItems.Add(reader["distributed"].ToString());
                        item.SubItems.Add(reader["time"].ToString());

                        if (reader["user"] != null &&
                            reader["domain"] != null)
                        {
                            if (!string.IsNullOrEmpty(reader["user"].ToString()) &&
                                !string.IsNullOrEmpty(reader["domain"].ToString()))
                            {
                                user = new User(reader["user"].ToString(), reader["domain"].ToString(), "");
                            }
                        }

                        BlueFlame.Classes.DatabaseObjects.License license =
                            new BlueFlame.Classes.DatabaseObjects.License(reader["licensekey"].ToString(),
                                                                          (bool)reader["multi"],
                                                                          (bool)reader["distributed"],
                                                                          reader["time"].ToString(), user, _product);
                        item.Tag = license;

                        if (user == null)
                        {
                            item.ImageKey = "productlicense";
                        }
                        else
                        {
                            item.ImageKey = "userlicense";
                        }

                        lV_licenses.Items.Add(item);
                    }
                    tSSL_count.Text = lV_licenses.Items.Count + " Licenses found";
                }
            }
        }
Example #2
0
        private void tSB_editLicense_Click(object sender, EventArgs e)
        {
            if (lV_licenses.SelectedItems.Count > 0)
            {
                BlueFlame.Classes.DatabaseObjects.License license
                    = (BlueFlame.Classes.DatabaseObjects.License)lV_licenses.SelectedItems[0].Tag;

                EditLicenseKey editKey = new EditLicenseKey(license.Key, license.Distributed, license.Multi);
                if (editKey.ShowDialog() == DialogResult.OK)
                {
                    license.Multi       = editKey.IsMulti;
                    license.Distributed = editKey.IsDistributed;
                    license.Save();
                }
            }
            GetLicenseKeys(_product);
        }
Example #3
0
        private void tSB_add_Click(object sender, EventArgs e)
        {
            EditLicenseKey newKey = new EditLicenseKey();

            if (newKey.ShowDialog() == DialogResult.OK)
            {
                BlueFlame.Classes.DatabaseObjects.License license =
                    new BlueFlame.Classes.DatabaseObjects.License(
                        newKey.LicenseKey,
                        newKey.IsMulti,
                        newKey.IsDistributed,
                        "",
                        null,
                        _product);
                license.Create();
                _licenseProvider = null;
            }
            GetLicenseKeys(_product);
        }
Example #4
0
        private void ResetLicense()
        {
            if (tC_main.SelectedTab == tC_main.TabPages["tP_licenseProduct"])
            {
                lV_searchResult = lV_licenseDetailProduct;
                if (lV_searchResult.SelectedItems[0].Tag is BlueFlame.Classes.DatabaseObjects.License)
                {
                    BlueFlame.Classes.DatabaseObjects.License license = lV_searchResult.SelectedItems[0].Tag as BlueFlame.Classes.DatabaseObjects.License;

                    MainForm.MySql.Statement(
                        Resources.SqlStrings.RemoveUserLicense,
                        new MySqlDataParameter("user", license.User.UserId),
                        new MySqlDataParameter("file", license.Product.FileId),
                        new MySqlDataParameter("productid", license.Product.ProductId));

                    license.Distributed = false;
                    license.Save();
                }
            }
            else
            {
                lV_searchResult = lV_licenseDetailUser;

                if (lV_licenseUser.SelectedItems.Count > 0)
                {
                    User user = lV_licenseUser.SelectedItems[0].Tag as User;
                    if (lV_searchResult.SelectedItems[0].Tag is BlueFlame.Classes.DatabaseObjects.License)
                    {
                        BlueFlame.Classes.DatabaseObjects.License license = lV_searchResult.SelectedItems[0].Tag as BlueFlame.Classes.DatabaseObjects.License;

                        MainForm.MySql.Statement(
                            Resources.SqlStrings.RemoveUserLicense,
                            new MySqlDataParameter("user", user.UserId),
                            new MySqlDataParameter("file", license.Product.FileId),
                            new MySqlDataParameter("productid", license.Product.ProductId));

                        license.Distributed = false;
                        license.Save();
                    }
                }
            }
            PopulateForm();
        }
Example #5
0
        private void SearchLicenseByUser()
        {
            lV_searchResult.Items.Clear();
            using (MySqlDataReader reader = MySql.Query(Resources.SqlStrings.SearchLicenseByUser,
                                                        new MySqlDataParameter("keyword", "%" + tSICB_search.Text + "%")))
            {
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Product product = new Product(
                            reader["productname"].ToString(),
                            "",
                            reader["file"].ToString(),
                            reader["productid"].ToString());

                        BlueFlame.Classes.DatabaseObjects.License license = new BlueFlame.Classes.DatabaseObjects.License(reader["licensekey"].ToString(),
                                                                                                                          (bool)reader["multi"],
                                                                                                                          (bool)reader["distributed"],
                                                                                                                          reader["insertdate"].ToString(),
                                                                                                                          null,
                                                                                                                          product);

                        ListViewItem item = new ListViewItem(product.Name);
                        item.SubItems.Add(product.ProductId);
                        item.SubItems.Add(product.FileId);
                        item.SubItems.Add(reader["lang"].ToString());
                        item.SubItems.Add(license.Key);
                        item.SubItems.Add(reader["insertdate"].ToString());
                        item.ImageKey = "productlicense";
                        item.Tag      = license;
                        lV_searchResult.Items.Add(item);
                    }
                }
                tSSL_count.Text = lV_searchResult.Items.Count + " Items found";
            }
        }
Example #6
0
        private void tSB_import_Click(object sender, EventArgs e)
        {
            ImportLicense import = new ImportLicense();

            if (import.ShowDialog() == DialogResult.OK)
            {
                bool multi = import.IsMulti;

                foreach (string str in import.Keys)
                {
                    BlueFlame.Classes.DatabaseObjects.License license =
                        new BlueFlame.Classes.DatabaseObjects.License(
                            str,
                            multi,
                            false,
                            "",
                            null,
                            _product);
                    license.Create();
                    _licenseProvider = null;
                }
                GetLicenseKeys(_product);
            }
        }
Example #7
0
        private void SearchLicenseByUser()
        {
            lV_searchResult.Items.Clear();
            using (MySqlDataReader reader = MySql.Query(Resources.SqlStrings.SearchLicenseByUser,
                new MySqlDataParameter("keyword", "%" + tSICB_search.Text + "%")))
            {
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Product product = new Product(
                            reader["productname"].ToString(),
                            "",
                            reader["file"].ToString(),
                            reader["productid"].ToString());

                        BlueFlame.Classes.DatabaseObjects.License license = new BlueFlame.Classes.DatabaseObjects.License(reader["licensekey"].ToString(),
                              (bool)reader["multi"],
                                (bool)reader["distributed"],
                            reader["insertdate"].ToString(),
                            null,
                            product);

                        ListViewItem item = new ListViewItem(product.Name);
                        item.SubItems.Add(product.ProductId);
                        item.SubItems.Add(product.FileId);
                        item.SubItems.Add(reader["lang"].ToString());
                        item.SubItems.Add(license.Key);
                        item.SubItems.Add(reader["insertdate"].ToString());
                        item.ImageKey = "productlicense";
                        item.Tag = license;
                        lV_searchResult.Items.Add(item);
                    }
                }
                tSSL_count.Text = lV_searchResult.Items.Count + " Items found";
            }
        }