コード例 #1
0
        /// <summary>
        /// 加载数据到树控件
        /// </summary>
        /// <param name="id"></param>
        /// <param name="row"></param>
        /// <param name="node"></param>
        private void LoadTree(string id, DataRow row, TreeListNode node)
        {
            if (m_MyLeafs == null)
            {
                m_MyLeafs = sqlHelper.ExecuteDataTable(string.Format(sql_queryLeaf, m_app.User.CurrentDeptId, m_app.User.Id));
            }

            TreeListNode nd = treeList1.AppendNode(new object[] { id, row["NAME"], "Folder", row["ISPERSON"], row["CREATEUSERS"], row["MEMO"], row["DEPTID"], row["CONTAINER"], row["PREVID"] }, node);

            nd.Tag = row;

            //查找叶子节点
            DataRow[] leafRows = m_MyLeafs.Select("PARENTID='" + id + "'");
            if (leafRows.Length > 0)
            {
                foreach (DataRow leaf in leafRows)
                {
                    TreeListNode leafnd = treeList1.AppendNode(new object[] { leaf["Code"], leaf["NAME"], "Leaf", leaf["ISPERSON"], leaf["CREATEUSERS"], leaf["ITEM_CONTENT"], leaf["DEPTID"], leaf["PARENTID"] }, nd);
                    TempletItem  item   = new TempletItem(leaf);
                    item.CatalogName = row["NAME"].ToString();
                    leafnd.Tag       = item;
                }
            }

            DataRow[] rows = m_MyTreeFolders.Select("Previd='" + id + "' ");

            foreach (DataRow dr in rows)
            {
                LoadTree(dr["ID"].ToString(), dr, nd);
            }
        }
コード例 #2
0
ファイル: ItemContentForm.cs プロジェクト: xuanximoming/key
 public ItemContentForm(IEmrHost app)
 {
     InitializeComponent();
     m_app = app;
     MyItem = new TempletItem();
     itemDisplayContent1.SetTemplateEditFlag(true);
 }
コード例 #3
0
        /// <summary>
        /// 删除操作    by cyq 2012-09-27
        /// 按钮删除(true)&右键删除(false)
        /// <param name="flag">是否需要删除确认提示:1-需要;0-不需要</param>
        /// </summary>
        private void DeleteItem()
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }

            string id       = treeList1.FocusedNode.GetValue("ID").ToString();
            string type     = treeList1.FocusedNode.GetValue("NODETYPE").ToString();
            string isPerson = string.Empty;

            if (type == "Folder")
            {
                DataRow drow = (DataRow)treeList1.FocusedNode.Tag;
                isPerson = null == drow["isPerson"] ? "" : drow["isPerson"].ToString();
            }
            else
            {
                TempletItem item = (TempletItem)treeList1.FocusedNode.Tag;
                isPerson = item.IsPerson;
            }
            string createuser = treeList1.FocusedNode.GetValue("CREATEUSER").ToString();
            string userName   = string.Empty;

            if (!string.IsNullOrEmpty(id))
            {
                try
                {
                    string msg = GetMsgIfNotCreateUser(id, createuser, type == "Folder" ? 0 : 1, 1, int.Parse(isPerson));
                    if (!string.IsNullOrEmpty(msg))
                    {
                        m_app.CustomMessageBox.MessageShow(msg);
                        return;
                    }
                    if (treeList1.FocusedNode.HasChildren && !IfHasDeleteRights(treeList1.FocusedNode))
                    {
                        m_app.CustomMessageBox.MessageShow("该分类包含其他人创建的子分类或模板,您无权删除。");
                        return;
                    }
                    //注:此处考虑为先考虑逻辑上是否满足删除条件,再提示是否确认删除
                    string sureStr = treeList1.FocusedNode.HasChildren ? "您确定要删除所选则分类及其所有子项吗?该操作不可恢复" : "您确定要删除吗?该操作不可恢复";
                    if (!(m_app.CustomMessageBox.MessageShow(sureStr, CustomMessageBoxKind.QuestionYesNo) == System.Windows.Forms.DialogResult.Yes))
                    {
                        return;
                    }

                    //if (type.Equals("Leaf"))
                    //{
                    //    sqlHelper.ExecuteNoneQuery(string.Format(sql_deletLeaf, id));
                    //}
                    //else
                    //{
                    //    sqlHelper.ExecuteNoneQuery(string.Format(sql_deletCatalog, id));
                    //}
                    DeleteNodeCascadeAll(treeList1.FocusedNode);
                    this.treeList1.DeleteNode(this.treeList1.FocusedNode);
                    m_app.CustomMessageBox.MessageShow("删除成功");
                }
                catch (Exception ex)
                {
                    m_app.CustomMessageBox.MessageShow(ex.Message);
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// 点击绑定模板的树控件事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            if (e.Node == null)
            {
                return;
            }

            string type = e.Node.GetValue("NODETYPE").ToString();

            if ((type.Equals("Leaf")) && (e.Node.Tag is TempletItem))//此处只是在点击子模板的时候右侧显示相应的内容
            {
                TempletItem item = (TempletItem)e.Node.Tag;
                itemDisplayContent1.ItemName = item.ItemName;
                //显示时,换行也要体现出来
                //edit by ywk 2012年6月1日 14:37:11

                if (item.Content.Contains("\n\r"))
                {
                    itemDisplayContent1.Content = item.Content.Replace("\n\r", "\r\n");
                }
                else if (item.Content.Contains("'||chr(10)||chr(13)||'"))
                {
                    itemDisplayContent1.Content = item.Content.Replace("'||chr(10)||chr(13)||'", "\r\n");
                }
                else
                {
                    itemDisplayContent1.Content = item.Content;
                }
                //itemDisplayContent1.Content = item.Content.Replace("\n\r", "\r\n");
                //itemDisplayContent1.Content = item.Content.Replace("'||chr(10)||chr(13)||'", "\r\n");
                itemDisplayContent1.CatalogName = item.CatalogName;
                itemDisplayContent1.ISPserson   = item.IsPerson;
                itemDisplayContent1.CreateUser  = item.CreateUser;
                itemDisplayContent1.Code        = item.Code;
                //itemDisplayContent1.ContainerCode = item.Container;
                itemDisplayContent1.InitFocus();
            }
            if (type.Equals("Folder"))//当点击的是文件夹节点,右侧清空
            {
                //点击文件夹节点,勾选其属于个人模板还是科室模板 add by ywk 2012年6月28日 14:30:23
                TreeListNode focusNode   = treeList1.FocusedNode;
                string       IsPerson    = string.Empty; //区分科室小模板和个人小模板
                string       CatalogName = string.Empty; //分类名称
                string       CreateUSer  = string.Empty; //创建人
                if (focusNode != null)
                {
                    IsPerson    = focusNode.GetValue("ISPERSON").ToString();
                    CatalogName = focusNode.GetValue("ITEMNAME").ToString();   //分类名称
                    CreateUSer  = focusNode.GetValue("CREATEUSER").ToString(); //创建人
                }
                itemDisplayContent1.Code        = string.Empty;
                itemDisplayContent1.ItemName    = "";
                itemDisplayContent1.CatalogName = CatalogName;
                itemDisplayContent1.CreateUser  = CreateUSer;
                itemDisplayContent1.Content     = "";
                itemDisplayContent1.ISPserson   = IsPerson;
                //itemDisplayContent1.ISPserson = item.IsPerson;
            }
            //设置当前位置 add by cyq 2012-10-08
            string currentLocation = GetCurrentLocation();

            this.lbl_currentLocation.Text    = currentLocation;
            this.lbl_currentLocation.ToolTip = currentLocation;
        }
コード例 #5
0
        /// <summary>
        /// add by  ywk 2012年6月1日 14:54:43
        ///  修改模板的功能
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnEditTempl_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }
            TreeListNode focusNode = treeList1.FocusedNode;

            if (!treeList1.FocusedNode.GetValue("NODETYPE").ToString().Equals("Leaf"))
            {
                m_app.CustomMessageBox.MessageShow("请选择模板");
                return;
            }
            //新增时先记录点击的节点以便修改后还是定位在此处
            string nodeID = string.Empty;

            if (this.treeList1.FocusedNode != null)
            {
                nodeID = treeList1.FocusedNode.GetValue("ID").ToString();
            }

            TempletItem item = (TempletItem)treeList1.FocusedNode.Tag;

            //原显示是有问题的add by 杨伟康
            if (item.Content.Contains("\n\r"))
            {
                m_ItemContent.MyItem.Content = item.Content.Replace("\n\r", "\r\n");
            }
            else if (item.Content.Contains("'||chr(10)||chr(13)||'"))
            {
                m_ItemContent.MyItem.Content = item.Content.Replace("'||chr(10)||chr(13)||'", "\r\n");
            }
            else
            {
                m_ItemContent.MyItem.Content = item.Content;
            }
            //m_ItemContent.MyItem.Content = item.Content.Replace("\n\r", "\r\n");


            m_ItemContent.MyItem.Code        = item.Code;        //模板CODE
            m_ItemContent.MyItem.ItemName    = item.ItemName;    //模板名称
            m_ItemContent.MyItem.CatalogName = item.CatalogName; //分类名称
            m_ItemContent.MyItem.ParentID    = item.ParentID;    //父节点
            m_ItemContent.MyItem.IsPerson    = item.IsPerson;    //区分科室和个人小模板
            m_ItemContent.MyItem.CreateUser  = item.CreateUser;

            //修改和删除只能控制到是创建人进行操作 add by ywk  edit by cyq 2012-09-27
            //if (m_ItemContent.MyItem.CreateUser != m_app.User.Id)
            //{
            //    m_app.CustomMessageBox.MessageShow("此模板只有创建者可以进行修改");
            //    return;
            //}
            //是否可以修改所有人创建的模板(0不可以 1;K)
            string CanEditPersonTempleteAll = AppConfigReader.GetAppConfig("CanEditPersonTempleteAll").Config;

            if (CanEditPersonTempleteAll.Trim() == "0")
            {
                string msg = GetMsgIfNotCreateUser(nodeID, item.CreateUser, 1, 0, int.Parse(item.IsPerson));
                if (!string.IsNullOrEmpty(msg))
                {
                    m_app.CustomMessageBox.MessageShow(msg);
                    return;
                }
            }
            if (m_ItemContent.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string content = string.Empty;
                if (m_ItemContent.MyItem.Content.Contains("\r\n"))//存在换行,替代插入数据库中 edit by ywk
                {
                    content = m_ItemContent.MyItem.Content.Replace("\r\n", "'||chr(10)||chr(13)||'");
                }
                else
                {
                    content = m_ItemContent.MyItem.Content;
                }
                string            updatesql = @" update emrtemplet_item_person set item_content=@content,name=@name where code=@code ";
                OracleParameter[] paraList  = new OracleParameter[]
                {
                    new OracleParameter("content", OracleType.Clob),
                    new OracleParameter("name", OracleType.VarChar),
                    new OracleParameter("code", OracleType.VarChar)
                };
                paraList[0].Value = content;
                paraList[1].Value = m_ItemContent.MyItem.ItemName;
                paraList[2].Value = item.Code;

                DS_SqlHelper.CreateSqlHelper();
                DS_SqlHelper.ExecuteNonQuery(updatesql, paraList, CommandType.Text);

                PersonItemManager_Load(null, null);
                TreeListNode leafnode = treeList1.FindNodeByKeyID(nodeID);
                m_app.CustomMessageBox.MessageShow("修改成功");
                treeList1.FocusedNode = leafnode;
            }
        }