Esempio n. 1
0
        private void Part3_Save_Click(object sender, EventArgs e)
        {
            try
            {
                //添加数据
                ShoulderDataInfo.id                 = txt3ID.Text;
                ShoulderDataInfo.shoulderAcross     = txtShoulderAcross.Text;
                ShoulderDataInfo.leftShoulder       = txtLeftShoulder.Text;
                ShoulderDataInfo.rightShoulder      = txtRightShoulder.Text;
                ShoulderDataInfo.leftShoulderAngle  = txtLeftShoulderAngle.Text;
                ShoulderDataInfo.rightShoulderAngle = txtRightShoulderAngle.Text;

                //执行添加
                int id = MyMC.AddShoulderData(ShoulderDataInfo);
                MessageBox.Show("新增--肩部数据--成功!", "成功提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            dataGridView3.DataSource = MyMC.GetAllShoulderData("ShoulderData").Tables[0].DefaultView;
            this.SetdataGridView3HeadText();
        }
Esempio n. 2
0
        private void tlBtnSave_Click(object sender, EventArgs e)
        {
            //判断是添加还是修改数据
            if (G_Int_addOrUpdate == 0)
            {
                try
                {
                    //添加数据
                    ShoulderDataInfo.id                 = txtID.Text;
                    ShoulderDataInfo.shoulderAcross     = txtShoulderAcross.Text;
                    ShoulderDataInfo.leftShoulder       = txtLeftShoulder.Text;
                    ShoulderDataInfo.rightShoulder      = txtRightShoulder.Text;
                    ShoulderDataInfo.leftShoulderAngle  = txtLeftShoulderAngle.Text;
                    ShoulderDataInfo.rightShoulderAngle = txtRightShoulderAngle.Text;

                    //执行添加
                    int id = baseinfo.AddShoulderData(ShoulderDataInfo);
                    MessageBox.Show("新增--肩部数据--成功!", "成功提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                //修改数据
                ShoulderDataInfo.id                 = txtID.Text;
                ShoulderDataInfo.shoulderAcross     = txtShoulderAcross.Text;
                ShoulderDataInfo.leftShoulder       = txtLeftShoulder.Text;
                ShoulderDataInfo.rightShoulder      = txtRightShoulder.Text;
                ShoulderDataInfo.leftShoulderAngle  = txtLeftShoulderAngle.Text;
                ShoulderDataInfo.rightShoulderAngle = txtRightShoulderAngle.Text;
                //执行修改
                int id = baseinfo.UpdateShoulderData(ShoulderDataInfo);
                MessageBox.Show("修改--肩部数据--成功!", "成功提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            dgvShoulderDataList.DataSource = baseinfo.GetAllShoulderData("ShoulderData").Tables[0].DefaultView;
            this.SetdgvShoulderDataListHeadText();
            this.cancelEnabled();
        }