Ejemplo n.º 1
0
        private void AddWaifu()
        {
            using (WaifuFrm waifu = new WaifuFrm())
            {
                waifu.id = -1;
                if (catCombo.SelectedValue.ToString() != "0")
                {
                    waifu.id_category = Int32.Parse(catCombo.SelectedValue.ToString());
                }
                else
                {
                    waifu.id_category = -1;
                }

                waifu.FormClosed += WaifuClosed;
                waifu.ShowDialog();
            }
        }
Ejemplo n.º 2
0
        private void editWaifuBtn_Click(object sender, EventArgs e)
        {
            using (WaifuFrm waifu = new WaifuFrm())
            {
                string name = WaifuList.SelectedItems[0].SubItems[1].Text;

                string query = "SELECT w.ID, w.name, cj.categoryID, cj.webID FROM";
                query += " (waifu w INNER JOIN category_join cj ON w.ID = cj.waifuID)";
                query += " where w.name = @name";

                using (conn = new OleDbConnection(Config.connString))
                    using (OleDbCommand com = new OleDbCommand(query, conn))
                    {
                        conn.Open();
                        com.Parameters.AddWithValue("@name", name);
                        OleDbDataReader read = com.ExecuteReader(CommandBehavior.SingleRow);

                        if (read.Read())
                        {
                            if (read["webID"].ToString() != "0")
                            {
                                MessageBox.Show("", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                return;
                            }

                            waifu.id          = Int32.Parse(read["ID"].ToString());
                            waifu.name        = name;
                            waifu.id_category = Int32.Parse(read["categoryID"].ToString());

                            waifu.FormClosed += WaifuClosed;
                            waifu.ShowDialog();
                        }
                        conn.Close();
                    }
            }
        }