Beispiel #1
0
 private void Bind()
 {
     try
     {
         TitleText = "客户一";
         NodeView1.Items.Clear();
         OperationalInfo OperationalInfo = new OperationalInfo();
         DataTable       table           = OperationalInfo.GetORDataByCU();
         if (table.Rows.Count > 0)
         {
             foreach (DataRow row in table.Rows)
             {
                 NodeViewItem nodeItem = new NodeViewItem();
                 nodeItem.Text         = row["OR_NO"].ToString();
                 nodeItem.TextColor    = System.Drawing.Color.FromArgb(Convert.ToInt32(Convert.ToByte(45)), Convert.ToInt32(Convert.ToByte(45)), Convert.ToInt32(Convert.ToByte(45)));
                 nodeItem.SubText      = row["OR_FAULTINFO"].ToString();
                 nodeItem.SubTextColor = System.Drawing.Color.FromArgb(Convert.ToInt32(Convert.ToByte(145)), Convert.ToInt32(Convert.ToByte(145)), Convert.ToInt32(Convert.ToByte(145)));
                 nodeItem.Icon         = row["OR_PROCESSRESULT"].ToString();
                 nodeItem.Date         = Convert.ToDateTime(row["OR_DECLAREDATE"]);
                 nodeItem.DateColor    = System.Drawing.Color.FromArgb(Convert.ToInt32(Convert.ToByte(145)), Convert.ToInt32(Convert.ToByte(145)), Convert.ToInt32(Convert.ToByte(145)));
                 NodeView1.Items.Add(nodeItem);
             }
         }
         lblQty.Text = "运维记录:3";
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #2
0
 protected override void OnEditValueChanged()
 {
     if (base.EditValue != null)
     {
         object[] items = base.Items;
         //this.vsPropertyGrid1.Site = new CollectionEditor.PropertyGridSite(base.Context, this.vsPropertyGrid1);
         NodeViewItem[] nodes = new NodeViewItem[items.Length];
         for (int i = 0; i < items.Length; i++)
         {
             nodes[i] = (NodeViewItem)((NodeViewItem)items[i]).Clone();
         }
         this.treeView1.NodeViewItems.Clear();
         //foreach (NodeViewItem one in this.treeView1.NodeViewItems)
         foreach (NodeViewItem one in nodes)
         {
             this.treeView1.NodeViewItems.Add(one);
         }
         this.m_CurrentNode       = null;
         this.btnAddChild.Enabled = false;
         this.btnDelete.Enabled   = false;
         NodeViewItemTreeItem treeView = this.TreeView;
         if ((items.Length > 0) && (nodes[0] != null))
         {
             this.treeView1.SelectedNode = nodes[0];
         }
     }
 }
Beispiel #3
0
 private void SetNodeProps(NodeViewItem node)
 {
     if (node != null)
     {
         this.lblRight.Text = node.Name.ToString() + " 属性(&P)";
     }
     else
     {
         this.lblRight.Text = "节点 属性(&P)";
     }
     this.vsPropertyGrid1.SelectedObject = node;
 }
Beispiel #4
0
 private bool CheckParent(NodeViewItem child, NodeViewItem parent)
 {
     while (child != null)
     {
         if (parent == child.ParentNode)
         {
             return(true);
         }
         child = child.ParentNode;
     }
     return(false);
 }
Beispiel #5
0
            private void btnDelete_Click(object sender, EventArgs e)
            {
                INodeViewList pNodeViewList = this.m_CurrentNode.NodeViewList;

                if (pNodeViewList != null)
                {
                    pNodeViewList.NodeViewItems.Remove(this.m_CurrentNode);
                    if (this.treeView1.NodeViewItems.Count == 0)
                    {
                        this.m_CurrentNode = null;
                        this.SetNodeProps(null);
                    }
                    this.SetButtonsState();
                }
            }
Beispiel #6
0
            private void btnMoveUp_Click(object sender, EventArgs e)
            {
                NodeViewItem curNode = this.m_CurrentNode;
                NodeViewItem parent  = this.m_CurrentNode.ParentNode;

                if (parent == null)
                {
                    INodeViewList pNodeViewList = curNode.NodeViewList;
                    if (pNodeViewList != null && pNodeViewList.NodeViewItems.Contains(curNode))
                    {
                        int index = pNodeViewList.NodeViewItems.IndexOf(curNode);
                        this.treeView1.NodeViewItems.RemoveAt(index);
                        this.treeView1.NodeViewItems[index - 1].NodeViewItems.Add(curNode);
                    }
                }
                else
                {
                    INodeViewList pNodeViewList = curNode.NodeViewList;
                    if (pNodeViewList != null && pNodeViewList.NodeViewItems.Contains(curNode))
                    {
                        int index = pNodeViewList.NodeViewItems.IndexOf(curNode);
                        parent.NodeViewItems.RemoveAt(index);
                        if (index == 0)
                        {
                            INodeViewList pNodeViewList2 = parent.NodeViewList;
                            if (pNodeViewList2 != null && pNodeViewList.NodeViewItems.Contains(parent))
                            {
                                int index2 = pNodeViewList.NodeViewItems.IndexOf(curNode);
                                if (parent.ParentNode == null)
                                {
                                    this.treeView1.NodeViewItems.Insert(index2, curNode);
                                }
                                else
                                {
                                    parent.ParentNode.NodeViewItems.Insert(index2, curNode);
                                }
                            }
                        }
                        else
                        {
                            parent.NodeViewItems[index - 1].NodeViewItems.Add(curNode);
                        }
                    }
                }
                this.treeView1.SelectedNode = curNode;
                this.m_CurrentNode          = curNode;
            }
Beispiel #7
0
 public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == null)
     {
         throw new ArgumentNullException("destinationType");
     }
     if ((destinationType == typeof(InstanceDescriptor)) && (value is NodeViewItem))
     {
         NodeViewItem node = (NodeViewItem)value;
         System.Reflection.MemberInfo member = null;
         object[] arguments = new object[] { };
         member = typeof(NodeViewItem).GetConstructor(new Type[] { });
         if (member != null)
         {
             return(new InstanceDescriptor(member, arguments, false));
         }
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
Beispiel #8
0
            private void Add(NodeViewItem parent, Type type)
            {
                NodeViewItem node = Activator.CreateInstance(type) as NodeViewItem;

                //TreeNode node = base.CreateInstance(type) as TreeNode;
                if (node == null)
                {
                    return;
                }
                //
                int num;

                this.NextNode = (num = this.NextNode) + 1;
                node.Name     = type.Name + num.ToString();
                node.Text     = node.Name;
                //
                if (parent == null)
                {
                    this.treeView1.NodeViewItems.Add(node);
                }
                else
                {
                    parent.NodeViewItems.Add(node);
                    parent.Expand();
                }
                //
                if (parent != null)
                {
                    this.treeView1.SelectedNode = parent;
                }
                else
                {
                    this.treeView1.SelectedNode = node;
                    this.SetNodeProps(node);
                }
            }
Beispiel #9
0
        /// <summary>
        /// 添加节点数据
        /// </summary>
        /// <param name="leave"></param>
        private void getNodeItemDate(LeaveDetailDto leave)
        {
            //清除所有节点
            nodeStateDate.Items.Clear();
            //添加节点数据
            NodeViewItem nodeItem = new NodeViewItem();

            nodeItem.FontIcon = "circle";
            UserDetails   userDetails = new UserDetails();
            UserDetailDto createUser  = userDetails.getUser(leave.L_CreateUser);

            if (createUser != null)
            {
                nodeItem.Image = createUser.U_Portrait;
                if (Client.Session["U_ID"].Equals(leave.L_CreateUser))
                {
                    nodeItem.Text = "我";
                }
                else
                {
                    nodeItem.Text = createUser.U_Name;
                }
                nodeItem.SubText      = "发起申请";
                nodeItem.Date         = leave.L_CreateDate.ToString();
                nodeItem.TextColor    = System.Drawing.Color.FromArgb(45, 45, 45);
                nodeItem.SubTextColor = System.Drawing.Color.FromArgb(236, 163, 56);
                nodeItem.DateColor    = System.Drawing.Color.FromArgb(145, 145, 145);
                nodeStateDate.Items.Add(nodeItem);//动态添加节点
            }
            switch (leave.L_Status)
            {
            case (int)L_Status.新建:
                if (string.IsNullOrEmpty(leave.L_CheckUsers) == false)
                {
                    string[] CheckUsers = leave.L_CheckUsers.Split(',');
                    foreach (string cUser in CheckUsers)
                    {
                        NodeViewItem nodeItem2 = new NodeViewItem();
                        nodeItem2.FontIcon = "circle";

                        UserDetailDto checkUser = userDetails.getUser(cUser);
                        if (checkUser != null)
                        {
                            nodeItem2.Image = checkUser.U_Portrait;
                            if (Client.Session["U_ID"].Equals(cUser))
                            {
                                nodeItem2.Text = "我";
                            }
                            else
                            {
                                nodeItem2.Text = checkUser.U_Name;
                            }
                            nodeItem2.SubText      = "审批中";
                            nodeItem2.TextColor    = System.Drawing.Color.FromArgb(45, 45, 45);
                            nodeItem2.SubTextColor = System.Drawing.Color.FromArgb(236, 163, 56);
                            nodeStateDate.Items.Add(nodeItem2);
                        }
                    }
                }
                break;

            case (int)L_Status.已审批:
                NodeViewItem nodeItem3 = new NodeViewItem();
                nodeItem3.FontIcon = "circle";
                UserDetailDto checkUser1 = userDetails.getUser(leave.L_CurrantCheck);
                if (checkUser1 != null)
                {
                    nodeItem3.Image = checkUser1.U_Portrait;
                    if (Client.Session["U_ID"].Equals(leave.L_CurrantCheck))
                    {
                        nodeItem3.Text = "我";
                    }
                    else
                    {
                        nodeItem3.Text = checkUser1.U_Name;
                    }
                    nodeItem3.SubText      = "已同意";
                    nodeItem3.Date         = leave.L_UpdateDate.ToString();
                    nodeItem3.TextColor    = System.Drawing.Color.FromArgb(45, 45, 45);
                    nodeItem3.SubTextColor = System.Drawing.Color.FromArgb(143, 187, 78);
                    nodeItem3.DateColor    = System.Drawing.Color.FromArgb(145, 145, 145);
                    nodeStateDate.Items.Add(nodeItem3);
                }


                break;

            case (int)L_Status.已拒绝:
                NodeViewItem nodeItem4 = new NodeViewItem();
                nodeItem4.FontIcon = "circle";
                UserDetailDto checkUser2 = userDetails.getUser(leave.L_CurrantCheck);
                if (checkUser2 != null)
                {
                    nodeItem4.Image = checkUser2.U_Portrait;
                    if (Client.Session["U_ID"].Equals(leave.L_CurrantCheck))
                    {
                        nodeItem4.Text = "我";
                    }
                    else
                    {
                        nodeItem4.Text = checkUser2.U_Name;
                    }
                    nodeItem4.SubText      = "已拒绝";
                    nodeItem4.Date         = leave.L_UpdateDate.ToString();
                    nodeItem4.TextColor    = System.Drawing.Color.FromArgb(45, 45, 45);
                    nodeItem4.SubTextColor = System.Drawing.Color.FromArgb(244, 64, 69);
                    nodeItem4.DateColor    = System.Drawing.Color.FromArgb(145, 145, 145);
                    nodeStateDate.Items.Add(nodeItem4);
                }
                break;
            }
        }
Beispiel #10
0
 private void treeView1_SelectedNodeChanged(object sender, PropertyChangedEventArgs e)
 {
     this.m_CurrentNode = e.NewValue as NodeViewItem;
     this.SetNodeProps(this.m_CurrentNode);
     this.SetButtonsState();
 }