private void button_OnOK_Click(object sender, EventArgs e) { this.userControl_EmployerGroupBase1.FillClass(); String str_ErrMessage; str_ErrMessage = this.myClass_EmployerGroup.CheckField(); if (!string.IsNullOrEmpty(str_ErrMessage)) { this.DialogResult = DialogResult.None; this.label_ErrMessage.Text = str_ErrMessage; return; } if (this.bool_Add) { if (!Class_EmployerGroup.ExistAndCanDeleteAndDelete(this.myClass_EmployerGroup.EmployerGroup, Enum_zwjKindofUpdate.Exist)) { this.myClass_EmployerGroup.AddAndModify(Enum_zwjKindofUpdate.Add); } else { this.label_ErrMessage.Text = "该公司组已添加!"; this.DialogResult = DialogResult.None; return; } } else { this.myClass_EmployerGroup.AddAndModify(Enum_zwjKindofUpdate.Modify); } }
/// <summary> /// 更新数据到对象中 /// </summary> public void FillClass() { myClass_EmployerGroup.EmployerGroup = this.textBox_EmployerGroup.Text; myClass_EmployerGroup.OAVisible = this.checkBox_OAVisible.Checked; myClass_EmployerGroup.EmployerGroupIndex = (int)this.numericUpDown_EmployerGroupIndex.Value; myClass_EmployerGroup.EmployerGroupRemark = this.textBox_EmployerGroupRemark.Text; if (myClass_EmployerGroupDefault == null) { myClass_EmployerGroupDefault = new Class_EmployerGroup(); } myClass_EmployerGroupDefault.EmployerGroup = this.textBox_EmployerGroup.Text; }
private void Form_EmployerGroup_Update_Load(object sender, EventArgs e) { if (!(this.bool_Add || Class_EmployerGroup.ExistAndCanDeleteAndDelete(myClass_EmployerGroup.EmployerGroup, 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_EmployerGroupBase1.InitControl(this.myClass_EmployerGroup, this.bool_Add); }
/// <summary> /// 初始化数据 /// </summary> /// <param name="myClass_EmployerGroup"></param> /// <param name="bool_Add"></param> public void InitControl(Class_EmployerGroup myClass_EmployerGroup, bool bool_Add) { this.myClass_EmployerGroup = myClass_EmployerGroup; if (bool_Add) { if (myClass_EmployerGroupDefault != null) { this.textBox_EmployerGroup.Text = myClass_EmployerGroupDefault.EmployerGroup; } } else { this.textBox_EmployerGroup.ReadOnly = true; this.textBox_EmployerGroup.Text = myClass_EmployerGroup.EmployerGroup; this.checkBox_OAVisible.Checked = myClass_EmployerGroup.OAVisible; if (myClass_EmployerGroup.EmployerGroupIndex >= this.numericUpDown_EmployerGroupIndex.Minimum && myClass_EmployerGroup.EmployerGroupIndex <= this.numericUpDown_EmployerGroupIndex.Maximum) { this.numericUpDown_EmployerGroupIndex.Value = myClass_EmployerGroup.EmployerGroupIndex; } this.textBox_EmployerGroupRemark.Text = myClass_EmployerGroup.EmployerGroupRemark; } }