private void button_OnOK_Click(object sender, EventArgs e) { this.userControl_StudentBase1.FillClass(); String str_ErrMessage; str_ErrMessage = this.myClass_Student.CheckField(); if (str_ErrMessage != null) { this.DialogResult = DialogResult.None; this.label_ErrMessage.Text = str_ErrMessage; return; } if (this.bool_Add) { if (Class_Student.ExistSecond(this.myClass_Student.IssueNo, this.myClass_Student.IdentificationCard, null, Enum_zwjKindofUpdate.Add)) { this.DialogResult = DialogResult.None; this.label_ErrMessage.Text = "身份证号码不能重复!"; return; } else { if (!this.myClass_Student.AddAndModify(Enum_zwjKindofUpdate.Add)) { this.label_ErrMessage.Text = "添加不成功,可能是考编号重复!"; this.DialogResult = DialogResult.None; return; } else { if (this.checkBox_Continuous.Checked) { EventArgs_Issue my_e = new EventArgs_Issue(this.myClass_Student.IssueNo, false); Publisher_Issue.OnEventName(my_e); this.label_ErrMessage.Text = ""; this.DialogResult = DialogResult.None; return; } else { this.DialogResult = DialogResult.OK; return; } } } } else { if (Class_Student.ExistSecond(this.myClass_Student.IssueNo, this.myClass_Student.IdentificationCard, this.myClass_Student.ExaminingNo, Enum_zwjKindofUpdate.Modify)) { this.DialogResult = DialogResult.None; this.label_ErrMessage.Text = "身份证号码不能重复!"; return; } else { this.myClass_Student.AddAndModify(Enum_zwjKindofUpdate.Modify); } } }
/// <summary> /// 刷新数据 /// </summary> /// <param name="bool_JustFill">true-只添加和修改数据,false-刷新全部数据</param> private void RefreshData(bool bool_JustFill) { this.myEventArgs_Issue.bool_JustFill = bool_JustFill; Publisher_Issue.OnEventName(this.myEventArgs_Issue); }
/// <summary> /// 初始化数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InitDataGridView(object sender, EventArgs_ShipClassification e) { this.myEventArgs_ShipClassification = e; string str_Filter; if (!string.IsNullOrEmpty(this.myEventArgs_ShipClassification.str_ShipClassificationAb)) { str_Filter = string.Format("ShipClassificationAb='{0}'", this.myEventArgs_ShipClassification.str_ShipClassificationAb); if (!string.IsNullOrEmpty(this.myEventArgs_ShipClassification.str_ShipboardNo)) { str_Filter += string.Format(" And ShipboardNo='{0}'", this.myEventArgs_ShipClassification.str_ShipboardNo); //if (this.myEventArgs_ShipClassification.bool_GXTheory) //{ // Class_DataControlBind.InitializeDataGridView(this.dataGridView_Data, Enum_DataTable.GXTheoryIssue.ToString()); // myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.GXTheoryIssue.ToString()]; //} } else if (!string.IsNullOrEmpty(this.myEventArgs_ShipClassification.str_Year)) { str_Filter += string.Format(" And (SignUpDate >= '{0}-1-1' and SignUpDate<='{0}-12-31 23:59:59.997')", this.myEventArgs_ShipClassification.str_Year); } } else { str_Filter = this.myEventArgs_ShipClassification.str_Filter; } Class_Data myClass_Data; if (this.myEventArgs_ShipClassification.bool_GXTheory) { Class_DataControlBind.InitializeDataGridView(this.dataGridView_Data, Enum_DataTable.GXTheoryIssue.ToString(), false); myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.GXTheoryIssue.ToString()]; } else { Class_DataControlBind.InitializeDataGridView(this.dataGridView_Data, Enum_DataTable.Issue.ToString(), false); myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.Issue.ToString()]; } if (Class_CustomUser.GetSecurity(Class_zwjPublic.myClass_CustomUser.UserGUID, Class_CustomSecurity.GetSecurityGUID("焊工权限"), Enum_zwjKindofUpdate.Read)) { } else if (Class_CustomUser.GetSecurity(Class_zwjPublic.myClass_CustomUser.UserGUID, Class_CustomSecurity.GetSecurityGUID("报考权限"), Enum_zwjKindofUpdate.Read)) { Class_Data myClass_Data_KindofEmployer = (Class_Data)Class_Public.myHashtable[Enum_DataTable.KindofEmployer.ToString()]; string str_Filter_KindofEmployer = "(1=0"; foreach (DataRowView myDataRowView_KindofEmployer in myClass_Data_KindofEmployer.myDataView) { Class_KindofEmployer myClass_KindofEmployer = new Class_KindofEmployer(myDataRowView_KindofEmployer["KindofEmployer"].ToString()); if (myClass_KindofEmployer.KindofEmployerManagerID.Equals(Class_zwjPublic.myClass_CustomUser.UserGUID)) { str_Filter_KindofEmployer += string.Format(" or KindofEmployer='{0}'", myClass_KindofEmployer.KindofEmployer); } } str_Filter_KindofEmployer += ")"; str_Filter = str_Filter_KindofEmployer + " and (" + str_Filter + ")"; } myClass_Data.SetFilter(str_Filter); if (this.myEventArgs_ShipClassification.bool_JustFill) { if (this.myDataTable.Rows.Count == 0) { this.dataGridView_Data.DataSource = null; myClass_Data.RefreshData(this.myEventArgs_ShipClassification.bool_JustFill); this.myDataTable = myClass_Data.myDataTable.Copy(); this.myDataView = new DataView(this.myDataTable); this.dataGridView_Data.DataSource = this.myDataView; if (this.dataGridView_Data.Rows.Count > 0) { this.dataGridView_Data.CurrentCell = this.dataGridView_Data.Rows[this.dataGridView_Data.Rows.Count - 1].Cells["IssueNo"]; } } else { myClass_Data.RefreshData(this.myEventArgs_ShipClassification.bool_JustFill, this.myDataTable); } } else { this.dataGridView_Data.DataSource = null; myClass_Data.RefreshData(this.myEventArgs_ShipClassification.bool_JustFill); this.myDataTable = myClass_Data.myDataTable.Copy(); this.myDataView = new DataView(this.myDataTable); this.dataGridView_Data.DataSource = this.myDataView; if (this.dataGridView_Data.Rows.Count > 0) { this.dataGridView_Data.CurrentCell = this.dataGridView_Data.Rows[this.dataGridView_Data.Rows.Count - 1].Cells["IssueNo"]; } } 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_Issue my_e = new EventArgs_Issue(null, this.myEventArgs_ShipClassification.bool_GXTheory); Publisher_Issue.OnEventName(my_e); } }
private void dataGridView_Data_RowEnter(object sender, DataGridViewCellEventArgs e) { EventArgs_Issue my_e = new EventArgs_Issue(this.dataGridView_Data.Rows[e.RowIndex].Cells["IssueNo"].Value.ToString(), this.myEventArgs_ShipClassification.bool_GXTheory); Publisher_Issue.OnEventName(my_e); }