Exemplo n.º 1
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            Account temp = MainWindow.account;

            tb_firstname.Text    = temp.firstName;
            tb_lastname.Text     = temp.lastName;
            tb_mail.Text         = temp.email;
            lbl_mail.Content     = temp.email;
            tb_password.Password = Certify.Decrypt(temp.password);
            TextRange textRange = new TextRange(tb_desc.Document.ContentStart, tb_desc.Document.ContentEnd);

            if (temp.description != null)
            {
                textRange.Text = temp.description;
            }
            if (temp.businessusage)
            {
                btn_upgrade.Visibility  = Visibility.Hidden;
                lbl_abu.Visibility      = Visibility.Visible;
                lbl_license.Content     = (string)FindResource("bu_account");
                lbl_lastpayment.Content = temp.lastpay.ToString("dd-MM-yyyy");
            }
            else
            {
                lbl_lastpayment.Content = (string)FindResource("lifetime_license_account");
            }
            lbl_name.Content = temp.firstName + " " + temp.lastName;
        }
Exemplo n.º 2
0
        private void RunStatement()
        {
            while (!threadHasToStop)
            {
                if (sqlStatementIsRunning)
                {
                    sqlStatementIsRunning = false;

                    try
                    {
                        SqlCommand command = cnn.CreateCommand();
                        command.CommandText = "select acc_id, firstname, lastname, email, password, businessusage, CONVERT(varchar, lastpayment, 105), description from accounts where email='" + mail + "';";
                        SqlDataReader reader;
                        bool          correctInformations = false;
                        string        accLine             = "";

                        cnn.Open();

                        reader = command.ExecuteReader();
                        while (reader.Read())
                        {
                            for (short i = 0; i < reader.FieldCount; i++)
                            {
                                if (i == 4 && Certify.Decrypt(reader.GetValue(i).ToString()) == password)
                                {
                                    correctInformations = true;
                                }

                                accLine += reader.GetValue(i).ToString() + ';';
                            }
                        }

                        cnn.Close();
                        Dispatcher.Invoke(new Action(() => {
                            progring.IsActive = false;

                            if (correctInformations)
                            {
                                accountLine        = accLine;
                                MainWindow.account = new Account(accountLine);
                                MainWindow mpw     = new MainWindow();
                                mpw.Show();
                                this.Close();
                            }
                            else
                            {
                                lbl_msg.Foreground = Brushes.Red;
                                lbl_msg.Visibility = Visibility.Visible;
                            }
                        }));
                    } catch (Exception ex) {
                    }
                }
            }
        }
Exemplo n.º 3
0
        public LoginWindow()
        {
            InitializeComponent();
            this.ShowIconOnTitleBar = false;

            if (Properties.Settings.Default.RememberUserName != null && Properties.Settings.Default.RememberUserName != "")
            {
                tb_mail.Text = Certify.Decrypt(Properties.Settings.Default.RememberUserName);
                tb_pw.Focus();
            }
            else
            {
                tb_mail.Focus();
            }


            cnn    = new SqlConnection(connectionString);
            thread = new Thread(RunStatement);
            thread.Start();
        }