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(); } } } }
private void listView1_ItemActivate(object sender, EventArgs e) { Predicate <RecordsBaseInfoModel> match = null; this.FamilyArcID = this.listView1.FocusedItem.SubItems[2].Text; if (this.FamilyArcID != "") { if (match == null) { match = c => c.IDCardNo.ToString() == this.FamilyArcID; } RecordsBaseInfoModel HouseModel = new RecordsBaseInfoModel(); HouseModel = this.ModelList.Find(match); RecordsFamilyInfoModel FamilyModel = new RecordsFamilyInfoBLL().GetModel(HouseModel.IDCardNo); if (FamilyModel == null) { RecordsFamilyInfoModel archive_family_info = new RecordsFamilyInfoModel { RecordID = HouseModel.RecordID, IDCardNo = HouseModel.IDCardNo, ToiletType = "1", HouseType = "1", LiveStatus = "1", CreatedDate = new DateTime?(DateTime.Today) }; FamilyModel = archive_family_info; FamilyModel.FamilyRecordID = HouseModel.IDCardNo; FamilyModel.CreatedDate = new DateTime?(DateTime.Today); FamilyModel.CreateBy = ConfigHelper.GetNode("doctor"); FamilyModel.CreateUnit = ConfigHelper.GetNode("orgCode"); FamilyModel.CustomerName = HouseModel.CustomerName; //增加户主信息 new RecordsFamilyInfoBLL().Add(archive_family_info); RecordsBaseInfoBLL recordsBaseInfoBLL = new RecordsBaseInfoBLL(); HouseModel.FamilyIDCardNo = FamilyModel.IDCardNo; HouseModel.HouseID = FamilyModel.IDCardNo; HouseModel.HouseName = FamilyModel.CustomerName; HouseModel.HouseRelation = "1"; HouseModel.HouseRealOther = "本人"; recordsBaseInfoBLL.Update(HouseModel); } this.Model.FamilyIDCardNo = FamilyModel.IDCardNo; this.Model.HouseID = FamilyModel.IDCardNo; this.Model.HouseName = FamilyModel.CustomerName; base.DialogResult = DialogResult.OK; } }