Пример #1
0
 public static void SaveUser(Userinos userinos)
 {
     using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
     {
         cnn.Execute("insert into Users (Username, Password, Email, Numbers, Date, Other, Points) values (@Username, @Password, @Email, @Numbers, @Date, @Other, @Points)", userinos);
     }
 }
Пример #2
0
 public static void Update(Userinos userinos)
 {
     using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
     {
         cnn.Execute("update Users set Points = @Points", userinos);
     }
 }
Пример #3
0
        private void Register_Click(object sender, EventArgs e)
        {
            Userinos u = new Userinos();

            if (string.IsNullOrWhiteSpace(rUsername.Text) || string.IsNullOrWhiteSpace(rPassword.Text) || string.IsNullOrWhiteSpace(rEmail.Text) || string.IsNullOrWhiteSpace(rCard.Text) || string.IsNullOrWhiteSpace(rDate.Text) || string.IsNullOrWhiteSpace(textBox1.Text))
            {
                MessageBox.Show("Fill in the gaps.");
            }
            else
            {
                if (!checkBox1.Checked)
                {
                    MessageBox.Show("You need to check the checkbox to finish.");
                }
                else
                {
                    u.Username = rUsername.Text;
                    u.Password = rPassword.Text;
                    u.Email    = rEmail.Text;
                    u.Numbers  = rCard.Text;
                    u.Date     = rDate.Text;
                    u.Other    = textBox1.Text;
                    u.Points   = 0;

                    SqliteAcc.SaveUser(u);

                    MessageBox.Show("Registration successful.");

                    Login log = new Login();
                    this.Hide();
                    log.ShowDialog();
                    this.Close();
                }
            }
        }
Пример #4
0
 public Form1(Userinos user)
 {
     InitializeComponent();
     Loadp();
     Load();
     useracc.Text     = user.Username;
     accCurrency.Text = user.Points + " ";
     idd = user.ID;
 }
Пример #5
0
        private void Order_Click(object sender, EventArgs e)
        {
            int       id       = idd;
            Userinos  user     = pur.AccPurchase(id);
            BuyOption selected = (BuyOption)Prices.SelectedItem;

            pric.Add(selected);
            user.Points      = user.Points + selected.Amount;
            accCurrency.Text = user.Points + "";

            SqliteAcc.Update(user);

            MessageBox.Show("Purchase Successful.");
        }
Пример #6
0
        private void Loginbutton_Click(object sender, EventArgs e)
        {
            string   username = namelogin.Text;
            string   password = passwordlogin.Text;
            Userinos user     = repository.GetAuthenticatedUser(username, password);

            if (user == null)
            {
                MessageBox.Show("Wrong details");
            }
            else
            {
                Form1 mw = new Form1(user);
                this.Hide();
                mw.ShowDialog();
                this.Close();
            }
        }