private void Part1_Save_Click(object sender, EventArgs e) { try { //添加数据 HeaderDataInfo.id = txt1ID.Text; HeaderDataInfo.headHeight = txtHeadHeight.Text; HeaderDataInfo.headWidth = txtHeadWidth.Text; HeaderDataInfo.headLength = txtHeadLength.Text; HeaderDataInfo.headGirth = txtHeadGirth.Text; HeaderDataInfo.crownShapeAround = txtCrownShapeAround.Text; HeaderDataInfo.bitragionIntertragicArc = txtBitragionIntertragicArc.Text; HeaderDataInfo.headSagittalArc = txtHeadSagittalArc.Text; HeaderDataInfo.browTopNeckArcLength = txtBrowTopNeckArcLength.Text; HeaderDataInfo.morphoGicalFacialLength = txtMorphoGicalFacialLength.Text; HeaderDataInfo.interpupillaryDistance = txtInterpupillaryDistance.Text; //执行添加 int id = MyMC.AddHeaderData(HeaderDataInfo); MessageBox.Show("新增--头部数据--成功!", "成功提示!", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } dataGridView1.DataSource = MyMC.GetAllHeaderData("HeaderData").Tables[0].DefaultView; this.SetdataGridView1HeadText(); }
private void tlBtnSave_Click(object sender, EventArgs e) { //判断是添加还是修改数据 if (G_Int_addOrUpdate == 0) { try { //添加数据 HeaderDataInfo.id = txtID.Text; HeaderDataInfo.headHeight = txtHeadHeight.Text; HeaderDataInfo.headWidth = txtHeadWidth.Text; HeaderDataInfo.headLength = txtHeadLength.Text; HeaderDataInfo.headGirth = txtHeadGirth.Text; HeaderDataInfo.crownShapeAround = txtCrownShapeAround.Text; HeaderDataInfo.bitragionIntertragicArc = txtBitragionIntertragicArc.Text; HeaderDataInfo.headSagittalArc = txtHeadSagittalArc.Text; HeaderDataInfo.browTopNeckArcLength = txtBrowTopNeckArcLength.Text; HeaderDataInfo.morphoGicalFacialLength = txtMorphoGicalFacialLength.Text; HeaderDataInfo.interpupillaryDistance = txtInterpupillaryDistance.Text; //执行添加 int id = baseinfo.AddHeaderData(HeaderDataInfo); MessageBox.Show("新增--头部数据--成功!", "成功提示!", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { //修改数据 HeaderDataInfo.id = txtID.Text; HeaderDataInfo.headHeight = txtHeadHeight.Text; HeaderDataInfo.headWidth = txtHeadWidth.Text; HeaderDataInfo.headLength = txtHeadLength.Text; HeaderDataInfo.headGirth = txtHeadGirth.Text; HeaderDataInfo.crownShapeAround = txtCrownShapeAround.Text; HeaderDataInfo.bitragionIntertragicArc = txtBitragionIntertragicArc.Text; HeaderDataInfo.headSagittalArc = txtHeadSagittalArc.Text; HeaderDataInfo.browTopNeckArcLength = txtBrowTopNeckArcLength.Text; HeaderDataInfo.morphoGicalFacialLength = txtMorphoGicalFacialLength.Text; HeaderDataInfo.interpupillaryDistance = txtInterpupillaryDistance.Text; //执行修改 int id = baseinfo.UpdateHeaderData(HeaderDataInfo); MessageBox.Show("修改--头部数据--成功!", "成功提示!", MessageBoxButtons.OK, MessageBoxIcon.Information); } dgvHeaderDataList.DataSource = baseinfo.GetAllHeaderData("HeaderData").Tables[0].DefaultView; this.SetdgvHeaderDataListHeadText(); this.cancelEnabled(); }