Esempio n. 1
0
        private void bt_save_Click(object sender, EventArgs e)
        {
            string str_jglx = "0";
            string str_tybz = "1";
            string str_lclx = "";//临床类型

            if (rb_jglx1.Checked)
            {
                str_jglx = "0";                  //字符
            }
            if (rb_jglx2.Checked)
            {
                str_jglx = "1";                  //数值
            }
            if (rb_qybz1.Checked)
            {
                str_tybz = "1";                  //启用
            }
            if (rb_qybz2.Checked)
            {
                str_tybz = "0";                  //停用
            }
            if (object.Equals(null, cmb_lclx.SelectedValue))
            {
                str_lclx = "";
            }
            else
            {
                str_lclx = cmb_lclx.SelectedValue.ToString().Trim();
            }
            if (str_state == "Update")
            {
                if (txt_tjxm.Text.Trim() == "")
                {
                    return;
                }
                ywszbiz.Update_tj_tjxmb(cmb_ksmc.SelectedValue.ToString().Trim(), txt_tjxm.Text.Trim(), txt_xmmc.Text.Trim(), txt_dj.Text.Trim(),
                                        txt_disp_order.Text.Trim(), cmb_xb.SelectedValue.ToString().Trim(), str_lclx, txt_dw.Text.Trim(),
                                        txt_zcjg.Text.Trim(), str_jglx, str_tybz, txt_minvalue.Text.Trim(), txt_maxvalue.Text.Trim());
                MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (rb_qybz2.Checked)
                {
                    tv_tjlxb.SelectedNode.ForeColor          = Color.Red;
                    tv_tjlxb.SelectedNode.ImageIndex         = 3;
                    tv_tjlxb.SelectedNode.SelectedImageIndex = 3;
                }
                else
                {
                    tv_tjlxb.SelectedNode.ForeColor          = tv_tjlxb.Nodes[0].ForeColor;
                    tv_tjlxb.SelectedNode.ImageIndex         = 2;
                    tv_tjlxb.SelectedNode.SelectedImageIndex = 2;
                }

                tv_tjlxb.SelectedNode.Text = txt_xmmc.Text.Trim();
            }
            if (str_state == "Insert")
            {
                if (object.Equals(cmb_ksmc.SelectedValue, null))
                {
                    return;
                }

                txt_tjxm.Text = ywszbiz.Get_proc_get_tjxmbh(cmb_ksmc.SelectedValue.ToString().Trim());//获取体检项目的编号
                if (txt_disp_order.Text == "")
                {
                    txt_disp_order.Text = txt_tjxm.Text;
                }

                ywszbiz.Insert_tj_tjxmb(cmb_ksmc.SelectedValue.ToString().Trim(), txt_tjxm.Text.Trim(), txt_xmmc.Text.Trim(), txt_dj.Text.Trim(),
                                        txt_disp_order.Text.Trim(), cmb_xb.SelectedValue.ToString().Trim(), str_lclx, txt_dw.Text.Trim(),
                                        txt_zcjg.Text.Trim(), str_jglx, str_tybz, txt_minvalue.Text.Trim(), txt_maxvalue.Text.Trim());

                MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                str_state = "Update";
                TreeNode node = new TreeNode(txt_xmmc.Text.Trim());
                node.Tag = txt_tjxm.Text.Trim();
                if (rb_qybz2.Checked)
                {
                    node.ForeColor = Color.Red;
                }
                tv_tjlxb.SelectedNode.Parent.Nodes.Add(node);
                cmb_ksmc.Enabled = false;
            }

            //AddTree();
            //if (treeNode != null)
            //{
            //    treeNode.Expand();
            //}
        }