コード例 #1
0
ファイル: BookBase.cs プロジェクト: TeamMassan/doujinshi
        //保管先が変更された時に書棚を当該場所の内容に変える
        protected void storage_SelectedIndexChanged(object sender, EventArgs e)
        {
            //別のreader読み込み処理中にconn.Close()してしまう減少を回避する
            if (SQLiteConnect.conn.State == ConnectionState.Open)
            {
                return;
            }
            SQLiteDataReader reader = null;
            string           query  = "SELECT place_ID FROM t_storage WHERE  place_name = '" + storage.Text + "'";

            SQLiteConnect.Excute(query, ref reader);
            if (reader != null)
            {
                reader.Read();
                // 保管場所IDの変更
                placeID = Convert.ToInt32(reader["place_ID"]);
                reader.Close();
            }
            SQLiteConnect.conn.Close();

            //本棚の内容変更
            query = "SELECT shelf_name FROM t_house_shelf WHERE " +
                    "(SELECT place_ID FROM t_storage WHERE place_name = '" + storage.Text + "') = t_house_shelf.place_ID";
            bookShelf.Items.Clear();
            SQLiteConnect.ComboBoxLoad(ref bookShelf, query, "shelf_name");
            bookShelf.SelectedIndex = 0;
        }
コード例 #2
0
ファイル: detail_search.cs プロジェクト: TeamMassan/doujinshi
        public detail_search()
        {
            InitializeComponent();
            bookName.Focus();
            //ジャンルのコンボボックスの中身の読み込み
            string query = "SELECT genre_title FROM t_genre";

            SQLiteConnect.ComboBoxLoad(ref genreForm, query, "genre_title");
            query = "SELECT origin_title FROM t_origin";
            SQLiteConnect.ComboBoxLoad(ref originForm, query, "origin_title");

            //保管場所一覧をロード
            query = "SELECT place_name FROM t_storage";
            SQLiteConnect.ComboBoxLoad(ref storage, query, "place_name");

            DateTime dt = DateTime.Today;

            for (int cnt = 0; cnt < 15; cnt++)
            {
                bYear.Items.Add(dt.Year - cnt);
                aYear.Items.Add(dt.Year - cnt);
            }
            for (int cnt = 1; cnt <= 12; cnt++)
            {
                bMonth.Items.Add(cnt);
                aMonth.Items.Add(cnt);
            }
            for (int cnt = 1; cnt <= 31; cnt++)
            {
                bDay.Items.Add(cnt);
                aDay.Items.Add(cnt);
            }
        }
コード例 #3
0
ファイル: BookBase.cs プロジェクト: TeamMassan/doujinshi
        public BookBase()
        {
            InitializeComponent();

            //継承先フォームではデザインビュー閲覧時にコンストラクタが実行されてしまう
            //回避策としてデザインモード中は実行しない
            if (this.IsDesignMode())
            {
                return;
            }
            string query;

            //作品一覧をロード
            query = "SELECT origin_title FROM t_origin";
            SQLiteConnect.ComboBoxLoad(ref originComboBox, query, "origin_title");
            originComboBox.SelectedIndex = 0;

            //ジャンル一覧をロード
            query = "SELECT genre_title FROM t_genre";
            SQLiteConnect.ComboBoxLoad(ref genreComboBox, query, "genre_title");
            genreComboBox.SelectedIndex = 0;

            //保管場所一覧をロード
            query = "SELECT place_name FROM t_storage";
            SQLiteConnect.ComboBoxLoad(ref storage, query, "place_name");
            storage.SelectedIndex = 0;
            //storage.Textがchangedするので本棚一覧もロードされる
            placeID = 1;    //保管場所を最初の項目で初期化

            //西暦にローカルタイムから過去15年分を追加
            DateTime dt = DateTime.Today;

            for (int cnt = 0; cnt < 15; cnt++)
            {
                yearForm.Items.Add(dt.Year - cnt);
            }
            for (int cnt = 1; cnt <= 12; cnt++)
            {
                monthForm.Items.Add(cnt);
            }
            for (int cnt = 1; cnt <= 31; cnt++)
            {
                dayForm.Items.Add(cnt);
            }

            //サムネのDrag&Dropを許可
            pictureBox.AllowDrop = true;

            //サムネイルの読み込み
            pictureBox.Image = Image.FromFile(@"Thumbnail\NoImage.jpg");
        }
コード例 #4
0
ファイル: detail_search.cs プロジェクト: TeamMassan/doujinshi
        //保管先が変更された時に書棚を当該場所の内容に変える
        private void storage_SelectedIndexChanged(object sender, EventArgs e)
        {
            SQLiteDataReader reader = null;
            string           query  = "SELECT place_ID FROM t_storage WHERE  place_name = '" + storage.Text + "'";

            SQLiteConnect.Excute(query, ref reader);
            if (reader != null)
            {
                reader.Read();
                reader.Close();
            }
            SQLiteConnect.conn.Close();

            //本棚の内容変更
            query = "SELECT shelf_name FROM t_house_shelf WHERE " +
                    "(SELECT place_ID FROM t_storage WHERE place_name = '" + storage.Text + "') = t_house_shelf.place_ID";
            bookShelf.Items.Clear();
            SQLiteConnect.ComboBoxLoad(ref bookShelf, query, "shelf_name");
        }