Example #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();
                 }
             }
         }
     }
 }
Example #2
0
        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();
                    }
                }
            }
        }