コード例 #1
0
ファイル: frmAddData.cs プロジェクト: IamWilliamWang/BID
        private void Part4_Save_Click(object sender, EventArgs e)
        {
            try
            {
                //添加数据
                ChestDataInfo.id                             = txt4ID.Text;
                ChestDataInfo.bust                           = txtBust.Text;
                ChestDataInfo.chestThickness                 = txtChestThickness.Text;
                ChestDataInfo.acrossFront                    = txtAcrossFront.Text;
                ChestDataInfo.acrossBack                     = txtAcrossBack.Text;
                ChestDataInfo.milkInterval                   = txtMilkInterval.Text;
                ChestDataInfo.underBustGirth                 = txtUnderBustGirth.Text;
                ChestDataInfo.thoracicCavityBand             = txtThoracicCavityBand.Text;
                ChestDataInfo.neckPointToBbustProminenceLeft = txtNeckPointToBbustProminenceLeft.Text;
                ChestDataInfo.neckPointToBustProminenceRight = txtNeckPointToBustProminenceRight.Text;

                //执行添加
                int id = MyMC.AddChestData(ChestDataInfo);
                MessageBox.Show("新增--胸部数据--成功!", "成功提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            dataGridView4.DataSource = MyMC.GetAllChestData("ChestData").Tables[0].DefaultView;
            this.SetdataGridView4HeadText();
        }
コード例 #2
0
ファイル: frmChestData.cs プロジェクト: IamWilliamWang/BID
        private void tlBtnSave_Click(object sender, EventArgs e)
        {
            //判断是添加还是修改数据
            if (G_Int_addOrUpdate == 0)
            {
                try
                {
                    //添加数据
                    ChestDataInfo.id                             = txtID.Text;
                    ChestDataInfo.bust                           = txtBust.Text;
                    ChestDataInfo.chestThickness                 = txtChestThickness.Text;
                    ChestDataInfo.acrossFront                    = txtAcrossFront.Text;
                    ChestDataInfo.acrossBack                     = txtAcrossBack.Text;
                    ChestDataInfo.milkInterval                   = txtMilkInterval.Text;
                    ChestDataInfo.underBustGirth                 = txtUnderBustGirth.Text;
                    ChestDataInfo.thoracicCavityBand             = txtThoracicCavityBand.Text;
                    ChestDataInfo.neckPointToBbustProminenceLeft = txtNeckPointToBbustProminenceLeft.Text;
                    ChestDataInfo.neckPointToBustProminenceRight = txtNeckPointToBustProminenceRight.Text;

                    //执行添加
                    int id = baseinfo.AddChestData(ChestDataInfo);
                    MessageBox.Show("新增--胸部数据--成功!", "成功提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                //修改数据
                ChestDataInfo.id                             = txtID.Text;
                ChestDataInfo.bust                           = txtBust.Text;
                ChestDataInfo.chestThickness                 = txtChestThickness.Text;
                ChestDataInfo.acrossFront                    = txtAcrossFront.Text;
                ChestDataInfo.acrossBack                     = txtAcrossBack.Text;
                ChestDataInfo.milkInterval                   = txtMilkInterval.Text;
                ChestDataInfo.underBustGirth                 = txtUnderBustGirth.Text;
                ChestDataInfo.thoracicCavityBand             = txtThoracicCavityBand.Text;
                ChestDataInfo.neckPointToBbustProminenceLeft = txtNeckPointToBbustProminenceLeft.Text;
                ChestDataInfo.neckPointToBustProminenceRight = txtNeckPointToBustProminenceRight.Text;
                //执行修改
                int id = baseinfo.UpdateChestData(ChestDataInfo);
                MessageBox.Show("修改--胸部数据--成功!", "成功提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            dgvChestDataList.DataSource = baseinfo.GetAllChestData("ChestData").Tables[0].DefaultView;
            this.SetdgvChestDataListHeadText();
            this.cancelEnabled();
        }