Esempio n. 1
0
        //検索ボタン
        private void m_selectBtn_Click(object sender, EventArgs e)
        {
            m_InterfaceList.Clear();
            DISP_dataSet dset = new DISP_dataSet();
            Dictionary <string, string> param_dict = new Dictionary <string, string>();
            Class_Detaget dg = new Class_Detaget();
            String        str;

            if (m_selecttext.Text != "")
            {
                if (this.m_selectKoumoku.SelectedIndex.ToString() != "")
                {
                    switch (this.m_selectKoumoku.SelectedIndex)
                    {
                    case 0:
                        param_dict["kennshino"] = m_selecttext.Text;
                        break;

                    //ホスト名
                    case 1:
                        param_dict["interfacename"] = m_selecttext.Text;
                        break;

                    case 2:
                        if (m_selecttext.Text == "無効")
                        {
                            param_dict["status"] = "0";
                        }
                        else if (m_selecttext.Text == "有効")
                        {
                            param_dict["status"] = "1";
                        }
                        break;

                    case 3:
                        param_dict["type"] = m_selecttext.Text;
                        break;

                    case 4:
                        param_dict["kanshi"] = m_selecttext.Text;
                        break;

                    case 5:
                        param_dict["border"] = m_selecttext.Text;
                        break;

                    case 6:
                        param_dict["IPaddress"] = m_selecttext.Text;
                        break;

                    case 7:
                        param_dict["IPaddressNAT"] = m_selecttext.Text;
                        break;

                    case 8:
                        param_dict["biko"] = m_selecttext.Text;
                        break;

                    case 9:
                        param_dict["userno"] = m_selecttext.Text;
                        break;

                    case 10:
                        param_dict["systemno"] = m_selecttext.Text;
                        break;

                    case 11:
                        param_dict["siteno"] = m_selecttext.Text;
                        break;

                    case 12:
                        param_dict["host_no"] = m_selecttext.Text;
                        break;

                    //更新日時
                    case 13:
                        DateTime dt;
                        str = m_selecttext.Text;

                        //入力された日付の形式の確認
                        if (DateTime.TryParse(str, out dt))
                        {
                            param_dict["chk_date"] = str;
                        }
                        else
                        {
                            MessageBox.Show("日付の形式が正しくありません。", "監視インターフェイス検索");
                            return;
                        }
                        break;

                    //更新者
                    case 14:
                        param_dict["chk_name_id"] = m_selecttext.Text;
                        break;

                    default:
                        break;
                    }
                }
            }
            //まず件数を取得する
            Int64 count = dg.getSelectInterfaceCount(param_dict, con, dset, true);

            if (MessageBox.Show(count.ToString() + "件ヒットしました。表示しますか?", "監視インターフェイス", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }
            //インターフェイス一覧を取得する
            dset = dg.getSelectInterface(param_dict, con, dset, true);


            this.splitContainer1.SplitterDistance = 250;

            this.m_InterfaceList.VirtualMode = true;
            // 1行全体選択
            this.m_InterfaceList.FullRowSelect = true;
            this.m_InterfaceList.HideSelection = false;
            this.m_InterfaceList.HeaderStyle   = ColumnHeaderStyle.Clickable;
            //Hook up handlers for VirtualMode events.
            this.m_InterfaceList.RetrieveVirtualItem += new RetrieveVirtualItemEventHandler(InterfaceList_RetrieveVirtualItem);
            this.m_InterfaceList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            this.m_InterfaceList.Scrollable = true;


            this.m_InterfaceList.Columns.Insert(0, "No", 30, HorizontalAlignment.Left);
            this.m_InterfaceList.Columns.Insert(1, "インターフェイス名", 120, HorizontalAlignment.Left);
            this.m_InterfaceList.Columns.Insert(2, "ステータス", 90, HorizontalAlignment.Left);
            this.m_InterfaceList.Columns.Insert(3, "監視タイプ", 90, HorizontalAlignment.Left);
            this.m_InterfaceList.Columns.Insert(4, "監視項目名", 80, HorizontalAlignment.Left);
            this.m_InterfaceList.Columns.Insert(5, "閾値", 50, HorizontalAlignment.Left);
            this.m_InterfaceList.Columns.Insert(6, "IPアドレス", 50, HorizontalAlignment.Left);
            this.m_InterfaceList.Columns.Insert(7, "IPアドレス(NAT)", 50, HorizontalAlignment.Left);
            this.m_InterfaceList.Columns.Insert(8, "備考", 50, HorizontalAlignment.Left);
            this.m_InterfaceList.Columns.Insert(9, "カスタマ番号", 50, HorizontalAlignment.Left);
            this.m_InterfaceList.Columns.Insert(10, "システム通番番号", 50, HorizontalAlignment.Left);
            this.m_InterfaceList.Columns.Insert(11, "拠点通番", 50, HorizontalAlignment.Left);
            this.m_InterfaceList.Columns.Insert(12, "ホスト通番", 50, HorizontalAlignment.Left);
            this.m_InterfaceList.Columns.Insert(13, "更新日時", 50, HorizontalAlignment.Left);
            this.m_InterfaceList.Columns.Insert(14, "更新者", 50, HorizontalAlignment.Left);

            //リストビューを初期化する
            interface_list = new DataTable("table1");
            interface_list.Columns.Add("No", Type.GetType("System.Int32"));
            interface_list.Columns.Add("インターフェイス名", Type.GetType("System.String"));
            interface_list.Columns.Add("ステータス", Type.GetType("System.String"));
            interface_list.Columns.Add("監視タイプ", Type.GetType("System.String"));
            interface_list.Columns.Add("監視項目名", Type.GetType("System.String"));
            interface_list.Columns.Add("閾値", Type.GetType("System.String"));
            interface_list.Columns.Add("IPアドレス", Type.GetType("System.String"));
            interface_list.Columns.Add("IPアドレス(NAT)", Type.GetType("System.String"));
            interface_list.Columns.Add("備考", Type.GetType("System.String"));
            interface_list.Columns.Add("カスタマ番号", Type.GetType("System.String"));
            interface_list.Columns.Add("システム通番番号", Type.GetType("System.String"));
            interface_list.Columns.Add("拠点通番", Type.GetType("System.String"));
            interface_list.Columns.Add("ホスト通番", Type.GetType("System.String"));
            interface_list.Columns.Add("更新日時", Type.GetType("System.String"));
            interface_list.Columns.Add("更新者", Type.GetType("System.String"));



            //リストに表示
            if (dset.watch_L != null)
            {
                m_InterfaceList.BeginUpdate();

                foreach (watch_InterfaceDS s_ds in dset.watch_L)
                {
                    DataRow urow = interface_list.NewRow();

                    urow["No"]          = s_ds.watch_Interfaceno;
                    urow["インターフェイス名"]   = s_ds.interfacename;
                    urow["ステータス"]       = s_ds.status;
                    urow["監視タイプ"]       = s_ds.type;
                    urow["監視項目名"]       = s_ds.kanshi;
                    urow["閾値"]          = s_ds.border;
                    urow["IPアドレス"]      = s_ds.IPaddress;
                    urow["IPアドレス(NAT)"] = s_ds.IPaddressNAT;
                    urow["備考"]          = s_ds.biko;

                    urow["カスタマ番号"]   = s_ds.userno;
                    urow["システム通番番号"] = s_ds.systemno;
                    urow["拠点通番"]     = s_ds.siteno;
                    urow["ホスト通番"]    = s_ds.host_no;
                    urow["更新日時"]     = s_ds.chk_date;
                    urow["更新者"]      = s_ds.chk_name_id;
                    interface_list.Rows.Add(urow);
                }
                this.m_InterfaceList.VirtualListSize = interface_list.Rows.Count;
                this.m_InterfaceList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);

                m_InterfaceList.EndUpdate();
            }
        }