private void button_OnOK_Click(object sender, EventArgs e) { this.userControl_ShipandShipClassificationBase1.FillClass(); String str_ErrMessage; str_ErrMessage = this.myClass_ShipandShipClassification.CheckField(); if (!string.IsNullOrEmpty(str_ErrMessage)) { this.DialogResult = DialogResult.None; this.label_ErrMessage.Text = str_ErrMessage; return; } if (this.bool_Add) { if (!Class_ShipandShipClassification.ExistAndCanDeleteAndDelete(this.myClass_ShipandShipClassification.ShipClassificationAb, this.myClass_ShipandShipClassification.ShipboardNo, Enum_zwjKindofUpdate.Exist)) { this.myClass_ShipandShipClassification.AddAndModify(Enum_zwjKindofUpdate.Add); } else { this.label_ErrMessage.Text = "该船级社和船舶系列已添加!"; this.DialogResult = DialogResult.None; return; } } else { this.myClass_ShipandShipClassification.AddAndModify(Enum_zwjKindofUpdate.Modify); } }
/// <summary> /// 初始化数据 /// </summary> /// <param name="myClass_ShipandShipClassification"></param> /// <param name="bool_Add"></param> public void InitControl(Class_ShipandShipClassification myClass_ShipandShipClassification, bool bool_Add) { this.myClass_ShipandShipClassification = myClass_ShipandShipClassification; if (bool_Add) { if (myClass_ShipandShipClassificationDefault != null) { } } else { this.button_ShipboardNo.Enabled = false; this.button_ShipClassificationAb.Enabled = false; this.textBox_ShipClassificationAb.Text = this.myClass_ShipandShipClassification.ShipClassificationAb; Class_ShipClassification myClass_ShipClassification = new Class_ShipClassification(this.myClass_ShipandShipClassification.ShipClassificationAb); this.textBox_ShipClassification.Text = myClass_ShipClassification.ShipClassification; this.textBox_ShipboardNo.Text = this.myClass_ShipandShipClassification.ShipboardNo; if (myClass_ShipandShipClassification.ShipandShipClassificationIndex >= this.numericUpDown_ShipandShipClassificationIndex.Minimum && myClass_ShipandShipClassification.ShipandShipClassificationIndex <= this.numericUpDown_ShipandShipClassificationIndex.Maximum) { this.numericUpDown_ShipandShipClassificationIndex.Value = myClass_ShipandShipClassification.ShipandShipClassificationIndex; } this.textBox_ShipandShipClassificationRemark.Text = myClass_ShipandShipClassification.ShipandShipClassificationRemark; } }
/// <summary> /// 更新数据到对象中 /// </summary> public void FillClass() { myClass_ShipandShipClassification.ShipClassificationAb = this.textBox_ShipClassificationAb.Text; myClass_ShipandShipClassification.ShipboardNo = this.textBox_ShipboardNo.Text; myClass_ShipandShipClassification.ShipandShipClassificationIndex = (int)this.numericUpDown_ShipandShipClassificationIndex.Value; myClass_ShipandShipClassification.ShipandShipClassificationRemark = this.textBox_ShipandShipClassificationRemark.Text; if (myClass_ShipandShipClassificationDefault == null) { myClass_ShipandShipClassificationDefault = new Class_ShipandShipClassification(); } }
private void Form_ShipandShipClassification_Update_Load(object sender, EventArgs e) { if (!(this.bool_Add || Class_ShipandShipClassification.ExistAndCanDeleteAndDelete(myClass_ShipandShipClassification.ShipClassificationAb, myClass_ShipandShipClassification.ShipboardNo, Enum_zwjKindofUpdate.Exist))) { MessageBox.Show("不存在该项,可能已删除!"); this.DialogResult = DialogResult.Cancel; this.Close(); return; } this.label_ErrMessage.Text = ""; if (!Class_zwjPublic.myBackColor.IsEmpty) { this.BackColor = Class_zwjPublic.myBackColor; } this.userControl_ShipandShipClassificationBase1.InitControl(this.myClass_ShipandShipClassification, this.bool_Add); }
private void toolStripMenuItem_RowTransferGXTheoryIssue_Click(object sender, EventArgs e) { bool bool_Transfer = false; Class_ShipClassification myClass_ShipClassification = new Class_ShipClassification(this.dataGridView_Data.CurrentRow.Cells["ShipClassificationAb"].Value.ToString()); if (myClass_ShipClassification.ShipRestrict && myClass_ShipClassification.TheorySeparate) { if (!Class_ShipandShipClassification.ExistAndCanDeleteAndDelete(myClass_ShipClassification.ShipClassificationAb, this.dataGridView_Data.CurrentRow.Cells["ShipboardNo"].Value.ToString(), Enum_zwjKindofUpdate.Exist)) { MessageBox.Show("本班级不符合理论班级编入条件,请重新设置船级社和船舶系列字段信息!"); return; } } else { MessageBox.Show("本班级不符合理论班级编入条件,请重新设置船级社和船舶系列字段信息!"); return; } int int_CheckSignUp = Class_KindofEmployerIssue.CheckSignUp((int)this.dataGridView_Data.CurrentRow.Cells["KindofEmployerIssueID"].Value, true); if (Properties.Settings.Default.WebServiceStartUp) { DataView myDataView_Temp = new DataView(Class_KindofEmployerIssue.GetDataTable_KindofEmployerWelderStudent((int)this.dataGridView_Data.CurrentRow.Cells["KindofEmployerIssueID"].Value, "StudentRemark is Null or StudentRemark=''", null)); foreach (DataRowView myDataRowView in myDataView_Temp) { if (!Class_Welder.ExistWelderPicture(myDataRowView["IdentificationCard"].ToString())) { int_CheckSignUp++; Class_KindofEmployerStudent myClass_KindofEmployerStudent = new Class_KindofEmployerStudent((int)myDataRowView["KindofEmployerStudentID"]); myClass_KindofEmployerStudent.StudentRemark = "该焊工没有电子照片"; myClass_KindofEmployerStudent.AddAndModify(Enum_zwjKindofUpdate.Modify); } } } if (int_CheckSignUp > 0) { if (MessageBox.Show(string.Format("该班级有 {0} 名学员不符合报考资格,详细信息请查阅学员的备注字段。确认把只具有报考资格的学员编入班级吗?", int_CheckSignUp), "确认窗口", MessageBoxButtons.OKCancel) == DialogResult.OK) { bool_Transfer = true; } } else { if (MessageBox.Show("确认编入班级吗?", "确认窗口", MessageBoxButtons.OKCancel) == DialogResult.OK) { bool_Transfer = true; } } if (bool_Transfer) { string str_IssueNo = Class_KindofEmployerIssue.TransferGXTheoryIssue((int)this.dataGridView_Data.CurrentRow.Cells["KindofEmployerIssueID"].Value); if (string.IsNullOrEmpty(str_IssueNo)) { MessageBox.Show("编入新理论班级失败,可能是下一个理论班级编号或理论考试编号设置错误!"); } else { MessageBox.Show(string.Format("新理论班级编号为 {0} ,请进入考试管理界面查询详细信息!", str_IssueNo)); } } EventArgs_KindofEmployerIssue myEventArgs_KindofEmployerIssue = new EventArgs_KindofEmployerIssue(); myEventArgs_KindofEmployerIssue.int_KindofEmployerIssueID = (int)this.dataGridView_Data.CurrentRow.Cells["KindofEmployerIssueID"].Value; Publisher_KindofEmployerIssue.OnEventName(myEventArgs_KindofEmployerIssue); }