コード例 #1
0
        public static void CreateLicenceTrial(string username, string email)
        {
            var old = File.Exists("License.lic");

            if (old)
            {
                File.Delete("License.lic");
            }

            var license = License.New()
                          .As(LicenseType.Trial)
                          .ExpiresAt(DateTime.Now.AddDays(14))
                          .LicensedTo(username, email)
                          .CreateAndSignWithPrivateKey(PrivateKey, "15021991");

            license.Expiration     = DateTime.Now.AddDays(14);
            license.Customer.Email = email;
            license.Customer.Name  = username;
            license.Sign(PrivateKey, "15021991");
            license.Type = LicenseType.Trial;
            var settings = new ElvaSettings().getInstance();

            settings.UserName = username;
            settings.Email    = email;

            settings.DemoUsed = true;
            settings.Save();

            File.WriteAllText("License.lic", license.ToString(), Encoding.UTF8);
        }
コード例 #2
0
        public static void CreateLicenceStandard(string username, string email)
        {
            var old = File.Exists("License.lic");

            if (old)
            {
                File.Delete("License.lic");
            }

            var license = License.New()
                          .As(LicenseType.Standard)
                          .LicensedTo(username, email)
                          .CreateAndSignWithPrivateKey(PrivateKey, "15021991");

            license.Customer.Email = email;
            license.Customer.Name  = username;
            license.Sign(PrivateKey, "15021991");
            license.Type = LicenseType.Standard;


            var settings = new ElvaSettings().getInstance();

            settings.UserName = username;
            settings.Email    = email;
            settings.Save();
            File.WriteAllText("License.lic", license.ToString(), Encoding.UTF8);
        }
コード例 #3
0
        /// <summary>
        /// Move to the Next page
        /// </summary>
        public void Next()
        {
            // Check if we're in the last page
            if (indexPage == LastPageIndex)
            {
                // save everything we're done
                ElvaSettings settings = DataHelpers.Settings;

                //if (SelectedPaye == null)
                //{
                //    DataHelpers.ShowMessage(_("Culture is empty"));
                //    return;
                //}

                settings.Societe        = Entreprise;
                settings.Email          = Email;
                settings.EmailPwd       = EmailPassword;
                settings.AppInitialized = true;


                // Edit the user password
                User user = DS.db.GetOne <User>(a => a.Name == "Admin");
                if (null != user && !string.IsNullOrEmpty(PasswordAdmin))
                {
                    user.Password = PasswordAdmin;
                    user.Save();
                }

                TransfertLogo();
                // todo: add mapping between email provider and email port, host adresse
                settings.Save();

                // Ask if we should close the window
                var _doIExit = _windowManager.ShowMessageBox(_("Voulez-vous fermer la fenêtre ?"), _("Fermeture"), System.Windows.MessageBoxButton.YesNo);
                if (_doIExit == System.Windows.MessageBoxResult.Yes)
                {
                    // Close the Assistant
                    this.RequestClose();
                    return;
                }
            }

            // Movin to th next page
            else
            {
                // Valdiate this page before moving to next one
                ValidatePage(indexPage);

                // Select next tabs
                indexPage++;
                NotifyOfPropertyChange("indexPage");

                // Update next button value text
                UpdateButtonNextValue();
            }
        }
コード例 #4
0
        public void VlidateLicence()
        {
            if (string.IsNullOrWhiteSpace(licenceFile))
            {
                MessageBox.Show("Charger votre licence d'abord");
                return;
            }
            if (string.IsNullOrWhiteSpace(clePublic))
            {
                MessageBox.Show("Clé public obligatoire!");
                return;
            }

            if (string.IsNullOrWhiteSpace(email) || string.IsNullOrEmpty(userName))
            {
                MessageBox.Show("Vérifer nom d'utilsateur ou email");
                return;
            }

            using (var publicK = new StreamWriter("public-lcs"))
            {
                publicK.Write(clePublic);
                publicK.Close();
            }


            File.Copy(licenceFile, "License.lic", true);

            try
            {
                if (FrameworkManager.ValidateLicence(clePublic, userName, email))
                {
                    MessageBox.Show("Licence validée");
                    var settings = new ElvaSettings().getInstance();
                    settings.UserName = userName;
                    settings.Email    = email;
                    settings.Save();
                    IsValide = true;
                    this.RequestClose();
                }
                else
                {
                    IsValide = false;
                    MessageBox.Show("Licence invalide");
                }
            }
            catch (Exception s)
            {
                MessageBox.Show(s.Message);
            }
        }
コード例 #5
0
ファイル: Bootstrapper.cs プロジェクト: anndream/ErpAlgerie
        protected override void OnLaunch()
        {
            try
            {
                base.OnLaunch();
                FrameworkManager.CreateCulture();

                // TEMP
                // FrameworkManager.GenerateLicence();
                // FrameworkManager.CreateLicenceTrial("admin", "admin");
                // FrameworkManager.CreateLicenceStandard("pos", "*****@*****.**");

                // Check AppInit

                var setting = new ElvaSettings().getInstance();

                FrameworkManager.CheckValidation();

                if (setting.AppInitialized == false)
                {
                    MessageBox.Show("Configuration de premiére utilisation");

                    // Setup modules
                    FrameworkManager.UpdateModules();

                    // setup series
                    FrameworkManager.CreateSeries();

                    setting.AppInitialized = true;
                    setting.Save();

                    MessageBox.Show("Configuration terminée");
                }
            }
            catch (Exception s)
            {
                MessageBox.Show(s.Message);
            }
        }