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(); } }
public bool UpdateVoltageParam(VM_VoltageParam vm_vp) { int count = 0; string sql = string.Format("UPDATE [dbo].[{0}] SET [VoltageLevel] = {1},[PreVoltage] = {2},[CurVoltage] ={3} WHERE [ID]='{1}'", CV_TableName, vm_vp.VoltageLevel, vm_vp.PreVoltage, vm_vp.CurVoltage); count = m_VoltageDAL.UpdateVoltageParaInfo(sql); return(count > 0 ? true : false); }
public bool InsertVoltageParam(VM_VoltageParam vm_vp) { int count = 0; string sql = string.Format("INSERT INTO[dbo].[{0}]([VoltageLevel],[PreVoltage],[CurVoltage]) VALUES('{1}','{2}','{3}'); ", CV_TableName, vm_vp.VoltageLevel, vm_vp.PreVoltage, vm_vp.CurVoltage); count = m_VoltageDAL.InsertCameraInfo(sql); return(count > 0 ? true : false); }