//検索ボタン private void m_selectBtn_Click(object sender, EventArgs e) { m_host_List.Clear(); DISP_dataSet dset = new DISP_dataSet(); Dictionary <string, string> param_dict = new Dictionary <string, string>(); Class_Detaget dg = new Class_Detaget(); if (m_selecttext.Text != "") { if (this.m_selectKoumoku.SelectedIndex.ToString() != "") { switch (this.m_selectKoumoku.SelectedIndex) { //ホスト通番 case 0: param_dict["host_no"] = m_selecttext.Text; break; //ホスト名 case 1: param_dict["hostname"] = m_selecttext.Text; break; //カスタマ通番 case 2: param_dict["userno"] = m_selecttext.Text; break; case 3: param_dict["systemno"] = m_selecttext.Text; break; case 4: param_dict["siteno"] = m_selecttext.Text; break; case 5: if (m_selecttext.Text == "有効") { param_dict["status"] = "1"; } else if (m_selecttext.Text == "無効") { param_dict["status"] = "0"; } break; case 6: param_dict["device"] = m_selecttext.Text; break; case 7: param_dict["location"] = m_selecttext.Text; break; case 8: param_dict["usefor"] = m_selecttext.Text; break; //設置機器ID case 9: param_dict["settikikiid"] = m_selecttext.Text; break; case 10: DateTime dt; String str = m_selecttext.Text; //入力された日付の形式の確認 if (DateTime.TryParse(str, out dt)) { param_dict["kansiStartdate"] = str; } else { MessageBox.Show("日付の形式が正しくありません。", "拠点検索"); return; } break; case 11: str = m_selecttext.Text; //入力された日付の形式の確認 if (DateTime.TryParse(str, out dt)) { param_dict["kansiEndsdate"] = str; } else { MessageBox.Show("日付の形式が正しくありません。", "拠点検索"); return; } break; case 12: param_dict["hosyukanri"] = m_selecttext.Text; break; case 13: param_dict["hosyuinfo"] = m_selecttext.Text; break; case 14: param_dict["biko"] = m_selecttext.Text; break; //更新日時 case 15: str = m_selecttext.Text; //入力された日付の形式の確認 if (DateTime.TryParse(str, out dt)) { param_dict["chk_date"] = str; } else { MessageBox.Show("日付の形式が正しくありません。", "拠点検索"); return; } break; //更新者 case 16: param_dict["chk_name_id"] = m_selecttext.Text; break; default: break; } } } //まず件数を取得する Int64 count = dg.getSelectHostCount(param_dict, con, dset, true); if (MessageBox.Show(count.ToString() + "件ヒットしました。表示しますか?", "ホスト", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } //ホスト一覧を取得する dset = dg.getSelectHost(param_dict, con, dset); this.splitContainer1.SplitterDistance = 280; this.m_host_List.VirtualMode = true; // 1行全体選択 this.m_host_List.FullRowSelect = true; this.m_host_List.HideSelection = false; this.m_host_List.HeaderStyle = ColumnHeaderStyle.Clickable; //Hook up handlers for VirtualMode events. this.m_host_List.RetrieveVirtualItem += new RetrieveVirtualItemEventHandler(Host_RetrieveVirtualItem); this.m_host_List.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); this.m_host_List.Scrollable = true; this.m_host_List.Columns.Insert(0, "No", 30, HorizontalAlignment.Left); this.m_host_List.Columns.Insert(1, "ホスト名", 120, HorizontalAlignment.Left); this.m_host_List.Columns.Insert(2, "ステータス", 90, HorizontalAlignment.Left); this.m_host_List.Columns.Insert(3, "機種", 80, HorizontalAlignment.Left); this.m_host_List.Columns.Insert(4, "設置場所", 50, HorizontalAlignment.Left); this.m_host_List.Columns.Insert(5, "用途", 50, HorizontalAlignment.Left); this.m_host_List.Columns.Insert(6, "設置機器ID", 120, HorizontalAlignment.Left); this.m_host_List.Columns.Insert(7, "監視開始日時", 120, HorizontalAlignment.Left); this.m_host_List.Columns.Insert(8, "監視終了日時", 120, HorizontalAlignment.Left); this.m_host_List.Columns.Insert(9, "保守管理番号", 50, HorizontalAlignment.Left); this.m_host_List.Columns.Insert(10, "保守情報", 50, HorizontalAlignment.Left); this.m_host_List.Columns.Insert(11, "備考", 50, HorizontalAlignment.Left); this.m_host_List.Columns.Insert(12, "カスタマ番号", 50, HorizontalAlignment.Left); this.m_host_List.Columns.Insert(13, "システム通番番号", 50, HorizontalAlignment.Left); this.m_host_List.Columns.Insert(14, "拠点通番", 50, HorizontalAlignment.Left); this.m_host_List.Columns.Insert(15, "更新日時", 50, HorizontalAlignment.Left); this.m_host_List.Columns.Insert(16, "更新者", 50, HorizontalAlignment.Left); //リストビューを初期化する host_list = new DataTable("table1"); host_list.Columns.Add("No", Type.GetType("System.Int32")); host_list.Columns.Add("ホスト名", Type.GetType("System.String")); host_list.Columns.Add("ステータス", Type.GetType("System.String")); host_list.Columns.Add("機種", Type.GetType("System.String")); host_list.Columns.Add("設置場所", Type.GetType("System.String")); host_list.Columns.Add("用途", Type.GetType("System.String")); host_list.Columns.Add("設置機器ID", Type.GetType("System.String")); host_list.Columns.Add("監視開始日時", Type.GetType("System.String")); host_list.Columns.Add("監視終了日時", Type.GetType("System.String")); host_list.Columns.Add("保守管理番号", Type.GetType("System.String")); host_list.Columns.Add("保守情報", Type.GetType("System.String")); host_list.Columns.Add("備考", Type.GetType("System.String")); host_list.Columns.Add("カスタマ番号", Type.GetType("System.String")); host_list.Columns.Add("システム通番番号", Type.GetType("System.String")); host_list.Columns.Add("拠点通番", Type.GetType("System.String")); host_list.Columns.Add("更新日時", Type.GetType("System.String")); host_list.Columns.Add("更新者", Type.GetType("System.String")); //リストに表示 if (dset.host_L != null) { m_host_List.BeginUpdate(); foreach (hostDS s_ds in dset.host_L) { DataRow urow = host_list.NewRow(); urow["No"] = s_ds.host_no; urow["ホスト名"] = s_ds.hostname; urow["ステータス"] = s_ds.status; urow["機種"] = s_ds.device; urow["設置場所"] = s_ds.location; urow["用途"] = s_ds.usefor; urow["設置機器ID"] = s_ds.settikikiid; urow["監視開始日時"] = s_ds.kansiStartdate; urow["監視終了日時"] = s_ds.kansiEndsdate; urow["保守管理番号"] = s_ds.hosyukanri; urow["保守情報"] = s_ds.hosyuinfo; urow["備考"] = s_ds.biko; urow["カスタマ番号"] = s_ds.userno; urow["システム通番番号"] = s_ds.systemno; urow["拠点通番"] = s_ds.siteno; urow["更新日時"] = s_ds.chk_date; urow["更新者"] = s_ds.chk_name_id; host_list.Rows.Add(urow); } this.m_host_List.VirtualListSize = host_list.Rows.Count; this.m_host_List.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); m_host_List.EndUpdate(); } }