//保存 public bool saveGoulougeanrecord(ChildGoulougeanRecordObj goulourecordobj) { try { string sqls = ""; if (goulourecordobj.id != 0) { sqls = "update child_goulougean_record set " + " childId = " + goulourecordobj.childId + " ,checkid = " + goulourecordobj.checkid + " ,huwai = '" + goulourecordobj.huwai + "'" + " ,problem = '" + goulourecordobj.problem + "'" + " ,vitdname = '" + goulourecordobj.vitdname + "'" + " ,vitdliang = '" + goulourecordobj.vitdliang + "'" + " ,zhidao = '" + goulourecordobj.zhidao + "'" + " where id= " + goulourecordobj.id; } else { sqls = "insert into child_goulougean_record (" + "childId" + ",checkid" + ",huwai" + ",problem" + ",vitdname" + ",vitdliang" + ",zhidao" + " ) values ( " + "" + goulourecordobj.childId + "" + "," + goulourecordobj.checkid + "" + ",'" + goulourecordobj.huwai + "'" + ",'" + goulourecordobj.problem + "'" + ",'" + goulourecordobj.vitdname + "'" + ",'" + goulourecordobj.vitdliang + "'" + ",'" + goulourecordobj.zhidao + "'" + ")"; } if (dg.executeupdate(sqls) > 0) { return(true); } else { return(false); } } catch (Exception ex) { MessageBox.Show("保存失败", "软件提示"); throw ex; } }
private ChildGoulougeanRecordObj getgoulourecordObj() { ChildGoulougeanRecordObj goulourecordobj = new ChildGoulougeanRecordObj(); goulourecordobj.id = _checkobj.goulourecordobj.id; goulourecordobj.checkid = _checkobj.Id; goulourecordobj.childId = _checkobj.ChildId; goulourecordobj.huwai = textBoxX12.Text; goulourecordobj.problem = textBoxX1.Text; goulourecordobj.vitdname = textBoxX7.Text; goulourecordobj.vitdliang = textBoxX11.Text; goulourecordobj.zhidao = textBoxX2.Text; return(goulourecordobj); }
private void buttonX4_Click(object sender, EventArgs e) { ChildGoulougeanRecordObj goulourecordobj = getgoulourecordObj(); if (goulourecordbll.saveGoulougeanrecord(goulourecordobj)) { MessageBox.Show("保存成功!"); this.Close(); _goulouzhuananpanel.refreshRecordList(); } else { MessageBox.Show("保存失败!请联系管理员"); } }