/// <summary> /// 初始化数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InitDataGridView(object sender, EventArgs_WeldingStandard e) { this.myEventArgs_WeldingStandard = e; Class_DataControlBind.InitializeDataGridView(this.dataGridView_Data, Enum_DataTable.WeldingSubject.ToString(), false); Class_Data myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.WeldingSubject.ToString()]; if (this.myEventArgs_WeldingStandard.bool_JustFill) { myClass_Data.RefreshData(this.myEventArgs_WeldingStandard.bool_JustFill); } else { this.dataGridView_Data.DataSource = null; myClass_Data.RefreshData(this.myEventArgs_WeldingStandard.bool_JustFill); this.dataGridView_Data.DataSource = myClass_Data.myDataView; } if (string.IsNullOrEmpty(this.myEventArgs_WeldingStandard.str_WeldingStandard)) { myClass_Data.myDataView.RowFilter = e.str_Filter; } else { myClass_Data.myDataView.RowFilter = string.Format("WeldingStandard='{0}'", e.str_WeldingStandard); } if (this.dataGridView_Data.RowCount == 0) { EventArgs_WeldingSubject my_e = new EventArgs_WeldingSubject(null); Publisher_WeldingSubject.OnEventName(my_e); } this.label_Data.Text = string.Format("考试科目,({0}):", this.dataGridView_Data.RowCount); }
/// <summary> /// 刷新数据 /// </summary> /// <param name="bool_JustFill">true-只添加和修改数据,false-刷新全部数据</param> private void RefreshData(bool bool_JustFill) { if (this.myEventArgs_WeldingSubject == null) { return; } this.myEventArgs_WeldingSubject.bool_JustFill = bool_JustFill; Publisher_WeldingSubject.OnEventName(this.myEventArgs_WeldingSubject); }
private void dataGridView_Data_RowEnter(object sender, DataGridViewCellEventArgs e) { EventArgs_WeldingSubject my_e = new EventArgs_WeldingSubject(this.dataGridView_Data.Rows[e.RowIndex].Cells["SubjectID"].Value.ToString()); Publisher_WeldingSubject.OnEventName(my_e); }