Beispiel #1
0
        private void btnGenerateRegCode_Click(object sender, RoutedEventArgs e)
        {
            string ProdKey = Crypt.StrEncrypt(RegisterInfo.ProductName, C_RegKey);
            string tmp     = "";

            RegisterInfo.RegUser  = "";
            RegisterInfo.RegKey   = "";
            RegisterInfo.IsAlways = false;
            RegisterInfo.IsTest   = true;
            RegisterInfo.IsValid  = true;
            if (tmp == Crypt.StrEncrypt("36891", ProdKey, 0))
            {
                RegisterInfo.StartDate = DateTime.Now.Date;
            }
            if (txtSerialNumber.Text == "")
            {
                MessageBox.Show("Please enter the serial number!");
                txtSerialNumber.Focus();
                return;
            }
            if (txtName.Text == "")
            {
                MessageBox.Show("Please enter a name!");
                txtName.Focus();
                return;
            }
            RegisterInfo.Serial = txtSerialNumber.Text.Trim();
            string RegName  = txtName.Text.Trim();
            bool   isAlways = true;
            string RegKey   = GetRegKey(RegName, true, DateTime.Now.AddYears(100));

            txtRegistrationCode.Text = RegKey;
            byte Always = Convert.ToByte(isAlways);

            string sqlStr = "INSERT INTO KeyList([ID],[Area],[User],[Serial],[Always],[ValidDate],[Key],[BuildTime]) " +
                            "VALUES('" + RegisterInfo.ProductName + "','','" + RegName + "','" + RegisterInfo.Serial + "'," + Always + ",'" + (DateTime.Now).ToString("dd/MM/yyyy HH:mm:ss") + "','" + RegKey + "','" + (DateTime.Now).ToString("dd/MM/yyyy HH:mm:ss") + "')";

            if (ExecSQL(sqlStr) != 0)
            {
                refreshData();
            }

            string msg = "\r\n" + "用户名称: " + RegName + "\r\n\r\n";

            msg = msg + "序 列  号: " + RegisterInfo.Serial + "\r\n\r\n";
            msg = msg + "注 册  码: " + RegKey + "\r\n\r\n";
            msg = msg + "提示:序列号、注册码均由数字0-9、A-F组成,注册码中的“-”不可忽略。\r\n";
            WindowPrompt winP = new WindowPrompt(msg);

            winP.ShowDialog();
        }
Beispiel #2
0
        private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            int index = DataGrid.SelectedIndex;

            if (DataGridDataInit.Instance.RegistrationList.Count > DataGrid.SelectedIndex && index >= 0)
            {
                string msg = "\r\n" + "用户名称: " + DataGridDataInit.Instance.RegistrationList[index].Name + "\r\n\r\n";
                msg = msg + "序 列  号: " + DataGridDataInit.Instance.RegistrationList[index].SerialNumber + "\r\n\r\n";
                msg = msg + "注 册  码: " + DataGridDataInit.Instance.RegistrationList[index].RegistrationCode + "\r\n\r\n";
                msg = msg + "提示:序列号、注册码均由数字0-9、A-F组成,注册码中的“-”不可忽略。\r\n";
                WindowPrompt winP = new WindowPrompt(msg);
                winP.ShowDialog();
            }
        }
Beispiel #3
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            int index = DataGrid.SelectedIndex;

            if (DataGridDataInit.Instance.RegistrationList.Count > DataGrid.SelectedIndex && index >= 0)
            {
                string sno = DataGridDataInit.Instance.RegistrationList[index].No;
                string msg = "\r\n" + "用户名称: " + DataGridDataInit.Instance.RegistrationList[index].Name + "\r\n\r\n";
                msg = msg + "序 列  号: " + DataGridDataInit.Instance.RegistrationList[index].SerialNumber + "\r\n\r\n";
                msg = msg + "注 册  码: " + DataGridDataInit.Instance.RegistrationList[index].RegistrationCode + "\r\n\r\n";
                msg = msg + "您确定要删除吗?";
                WindowPrompt winP = new WindowPrompt(msg);

                if (winP.ShowDialog() == true)
                {
                    string sqlStr = "delete from KeyList where [No]=" + sno + "";
                    if (ExecSQL(sqlStr) != 0)
                    {
                        refreshData();
                    }
                }
            }
        }