Beispiel #1
0
 public License(string key, bool multi, bool distributed, string insertdate,User user, Product product)
 {
     _user = user;
     _distributed = distributed;
     _multi = multi;
     _product = product;
     _key = key;
     _instertdate = insertdate;
 }
Beispiel #2
0
        private void SearchLicenseByProduct()
        {
            lV_searchResult.Items.Clear();

            using (MySqlDataReader reader = MySql.Query(Resources.SqlStrings.SearchLicenseByProduct,
                new MySqlDataParameter("keyword", "%" + tSICB_search.Text + "%")))
            {
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        User user = null;
                        if (!string.IsNullOrEmpty(reader["user"].ToString()))
                        {
                            user = new User(reader["user"].ToString(),
                                reader["domain"].ToString(), "");
                        }

                        ListViewItem item = new ListViewItem(reader["user"].ToString());
                        item.SubItems.Add(reader["user"].ToString());
                        item.SubItems.Add(reader["licensekey"].ToString());
                        item.SubItems.Add(reader["insertdate"].ToString());
                        item.SubItems.Add(reader["multi"].ToString());
                        item.SubItems.Add(reader["distributed"].ToString());
                        if (user != null) item.ImageKey = "userlicense";
                        else item.ImageKey = "productlicense";

                        item.Tag = new BlueFlame.Classes.DatabaseObjects.License(reader["licensekey"].ToString(),
                            (int.Parse(reader["multi"].ToString()) == 1),
                            (int.Parse(reader["distributed"].ToString()) == 1),
                            reader["insertdate"].ToString(),
                            user,
                            null);

                        lV_searchResult.Items.Add(item);
                    }
                }
                tSSL_count.Text = lV_searchResult.Items.Count + " Items found";
            }
        }
Beispiel #3
0
        private void lV_licenseProduct_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lV_licenseProduct.SelectedItems.Count > 0)
            {
                if (lV_licenseProduct.SelectedItems[0].Tag is Disc)
                {
                    Cursor = Cursors.WaitCursor;
                    lV_licenseDetailProduct.Items.Clear();
                    Disc product = (lV_licenseProduct.SelectedItems[0].Tag as Disc);
                    using (MySqlDataReader reader = MySql.Query(
                        Resources.SqlStrings.GetLicensesByProduct,
                        new MySqlDataParameter("file", product.FileId),
                        new MySqlDataParameter("productid", product.ProductId)))
                    {
                        if (reader.HasRows)
                        {
                            int used = 0;
                            while (reader.Read())
                            {
                                // name id file lang key date
                                User user = null;
                                if(!string.IsNullOrEmpty(reader["user"].ToString()))
                                {
                                    user = new User(reader["user"].ToString(),
                                        reader["domain"].ToString(),"");
                                }

                                bool multi = (bool)reader["multi"];
                                bool distributed = (bool)reader["distributed"];
                                ListViewItem item = new ListViewItem(reader["user"].ToString());
                                item.SubItems.Add(reader["domain"].ToString());
                                item.SubItems.Add(reader["licensekey"].ToString().ToUpper());
                                item.SubItems.Add(reader["time"].ToString());
                                item.SubItems.Add(reader["multi"].ToString());
                                item.SubItems.Add(reader["distributed"].ToString());
                                item.Tag = new BlueFlame.Classes.DatabaseObjects.License(reader["licensekey"].ToString(),
                                    multi,
                                    distributed,
                                    reader["time"].ToString(),
                                    user,
                                    new Product("","",product.FileId, product.ProductId));

                                if (user != null)
                                {
                                    item.ImageKey = "userlicense";
                                    used++;
                                }
                                else
                                {
                                    item.ImageKey = "productlicense";
                                }
                                lV_licenseDetailProduct.Items.Add(item);
                            }
                            int all = lV_licenseDetailProduct.Items.Count;
                            tSSL_count2.Text = all + " Licenses, " + used + " Used, " + (all - used) + " Unused";
                        }
                    }
                    Cursor = Cursors.Default;
                }
            }
        }