Example #1
0
        private void btn_Next_Click(object sender, EventArgs e)
        {
            try
            {
                if (txt_Key.Text == "Superior_Investment_Installation_Key")
                {
                    string                     cpuInfo = string.Empty;
                    ManagementClass            mc      = new ManagementClass("win32_processor");
                    ManagementObjectCollection moc     = mc.GetInstances();

                    foreach (ManagementObject mo in moc)
                    {
                        cpuInfo = mo.Properties["processorID"].Value.ToString();
                        break;
                    }
                    using (StreamWriter writer = new StreamWriter(filePath))
                    {
                        writer.WriteLine(Cryptography.Encrypt(cpuInfo, "SuperiorInvestment#"));
                    }
                    if (_SuperAdminRepo.GetAllRecords().Count() > 0)
                    {
                        Login login_Form = new Login();
                        Hide();
                        login_Form.FormClosed += (s, args) => Close();
                        login_Form.ShowDialog();
                    }
                    else
                    {
                        RegisterSuperAdmin registerSuperAdmin_Form = new RegisterSuperAdmin();
                        Hide();
                        registerSuperAdmin_Form.FormClosed += (s, args) => Close();
                        registerSuperAdmin_Form.ShowDialog();
                    }
                }
                else
                {
                    string message = "Wrong installation key. Please try again.";
                    MessageBox.Show(message, "Superior Investment", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txt_Key.Text = string.Empty;
                }
            }
            catch (Exception ex)
            {
                //string message = "config file does not exist. Please contact system developer";
                MessageBox.Show(ex.Message, "Superior Investment", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Application.Exit();
            }
        }
Example #2
0
 private void UsageLock_Load(object sender, EventArgs e)
 {
     try
     {
         if (File.Exists(filePath))
         {
             using (StreamReader reader = new StreamReader(filePath))
             {
                 while (!reader.EndOfStream)
                 {
                     Utilities.KEY = reader.ReadLine();
                 }
             }
             if (Utilities.KEY != string.Empty)
             {
                 Utilities.KEY = Cryptography.Decrypt(Utilities.KEY, "SuperiorInvestment#");
                 string                     cpuInfo = string.Empty;
                 ManagementClass            mc      = new ManagementClass("win32_processor");
                 ManagementObjectCollection moc     = mc.GetInstances();
                 foreach (ManagementObject mo in moc)
                 {
                     cpuInfo = mo.Properties["processorID"].Value.ToString();
                     break;
                 }
                 if (Utilities.KEY == cpuInfo)
                 {
                     if (_SuperAdminRepo.GetAllRecords().Count() > 0)
                     {
                         Login login_Form = new Login();
                         Hide();
                         login_Form.FormClosed += (s, args) => Close();
                         login_Form.ShowDialog();
                     }
                     else
                     {
                         RegisterSuperAdmin registerSuperAdmin_Form = new RegisterSuperAdmin();
                         Hide();
                         registerSuperAdmin_Form.FormClosed += (s, args) => this.Close();
                         registerSuperAdmin_Form.ShowDialog();
                     }
                 }
             }
         }
     }
     catch (Exception ex) { }
 }
Example #3
0
 private void WelcomeForm_Load(object sender, EventArgs e)
 {
     try
     {
         using (StreamReader reader = new StreamReader(screenPath))
         {
             while (!reader.EndOfStream)
             {
                 showDialog = Cryptography.Decrypt(reader.ReadLine(), "SuperiorInvestment#");
             }
         }
         if (showDialog == "True")
         {
             if (File.Exists(filePath))
             {
                 using (StreamReader reader = new StreamReader(filePath))
                 {
                     while (!reader.EndOfStream)
                     {
                         Utilities.KEY = reader.ReadLine();
                     }
                 }
                 if (Utilities.KEY != string.Empty)
                 {
                     Utilities.KEY = Cryptography.Decrypt(Utilities.KEY, "SuperiorInvestment#");
                     string                     cpuInfo = string.Empty;
                     ManagementClass            mc      = new ManagementClass("win32_processor");
                     ManagementObjectCollection moc     = mc.GetInstances();
                     foreach (ManagementObject mo in moc)
                     {
                         cpuInfo = mo.Properties["processorID"].Value.ToString();
                         break;
                     }
                     if (Utilities.KEY == cpuInfo)
                     {
                         if (_SuperAdminRepo.GetAllRecords().Count() > 0)
                         {
                             Login login_Form = new Login();
                             Hide();
                             login_Form.FormClosed += (s, args) => Close();
                             login_Form.ShowDialog();
                         }
                         else
                         {
                             RegisterSuperAdmin registerSuperAdmin_Form = new RegisterSuperAdmin();
                             Hide();
                             registerSuperAdmin_Form.FormClosed += (s, args) => this.Close();
                             registerSuperAdmin_Form.ShowDialog();
                         }
                     }
                     else
                     {
                         UsageLock usageLock = new UsageLock();
                         Hide();
                         usageLock.FormClosed += (s, args) => Close();
                         usageLock.ShowDialog();
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         //MessageBox.Show($"{Utilities.ERRORMESSAGE} \n Error details: {ex.Message}", "Superior Investment!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }