Esempio n. 1
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            isToValid = false;
            if (ValidateData())
            {
                KnowledgeMatrix.BusinessObjects.License obj = new BusinessObjects.License();
                obj.name  = txtName.Text;
                obj.email = txtEmail.Text;
                if (!string.IsNullOrWhiteSpace(txtOrganisation.Text))
                {
                    obj.organisationName = txtOrganisation.Text;
                }



                if (!string.IsNullOrWhiteSpace(txtPhone.Text))
                {
                    obj.phoneNumber = txtPhone.Text;
                }

                folderBrowserDialog1.Description = @"Select the folder to save reg info file";
                DialogResult re = folderBrowserDialog1.ShowDialog();
                if (DialogResult.OK == re)
                {
                    obj.filename = folderBrowserDialog1.SelectedPath + @"\RegInfo_" + txtPhone.Text + @"_" + DateTime.Now.ToShortDateString().Replace(@"/", "_") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + ".txt";


                    //obj.filename = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + @"\DataLicense.txt";
                    obj.RegisterUser();

                    MessageBox.Show("Registration info File is made available at" + obj.filename);
                }
            }
        }
Esempio n. 2
0
 private void btnActivate_Click(object sender, EventArgs e)
 {
     isToValid = true;
     if (ValidateData())
     {
         DialogResult result = openFileDialog1.ShowDialog(); // Show the dialog.
         if (result == DialogResult.OK)                      // Test result.z
         {
             string file = openFileDialog1.FileName;
             KnowledgeMatrix.BusinessObjects.License obj = new BusinessObjects.License();
             obj.name       = txtName.Text;
             obj.email      = txtEmail.Text;
             obj.filename   = file;
             obj.licensekey = serialBox1.Text;
             if (obj.ValidateLicense())
             {
                 //MessageBox.Show(Properties.Settings.Default.ProductKey);
                 if (!string.IsNullOrWhiteSpace(txtOrganisation.Text))
                 {
                     KnowledgeMatrix.Properties.Settings.Default.OrganizationName = txtOrganisation.Text;
                     //    Properties.Settings.Default.Footer = "Pathways Foundation, Digital Warriors.Copyright Reserved";
                     KnowledgeMatrix.Properties.Settings.Default.Save();
                 }
                 MessageBox.Show("Succesfully Activated.");
                 ((System.Windows.Forms.UserControl)(this)).Text = "Done";
                 this.InvokeOnClick(this, e);
             }
             else
             {
                 MessageBox.Show("Kindly provide correct License information");
             }
             try
             {
                 // string text = File.ReadAllText(file);
                 //size = text.Length;
             }
             catch (Exception)
             {
             }
         }
         // MessageBox.Show(serialBox1.Text);
     }
 }
Esempio n. 3
0
        private void btnGenerateLicense_Click(object sender, EventArgs e)
        {
            isToValid = true;
            if (ValidateData())
            {
                //Validate whether record exist in the DB
                //For Admin Generate Database
                AdminDatabaseMgmt objAdmin = new AdminDatabaseMgmt();
                if (!string.IsNullOrWhiteSpace(txtIP.Text))
                {
                    objAdmin.IP = txtIP.Text;
                }
                objAdmin.name  = txtName.Text;
                objAdmin.email = txtEmail.Text;
                bool isRecordAvlbl = objAdmin.ValidateRecord();

                if (isRecordAvlbl)
                {
                    if (DialogResult.No == MessageBox.Show("The license for the combination (name, email and IP) is already created. Do you like create new one?", "License Available", MessageBoxButtons.YesNo))
                    {
                        return;
                    }
                }

                //Create License
                KnowledgeMatrix.BusinessObjects.License obj = new BusinessObjects.License();
                obj.name       = txtName.Text;
                obj.email      = txtEmail.Text;
                obj.LicenseKey = serialBox1.Text;
                if (!string.IsNullOrWhiteSpace(txtIP.Text))
                {
                    obj.IP = txtIP.Text;
                }

                if (!string.IsNullOrWhiteSpace(txtPhone.Text))
                {
                    obj.phoneNumber = txtPhone.Text;
                }

                folderBrowserDialog1.Description = @"Select the folder to save license file";
                DialogResult re = folderBrowserDialog1.ShowDialog();
                if (DialogResult.OK == re)
                {
                    obj.filename = folderBrowserDialog1.SelectedPath + @"\Data_" + txtPhone.Text + @"_" + DateTime.Now.ToShortDateString().Replace(@"/", "_") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + "License.txt";


                    //obj.filename = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + @"\DataLicense.txt";
                    obj.GenerateLicense();

                    //MessageBox.Show("License File is made available at" + obj.filename);

                    if (DialogResult.No == MessageBox.Show("License File is made available at " + obj.filename + " . Do you want to create one more new license ?", "License Available", MessageBoxButtons.YesNo))
                    {
                        ((System.Windows.Forms.UserControl)(this)).Text = "Done";
                        this.InvokeOnClick(this, e);
                    }
                    else
                    {
                        btnClear_Click(null, null);
                    }
                }
            }
        }