Ejemplo n.º 1
0
 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();
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 private void PersonRecordPictureBox_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(this.IDCardNo))
     {
         new MessageForm("请先刷身份证或输入身份证登录系统!")
         {
             StartPosition = FormStartPosition.CenterParent
         }.ShowDialog();
         return;
     }
     using (PBControler controler = new PBControler(new PersonForm(this.IDCardNo), new PersonInfoFactory()))
     {
         controler.IParentFrm.IShowDialog();
     }
     GC.Collect();
 }