private void dataGridView_Data_RowEnter(object sender, DataGridViewCellEventArgs e) { EventArgs_WelderBelong my_e = new EventArgs_WelderBelong(this.dataGridView_Data.Rows[e.RowIndex].Cells["IdentificationCard"].Value.ToString()); Publisher_WelderBelong.OnEventName(my_e); }
/// <summary> /// 初始化数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InitDataGridView(object sender, EventArgs_Unit e) { this.str_Filter = null; this.myEventArgs_Unit = e; Class_DataControlBind.InitializeDataGridView(this.dataGridView_Data, Enum_DataTable.WelderBelong.ToString(), false); Class_Data myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.WelderBelong.ToString()]; if (string.IsNullOrEmpty(this.myEventArgs_Unit.WorkPlaceHPID)) { if (string.IsNullOrEmpty(this.myEventArgs_Unit.DepartmentHPID)) { if (string.IsNullOrEmpty(this.myEventArgs_Unit.EmployerHPID)) { if (string.IsNullOrEmpty(this.myEventArgs_Unit.EmployerGroup)) { str_Filter = string.Format("1=1"); } else { str_Filter = string.Format("WelderBelongEmployerGroup='{0}'", this.myEventArgs_Unit.EmployerGroup); } } else { str_Filter = string.Format("WelderBelongEmployerHPID='{0}'", this.myEventArgs_Unit.EmployerHPID); } } else { str_Filter = string.Format("WelderBelongDepartmentHPID='{0}'", this.myEventArgs_Unit.DepartmentHPID); } } else { str_Filter = string.Format("WelderBelongWorkPlaceHPID='{0}'", this.myEventArgs_Unit.WorkPlaceHPID); } if (bool_Refresh) { myClass_Data.SetFilter(str_Filter); if (this.myEventArgs_Unit.bool_JustFill) { if (this.myDataTable.Rows.Count == 0) { this.dataGridView_Data.DataSource = null; myClass_Data.RefreshData(this.myEventArgs_Unit.bool_JustFill); this.myDataTable = myClass_Data.myDataTable.Copy(); this.myDataView = new DataView(this.myDataTable); this.dataGridView_Data.DataSource = this.myDataView; } else { myClass_Data.RefreshData(this.myEventArgs_Unit.bool_JustFill, this.myDataTable); } } else { this.dataGridView_Data.DataSource = null; myClass_Data.RefreshData(this.myEventArgs_Unit.bool_JustFill); this.myDataTable = myClass_Data.myDataTable.Copy(); this.myDataView = new DataView(this.myDataTable); this.dataGridView_Data.DataSource = this.myDataView; } } else { if (this.myDataTable == null) { myClass_Data.SetFilter("1=1"); this.dataGridView_Data.DataSource = null; myClass_Data.RefreshData(this.myEventArgs_Unit.bool_JustFill); this.myDataTable = myClass_Data.myDataTable.Copy(); this.myDataView = new DataView(this.myDataTable); this.dataGridView_Data.DataSource = this.myDataView; } else { } ((DataView)this.dataGridView_Data.DataSource).RowFilter = str_Filter; } if (string.IsNullOrEmpty(((DataView)this.dataGridView_Data.DataSource).Sort)) { ((DataView)this.dataGridView_Data.DataSource).Sort = myClass_Data.myDataView.Sort; } this.label_Data.Text = string.Format("焊工信息,({0}):", this.dataGridView_Data.RowCount); if (this.dataGridView_Data.RowCount == 0) { EventArgs_WelderBelong my_e = new EventArgs_WelderBelong(""); Publisher_WelderBelong.OnEventName(my_e); } }
/// <summary> /// 刷新数据 /// </summary> /// <param name="bool_JustFill">true-只添加和修改数据,false-刷新全部数据</param> private void RefreshData(bool bool_JustFill) { this.myEventArgs_WelderBelong.bool_JustFill = bool_JustFill; Publisher_WelderBelong.OnEventName(myEventArgs_WelderBelong); }