Example #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         FormMetric form1 = (FormMetric)this.Owner;
         update.updatdUnit(textBox1.Text, textBox2.Text, newId, rowMetric.Oldid, rowMetric.oldcode, rowMetric.oldname);
         //form1.refresh();
         form1.updateColumn(rowMetric.RName, textBox1.Text, textBox2.Text, comboBox1.Text);
         this.Close();
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #2
0
        private void btnDelete_Click(object sender, EventArgs e)//删除数据库内计量单位
        {
            string str = "delete from DMetric where MetricCode = '" + label5.Text + "' and " +
                         "MetricName = '" + label6.Text + "' and UnitID = " + Eid;

            try
            {
                FormMetric form = (FormMetric)this.Owner;
                db.SetPIVAsDB(str);
                form.deleteRow();
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #3
0
        private void Key(object sender, KeyPressEventArgs e)//各编辑框响应的键盘按键
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                string str;
                if (UId == null)
                {
                    str = "insert into DMetric values('" + txtCode.Text + "','" + txtName.Text + "', 0)";
                }
                else
                {
                    str = "insert into DMetric values('" + txtCode.Text + "','" + txtName.Text + "'," + UId + ")";
                }

                FormMetric form1 = (FormMetric)this.Owner;
                db.SetPIVAsDB(str);
                form1.addRow(txtCode.Text, txtName.Text, cbbPName.Text, UId);
                this.Close();
            }
        }
Example #4
0
        private void btnAdd_Click(object sender, EventArgs e)//数据库内增加计量单位
        {
            string str;

            if (UId == null)
            {
                str = "insert into DMetric values('" + txtCode.Text + "','" + txtName.Text + "', 0)";
            }
            else
            {
                str = "insert into DMetric values('" + txtCode.Text + "','" + txtName.Text + "'," + UId + ")";
            }

            FormMetric form1 = (FormMetric)this.Owner;

            db.SetPIVAsDB(str);
            form1.addRow(txtCode.Text, txtName.Text, cbbPName.Text, UId);

            this.Close();
        }