/// <summary> /// 更新数据到对象中 /// </summary> public void FillClass() { myClass_BlackList.BlackListBeginDate = this.DateTimePicker_BlackListBeginDate.Value; myClass_BlackList.BlackListEndDate = this.DateTimePicker_BlackListEndDate.Value; myClass_BlackList.BlackListCausation = this.textBox_BlackListCausation.Text; myClass_BlackList.IdentificationCard = this.MaskedTextBox_IdentificationCard.Text; myClass_BlackList.BlackListRemark = this.textBox_BlackListRemark.Text; if (myClass_BlackListDefault == null) { myClass_BlackListDefault = new Class_BlackList(); } }
/// <summary> /// 删除数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripMenuItem_DataGridViewRowDelete_Click(object sender, EventArgs e) { if (Class_BlackList.ExistAndCanDeleteAndDelete((int)this.dataGridView_Data.CurrentRow.Cells["BlackListID"].Value, Enum_zwjKindofUpdate.CanDelete)) { if (MessageBox.Show("确认删除吗?", "确认窗口", MessageBoxButtons.OKCancel) == DialogResult.OK) { Class_BlackList.ExistAndCanDeleteAndDelete((int)this.dataGridView_Data.CurrentRow.Cells["BlackListID"].Value, Enum_zwjKindofUpdate.Delete); this.RefreshData(false); } } else { MessageBox.Show("不能删除!"); } }
private void Form_BlackList_Update_Load(object sender, EventArgs e) { if (!(this.bool_Add || Class_BlackList.ExistAndCanDeleteAndDelete(myClass_BlackList.BlackListID, 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_BlackListBase1.InitControl(this.myClass_BlackList, this.bool_Add); }
/// <summary> /// 初始化数据 /// </summary> /// <param name="myClass_BlackList"></param> /// <param name="bool_Add"></param> public void InitControl(Class_BlackList myClass_BlackList, bool bool_Add) { this.myClass_BlackList = myClass_BlackList; if (!string.IsNullOrEmpty(this.myClass_BlackList.IdentificationCard)) { this.InitControlWelder(new Class_Welder(this.myClass_BlackList.IdentificationCard)); this.Button_WelderModify.Visible = false; this.Button_WelderUpdate.Visible = false; } if (bool_Add) { if (myClass_BlackListDefault != null) { } } else { this.textBox_BlackListID.Text = this.myClass_BlackList.BlackListID.ToString(); this.DateTimePicker_BlackListBeginDate.Value = this.myClass_BlackList.BlackListBeginDate; this.DateTimePicker_BlackListEndDate.Value = this.myClass_BlackList.BlackListEndDate; this.textBox_BlackListCausation.Text = myClass_BlackList.BlackListCausation; this.textBox_BlackListRemark.Text = myClass_BlackList.BlackListRemark; } }