コード例 #1
0
        /// <summary>
        /// 添加科室
        /// </summary>
        public void AddDepartment()
        {
            //创建新增科室
            Neusoft.HISFC.Models.Base.DepartmentStat dept = new Neusoft.HISFC.Models.Base.DepartmentStat();

            //取新增节点的统计大类编码、父级编码、父级名称
            ParentNodeStat(this.tvDepartmentLevelTree1.SelectedNode, ref dept);

            //新增节点为叶子节点。
            dept.NodeKind = 1;

            ucDepartmentStat deptLevel = new ucDepartmentStat(dept);

            //定义事件(用于判断是否增加的是本科室)路志鹏,2007-4-11
            ucDepartmentStat.DoCheckNode += new ucDepartmentStat.CheckHander(ucDepartmentStat_DoCheckNode);

            //创建临时窗口用来修改数据
            Neusoft.FrameWork.WinForms.Classes.Function.PopForm.Text = "科室属性";
            DialogResult dlg = Neusoft.FrameWork.WinForms.Classes.Function.PopShowControl(deptLevel);

            if (dlg == DialogResult.OK)
            {
                this.tvDepartmentLevelTree1.AddDepartment(this.tvDepartmentLevelTree1.SelectedNode, dept);
                //显示当前TreeView中选中节点的下级内容
                this.ShowList();
            }
            ucDepartmentStat.DoCheckNode -= new ucDepartmentStat.CheckHander(ucDepartmentStat_DoCheckNode);
        }
コード例 #2
0
        /// <summary>
        /// 修改科室属性
        /// </summary>
        public void DeptProperty()
        {
            //判断修改的科室是否是树上的
            //当ListView中选中项目时,查看其ListView中选中项目的属性
            Neusoft.HISFC.Models.Base.DepartmentStat dept = null;
            if (this.neuListView1.SelectedItems.Count > 0 && this.neuListView1.Focused)
            {
                //取得当前ListView中要修改的科室数据信息
                dept = ((TreeNode)this.neuListView1.SelectedItems[0].Tag).Tag as Neusoft.HISFC.Models.Base.DepartmentStat;
            }
            else
            {
                //当ListView中没有选中项目时,如果TreeView中选中了项目并且不是统计大类,则允许查看TreeView中节点的属性
                if (this.tvDepartmentLevelTree1.SelectedNode != null && this.tvDepartmentLevelTree1.SelectedNode.Parent != null)
                {
                    dept = this.tvDepartmentLevelTree1.SelectedNode.Tag as Neusoft.HISFC.Models.Base.DepartmentStat;
                }
            }
            if (dept != null)
            {
                string s = dept.StatCode.ToString();
                #region 麻烦,顺序号保存在COM_DEPTSTAT里的,不是com_department的,但是取呢却是取com_department里的,先这么简单的取取吧
                //{9E9F36B8-74B0-482b-A5D4-7E3C919EBAE1} wbo 2010-12-11
                if ("16" == s)//16是维护挂号科室顺序的
                {
                    string sql = @"select sort_id from com_deptstat d
where d.stat_code = '16'
and d.dept_code = '{0}'";
                    try
                    {
                        sql = string.Format(sql, dept.ID);
                        Neusoft.HISFC.BizLogic.Manager.Department deptManager = new Neusoft.HISFC.BizLogic.Manager.Department();
                        string result = deptManager.ExecSqlReturnOne(sql);
                        if (string.IsNullOrEmpty(result))
                        {
                            //取不出来就算了
                        }
                        else
                        {
                            //应该取得出来
                            dept.SortId = Neusoft.FrameWork.Function.NConvert.ToInt32(result);
                        }
                    }
                    catch (Exception ex)
                    { }
                }

                #endregion
                ucDepartmentStat deptLevel = new ucDepartmentStat(dept);
                //创建临时窗口用来修改数据
                Neusoft.FrameWork.WinForms.Classes.Function.PopForm.Text = "科室属性";
                DialogResult dialogResult = Neusoft.FrameWork.WinForms.Classes.Function.PopShowControl(deptLevel);
                if (dialogResult == DialogResult.OK)
                {
                    this.ShowList();
                }
            }
        }