private void frmCheckSpuse_Load(object sender, EventArgs e) { if (ShowORAdd == 2) { this.Text = "配偶信息"; dbtblNumberInfo info = new dbtblNumberInfo(); DataTable td = info.GetPeiOuInfo(this.GetID); if (PeiOuSex == 0) { cbxsex.Text = "男"; } else { cbxsex.Text = "女"; } txtnumjob.Text = td.Rows[0]["工作"].ToString(); txtNumNmae.Text = td.Rows[0]["姓名"].ToString(); dtpOne.Text = td.Rows[0]["出生日期"].ToString(); txtDieDay.Text = td.Rows[0]["NiDIeDay"].ToString(); txtnumaddress.Text = td.Rows[0]["NiAddress"].ToString(); txtnumlifestory.Text = td.Rows[0]["NiLifeStory"].ToString(); txtnumage.Text = td.Rows[0]["年龄"].ToString(); cbxDieNow.Text = td.Rows[0]["状态"].ToString(); btnAdd.Visible = false; btnOver.Visible = false; EnableFalse(); } else if (ShowORAdd == 1) { this.Text = "添加配偶"; txtnumage.Enabled = false; cbxsex.SelectedIndex = PeiOuSex; cbxsex.Enabled = false; } }
private void deleteTSM_Click(object sender, EventArgs e) { if (IsCan == 20) { MessageBox.Show("你暂时未有此项权限", "提示"); return; } if (btnsave.Visible == true) { MessageBox.Show("无法删除!信息正在修改!", "提示"); return; } //得到族系_族系 if (lblbianhao.Text == "abc") { MessageBox.Show("请选择一个族人", "提示"); return; } if (System.Windows.Forms.MessageBox.Show("你确定要删除族人吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK) { int i = Convert.ToInt32(lblbianhao.Text); dbtblNumberInfo num = new dbtblNumberInfo(); Delete(i); InitMenuTreeView(); deleteAll(); MessageBox.Show("已经删除完毕", "成功"); } }
private void Delete(int i) { dbtblNumberInfo num = new dbtblNumberInfo(); int t_sex = num.GetPersonSex(i); num.CarryOutSqlSentence("delete from [Family].[dbo].[tblNumberInfo] where NiId=" + i); num.CarryOutSqlSentence("delete from [Family].[dbo].[tblNumberInfo] where NiSpouseId = " + i); if (t_sex == 1) //女族人 { DataTable db = num.MotherGetChilDataTable(i); for (int j = 0; j < db.Rows.Count; j++) { if (num.GetChildCount(j, t_sex) != 0) { Delete(Convert.ToInt32(db.Rows[j]["NiId"])); } num.CarryOutSqlSentence("delete from [Family].[dbo].[tblNumberInfo] where NiId=" + db.Rows[j]["NiId"].ToString()); num.CarryOutSqlSentence("delete from [Family].[dbo].[tblNumberInfo] where NiSpouseId = " + db.Rows[j]["NiId"].ToString()); } } else { DataTable db = num.FatherGetChilDataTable(i); for (int j = 0; j < db.Rows.Count; j++) { if (num.GetChildCount(j, t_sex) != 0) { Delete(Convert.ToInt32(db.Rows[j]["NiId"])); } num.CarryOutSqlSentence("delete from [Family].[dbo].[tblNumberInfo] where NiId=" + db.Rows[j]["NiId"].ToString()); num.CarryOutSqlSentence("delete from [Family].[dbo].[tblNumberInfo] where NiSpouseId = " + db.Rows[j]["NiId"].ToString()); } } }
private void BindChildNode(TreeNode tnTop) { dbvwNumberInfo vw = new dbvwNumberInfo(); dbtblNumberInfo num = new dbtblNumberInfo(); int i = Convert.ToInt32(tnTop.Tag.ToString()); int t_sex = num.GetPersonSex(i); if (t_sex == 1)//女族人 { DataTable db = num.MotherGetChilDataTable(i); for (int j = 0; j < db.Rows.Count; j++) { TreeNode node = new TreeNode(); node.Tag = db.Rows[j]["NiId"]; if (num.GetPersonSex(Convert.ToInt32(db.Rows[j]["NiId"])) == 1) { node.Text = "女:" + db.Rows[j]["NiName"].ToString(); } else { node.Text = "男:" + db.Rows[j]["NiName"].ToString(); } tnTop.Nodes.Add(node); if (num.GetChildCount(i) != 0) { BindChildNode(node); } } } else if (t_sex == 0)//女族人 { DataTable db = num.FatherGetChilDataTable(i); for (int j = 0; j < db.Rows.Count; j++) { TreeNode node = new TreeNode(); node.Tag = db.Rows[j]["NiId"]; if (num.GetPersonSex(Convert.ToInt32(db.Rows[j]["NiId"])) == 1) { node.Text = "女:" + db.Rows[j]["NiName"].ToString(); } else { node.Text = "男:" + db.Rows[j]["NiName"].ToString(); } tnTop.Nodes.Add(node); if (num.GetChildCount(i) != 0) { BindChildNode(node); } } } }
public void ShowEditPeiOu() { int i = Convert.ToInt32(lblbianhao.Text); FrmEdit frmcheck = new FrmEdit(); frmcheck.GetID = Convert.ToInt32(lblbianhao.Text); dbtblNumberInfo num = new dbtblNumberInfo(); if (num.GetPersonSex(i) == 1) { frmcheck.PeiOuSex = 0; } else { frmcheck.PeiOuSex = 1; } frmcheck.ShowORAdd = 2; frmcheck.Show(); }
public void ShowForm2_Add() { int i = Convert.ToInt32(lblbianhao.Text); frmCheckSpuse frmcheck = new frmCheckSpuse(); frmcheck.GetID = Convert.ToInt32(lblbianhao.Text); dbtblNumberInfo num = new dbtblNumberInfo(); if (num.GetPersonSex(i) == 1) { frmcheck.PeiOuSex = 0; } else { frmcheck.PeiOuSex = 1; } frmcheck.ShowORAdd = 1; frmcheck.Show(); }
public void ShowForm2() { if (txtnumpeiou.Text == "未婚配" || txtnumpeiou.Text == "") { MessageBox.Show("此人未有婚配", "提示"); return; } int i = Convert.ToInt32(lblbianhao.Text); frmCheckSpuse frmcheck = new frmCheckSpuse(); frmcheck.GetID = Convert.ToInt32(lblbianhao.Text); dbtblNumberInfo num = new dbtblNumberInfo(); if (num.GetPersonSex(i) == 1) { frmcheck.PeiOuSex = 0; } else { frmcheck.PeiOuSex = 1; } frmcheck.ShowORAdd = 2; frmcheck.Show(); }
private void FrmEdit_Load(object sender, EventArgs e) { this.Text = "配偶信息"; dbtblNumberInfo info = new dbtblNumberInfo(); DataTable td = info.GetPeiOuInfo(this.GetID); if (PeiOuSex == 0) { cbxsex.Text = "男"; } else { cbxsex.Text = "女"; } txtnumjob.Text = td.Rows[0]["工作"].ToString(); txtNumNmae.Text = td.Rows[0]["姓名"].ToString(); txttimeBirth.Text = td.Rows[0]["出生日期"].ToString(); txtdieDay.Text = td.Rows[0]["NiDIeDay"].ToString(); txtnumaddress.Text = td.Rows[0]["NiAddress"].ToString(); txtnumlifestory.Text = td.Rows[0]["NiLifeStory"].ToString(); txtnumage.Text = td.Rows[0]["年龄"].ToString(); cbxDieNow.Text = td.Rows[0]["状态"].ToString(); EnableFalse(); }