示例#1
0
        private IntelliLockManager.License CreateLicenseFile(string projectTypeFolderName, Dictionary <string, string> licenseInformationKeyValues)
        {
            string apiIntelliLockProjLocation = MapPath("~\\Releases\\" + version + "\\" + projectTypeFolderName + "\\IntelliLockProject\\IntelliLockProject.ilproj");
            string companyOrDeveloperName     = string.Empty;

            if (Request.Form.AllKeys.Contains("Company or Developer Name"))
            {
                companyOrDeveloperName = Request.Form["Company or Developer Name"].Trim();
            }
            else
            { /*throw error and email my account from the catch*/
            }


            IntelliLockManager.LicenseManager licenseManager = new IntelliLockManager.LicenseManager();
            IntelliLockManager.License        license        = licenseManager.CreateLicense(apiIntelliLockProjLocation, licenseInformationKeyValues);


            if (license.LicenseFile == null)
            { /*throw error and email my account from the catch*/
            }

            return(license);
        }
示例#2
0
        private void CreateLicensesForProducts(SqlDatabaseManager.SimpleSqlite.Customer customer)
        {
            List <IntelliLockManager.License> apiLicenses     = new List <IntelliLockManager.License>();
            List <IntelliLockManager.License> utilityLicenses = new List <IntelliLockManager.License>();



            foreach (Order order in customer.Orders)
            {
                Dictionary <string, string> licenseInformationKeyValues = new Dictionary <string, string>();
                licenseInformationKeyValues.Add("[AssemblyCompany]", order.DeveloperOrCompanyName);
                licenseInformationKeyValues.Add("FirstName", customer.FirstName);
                licenseInformationKeyValues.Add("LastName", customer.LastName);
                licenseInformationKeyValues.Add("Email", customer.Email);

                foreach (Product product in order.Products)
                {
                    switch (product.ProductType)
                    {
                    case ProductType.API_Utility:

                        //Create an api and utility license
                        IntelliLockManager.License apiLicenseForDualPackage = CreateLicenseFile("API", licenseInformationKeyValues);
                        apiLicenses.Add(apiLicenseForDualPackage);

                        IntelliLockManager.License utilityLicenseForDualPackage = CreateLicenseFile("Utility", licenseInformationKeyValues);
                        utilityLicenses.Add(utilityLicenseForDualPackage);
                        break;

                    case ProductType.API:

                        IntelliLockManager.License apiLicenseForSinglePackage = CreateLicenseFile("API", licenseInformationKeyValues);
                        apiLicenses.Add(apiLicenseForSinglePackage);
                        break;

                    case ProductType.Utility:
                        IntelliLockManager.License utilityLicenseForSinglePackage = CreateLicenseFile("Utility", licenseInformationKeyValues);
                        utilityLicenses.Add(utilityLicenseForSinglePackage);
                        break;
                    }
                }
            }


            if (apiLicenses.Count > 0)
            {
                string apiEmailTemplateLocation = MapPath("~\\Releases\\" + version + "\\API\\EmailTemplate\\ApiEmailTemplate.html");
                string licenseFileName          = ConfigurationManager.AppSettings["ApiLicenseFileName"] ?? "api.sslic";
                string emailSubject             = ConfigurationManager.AppSettings["APIEmailSubject"] ?? "SimpleSqlite API License File(s)";
                string productName = "SimpleSqlite API";

                SendLicenseFileEmail(customer, apiLicenses, apiEmailTemplateLocation, licenseFileName, emailSubject, productName);
            }

            if (utilityLicenses.Count > 0)
            {
                string utilityEmailTemplateLocation = MapPath("~\\Releases\\" + version + "\\Utility\\EmailTemplate\\UtilityEmailTemplate.html");
                string licenseFileName = ConfigurationManager.AppSettings["UtilityLicenseFileName"] ?? "util.sslic";
                string emailSubject    = ConfigurationManager.AppSettings["UtilityEmailSubject"] ?? "SimpleSqlite Utility License File(s)";
                string productName     = "SimpleSqlite Utility";

                SendLicenseFileEmail(customer, utilityLicenses, utilityEmailTemplateLocation, licenseFileName, emailSubject, productName);
            }
        }