Esempio n. 1
0
        private void btnAddVoltage_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtCurVoltage.Text) || string.IsNullOrWhiteSpace(txtPreVoltage.Text) || string.IsNullOrWhiteSpace(txtVoltageLevel.Text))
            {
                MessageBoxHelper.ShowInformationMessageBox("存在数值为空,请填全!");
                return;
            }
            if (decimal.Parse(txtCurVoltage.Text.ToString()) < decimal.Parse(txtPreVoltage.Text))
            {
                MessageBoxHelper.ShowInformationMessageBox("前值必须小于后值,请修改!");
                return;
            }
            if (txtVoltageLevel.Text == "0")
            {
                MessageBoxHelper.ShowInformationMessageBox("电压等级不能为0,请修改!");
                return;
            }
            VoltageBLL      voltageBLL = new VoltageBLL();
            VM_VoltageParam vm_vp      = new VM_VoltageParam();

            vm_vp.CurVoltage   = decimal.Parse(txtCurVoltage.Text);
            vm_vp.PreVoltage   = decimal.Parse(txtPreVoltage.Text);
            vm_vp.VoltageLevel = int.Parse(txtVoltageLevel.Text);
            voltageBLL.GetVoltageList("");
            if (voltageBLL.InsertVoltageParam(vm_vp))
            {
                RefreshVoltageUI();
            }
        }
Esempio n. 2
0
        private void RefreshVoltageUI()
        {
            DataTable  dt         = new DataTable();
            VoltageBLL voltageBLL = new VoltageBLL();
            DataSet    ds         = voltageBLL.GetVoltageList("");

            dt = ds.Tables[0];
            dataGridView3.DataSource = null;
            dataGridView3.Rows.Clear();
            dataGridView3.DataSource = dt;
        }