private void btOK_Click(object sender, EventArgs e)
        {
            if (radioGroupTrial.SelectedIndex == 1)
            {

                //- Check selected license file complete?
                // If complete, to check enter license key.
                // If not, show warning message box screen 1022.

                // - Check enter licensed key completed?
                // If complete, to check validate license file and license key.
                // If not, show warning message box screen 1023.

                // - Check validates license file and license key?
                // If valid, show information message box screen 3018, load data from license file to database and show screen 2801-2.
                // If not valid, show warning message box screen 1024.

                if (textEditFile.EditValue == null)
                {
                    utilClass.showPopupMessegeBox(this, getLanguage("_msg_1022"), this.Text);
                    return;
                }

                if (textEditKey1.EditValue != null && textEditKey2.EditValue != null && textEditKey3.EditValue != null && textEditKey4.EditValue != null)
                {

                    string TextKey = textEditKey1.EditValue.ToString() + "-" + textEditKey2.EditValue.ToString() + "-" + textEditKey3.EditValue.ToString() + "-" + textEditKey4.EditValue.ToString();
                    if (TextKey == MainForm.LicObj.LicenseKey)
                    {
                        BusinessLogicBridge.DataStore.updateLicenceKey(MainForm.LicObj.LicenseKey);

                        DataTable GeneralPath = BusinessLogicBridge.DataStore.getGeneralConfig();

                        string dataPath = MainForm.CombinePaths(AppDomain.CurrentDomain.BaseDirectory, "Licence");

                        if (Directory.Exists(dataPath) == false)
                        {
                            Directory.CreateDirectory(dataPath);
                        }

                        try
                        {
                            string descnationfile = Path.Combine(dataPath, "regkey.lic");
                            System.IO.File.Copy(textEditFile.EditValue.ToString(), descnationfile, true);
                            objMEATHLicense LicObj = new objMEATHLicense();
                            LicObj = MainForm.readLicense(descnationfile);
                            BusinessLogicBridge.DataStore.updateADCSerial(LicObj.ADCSN1, LicObj.ADCSN2, LicObj.ADCSN3, LicObj.ADCSN4, LicObj.ADCSN5);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message.ToString());
                        }

                        utilClass.showPopupMessegeBox(this, getLanguage("_msg_3018"), this.Text, "info");

                        MainForm.TrialVersion = false;
                        MainForm.HaveLicence = true;
                        this.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        utilClass.showPopupMessegeBox(this, getLanguage("_msg_1024"), this.Text);
                        this.DialogResult = DialogResult.Cancel;
                    }

                }
                else
                {
                    utilClass.showPopupMessegeBox(this, getLanguage("_msg_1023"), this.Text);
                    return;
                }
            }
            else {

                // Trial Version
                MainForm.TrialVersion = true;

                string s = BusinessLogicBridge.DataStore.getCheckinCounter();

                if (s == "")
                {
                    s = HelperEncrypt.Encrypt(s, MainForm.hashKey);

                    // Update Counter Checkin
                    BusinessLogicBridge.DataStore.updateCounterCheckin(s);
                }

                this.DialogResult = DialogResult.Ignore;

            }
        }
Beispiel #2
0
        private void btOK_Click(object sender, EventArgs e)
        {
            if (radioGroupTrial.SelectedIndex == 1)
            {
                //- Check selected license file complete?
                // If complete, to check enter license key.
                // If not, show warning message box screen 1022.

                // - Check enter licensed key completed?
                // If complete, to check validate license file and license key.
                // If not, show warning message box screen 1023.

                // - Check validates license file and license key?
                // If valid, show information message box screen 3018, load data from license file to database and show screen 2801-2.
                // If not valid, show warning message box screen 1024.

                if (textEditFile.EditValue == null)
                {
                    utilClass.showPopupMessegeBox(this, getLanguage("_msg_1022"), this.Text);
                    return;
                }

                if (textEditKey1.EditValue != null && textEditKey2.EditValue != null && textEditKey3.EditValue != null && textEditKey4.EditValue != null)
                {
                    string TextKey = textEditKey1.EditValue.ToString() + "-" + textEditKey2.EditValue.ToString() + "-" + textEditKey3.EditValue.ToString() + "-" + textEditKey4.EditValue.ToString();
                    if (TextKey == MainForm.LicObj.LicenseKey)
                    {
                        BusinessLogicBridge.DataStore.updateLicenceKey(MainForm.LicObj.LicenseKey);

                        DataTable GeneralPath = BusinessLogicBridge.DataStore.getGeneralConfig();

                        string dataPath = MainForm.CombinePaths(AppDomain.CurrentDomain.BaseDirectory, "Licence");

                        if (Directory.Exists(dataPath) == false)
                        {
                            Directory.CreateDirectory(dataPath);
                        }

                        try
                        {
                            string descnationfile = Path.Combine(dataPath, "regkey.lic");
                            System.IO.File.Copy(textEditFile.EditValue.ToString(), descnationfile, true);
                            objMEATHLicense LicObj = new objMEATHLicense();
                            LicObj = MainForm.readLicense(descnationfile);
                            BusinessLogicBridge.DataStore.updateADCSerial(LicObj.ADCSN1, LicObj.ADCSN2, LicObj.ADCSN3, LicObj.ADCSN4, LicObj.ADCSN5);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message.ToString());
                        }

                        utilClass.showPopupMessegeBox(this, getLanguage("_msg_3018"), this.Text, "info");

                        MainForm.TrialVersion = false;
                        MainForm.HaveLicence  = true;
                        this.DialogResult     = DialogResult.OK;
                    }
                    else
                    {
                        utilClass.showPopupMessegeBox(this, getLanguage("_msg_1024"), this.Text);
                        this.DialogResult = DialogResult.Cancel;
                    }
                }
                else
                {
                    utilClass.showPopupMessegeBox(this, getLanguage("_msg_1023"), this.Text);
                    return;
                }
            }
            else
            {
                // Trial Version
                MainForm.TrialVersion = true;

                string s = BusinessLogicBridge.DataStore.getCheckinCounter();

                if (s == "")
                {
                    s = HelperEncrypt.Encrypt(s, MainForm.hashKey);

                    // Update Counter Checkin
                    BusinessLogicBridge.DataStore.updateCounterCheckin(s);
                }

                this.DialogResult = DialogResult.Ignore;
            }
        }