public ArrayList return_query_hang_history(int PERSON_BUSINESS_TITLE, int PERSON_BUSINESS_TITLE_DETAIL, int PERSON_COMPANY, int PERSON_DEPTNAME, int PERSON_JOB_CODE, int PERSON_JOB_FAMILY, int PERSON_LOCATION, int PERSON_MGR_ID, int PERSON_ROLLUP_1, int PERSON_ROLLUP_2, int PERSON_ROLLUP_3) //获得用户的访问根据用户信息 { ArrayList temp = new ArrayList(); for (int i = 0; i < Static.hang_index.Count; i++) { Hang temp_query = (Hang)Static.hang_index[i]; if ((temp_query.PERSON_BUSINESS_TITLE == PERSON_BUSINESS_TITLE) && (temp_query.PERSON_BUSINESS_TITLE_DETAIL == PERSON_BUSINESS_TITLE_DETAIL) && (temp_query.PERSON_COMPANY == PERSON_COMPANY) && (temp_query.PERSON_DEPTNAME == PERSON_DEPTNAME) && (temp_query.PERSON_JOB_CODE == PERSON_JOB_CODE) && (temp_query.PERSON_JOB_FAMILY == PERSON_JOB_FAMILY) && (temp_query.PERSON_LOCATION == PERSON_LOCATION) && (temp_query.PERSON_MGR_ID == PERSON_MGR_ID) && (temp_query.PERSON_ROLLUP_1 == PERSON_ROLLUP_1) && (temp_query.PERSON_ROLLUP_2 == PERSON_ROLLUP_2) && (temp_query.PERSON_ROLLUP_3 == PERSON_ROLLUP_3) ) { temp.Add(temp_query); } } return(temp); }
private void button1_Click_1(object sender, EventArgs e) { Hang hAng = new Hang(); hAng.Add_hang(Static.targetnum, 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); user_no_rule error_tip = new user_no_rule(); error_tip.Show(); this.Dispose(); }
/// <summary> /// 读取挂起 /// </summary> public void Get_hang() { string filepath = "..\\..\\hang.csv"; if (!File.Exists(filepath)) //没有规则文件 通过关联规则生成规则文件 { return; } StreamReader mysr = new StreamReader(filepath, System.Text.Encoding.Default); string str; //文件行 Hang hang; string[] now_string; //每一列 int TARGET_NAME; int PERSON_BUSINESS_TITLE; int PERSON_BUSINESS_TITLE_DETAIL; int PERSON_COMPANY; int PERSON_DEPTNAME; int PERSON_JOB_CODE; int PERSON_JOB_FAMILY; int PERSON_LOCATION; int PERSON_MGR_ID; int PERSON_ROLLUP_1; int PERSON_ROLLUP_2; int PERSON_ROLLUP_3; DateTime REQUEST_DATE; while ((str = mysr.ReadLine()) != null) { //System.Console.WriteLine(str); now_string = str.Split(','); //System.Console.WriteLine(now_string[0]); TARGET_NAME = Convert.ToInt32(now_string[0]); PERSON_BUSINESS_TITLE = Convert.ToInt32(now_string[1]); PERSON_BUSINESS_TITLE_DETAIL = Convert.ToInt32(now_string[2]); PERSON_COMPANY = Convert.ToInt32(now_string[3]); PERSON_DEPTNAME = Convert.ToInt32(now_string[4]); PERSON_JOB_CODE = Convert.ToInt32(now_string[5]); PERSON_JOB_FAMILY = Convert.ToInt32(now_string[6]); PERSON_LOCATION = Convert.ToInt32(now_string[7]); PERSON_MGR_ID = Convert.ToInt32(now_string[8]); PERSON_ROLLUP_1 = Convert.ToInt32(now_string[9]); PERSON_ROLLUP_2 = Convert.ToInt32(now_string[10]); PERSON_ROLLUP_3 = Convert.ToInt32(now_string[11]); REQUEST_DATE = Convert.ToDateTime(now_string[12]); hang = new Hang(TARGET_NAME, PERSON_BUSINESS_TITLE, PERSON_BUSINESS_TITLE_DETAIL, PERSON_COMPANY, PERSON_DEPTNAME, PERSON_JOB_CODE, PERSON_JOB_FAMILY, PERSON_LOCATION, PERSON_MGR_ID, PERSON_ROLLUP_1, PERSON_ROLLUP_2, PERSON_ROLLUP_3, REQUEST_DATE); Static.hang_index.Add(hang);//写入ArrayList } mysr.Close(); }
private void button3_Click_1(object sender, EventArgs e) { Query_history query_History; Rule rule; string ACTION; IOStream iOStream = new IOStream(); for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value) == 0) { ACTION = "add_access"; } else { ACTION = "remove_access"; } Hang hang = new Hang (Convert.ToInt32(dataGridView1.Rows[i].Cells[2].Value), Convert.ToInt32(dataGridView1.Rows[i].Cells[4].Value), Convert.ToInt32(dataGridView1.Rows[i].Cells[5].Value), Convert.ToInt32(dataGridView1.Rows[i].Cells[6].Value), Convert.ToInt32(dataGridView1.Rows[i].Cells[7].Value), Convert.ToInt32(dataGridView1.Rows[i].Cells[8].Value), Convert.ToInt32(dataGridView1.Rows[i].Cells[9].Value), Convert.ToInt32(dataGridView1.Rows[i].Cells[10].Value), Convert.ToInt32(dataGridView1.Rows[i].Cells[11].Value), Convert.ToInt32(dataGridView1.Rows[i].Cells[12].Value), Convert.ToInt32(dataGridView1.Rows[i].Cells[13].Value), Convert.ToInt32(dataGridView1.Rows[i].Cells[14].Value), Convert.ToDateTime(dataGridView1.Rows[i].Cells[3].Value)); 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(Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value), 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); } this.dataGridView1.Rows.Clear(); ad_ch_success form = new ad_ch_success(); form.Show(); }
public ad_rules_hang() { InitializeComponent(); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.dataGridView1.Rows.Clear(); Query_history_operation query_History_Operation = new Query_history_operation(); //查询操作类 for (int i = 0; i < Static.hang_index.Count; i++) { Hang query_out_his = (Hang)Static.hang_index[i]; TimeSpan time_dis = DateTime.Now - query_out_his.REQUEST_DATE; double time_ = time_dis.TotalDays; int index = this.dataGridView1.Rows.Add(); //this.dataGridView1.Rows[index].Cells[1].Value = query_out_his.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; } //DataGridViewButtonColumn btnMDF = new DataGridViewButtonColumn(); //btnMDF.Name = "btnMDF"; //btnMDF.HeaderText = "修改"; //btnMDF.DefaultCellStyle.NullValue = "修改"; //btnMDF.Width = 61; //dataGridView1.Columns.Add(btnMDF); }
/// <summary> /// 追加挂起 /// </summary> public void write_hang(Hang hang) { string filepath = "..\\..\\hang.csv"; // 文件路径 FileStream fs = new FileStream(filepath, FileMode.Append); StreamWriter sw = new StreamWriter(fs, Encoding.UTF8); sw.Write(hang.TARGET_NAME.ToString() + ","); sw.Write(hang.PERSON_BUSINESS_TITLE.ToString() + ","); sw.Write(hang.PERSON_BUSINESS_TITLE_DETAIL.ToString() + ","); sw.Write(hang.PERSON_COMPANY.ToString() + ","); sw.Write(hang.PERSON_DEPTNAME.ToString() + ","); sw.Write(hang.PERSON_JOB_CODE.ToString() + ","); sw.Write(hang.PERSON_JOB_FAMILY.ToString() + ","); sw.Write(hang.PERSON_LOCATION.ToString() + ","); sw.Write(hang.PERSON_MGR_ID.ToString() + ","); sw.Write(hang.PERSON_ROLLUP_1.ToString() + ","); sw.Write(hang.PERSON_ROLLUP_2.ToString() + ","); sw.Write(hang.PERSON_ROLLUP_3.ToString() + ","); sw.WriteLine(hang.REQUEST_DATE.ToString()); sw.Close(); return; }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if ((string)comboBox1.SelectedItem == "全部") { this.dataGridView1.Rows.Clear(); Query_history_operation query_History_Operation = new Query_history_operation(); //查询操作类 //ArrayList query = query_History_Operation.return_query_history("9670"); // 需要重写的那个查询函数 for (int i = 0; i < Static.query_history_index.Count; i++) { Query_history query_out_his = (Query_history)Static.query_history_index[i]; if (i > 500) { break; } int index = this.dataGridView1.Rows.Add(); this.dataGridView1.Rows[index].Cells[0].Value = query_out_his.ACTION; //授权结果 this.dataGridView1.Rows[index].Cells[1].Value = query_out_his.TARGET_NAME; //资源名称 this.dataGridView1.Rows[index].Cells[2].Value = query_out_his.REQUEST_DATE; this.dataGridView1.Rows[index].Cells[3].Value = query_out_his.PERSON_BUSINESS_TITLE; this.dataGridView1.Rows[index].Cells[4].Value = query_out_his.PERSON_BUSINESS_TITLE_DETAIL; this.dataGridView1.Rows[index].Cells[5].Value = query_out_his.PERSON_COMPANY; this.dataGridView1.Rows[index].Cells[6].Value = query_out_his.PERSON_DEPTNAME; this.dataGridView1.Rows[index].Cells[7].Value = query_out_his.PERSON_JOB_CODE; this.dataGridView1.Rows[index].Cells[8].Value = query_out_his.PERSON_JOB_FAMILY; this.dataGridView1.Rows[index].Cells[9].Value = query_out_his.PERSON_LOCATION; this.dataGridView1.Rows[index].Cells[10].Value = query_out_his.PERSON_MGR_ID; this.dataGridView1.Rows[index].Cells[11].Value = query_out_his.PERSON_ROLLUP_1; this.dataGridView1.Rows[index].Cells[12].Value = query_out_his.PERSON_ROLLUP_2; this.dataGridView1.Rows[index].Cells[13].Value = query_out_his.PERSON_ROLLUP_3; } } if ((string)comboBox1.SelectedItem == "半年内") { this.dataGridView1.Rows.Clear(); Query_history_operation query_History_Operation = new Query_history_operation(); //查询操作类 //ArrayList query = query_History_Operation.return_query_history("9670"); // 需要重写的那个查询函数 for (int i = 0; i < Static.query_history_index.Count; i++) { Query_history query_out_his = (Query_history)Static.query_history_index[i]; TimeSpan time_dis = DateTime.Now - query_out_his.REQUEST_DATE; double time_ = time_dis.TotalDays; if (time_ <= 180) { int index = this.dataGridView1.Rows.Add(); this.dataGridView1.Rows[index].Cells[0].Value = query_out_his.ACTION; //授权结果 this.dataGridView1.Rows[index].Cells[1].Value = query_out_his.TARGET_NAME; //资源名称 this.dataGridView1.Rows[index].Cells[2].Value = query_out_his.REQUEST_DATE; this.dataGridView1.Rows[index].Cells[3].Value = query_out_his.PERSON_BUSINESS_TITLE; this.dataGridView1.Rows[index].Cells[4].Value = query_out_his.PERSON_BUSINESS_TITLE_DETAIL; this.dataGridView1.Rows[index].Cells[5].Value = query_out_his.PERSON_COMPANY; this.dataGridView1.Rows[index].Cells[6].Value = query_out_his.PERSON_DEPTNAME; this.dataGridView1.Rows[index].Cells[7].Value = query_out_his.PERSON_JOB_CODE; this.dataGridView1.Rows[index].Cells[8].Value = query_out_his.PERSON_JOB_FAMILY; this.dataGridView1.Rows[index].Cells[9].Value = query_out_his.PERSON_LOCATION; this.dataGridView1.Rows[index].Cells[10].Value = query_out_his.PERSON_MGR_ID; this.dataGridView1.Rows[index].Cells[11].Value = query_out_his.PERSON_ROLLUP_1; this.dataGridView1.Rows[index].Cells[12].Value = query_out_his.PERSON_ROLLUP_2; this.dataGridView1.Rows[index].Cells[13].Value = query_out_his.PERSON_ROLLUP_3; } } } if ((string)comboBox1.SelectedItem == "三天内") { this.dataGridView1.Rows.Clear(); Query_history_operation query_History_Operation = new Query_history_operation(); //查询操作类 //ArrayList query = query_History_Operation.return_query_history("9670"); // 需要重写的那个查询函数 for (int i = 0; i < Static.query_history_index.Count; i++) { Query_history query_out_his = (Query_history)Static.query_history_index[i]; TimeSpan time_dis = DateTime.Now - query_out_his.REQUEST_DATE; double time_ = time_dis.TotalDays; if (time_ <= 3.0) { int index = this.dataGridView1.Rows.Add(); this.dataGridView1.Rows[index].Cells[0].Value = query_out_his.ACTION; //授权结果 this.dataGridView1.Rows[index].Cells[1].Value = query_out_his.TARGET_NAME; //资源名称 this.dataGridView1.Rows[index].Cells[2].Value = query_out_his.REQUEST_DATE; this.dataGridView1.Rows[index].Cells[3].Value = query_out_his.PERSON_BUSINESS_TITLE; this.dataGridView1.Rows[index].Cells[4].Value = query_out_his.PERSON_BUSINESS_TITLE_DETAIL; this.dataGridView1.Rows[index].Cells[5].Value = query_out_his.PERSON_COMPANY; this.dataGridView1.Rows[index].Cells[6].Value = query_out_his.PERSON_DEPTNAME; this.dataGridView1.Rows[index].Cells[7].Value = query_out_his.PERSON_JOB_CODE; this.dataGridView1.Rows[index].Cells[8].Value = query_out_his.PERSON_JOB_FAMILY; this.dataGridView1.Rows[index].Cells[9].Value = query_out_his.PERSON_LOCATION; this.dataGridView1.Rows[index].Cells[10].Value = query_out_his.PERSON_MGR_ID; this.dataGridView1.Rows[index].Cells[11].Value = query_out_his.PERSON_ROLLUP_1; this.dataGridView1.Rows[index].Cells[12].Value = query_out_his.PERSON_ROLLUP_2; this.dataGridView1.Rows[index].Cells[13].Value = query_out_his.PERSON_ROLLUP_3; } } } if ((string)comboBox1.SelectedItem == "一个月内") { this.dataGridView1.Rows.Clear(); Query_history_operation query_History_Operation = new Query_history_operation(); //查询操作类 //ArrayList query = query_History_Operation.return_query_history("9670"); // 需要重写的那个查询函数 for (int i = 0; i < Static.query_history_index.Count; i++) { Query_history query_out_his = (Query_history)Static.query_history_index[i]; TimeSpan time_dis = DateTime.Now - query_out_his.REQUEST_DATE; double time_ = time_dis.TotalDays; if (time_ <= 30.0) { int index = this.dataGridView1.Rows.Add(); this.dataGridView1.Rows[index].Cells[0].Value = query_out_his.ACTION; //授权结果 this.dataGridView1.Rows[index].Cells[1].Value = query_out_his.TARGET_NAME; //资源名称 this.dataGridView1.Rows[index].Cells[2].Value = query_out_his.REQUEST_DATE; this.dataGridView1.Rows[index].Cells[3].Value = query_out_his.PERSON_BUSINESS_TITLE; this.dataGridView1.Rows[index].Cells[4].Value = query_out_his.PERSON_BUSINESS_TITLE_DETAIL; this.dataGridView1.Rows[index].Cells[5].Value = query_out_his.PERSON_COMPANY; this.dataGridView1.Rows[index].Cells[6].Value = query_out_his.PERSON_DEPTNAME; this.dataGridView1.Rows[index].Cells[7].Value = query_out_his.PERSON_JOB_CODE; this.dataGridView1.Rows[index].Cells[8].Value = query_out_his.PERSON_JOB_FAMILY; this.dataGridView1.Rows[index].Cells[9].Value = query_out_his.PERSON_LOCATION; this.dataGridView1.Rows[index].Cells[10].Value = query_out_his.PERSON_MGR_ID; this.dataGridView1.Rows[index].Cells[11].Value = query_out_his.PERSON_ROLLUP_1; this.dataGridView1.Rows[index].Cells[12].Value = query_out_his.PERSON_ROLLUP_2; this.dataGridView1.Rows[index].Cells[13].Value = query_out_his.PERSON_ROLLUP_3; } } } if ((string)comboBox1.SelectedItem == "一周内") { this.dataGridView1.Rows.Clear(); Query_history_operation query_History_Operation = new Query_history_operation(); //查询操作类 //ArrayList query = query_History_Operation.return_query_history("9670"); // 需要重写的那个查询函数 for (int i = 0; i < Static.query_history_index.Count; i++) { Query_history query_out_his = (Query_history)Static.query_history_index[i]; TimeSpan time_dis = DateTime.Now - query_out_his.REQUEST_DATE; double time_ = time_dis.TotalDays; if (time_ <= 7.0) { int index = this.dataGridView1.Rows.Add(); this.dataGridView1.Rows[index].Cells[0].Value = query_out_his.ACTION; //授权结果 this.dataGridView1.Rows[index].Cells[1].Value = query_out_his.TARGET_NAME; //资源名称 this.dataGridView1.Rows[index].Cells[2].Value = query_out_his.REQUEST_DATE; this.dataGridView1.Rows[index].Cells[3].Value = query_out_his.PERSON_BUSINESS_TITLE; this.dataGridView1.Rows[index].Cells[4].Value = query_out_his.PERSON_BUSINESS_TITLE_DETAIL; this.dataGridView1.Rows[index].Cells[5].Value = query_out_his.PERSON_COMPANY; this.dataGridView1.Rows[index].Cells[6].Value = query_out_his.PERSON_DEPTNAME; this.dataGridView1.Rows[index].Cells[7].Value = query_out_his.PERSON_JOB_CODE; this.dataGridView1.Rows[index].Cells[8].Value = query_out_his.PERSON_JOB_FAMILY; this.dataGridView1.Rows[index].Cells[9].Value = query_out_his.PERSON_LOCATION; this.dataGridView1.Rows[index].Cells[10].Value = query_out_his.PERSON_MGR_ID; this.dataGridView1.Rows[index].Cells[11].Value = query_out_his.PERSON_ROLLUP_1; this.dataGridView1.Rows[index].Cells[12].Value = query_out_his.PERSON_ROLLUP_2; this.dataGridView1.Rows[index].Cells[13].Value = query_out_his.PERSON_ROLLUP_3; } } } if ((string)comboBox1.SelectedItem == "一天内") { this.dataGridView1.Rows.Clear(); Query_history_operation query_History_Operation = new Query_history_operation(); //查询操作类 //ArrayList query = query_History_Operation.return_query_history("9670"); // 需要重写的那个查询函数 for (int i = 0; i < Static.query_history_index.Count; i++) { Query_history query_out_his = (Query_history)Static.query_history_index[i]; TimeSpan time_dis = DateTime.Now - query_out_his.REQUEST_DATE; double time_ = time_dis.TotalDays; if (time_ <= 1.0) { int index = this.dataGridView1.Rows.Add(); this.dataGridView1.Rows[index].Cells[0].Value = query_out_his.ACTION; //授权结果 this.dataGridView1.Rows[index].Cells[1].Value = query_out_his.TARGET_NAME; //资源名称 this.dataGridView1.Rows[index].Cells[2].Value = query_out_his.REQUEST_DATE; this.dataGridView1.Rows[index].Cells[3].Value = query_out_his.PERSON_BUSINESS_TITLE; this.dataGridView1.Rows[index].Cells[4].Value = query_out_his.PERSON_BUSINESS_TITLE_DETAIL; this.dataGridView1.Rows[index].Cells[5].Value = query_out_his.PERSON_COMPANY; this.dataGridView1.Rows[index].Cells[6].Value = query_out_his.PERSON_DEPTNAME; this.dataGridView1.Rows[index].Cells[7].Value = query_out_his.PERSON_JOB_CODE; this.dataGridView1.Rows[index].Cells[8].Value = query_out_his.PERSON_JOB_FAMILY; this.dataGridView1.Rows[index].Cells[9].Value = query_out_his.PERSON_LOCATION; this.dataGridView1.Rows[index].Cells[10].Value = query_out_his.PERSON_MGR_ID; this.dataGridView1.Rows[index].Cells[11].Value = query_out_his.PERSON_ROLLUP_1; this.dataGridView1.Rows[index].Cells[12].Value = query_out_his.PERSON_ROLLUP_2; this.dataGridView1.Rows[index].Cells[13].Value = query_out_his.PERSON_ROLLUP_3; } } } if ((string)comboBox1.SelectedItem == "被挂起") { this.dataGridView1.Rows.Clear(); Query_history_operation query_History_Operation = new Query_history_operation(); //查询操作类 for (int i = 0; i < Static.hang_index.Count; i++) { Hang query_out_his = (Hang)Static.hang_index[i]; TimeSpan time_dis = DateTime.Now - query_out_his.REQUEST_DATE; double time_ = time_dis.TotalDays; int index = this.dataGridView1.Rows.Add(); //this.dataGridView1.Rows[index].Cells[0].Value = query_out_his.ACTION; //授权结果 //this.dataGridView1.Rows[index].Cells[0].Value = query_out_his.ACTION; //授权结果 this.dataGridView1.Rows[index].Cells[1].Value = query_out_his.TARGET_NAME; //资源名称 this.dataGridView1.Rows[index].Cells[2].Value = query_out_his.REQUEST_DATE; this.dataGridView1.Rows[index].Cells[3].Value = query_out_his.PERSON_BUSINESS_TITLE; this.dataGridView1.Rows[index].Cells[4].Value = query_out_his.PERSON_BUSINESS_TITLE_DETAIL; this.dataGridView1.Rows[index].Cells[5].Value = query_out_his.PERSON_COMPANY; this.dataGridView1.Rows[index].Cells[6].Value = query_out_his.PERSON_DEPTNAME; this.dataGridView1.Rows[index].Cells[7].Value = query_out_his.PERSON_JOB_CODE; this.dataGridView1.Rows[index].Cells[8].Value = query_out_his.PERSON_JOB_FAMILY; this.dataGridView1.Rows[index].Cells[9].Value = query_out_his.PERSON_LOCATION; this.dataGridView1.Rows[index].Cells[10].Value = query_out_his.PERSON_MGR_ID; this.dataGridView1.Rows[index].Cells[11].Value = query_out_his.PERSON_ROLLUP_1; this.dataGridView1.Rows[index].Cells[12].Value = query_out_his.PERSON_ROLLUP_2; this.dataGridView1.Rows[index].Cells[13].Value = query_out_his.PERSON_ROLLUP_3; } } }
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(); }