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();
                 }
             }
         }
     }
 }
 private void btnFront_Click(object sender, EventArgs e)
 {
     if (this.currentPage > 0)
     {
         this.lbPages.Text = string.Format("{0}/{1}页", --this.currentPage + 1, this.totalPages);
         DataSet ds = new RecordsFamilyInfoBLL().GetFamilyListByPage(this.GetWhere(), "FamilyIDCardNo DESC", this.currentPage * this.pageCount, this.pageCount);
         if (ds.Tables.Count > 0)
         {
             this.TransDs(ds);
             this.bds.DataSource     = ds.Tables[0];
             this.dgvData.DataSource = this.bds;
         }
     }
 }
Example #3
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();
                    }
                }
            }
        }
Example #4
0
        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;
            }
        }
 private void btnQuery_Click(object sender, EventArgs e)
 {
     if (this.btnQuery.Text == "重置条件")
     {
         this.groupBox1.Enabled = true;
         this.btnQuery.Text     = "查询";
         txtIdNum.Text          = "";
         tbAddr.Text            = "";
         dtpCreatedDateSt.Text  = "";
         dtpCreatedDateEd.Text  = "";
     }
     else if (this.ckxCreatedDate.Checked && (this.dtpCreatedDateSt.Value.Date > this.dtpCreatedDateEd.Value.Date))
     {
         MessageBox.Show(" 建档日期:开始日期大于结束日期!", "日期错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
     else
     {
         this.btnQuery.Enabled = false;
         string where          = this.GetWhere();
         if (string.IsNullOrEmpty(where))
         {
             MessageBox.Show("请选择查询条件!", "查询条件", MessageBoxButtons.OK, MessageBoxIcon.Hand);
             this.btnQuery.Enabled = true;
         }
         else
         {
             RecordsFamilyInfoBLL archive_baseinfo = new RecordsFamilyInfoBLL();
             this.totalCount        = archive_baseinfo.GetFamilyRecordCount(where);
             this.totalPages        = (this.totalCount <= this.pageCount) ? 1 : ((this.totalCount / this.pageCount) + (((this.totalCount % this.pageCount) > 0) ? 1 : 0));
             this.currentPage       = 0;
             this.lbTotalCount.Text = string.Format("共计{0}条", this.totalCount.ToString());
             DataSet ds = archive_baseinfo.GetFamilyListByPage(where, "FamilyIDCardNo DESC", 0, this.pageCount);
             this.lbPages.Text = string.Format("{0}/{1}页", this.currentPage + 1, this.totalPages);
             if (ds.Tables.Count > 0)
             {
                 this.TransDs(ds);
                 this.bds.DataSource     = ds.Tables[0];
                 this.dgvData.DataSource = this.bds;
             }
             this.groupBox1.Enabled = false;
             this.btnQuery.Enabled  = true;
             this.btnQuery.Text     = "重置条件";
         }
     }
 }