private void dgvData_CellContentClick(object sender, DataGridViewCellEventArgs e) { if ((this.bds.Position >= 0) && (e.RowIndex >= 0)) { DataRowView view = (DataRowView)this.bds.List[this.bds.Position]; if (((this.dgvData.Columns[e.ColumnIndex].HeaderText == "修改") && (this.bds.Position >= 0)) && (e.RowIndex >= 0)) { using (PBControler controler = new PBControler(new PersonForm(view.Row["IDCardNo"].ToString()), new PersonInfoFactory())) { controler.IParentFrm.IShowDialog(); ChackDate(); } GC.Collect(); } else if (((this.dgvData.Columns[e.ColumnIndex].HeaderText == "删除") && (this.bds.Position >= 0)) && (e.RowIndex >= 0)) { if (view != null) { DataRow row = view.Row; if (row["HouseRelation"].ToString() == "1") { string str = "?当前人员为户主且有相应的家庭档案信息,是否删除现家庭档案和所有家庭成员的关联关系?"; if (MessageBox.Show("确定删除:" + row["CustomerName"].ToString() + str + "删除之后的信息将无法恢复!", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { RecordsBaseInfoBLL archive_baseinfo = new RecordsBaseInfoBLL(); foreach (RecordsBaseInfoModel archive_baseinfo2 in archive_baseinfo.GetModelList(string.Format(" and FamilyIDCardNo = '{0}' ", this.Model.RecordID))) { archive_baseinfo2.RecordID = null; archive_baseinfo2.HouseRelation = null; archive_baseinfo2.HouseRealOther = null; archive_baseinfo.Update(archive_baseinfo2); } RecordsFamilyInfoBLL archive_family_info = new RecordsFamilyInfoBLL(); RecordsFamilyInfoModel model = archive_family_info.GetModel(this.Model.IDCardNo); if (model != null) { archive_family_info.Delete(model.ID); } new RecordsBaseInfoBLL().DelTheMan(row["IDCardNo"].ToString()); // row.Delete(); // row.Table.AcceptChanges(); ChackDate(); } } else if (MessageBox.Show("确定删除:" + row["CustomerName"].ToString() + "?删除之后的信息将无法恢复!", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { new RecordsBaseInfoBLL().DelTheMan(row["IDCardNo"].ToString()); row.Delete(); row.Table.AcceptChanges(); ChackDate(); } } } } }
private void listView1_ItemActivate(object sender, EventArgs e) { Predicate <RecordsFamilyInfoModel> match = null; this.FamilyArcID = this.listView1.FocusedItem.SubItems[0].Text; if (this.FamilyArcID != "无") { if (match == null) { match = c => c.RecordID.ToString() == this.FamilyArcID; } RecordsFamilyInfoModel recordsFamilyInfoModel = this.familys.Find(match); if (recordsFamilyInfoModel != null) { this.Model.FamilyIDCardNo = recordsFamilyInfoModel.IDCardNo; this.Model.HouseID = recordsFamilyInfoModel.IDCardNo; this.Model.HouseName = recordsFamilyInfoModel.CustomerName; } base.DialogResult = DialogResult.OK; } else if (this.Model.HouseRelation == "1") { if (MessageBox.Show("当前人员为户主且有相应的家庭档案信息,此操作将会将人员的家庭关系删除,是否继续?\r\n(注意:这样将会删除现家庭档案的所有信息和家庭中所有对应的人员关系!)", "家庭档案", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.OK) { RecordsBaseInfoBLL recordsBaseInfoBLL = new RecordsBaseInfoBLL(); foreach (RecordsBaseInfoModel recordsBaseInfoModel in recordsBaseInfoBLL.GetModelList(string.Format(" and FY_ARCHIVEID = '{0}' ", this.Model.FamilyIDCardNo))) { recordsBaseInfoModel.FamilyIDCardNo = null; recordsBaseInfoModel.HouseRelation = null; recordsBaseInfoModel.HouseRealOther = null; recordsBaseInfoBLL.Update(recordsBaseInfoModel); } new RecordsFamilyInfoBLL(); this.Model.FamilyIDCardNo = null; this.Model.HouseID = null; this.Model.HouseName = null; this.Model.HouseRelation = null; this.Model.HouseRealOther = null; base.DialogResult = DialogResult.OK; } } else if (MessageBox.Show("此操作将会将人员的家庭关系删除,是否继续?", "家庭档案", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.OK) { this.Model.FamilyIDCardNo = null; this.Model.HouseID = null; this.Model.HouseName = null; this.Model.HouseRelation = null; this.Model.HouseRealOther = null; base.DialogResult = DialogResult.OK; } }
private void btnDel_Click(object sender, EventArgs e) { if (this.bds.Position >= 0) { DataRowView view = this.bds.List[this.bds.Position] as DataRowView; if (view != null) { DataRow row = view.Row; if (row["HouseRelation"].ToString() == "1") { string str = "?当前人员为户主且有相应的家庭档案信息,是否删除现家庭档案和所有家庭成员的关联关系?"; if (MessageBox.Show("确定删除:" + row["CustomerName"].ToString() + str + "删除之后的信息将无法恢复!", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { RecordsBaseInfoBLL archive_baseinfo = new RecordsBaseInfoBLL(); foreach (RecordsBaseInfoModel archive_baseinfo2 in archive_baseinfo.GetModelList(string.Format(" and FamilyIDCardNo = '{0}' ", row["IDCardNo"].ToString()))) { archive_baseinfo2.RecordID = null; archive_baseinfo2.HouseRelation = null; archive_baseinfo2.HouseRealOther = null; archive_baseinfo.Update(archive_baseinfo2); } RecordsFamilyInfoBLL archive_family_info = new RecordsFamilyInfoBLL(); RecordsFamilyInfoModel model = archive_family_info.GetModel(row["IDCardNo"].ToString()); if (model != null) { archive_family_info.Delete(model.ID); } //删除签名 DeteSign(SignPath, row["IDCardNo"].ToString()); new RecordsBaseInfoBLL().DelTheMan(row["IDCardNo"].ToString()); row.Delete(); row.Table.AcceptChanges(); } } else if (MessageBox.Show("确定删除:" + row["CustomerName"].ToString() + "?删除之后的信息将无法恢复!", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { //删除签名 DeteSign(SignPath, row["IDCardNo"].ToString()); new RecordsBaseInfoBLL().DelTheMan(row["IDCardNo"].ToString()); row.Delete(); row.Table.AcceptChanges(); } } } }