private void GetData() { // 検索モード SearchType _searchType; if (this.rblSearch.SelectedIndex == 0) { _searchType = SearchType.Ambiguous; } else if (this.rblSearch.SelectedIndex == 1) { _searchType = SearchType.Part; } else { _searchType = SearchType.Complete; } String _keyword = MkaCommon.GetCondition(txtKeyword.Text.Trim(), _searchType); MkaDBConnect dbCon = new MkaDBConnect(); MySqlConnection con; MySqlCommand cmd; // open connection if (dbCon.OpenConnection() != 1) { return; } con = dbCon.GetConnection(); // get search records cmd = new MySqlCommand("simple_get_records", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new MySqlParameter("_keyword", _keyword)); MySqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection); DataTable dt = new DataTable(); dt.Load(rdr); lblResult.Visible = true; if (dt.Rows.Count == 0) { lblResult.Text = "見つかりませんでした."; } else { lblResult.Text = dt.Rows.Count.ToString() + "点が見つけました."; } gvResults.DataSource = dt; gvResults.DataBind(); // close connection dbCon.CloseConnection(); }
private Image GetImage(int RBangou) { MkaDBConnect dbCon = new MkaDBConnect(); MySqlConnection con; MySqlCommand cmd; // open connection if (dbCon.OpenConnection() != 1) { return(null); } con = dbCon.GetConnection(); // get search records cmd = new MySqlCommand("get_mokkan_simple", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new MySqlParameter("_rBangou", RBangou)); MySqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection); DataTable dt = new DataTable(); dt.Load(rdr); // close connection dbCon.CloseConnection(); if (dt.Rows.Count == 0) { return(new Bitmap(_resize.Width, _resize.Height)); } String path = String.Format("{0}\\{1}\\{2}\\{3}\\{1}_{2}_{3}_{4}.jpg", ConfigurationSettings.AppSettings["MokkanPath"], dt.Rows[0][0], dt.Rows[0][1], dt.Rows[0][2], RBangou); Bitmap bmp = new Bitmap(path); bmp = MkaCommon.ResizeImage(bmp, _resize); return(bmp); }
private void GetKeywords() { // 検索モード if (this.rblSearch.SelectedIndex == 0) { _searchType = SearchType.Ambiguous; } else if (this.rblSearch.SelectedIndex == 1) { _searchType = SearchType.Part; } else { _searchType = SearchType.Complete; } // 調査次数 if (txtChousaJisuu.Text.Trim() != "" && !Int32.TryParse(txtChousaJisuu.Text.Trim(), out _chousaJisuu)) { _chousaJisuu = 0; } // 大地区 _ooChiku = this.txtOoChiku.Text.Trim(); // 中小地区 _chuushouChiku = this.txtChuushouChiku.Text.Trim(); // 遺構名 _ikoumei = MkaCommon.GetCondition(this.txtIkoumei.Text.Trim(), _searchType); // 土層名 _dosoumei = MkaCommon.GetCondition(this.txtDosoumei.Text.Trim(), _searchType); // グリッド if (txtGrid.Text.Trim() != "" && !Int32.TryParse(txtGrid.Text.Trim(), out _grid)) { _grid = 0; } // 出土日付 _date = Regex.Replace(this.txtDate.Text, @"[/]", ""); if (_date.Length > 6) { _date = _date.Substring(0, 6); } // バット番号 _batBangou = this.txtBatBangou.Text.Trim(); // ガラス板番号 _glassItaBangou = this.txtGlassBangou.Text.Trim(); // R番号 if (txtRBangou.Text.Trim() != "" && !Int32.TryParse(txtRBangou.Text.Trim(), out _rBangou)) { _rBangou = 0; } // 仮釈文 _kariShakubun = MkaCommon.GetCondition(this.txtKariShakubun.Text.Trim(), _searchType); // 概報所収情報 _gaihouShoshuuJyouhou = MkaCommon.GetCondition(this.txtGaihouShoshuuJyouhou.Text.Trim(), _searchType); // 写真番号情報 _shashinBangouJyouhou = MkaCommon.GetCondition(this.txtShasinBangouJyouhou.Text.Trim(), _searchType); // 備考 _bikou = MkaCommon.GetCondition(this.txtBikou.Text.Trim(), _searchType); }