public bool InsertOrUpdateHealthRecord(Dicthealthrecords model, bool isAdd) { int cnt = 0; bool b = true; try { if (isAdd) { model.Dicthealthrecordsid = getSeqID("SEQ_DICTHEALTHRECORDS"); cnt = Convert.ToInt32(insert("Dict.InsertDicthealthrecords", model)); } else { cnt = Convert.ToInt32(insert("Dict.UpdateDicthealthrecords", model)); } if (cnt < 0) { b = false; } } catch (Exception) { b = false; } return(b); }
protected void btnSave_Click(object sender, EventArgs e) { Dicthealthrecords model = new Dicthealthrecords(); model.Dictmemberid = Convert.ToDouble(hidMemberID.Text); model.Dictrecordtype = Convert.ToInt32(dpType.SelectedValue); model.Dictrecordtext = txtHealthRecord.Text; bool b = ms.InsertOrUpdateHealthRecord(model, true); if (!b) { MessageBoxShow("添加失败,请重试!"); return; } else { MessageBoxShow("保存成功!"); dpType.SelectedIndex = 0; txtHealthRecord.Text = string.Empty; } }