示例#1
0
        private void addWaifuBtn_Click(object sender, EventArgs e)
        {
            using (conn = new OleDbConnection(Config.connString))
                using (OleDbCommand com = new OleDbCommand("SELECT * from category", conn))
                {
                    conn.Open();

                    if (com.ExecuteScalar() == null)
                    {
                        DialogResult empty = MessageBox.Show("Category is empty, do you want to add a category?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                        if (empty == DialogResult.Yes)
                        {
                            using (CategoryFrm category = new CategoryFrm())
                            {
                                category.id          = -1;
                                category.FormClosed += CatClosed;
                                category.ShowDialog();
                            }
                        }
                        else
                        {
                            conn.Close();
                            return;
                        }

                        conn.Close();
                    }
                }
            AddWaifu();
        }
示例#2
0
 private void addCatBtn_Click(object sender, EventArgs e)
 {
     using (CategoryFrm category = new CategoryFrm())
     {
         category.id          = -1;
         category.FormClosed += CatClosed;
         category.ShowDialog();
     }
 }
示例#3
0
 private void editCatBtn_Click(object sender, EventArgs e)
 {
     using (CategoryFrm category = new CategoryFrm())
     {
         category.id           = ((KeyValuePair <int, string>)catCombo.SelectedItem).Key;
         category.categoryName = ((KeyValuePair <int, string>)catCombo.SelectedItem).Value;
         category.FormClosed  += CatClosedEdit;
         category.ShowDialog();
         catCombo.SelectedValue = ((KeyValuePair <int, string>)catCombo.SelectedItem).Key;
     }
 }