/// <summary> /// 保存信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { ProxyBllCOMMAND_PAR_SEND bllCommandParSend = new ProxyBllCOMMAND_PAR_SEND(); //置灰保存按钮 btnSave.Enabled = false; //判断该命令字编号在数据库中是否存在,如果存在进行修改处理,否则进行新增操作 string now_CommandParId = ""; now_CommandParId = txtId.Text; DataSet dsCommandParCount = bllCommandParSend.GetParCount(now_CommandParId); int tempParCount = -1; if (dsCommandParCount != null) { if (dsCommandParCount.Tables[0].Rows.Count > 0) { tempParCount = Convert.ToInt16(dsCommandParCount.Tables[0].Rows[0][0].ToString()); } } if (tempParCount == 0) //新增操作 { try { //将产品标准数据写入Model类中 CreateOrUpdateParInfo(1); bllCommandParSend.Add(_mdlCommandParSend); } catch (Exception ex) { MessageBox.Show("系统处理异常,请联系管理员。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else //修改操作 { //已经存在判断是否执行修改保存 DialogResult dialogResult = XtraMessageBox.Show("当前数据已存在,是否执行修改保存操作?", "选择", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes) { try { //将产品数据写入Model类中 CreateOrUpdateParInfo(2); bllCommandParSend.Update(_mdlCommandParSend); } catch (Exception ex) { MessageBox.Show("系统处理异常,请联系管理员。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } btnSave.Enabled = true; //读取未开始试验的试验任务 BindGridview(); }
/// <summary> /// 读取并显示需要在试验参数信息中设置的参数 /// </summary> private void QueryAndDis_CommPar() { ProxyBllCOMMAND_PAR_SEND bllTestCommPar = new ProxyBllCOMMAND_PAR_SEND(); //获取在数据管理客户端需要设置的参数F_SENDPAR_SET=1 string temp_con = ""; temp_con = " F_SENDPAR_SET=2 "; _TestCommStartPar = bllTestCommPar.GetAndDisplayCommPar(_TestCommStartPar, temp_con); gcParValue.DataSource = _TestCommStartPar; }
/// <summary> /// 彻底删除一条记录,一旦删除无法恢复,建议不要使用此功能 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDelete_Click(object sender, EventArgs e) { string now_CommandParId = ""; now_CommandParId = txtId.Text; string now_CommandParName = ""; now_CommandParName = txtName.Text; DialogResult dialogResult = XtraMessageBox.Show("确认执行参数:" + now_CommandParName + "的删除操作吗?", "选择", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes) { ProxyBllCOMMAND_PAR_SEND bllCommnadParSend = new ProxyBllCOMMAND_PAR_SEND(); bllCommnadParSend.Delete(Convert.ToInt16(now_CommandParId)); //读取参数信息 BindGridview(); } }