public int kaiyao_Insert(kaiyao ky) { SqlParameter Rid = new SqlParameter("@Rid", SqlDbType.VarChar); SqlParameter kId = new SqlParameter("@kId", SqlDbType.Int); SqlParameter yaopinName = new SqlParameter("@yaopinName", SqlDbType.VarChar); SqlParameter zhuangtai = new SqlParameter("@zhuangtai", SqlDbType.VarChar); SqlParameter yizhu = new SqlParameter("@yizhu", SqlDbType.VarChar); SqlParameter yongfa = new SqlParameter("@yongfa", SqlDbType.VarChar); SqlParameter result = new SqlParameter("@result", SqlDbType.Int); result.Direction = ParameterDirection.Output; Rid.Value = ky.Rid; kId.Value = ky.Kid; yaopinName.Value = ky.yaopinName; zhuangtai.Value = ky.zhuangtai; yizhu.Value = ky.yizhu; yongfa.Value = ky.yongfa; SqlParameter[] sp = { kId, Rid, yaopinName, zhuangtai, yizhu, yongfa, result }; bool f = DBHelper.ExecuteNonQueryProc("kaiyao_insert", sp); if (f) { return((int)result.Value); } else { return(-1); } }
private void btnOk_Click(object sender, EventArgs e) { if (txtKId.Text == "" || txtRid.Text == "") { MessageBox.Show("请先选择挂号单 !"); return; } if (txtYizhu.Text == "" || txtJinji.Text == "") { MessageBox.Show("请把药方填写完整 !"); return; } string ypName = ""; foreach (ListViewItem item in lvwYaofang.Items) { ypName += item.SubItems[1].Text + "-"; } kaiyao ky = new kaiyao(); ky.Rid = txtRid.Text; ky.Kid = int.Parse(txtKId.Text); ky.yaopinName = ypName; ky.zhuangtai = "no"; ky.yizhu = txtYizhu.Text; ky.yongfa = txtJinji.Text; lvwGuahaoShow.Items.RemoveAt(0); string mes = new Prescribe_BLL().kaiyao_Insert(ky); MessageBox.Show(mes); }
public string kaiyao_Insert(kaiyao ky) { int re = new Prescribe_DAL().kaiyao_Insert(ky); if (re == 0) { return("该药方已经存在"); } else if (re == 1) { return("提交药方成功"); } else { return("提交药方失败"); } }