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);
            }
        }
        /// <summary>
        /// 添加药方
        /// </summary>
        /// <param name="ky"></param>
        /// <returns></returns>
        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("提交药方失败");
            }
        }
Esempio n. 3
0
        //中药提交
        private void BtnOk_Click(object sender, RoutedEventArgs e)
        {
            if (txtKId.Text == "" || txtRid.Text == "")
            {
                var t1 = new Tip("请先选择挂号单 !");
                t1.ShowDialog();
                return;
            }
            if (txtYizhu.Text == "" || txtJinji.Text == "")
            {
                var t2 = new Tip("请把药方填写完整 !");
                t2.ShowDialog();
                return;
            }
            string ypName = "";

            if (lvwYaofang.SelectedItems.Count > 0)
            {
                string   str = lvwYaofang.Items[lvwYaofang.SelectedIndex].ToString();
                string[] ss  = str.Split(',');
                //foreach (ListViewItem item in lvwYaofang.Items)
                //{
                //    ypName += ss[1].Substring(3).Replace("=", "").Trim() + "-";
                //}

                Kaiyao ky = new Kaiyao
                {
                    Rid        = txtRid.Text,
                    Kid        = int.Parse(txtKId.Text),
                    yaopinName = ypName,
                    zhuangtai  = "no",
                    yizhu      = txtYizhu.Text,
                    yongfa     = txtJinji.Text
                };
                if (lvwGuaHaoShow.SelectedItems.Count > 0)
                {
                    lvwGuaHaoShow.Items.RemoveAt(lvwGuaHaoShow.SelectedIndex);
                }
                string mes = new Prescribe_BLL().kaiyao_Insert(ky);
                //MessageBox.Show(mes);
                var t = new Tip("提交成功!");
                t.ShowDialog();
            }
        }