IntelliLock
User guide
×
Menu
  • SDK
  • IntelliLockDB.dll & System.Data.SQLite.DLL

IntelliLockDB.dll & System.Data.SQLite.DLL

 
IntelliLockDB.dll & System.Data.SQLite.DLL. This libraries are required to access IntelliLock databases (to use them in ASP.NET). You can freely use this libraries on a server or any other environment.
 
How To Examples:
 
 
How To Example Code:
   /// <summary>
    /// Open Database
    /// </summary>
    public IntelliLockDB.ILDataBase OpenDatabase(string db_filename, string db_password)
    {
        return new IntelliLockDB.ILDataBase(db_filename, db_password);
    }
 
    /// <summary>
    /// Add Customer
    /// </summary>
    public void AddCustomer(string db_filename, string db_password)
    {
        IntelliLockDB.ILDataBase mydb = new IntelliLockDB.ILDataBase(db_filename, db_password);
        IntelliLockDB.Customer customer =  mydb.Customers.AddCustomer();
        customer.Company = "ACME";
        customer.FirstName = "John";
        customer.LastName = "Doe";
        customer.EMail = "mymail@mydomain.com";
        mydb.Customers.Save();
    }
 
    /// <summary>
    /// Add Product
    /// </summary>
    public void AddProduct(string db_filename, string db_password)
    {
        IntelliLockDB.ILDataBase mydb = new IntelliLockDB.ILDataBase(db_filename, db_password);
        IntelliLockDB.Product product = mydb.Products.AddProduct();
        product.ProductName = "My Product";
        product.ProductVersion = "v1.3.4.5";
        product.Comments = "Special Version";
        mydb.Products.Save();
    }
 
    /// <summary>
    /// Add Sale
    /// </summary>
    public void AddSale(string db_filename, string db_password)
    {
        IntelliLockDB.ILDataBase mydb = new IntelliLockDB.ILDataBase(db_filename, db_password);
        IntelliLockDB.Sale sale = mydb.Sales.AddSale();
        sale.Price = 10.00f;
        sale.Product = "My Product";
        sale.Quantity = 1;
        sale.Date = DateTime.Now;
        sale.Customer = "John Doe";
        mydb.Sales.Save();
    }
 
    /// <summary>
    /// Add License Track
    /// </summary>
    public void AddLicenseTrack(string db_filename, string db_password,string  customerid, string productid)
    {
        IntelliLockDB.ILDataBase mydb = new IntelliLockDB.ILDataBase(db_filename, db_password);
 
        IntelliLockDB.Customer customer = mydb.Customers.GetCustomerByCustomerID(customerid);
        IntelliLockDB.Product product = mydb.Products.GetProductByProductID(productid);
 
        IntelliLockDB.LicenseTrack track = mydb.LicenseTracker.AddLicenseTrack();
        track.CustomerID = customerid;
        track.Customer = customer.FirstName + " " + customer.LastName; ;
        track.ProductID = productid;
        track.Product = product.ProductName + " " + product.ProductVersion;
        track.CreationDate = DateTime.Now;
        mydb.LicenseTracker.Save();
    }
 
    /// <summary>
    /// Delete All Database Entries
    /// </summary>
    public void DeleteAll(string db_filename, string db_password)
    {
        IntelliLockDB.ILDataBase mydb = new IntelliLockDB.ILDataBase(db_filename, db_password);
        mydb.Products.DeleteAllProducts();
        mydb.Products.Save();
        mydb.Customers.DeleteAllCustomers();
        mydb.Customers.Save();
        mydb.Sales.DeleteAllSales();
        mydb.Sales.Save();
        mydb.LicenseTracker.DeleteAllLicenseTracker();
        mydb.LicenseTracker.Save();
    }
 
    /// <summary>
    /// Delete Specic Customer
    /// </summary>
    public void DeleteCustomer(string db_filename, string db_password, string customerid)
    {
        IntelliLockDB.ILDataBase mydb = new IntelliLockDB.ILDataBase(db_filename, db_password);
        IntelliLockDB.Customer customer = mydb.Customers.GetCustomerByCustomerID(customerid);
        mydb.Customers.DeleteCustomer(customer);
        mydb.Customers.Save();
    }
 
    /// <summary>
    /// Delete Specic Sale
    /// </summary>
    public void DeleteSale(string db_filename, string db_password, string saleid)
    {
        IntelliLockDB.ILDataBase mydb = new IntelliLockDB.ILDataBase(db_filename, db_password);
        IntelliLockDB.Sale sale = mydb.Sales.GetSaleBySaleID(saleid);
        mydb.Sales.DeleteSale(sale);
        mydb.Sales.Save();
    }
 
    /// <summary>
    /// Export Sales To XML
    /// </summary>
    public void ExportSalesToXML(string db_filename, string db_password)
    {
        IntelliLockDB.ILDataBase mydb = new IntelliLockDB.ILDataBase(db_filename, db_password);
        mydb.Sales.ToXml();
    }
 
    /// <summary>
    /// Import Sales From XML
    /// </summary>
    public void SalesToXML(string db_filename, string db_password, string xml)
    {
        IntelliLockDB.ILDataBase mydb = new IntelliLockDB.ILDataBase(db_filename, db_password);
        int salesbefore = mydb.Sales.SaleCount;
        mydb.Sales.FromXml(xml);
        mydb.Sales.Save();
        int salesafter = mydb.Sales.SaleCount;
    }
 
    /// <summary>
    /// Reject Changes To Database
    /// </summary>
    public void RejectChanges(string db_filename, string db_password, string saleid)
    {
        IntelliLockDB.ILDataBase mydb = new IntelliLockDB.ILDataBase(db_filename, db_password);
        IntelliLockDB.Sale sale = mydb.Sales.GetSaleBySaleID(saleid);
        mydb.Sales.DeleteSale(sale);
        mydb.Sales.RejectChanges();
    }