示例#1
0
        public mainlist()
        {
            InitializeComponent();
            login focusform = new login();

            focusform.ShowDialog();

            collectAll();
        }
示例#2
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (status == false)
     {
         login focusform = new login();
         focusform.ShowDialog();
     }
     else
     {
         settings focusforum = new settings();
         focusforum.ShowDialog();
     }
 }
示例#3
0
 private void buttonShowAll_Click(object sender, EventArgs e)
 {
     if (status == false)
     {
         login focusform = new login();
         focusform.ShowDialog();
     }
     else
     {
         sebox.Items.Clear();
         collectAll();
     }
 }
示例#4
0
 private void buttonShowObr_Click(object sender, EventArgs e)
 {
     if (status == false)
     {
         login focusform = new login();
         focusform.ShowDialog();
     }
     else
     {
         getID(sebox.SelectedIndex);
         if (selectedItem != null)
         {
             showObr showForm = new showObr();
             showForm.Show();
         }
     }
 }
示例#5
0
 private void insertbutton_Click(object sender, EventArgs e)
 {
     if (status == false)
     {
         login focusform = new login();
         focusform.ShowDialog();
     }
     else
     {
         if (root == true)
         {
             addobr additform = new addobr();
             additform.Show();
         }
         else
         {
             MessageBox.Show("Вы не обладаете правами администратора", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
示例#6
0
 private void buttonDeleteObr_Click(object sender, EventArgs e)
 {
     if (status == false)
     {
         login focusform = new login();
         focusform.ShowDialog();
     }
     else
     {
         if (root == true)
         {
             deleteSelectedItem();
             sebox.Items.Clear();
             collectAll();
         }
         else
         {
             MessageBox.Show("Вы не обладаете правами администратора", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
示例#7
0
        private void search_Click(object sender, EventArgs e)
        {
            if (status == false)
            {
                login focusform = new login();
                focusform.ShowDialog();
            }
            {
                List <string> specs = new List <string>
                {
                    "year",
                    "country",
                    "firm",
                    "model",
                    "form",
                    "material",
                    "num"
                };

                using var connectionDB = new SQLiteConnection(@"Data Source=C:\guitars.sqlite;Version=3;");
                connectionDB.Open();
                if (listBox1.SelectedIndex == -1)
                {
                    var result = MessageBox.Show("Вы не выбрали категорию поиска.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    sebox.Items.Clear();
                    using var cmdr = new SQLiteCommand("SELECT * FROM guitars WHERE " + specs[listBox1.SelectedIndex] + " = '" + searchbox.Text + "'", connectionDB);
                    using SQLiteDataReader reader = cmdr.ExecuteReader();

                    while (reader.Read())
                    {
                        sebox.Items.Add($"ID[{reader["id"]}] Model: {reader["model"]}, Firm: {reader["firm"]}, Year: {reader["year"]}, Country: {reader["country"]}, Form: {reader["form"]}, Material: {reader["material"]}, Num: {reader["num"]}.");
                    }
                }
                connectionDB.Close();
            }
        }