//保存 public bool savePinxuegeanrecord(ChildPinxuegeanRecordObj pinxuerecordobj) { try { string sqls = ""; if (pinxuerecordobj.id != 0) { sqls = "update child_pinxuegean_record set " + " childId = " + pinxuerecordobj.childId + " ,checkid = " + pinxuerecordobj.checkid + " ,hb = '" + pinxuerecordobj.hb + "'" + " ,problem = '" + pinxuerecordobj.problem + "'" + " ,zhiliao = '" + pinxuerecordobj.zhiliao + "'" + " ,yaowu = '" + pinxuerecordobj.yaowu + "'" + " ,jiliang = '" + pinxuerecordobj.jiliang + "'" + " ,zhidao = '" + pinxuerecordobj.zhidao + "'" + " where id= " + pinxuerecordobj.id; } else { sqls = "insert into child_pinxuegean_record (" + "childId" + ",checkid" + ",hb" + ",problem" + ",zhiliao" + ",yaowu" + ",jiliang" + ",zhidao" + " ) values ( " + "" + pinxuerecordobj.childId + "" + "," + pinxuerecordobj.checkid + "" + ",'" + pinxuerecordobj.hb + "'" + ",'" + pinxuerecordobj.problem + "'" + ",'" + pinxuerecordobj.zhiliao + "'" + ",'" + pinxuerecordobj.yaowu + "'" + ",'" + pinxuerecordobj.jiliang + "'" + ",'" + pinxuerecordobj.zhidao + "'" + ")"; } if (dg.executeupdate(sqls) > 0) { return(true); } else { return(false); } } catch (Exception ex) { MessageBox.Show("保存失败", "软件提示"); throw ex; } }
private void buttonX4_Click(object sender, EventArgs e) { ChildPinxuegeanRecordObj pinxuerecordobj = getpinxuerecordObj(); if (pinxuerecordbll.savePinxuegeanrecord(pinxuerecordobj)) { MessageBox.Show("保存成功!"); this.Close(); _pinxuezhuananpanel.refreshRecordList(); } else { MessageBox.Show("保存失败!请联系管理员"); } }
private ChildPinxuegeanRecordObj getpinxuerecordObj() { ChildPinxuegeanRecordObj pinxuerecordobj = new ChildPinxuegeanRecordObj(); pinxuerecordobj.id = _checkobj.pinxuerecordobj.id; pinxuerecordobj.checkid = _checkobj.Id; pinxuerecordobj.childId = _checkobj.ChildId; pinxuerecordobj.hb = textBoxX12.Text; pinxuerecordobj.problem = textBoxX1.Text; pinxuerecordobj.yaowu = textBoxX7.Text; pinxuerecordobj.jiliang = textBoxX11.Text; pinxuerecordobj.zhidao = textBoxX2.Text; pinxuerecordobj.zhidao = textBoxX2.Text; return(pinxuerecordobj); }