Example #1
0
        /// <summary>
        /// treelist初始化
        /// </summary>
        private void InitTreeList()
        {
            rootDict = new Dictionary <string, string>();
            rootDict.Add("0", "麻醉事件模板");
            rootDict.Add("1", "复苏事件模板");
            rootDict.Add("2", "体外事件模板");
            Dictionary <string, EventTempletDetail> tmplist1 = new Dictionary <string, EventTempletDetail>();

            treeList1.Nodes.Clear();
            if (_isApply)
            {
                TreeListNode node = treeList1.AppendNode(new object[] { rootDict[_eventNo.ToString()] }, null);
                treeList1.AppendNode(new object[] { "公用" }, node);
                treeList1.AppendNode(new object[] { "私有" }, node);
            }
            else
            {
                _eventNo = ExtendApplicationContext.Current.EventNo;
                TreeListNode node = treeList1.AppendNode(new object[] { rootDict[_eventNo.ToString()] }, null);
                treeList1.AppendNode(new object[] { "公用" }, node);
                treeList1.AppendNode(new object[] { "私有" }, node);
            }
            _anesthesiaEventTemplet = commonRepository.GetAnesEventTempletAll().Data;
            string filterStr = "(CREATE_BY='公用' OR CREATE_BY='" + ExtendApplicationContext.Current.LoginUser.USER_JOB_ID + "')";

            //if (_isApply)
            //{
            filterStr += " AND TEMPLET_CLASS='" + _eventNo + "'";
            //}
            List <MED_ANESTHESIA_EVENT_TEMPLET> eventRows = _anesthesiaEventTemplet.Where(x => x.CREATE_BY == "公用" || x.CREATE_BY == ExtendApplicationContext.Current.LoginUser.USER_JOB_ID &&
                                                                                          (x.TEMPLET_CLASS == "0" || x.TEMPLET_CLASS == "1")).ToList();

            if (eventRows.Count > 0)
            {
                foreach (MED_ANESTHESIA_EVENT_TEMPLET row in eventRows)
                {
                    if (!tmplist1.ContainsKey(row.TEMPLET_NAME))
                    {
                        EventTempletDetail tmp = new EventTempletDetail();
                        tmp.Owner = row.CREATE_BY;
                        tmp.Name  = row.TEMPLET_NAME;
                        //tmp.AnesMethod = row.ANESTHESIA_METHOD.Equals("*") ? "通用" : row.ANESTHESIA_METHOD;
                        tmp.AnesMethod   = row.ANESTHESIA_METHOD;
                        tmp.TempletClass = row.TEMPLET_CLASS;
                        tmplist1.Add(row.TEMPLET_NAME, tmp);
                    }
                }
            }
            Dictionary <string, EventTempletDetail> .Enumerator enumertor = tmplist1.GetEnumerator();
            while (enumertor.MoveNext())
            {
                if (rootDict.ContainsKey(enumertor.Current.Value.TempletClass))
                {
                    AppendNode(enumertor.Current.Value);
                }
            }
            treeList1.ExpandAll();
        }
Example #2
0
 private void AppendNode(TreeListNode parentNode, EventTempletDetail templet)
 {
     if (parentNode != null)
     {
         TreeListNode newNode = null;
         foreach (TreeListNode node in parentNode.Nodes)
         {
             if (node.GetDisplayText(0).Equals(templet.AnesMethod))
             {
                 newNode = treeList1.AppendNode(new object[] { templet.Name }, node);
                 break;
             }
         }
         if (newNode == null)
         {
             treeList1.AppendNode(new object[] { templet.Name }, treeList1.AppendNode(new object[] { templet.AnesMethod }, parentNode));
         }
     }
 }
Example #3
0
        private void AppendNode(EventTempletDetail templet)
        {
            TreeListNode rootnode = treeList1.Nodes[0];

            foreach (TreeListNode node in treeList1.Nodes)
            {
                if (node.GetDisplayText(0) == rootDict[templet.TempletClass])
                {
                    rootnode = node;
                }
            }
            if (templet.Owner.Equals("公用"))
            {
                AppendNode(rootnode.Nodes[0], templet);
            }
            else
            {
                AppendNode(rootnode.Nodes[1], templet);
            }
        }
Example #4
0
 private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
 {
     if (e.Node != null && e.Node.ParentNode != null && e.Node.ParentNode.ParentNode != null && !e.Node.HasChildren)
     {
         BindGrid(e.Node.GetDisplayText(0));
         if (gridView1.RowCount > 0 && gridView1.FocusedRowHandle > -1)
         {
             btnDel.Enabled = true;
         }
         else
         {
             btnDel.Enabled = false;
         }
         btnApply.Enabled = true;
         EventTempletDetail templet = new EventTempletDetail();
         templet.Name       = e.Node.GetDisplayText(0);
         templet.AnesMethod = e.Node.ParentNode.GetDisplayText(0);
         if (e.Node.ParentNode.ParentNode.GetDisplayText(0).Equals("私有"))
         {
             templet.Owner = ExtendApplicationContext.Current.LoginUser.USER_JOB_ID;
         }
         else
         {
             templet.Owner = "公用";
             if (!ExtendApplicationContext.Current.LoginUser.isMDSD && !_hasPublicTempletRight)
             {
                 btnDel.Enabled = false;
             }
         }
         currentTemplet = templet;
     }
     else
     {
         gridControl1.DataSource = null;
         btnApply.Enabled        = false;
         btnDel.Enabled          = false;
     }
     btnSave.Enabled = false;
 }
Example #5
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textEdit2.Text.Trim()))
            {
                MessageBoxFormPC.Show("模板名不能为空!", "提示信息");
                return;
            }
            List <MED_ANESTHESIA_EVENT_TEMPLET> anesthesiaEventTempletDataTable = commonRepository.GetAnesEventTemplet(textEdit2.Text.Trim()).Data;

            if (anesthesiaEventTempletDataTable != null && anesthesiaEventTempletDataTable.Count > 0)
            {
                MessageBoxFormPC.Show("模板名已存在!", "提示信息");
                return;
            }
            if (ParentForm != null && ParentForm.Modal)
            {
                ParentForm.DialogResult = DialogResult.OK;
                EventTempletDetail templet = new EventTempletDetail();
                templet.AnesMethod = string.IsNullOrEmpty(textEdit1.Text.Trim()) ? "通用" : textEdit1.Text.Trim();
                templet.Name       = textEdit2.Text;
                templet.Owner      = checkEdit1.Checked ? ExtendApplicationContext.Current.LoginUser.USER_JOB_ID : "公用";
                DialogResultData   = templet;
            }
        }