private void button5_Click_1(object sender, EventArgs e) { accept_change form = new accept_change(); string filepath = "..\\..\\hang.csv"; if (File.Exists(filepath)) { string path = "..\\..\\ss.exe"; Process p = Process.Start(path); p.WaitForExit();//关键,等待外部程序退出后才能往下执行 } else { form.Show(); return; } string file_path = "..\\..\\result.csv"; StreamReader mysr = new StreamReader(file_path, System.Text.Encoding.Default); string str; //文件行 string[] now_string; //每一列 Query_history_operation query_History_Operation = new Query_history_operation(); Rule_operation rule_Operation = new Rule_operation(); Hang hang; Query_history query_History; Rule rule; string ACTION; IOStream iOStream = new IOStream(); int i = 0; this.dataGridView1.Rows.Clear(); //清空列表 while ((str = mysr.ReadLine()) != null) { now_string = str.Split(','); int act = Convert.ToInt32(now_string[0]); if (act == 1) { ACTION = "add_access"; Hang query_out_his = (Hang)Static.hang_index[i]; int index = this.dataGridView1.Rows.Add(); this.dataGridView1.Rows[index].Cells[1].Value = ACTION; //授权结果 this.dataGridView1.Rows[index].Cells[2].Value = query_out_his.TARGET_NAME; //资源名称 this.dataGridView1.Rows[index].Cells[3].Value = query_out_his.REQUEST_DATE; this.dataGridView1.Rows[index].Cells[4].Value = query_out_his.PERSON_BUSINESS_TITLE; this.dataGridView1.Rows[index].Cells[5].Value = query_out_his.PERSON_BUSINESS_TITLE_DETAIL; this.dataGridView1.Rows[index].Cells[6].Value = query_out_his.PERSON_COMPANY; this.dataGridView1.Rows[index].Cells[7].Value = query_out_his.PERSON_DEPTNAME; this.dataGridView1.Rows[index].Cells[8].Value = query_out_his.PERSON_JOB_CODE; this.dataGridView1.Rows[index].Cells[9].Value = query_out_his.PERSON_JOB_FAMILY; this.dataGridView1.Rows[index].Cells[10].Value = query_out_his.PERSON_LOCATION; this.dataGridView1.Rows[index].Cells[11].Value = query_out_his.PERSON_MGR_ID; this.dataGridView1.Rows[index].Cells[12].Value = query_out_his.PERSON_ROLLUP_1; this.dataGridView1.Rows[index].Cells[13].Value = query_out_his.PERSON_ROLLUP_2; this.dataGridView1.Rows[index].Cells[14].Value = query_out_his.PERSON_ROLLUP_3; } else { ACTION = "remove_access"; hang = (Hang)Static.hang_index[i]; query_History = new Query_history(ACTION, hang.TARGET_NAME, hang.PERSON_BUSINESS_TITLE, hang.PERSON_BUSINESS_TITLE_DETAIL, hang.PERSON_COMPANY, hang.PERSON_DEPTNAME, hang.PERSON_JOB_CODE, hang.PERSON_JOB_FAMILY, hang.PERSON_LOCATION, hang.PERSON_MGR_ID, hang.PERSON_ROLLUP_1, hang.PERSON_ROLLUP_2, hang.PERSON_ROLLUP_3, hang.REQUEST_DATE); //构造函数 Static.query_history_index.Add(query_History); iOStream.write_query(query_History); rule = new Rule(act, hang.TARGET_NAME, hang.PERSON_BUSINESS_TITLE, hang.PERSON_BUSINESS_TITLE_DETAIL, hang.PERSON_COMPANY, hang.PERSON_DEPTNAME, hang.PERSON_JOB_CODE, hang.PERSON_JOB_FAMILY, hang.PERSON_LOCATION, hang.PERSON_MGR_ID, hang.PERSON_ROLLUP_1, hang.PERSON_ROLLUP_2, hang.PERSON_ROLLUP_3); //构造函数 Static.rule_index.Add(rule); iOStream.write_rule(rule); } i++; } mysr.Close(); //this.dataGridView1.Rows.Clear(); iOStream.clear_hang(); //ad_ch_success form = new ad_ch_success(); //accept_change form = new accept_change(); form.Show(); }
private void button1_Click(object sender, EventArgs e) //查询 { int TARGET_NAMEnum = -1; string TARGET_NAME = comboBox1.Text.Trim(); int.TryParse(TARGET_NAME, out TARGET_NAMEnum); System.Console.WriteLine(TARGET_NAMEnum); if (TARGET_NAMEnum > 0) { Rule_operation search_rules = new Rule_operation(); Query_history_operation query_History_Operation = new Query_history_operation(); string result = search_rules.Find(/*comboBox1.Text*/ TARGET_NAMEnum, Convert.ToInt32(Static.PERSON_BUSINESS_TITLE), Convert.ToInt32(Static.PERSON_BUSINESS_TITLE_DETAIL), Convert.ToInt32(Static.PERSON_COMPANY), Convert.ToInt32(Static.PERSON_DEPTNAME), Convert.ToInt32(Static.PERSON_JOB_CODE), Convert.ToInt32(Static.PERSON_JOB_FAMILY), Convert.ToInt32(Static.PERSON_LOCATION), Convert.ToInt32(Static.PERSON_MGR_ID), Convert.ToInt32(Static.PERSON_ROLLUP_1), Convert.ToInt32(Static.PERSON_ROLLUP_2), Convert.ToInt32(Static.PERSON_ROLLUP_3)); if (result == "add_access") { user_do_search user_Do_Search = new user_do_search(); user_Do_Search.Show(); //this.Dispose(); //增加访问记录 query_History_Operation.Add_query_history(result, /*comboBox1.Text*/ TARGET_NAMEnum, Convert.ToInt32(Static.PERSON_BUSINESS_TITLE), Convert.ToInt32(Static.PERSON_BUSINESS_TITLE_DETAIL), Convert.ToInt32(Static.PERSON_COMPANY), Convert.ToInt32(Static.PERSON_DEPTNAME), Convert.ToInt32(Static.PERSON_JOB_CODE), Convert.ToInt32(Static.PERSON_JOB_FAMILY), Convert.ToInt32(Static.PERSON_LOCATION), Convert.ToInt32(Static.PERSON_MGR_ID), Convert.ToInt32(Static.PERSON_ROLLUP_1), Convert.ToInt32(Static.PERSON_ROLLUP_2), Convert.ToInt32(Static.PERSON_ROLLUP_3)); } else if (result == "remove_access") { user_no_limit error_tip = new user_no_limit(); error_tip.Show(); //增加访问记录 query_History_Operation.Add_query_history(result, /*comboBox1.Text*/ TARGET_NAMEnum, Convert.ToInt32(Static.PERSON_BUSINESS_TITLE), Convert.ToInt32(Static.PERSON_BUSINESS_TITLE_DETAIL), Convert.ToInt32(Static.PERSON_COMPANY), Convert.ToInt32(Static.PERSON_DEPTNAME), Convert.ToInt32(Static.PERSON_JOB_CODE), Convert.ToInt32(Static.PERSON_JOB_FAMILY), Convert.ToInt32(Static.PERSON_LOCATION), Convert.ToInt32(Static.PERSON_MGR_ID), Convert.ToInt32(Static.PERSON_ROLLUP_1), Convert.ToInt32(Static.PERSON_ROLLUP_2), Convert.ToInt32(Static.PERSON_ROLLUP_3)); } else if (result == "hang") { Static.targetnum = TARGET_NAMEnum; user_no_limit_hang error_tip = new user_no_limit_hang(); error_tip.Show(); /* * user_no_rule error_tip = new user_no_rule(); * error_tip.Show(); * //增加一条挂起访问记录 arraylist * Hang hAng = new Hang(); * hAng.Add_hang(TARGET_NAMEnum, * Convert.ToInt32(Static.PERSON_BUSINESS_TITLE), * Convert.ToInt32(Static.PERSON_BUSINESS_TITLE_DETAIL), * Convert.ToInt32(Static.PERSON_COMPANY), * Convert.ToInt32(Static.PERSON_DEPTNAME), * Convert.ToInt32(Static.PERSON_JOB_CODE), * Convert.ToInt32(Static.PERSON_JOB_FAMILY), * Convert.ToInt32(Static.PERSON_LOCATION), * Convert.ToInt32(Static.PERSON_MGR_ID), * Convert.ToInt32(Static.PERSON_ROLLUP_1), * Convert.ToInt32(Static.PERSON_ROLLUP_2), * Convert.ToInt32(Static.PERSON_ROLLUP_3)); * Static.hang_index.Add(hAng); * IOStream iOStream = new IOStream(); * iOStream.write_hang(hAng); * System.Console.WriteLine(Static.hang_index.Count); */ } else if (result == "no_resource") { user_no_resource error_tip = new user_no_resource(); error_tip.Show(); } } else { user_input_error form = new user_input_error(); form.Show(); } }