private void BatchAutoTest_Load(object sender, EventArgs e) { // Apサーバコンボボックスの設定 var ApServers = ConfigurationManager.AppSettings["ApServer"].Split(','); foreach (var ApServer in ApServers) { cmbApServer.Items.Add(ApServer.Trim()); } cmbApServer.SelectedIndex = 0; // Dbサーバコンボボックスの設定 var DbServers = ConfigurationManager.AppSettings["DbServer"].Split(','); foreach (var DbServer in DbServers) { cmbDbServer.Items.Add(DbServer.Trim()); } cmbDbServer.SelectedIndex = 0; // タスクリストの設定 listTasks.FullRowSelect = true; listTasks.GridLines = true; listTasks.Sorting = SortOrder.Ascending; listTasks.View = View.Details; // 列(コラム)ヘッダの作成 var columnStatus = new ColumnHeader(); var columnSrv = new ColumnHeader(); var columnType = new ColumnHeader(); var columnName = new ColumnHeader(); var columnCmd = new ColumnHeader(); columnStatus.Text = "Status"; columnStatus.Width = 60; columnSrv.Text = "環境"; columnSrv.Width = 40; columnType.Text = "ジョブ種別"; columnType.Width = 100; columnName.Text = "ジョブ名"; columnName.Width = 250; columnCmd.Text = "実行コマンド"; columnCmd.Width = 400; ColumnHeader[] colHeaderRegValue = { columnStatus, columnSrv, columnType, columnName, columnCmd }; listTasks.Columns.AddRange(colHeaderRegValue); //自動実行表示 lblStatus.Visible = false; progressBar1.Visible = false; string[] item1 = { "正常終了", "AP", "IF転送", "[B]請求計算01", @"C:\inputdata\20170202,/usr/local/sei19/" }; string[] item2 = { "未実行", "AP", "コマンド実行", "[B]請求計算01", "/usr/local/sei19/batch/block/M0008_1.sh" }; string[] item3 = { "未実行", "DB", "SQL実行", "合算請求ワークパッチ", "TRUNCATE TABLE SEI_W_GASSANSEIKYU;" }; listTasks.Items.Add(new ListViewItem(item1)); listTasks.Items.Add(new ListViewItem(item2)); listTasks.Items.Add(new ListViewItem(item3)); }
public void test() { //string s = Environment.MachineName; string s = "ApServer02"; ApServer item = (ApServer)Enum.Parse(typeof(ApServer), s, false); Console.WriteLine((int)item); // return 2 Console.WriteLine(item); // return ApServer02 }