public admin_func_record() { InitializeComponent(); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; Query_history_operation query_History_Operation = new Query_history_operation(); //查询操作类 for (int i = 0; i < Static.query_history_index.Count; i++) { Query_history query_out_his = (Query_history)Static.query_history_index[i]; 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; } }
public ArrayList return_query_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.query_history_index.Count; i++) { Query_history temp_query = (Query_history)Static.query_history_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); }
/// <summary> /// 读取访问记录 /// </summary> public void Get_query() { string filepath = "..\\..\\query.csv"; StreamReader mysr = new StreamReader(filepath, System.Text.Encoding.Default); string str; //文件行 Query_history query_History = new Query_history(); string[] now_string; //每一列 string ACTION; 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; mysr.ReadLine(); // 读取title while ((str = mysr.ReadLine()) != null) { //System.Console.WriteLine(str); now_string = str.Split(','); ACTION = now_string[0]; TARGET_NAME = Convert.ToInt32(now_string[1]); PERSON_BUSINESS_TITLE = Convert.ToInt32(now_string[2]); PERSON_BUSINESS_TITLE_DETAIL = Convert.ToInt32(now_string[3]); PERSON_COMPANY = Convert.ToInt32(now_string[4]); PERSON_DEPTNAME = Convert.ToInt32(now_string[5]); PERSON_JOB_CODE = Convert.ToInt32(now_string[6]); PERSON_JOB_FAMILY = Convert.ToInt32(now_string[7]); PERSON_LOCATION = Convert.ToInt32(now_string[8]); PERSON_MGR_ID = Convert.ToInt32(now_string[9]); PERSON_ROLLUP_1 = Convert.ToInt32(now_string[10]); PERSON_ROLLUP_2 = Convert.ToInt32(now_string[11]); PERSON_ROLLUP_3 = Convert.ToInt32(now_string[12]); REQUEST_DATE = Convert.ToDateTime(now_string[13]); query_History = new Query_history(ACTION, 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.query_history_index.Add(query_History);//写入ArrayList } mysr.Close(); }
//private ArrayList query_history_index = new ArrayList(); /// <summary> /// 添加访问记录 /// </summary> /// <param name="ACTION"></param> /// <param name="TARGET_NAME"></param> /// <param name="PERSON_BUSINESS_TITLE"></param> /// <param name="PERSON_BUSINESS_TITLE_DETAIL"></param> /// <param name="PERSON_COMPANY"></param> /// <param name="PERSON_DEPTNAME"></param> /// <param name="PERSON_JOB_CODE"></param> /// <param name="PERSON_JOB_FAMILY"></param> /// <param name="PERSON_LOCATION"></param> /// <param name="PERSON_MGR_ID"></param> /// <param name="PERSON_ROLLUP_1"></param> /// <param name="PERSON_ROLLUP_2"></param> /// <param name="PERSON_ROLLUP_3"></param> public void Add_query_history(string ACTION, 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) //添加 { //Query_history now_query = new Query_history(n, r, qt, rt, ih); Query_history now_query = new Query_history(); now_query.ADD_new_query_history(ACTION, 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); Static.query_history_index.Add(now_query); IOStream myst = new IOStream(); myst.write_query(now_query); }
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(); }
/// <summary> /// 找到在规则内 返回action 否则返回字符串 hang /// </summary> /// <param name="TARGET_NAME"></param> //resource /// <param name="PERSON_BUSINESS_TITLE"></param> /// <param name="PERSON_BUSINESS_TITLE_DETAIL"></param> /// <param name="PERSON_COMPANY"></param> /// <param name="PERSON_DEPTNAME"></param> /// <param name="PERSON_JOB_CODE"></param> /// <param name="PERSON_JOB_FAMILY"></param> /// <param name="PERSON_LOCATION"></param> /// <param name="PERSON_MGR_ID"></param> /// <param name="PERSON_ROLLUP_1"></param> /// <param name="PERSON_ROLLUP_2"></param> /// <param name="PERSON_ROLLUP_3"></param> /// <returns></returns> public string Find(int TARGET_NAME = -1, int PERSON_BUSINESS_TITLE = -1, int PERSON_BUSINESS_TITLE_DETAIL = -1, int PERSON_COMPANY = -1, int PERSON_DEPTNAME = -1, int PERSON_JOB_CODE = -1, int PERSON_JOB_FAMILY = -1, int PERSON_LOCATION = -1, int PERSON_MGR_ID = -1, int PERSON_ROLLUP_1 = -1, int PERSON_ROLLUP_2 = -1, int PERSON_ROLLUP_3 = -1) { for (int i = 0; i < Static.rule_index.Count; i++) { Rule rule = (Rule)Static.rule_index[i]; if ((rule.TARGET_NAME == TARGET_NAME || rule.TARGET_NAME == -1) && (rule.PERSON_BUSINESS_TITLE == PERSON_BUSINESS_TITLE || rule.PERSON_BUSINESS_TITLE == -1) && (rule.PERSON_BUSINESS_TITLE_DETAIL == PERSON_BUSINESS_TITLE_DETAIL || rule.PERSON_BUSINESS_TITLE_DETAIL == -1) && (rule.PERSON_COMPANY == PERSON_COMPANY || rule.PERSON_COMPANY == -1) && (rule.PERSON_DEPTNAME == PERSON_DEPTNAME || rule.PERSON_DEPTNAME == -1) && (rule.PERSON_JOB_CODE == PERSON_JOB_CODE || rule.PERSON_JOB_CODE == -1) && (rule.PERSON_JOB_FAMILY == PERSON_JOB_FAMILY || rule.PERSON_JOB_FAMILY == -1) && (rule.PERSON_LOCATION == PERSON_LOCATION || rule.PERSON_LOCATION == -1) && (rule.PERSON_MGR_ID == PERSON_MGR_ID || rule.PERSON_MGR_ID == -1) && (rule.PERSON_ROLLUP_1 == PERSON_ROLLUP_1 || rule.PERSON_ROLLUP_1 == -1) && (rule.PERSON_ROLLUP_2 == PERSON_ROLLUP_2 || rule.PERSON_ROLLUP_2 == -1) && (rule.PERSON_ROLLUP_3 == PERSON_ROLLUP_3 || rule.PERSON_ROLLUP_3 == -1) ) { return(rule.ACTION == 0 ? "remove_access" : "add_access"); } } int count = 0; for (int i = 0; i < Static.query_history_index.Count; i++) { Query_history query_History = (Query_history)Static.query_history_index[i]; if (query_History.TARGET_NAME == TARGET_NAME) { count++; } } if (count == 0) { return("no_resource"); } return("hang");//没有搜到 挂起 }
/// <summary> /// 追加访问记录 /// </summary> public void write_query(Query_history query_History) { string filepath = "..\\..\\query.csv"; // 文件路径 FileStream fs = new FileStream(filepath, FileMode.Append); StreamWriter sw = new StreamWriter(fs, Encoding.UTF8); sw.Write(query_History.ACTION + ","); sw.Write(query_History.TARGET_NAME.ToString() + ","); sw.Write(query_History.PERSON_BUSINESS_TITLE.ToString() + ","); sw.Write(query_History.PERSON_BUSINESS_TITLE_DETAIL.ToString() + ","); sw.Write(query_History.PERSON_COMPANY.ToString() + ","); sw.Write(query_History.PERSON_DEPTNAME.ToString() + ","); sw.Write(query_History.PERSON_JOB_CODE.ToString() + ","); sw.Write(query_History.PERSON_JOB_FAMILY.ToString() + ","); sw.Write(query_History.PERSON_LOCATION.ToString() + ","); sw.Write(query_History.PERSON_MGR_ID.ToString() + ","); sw.Write(query_History.PERSON_ROLLUP_1.ToString() + ","); sw.Write(query_History.PERSON_ROLLUP_2.ToString() + ","); sw.Write(query_History.PERSON_ROLLUP_3.ToString() + ","); sw.WriteLine(query_History.REQUEST_DATE.ToString()); sw.Close(); }
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(); }