示例#1
0
        private void DeleteSetBtn_Click(object sender, EventArgs e)
        {
            ChooseSet.Text = "";
            ChooseSet.Items.Remove(currentSet.SetName);

            Text1.Clear();
            Text2.Clear();
            Title1.Clear();
            Title2.Clear();
            PointerInput.Clear();
            PointerVal.Text = "";

            Querey querey = new Querey();

            using (querey.connection = querey.NewConn)
            {
                string[][] tables = { new string[] { "Sets", "Id" }, new string[] { "Flashcards", "SetId" }, new string[] { "Permissions", "SetId" }, new string[] { "SetProgress", "SetId" } };

                foreach (string[] table in tables)
                {
                    using (querey.command = querey.NewComm)
                    {
                        querey.command.CommandText = "DELETE FROM " + table[0] + " WHERE " + table[1] + "= @setid;";
                        querey.AddParameter("@setid", currentCard.setId);
                        querey.command.ExecuteNonQuery();
                    }
                }
            }

            currentSet = null;

            ChangeEdit(false);
            SaveChanges();
            new MessageForm("deleted").Show();
        }
示例#2
0
        // Actions on the person
        private void AddGuest_Click(object sender, EventArgs e)
        {
            personToEdit = false;

            Text1.Clear();
            Text2.Clear();
            Text3.Clear();
            Text4.Clear();
            TPDateOfBirth.Value = DateTime.Today;

            Panel_Reservation.Enabled = false;
            Panel_Guest.Visible       = true;
        }
示例#3
0
        private void Add_Click(object sender, EventArgs e)
        {
            if (_num < 64)
            {
                _data[_num, 0] = Text1.Text;
                _data[_num, 1] = Text2.Text;
                _num++;
            }
            else
            {
                MessageForm errorForm = new MessageForm("You can have a maximum of 64 cards");
            }

            Text1.Clear();
            Text2.Clear();
        }
示例#4
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (!Text1.Text.Equals("") && !Text2.Text.Equals(""))
            {
                login = new LogIn(Text1.Text, Text2.Text);

                string attempt = login.LogInAttemptAdmin();
                if (attempt.Equals("Failed"))
                {
                    MessageBox.Show("Either your username or password is incorrect !", "Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Logs.addLog(Text1.Text, " AdminLogin ", attempt + " ");
                }
                else if (attempt.Equals("Successful"))
                {
                    AdminLoginForm f2 = new AdminLoginForm();
                    f2.ShowDialog(); // Shows register form
                    Logs.addLog(Text1.Text, " AdminLogin ", attempt + " ");
                }
                else if (attempt.Equals("Too long"))
                {
                    MessageBox.Show("Please enter maximum 20 characters for each field !", "Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("Failed to connect to database, please try again !", "Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Logs.addLog(Text1.Text, " AdminLogin ", "Failed(database problems) ");
                }
            }
            else
            {
                MessageBox.Show("Please fill al the fields !", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            Text1.Clear();
            Text2.Clear();
        }