Esempio n. 1
0
        private void 刷新ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            TreeNode node = Treeview.SelectedNode;

            node.Nodes.Clear();
            getDatabaseinfo();
            Treeview.ExpandAll();
        }
Esempio n. 2
0
 private void ParentView_Load(object sender, EventArgs e)
 {
     Text = "Release Log Details - SPM Connect (" + releaseLogNumber + ")";
     FillReleaseinfo(connectapi.GrabReleaseLogDetails(releaseLogNumber));
     Startprocessfortreeview();
     Treeview.ExpandAll();
     log4net.Config.XmlConfigurator.Configure();
     log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
     log.Info("Opened Item Details " + releaseLogNumber + " by " + System.Environment.UserName);
 }
Esempio n. 3
0
 private void Expandchk_Click(object sender, EventArgs e)
 {
     if (Expandchk.Checked)
     {
         Treeview.ExpandAll();
     }
     else
     {
         Treeview.CollapseAll();
     }
 }
Esempio n. 4
0
        private void refreshToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            TreeNode node = Treeview.SelectedNode;

            if (node != null && node.Level > 1)
            {
                node.Nodes.Clear();
                getDatabaseinfo(node);
                Treeview.ExpandAll();
            }
        }
Esempio n. 5
0
 private void ParentView_Load(object sender, EventArgs e)
 {
     // Suspend the layout logic for the form, while the application is initializing
     this.SuspendLayout();
     Text = "Release Log Details - SPM Connect (" + releaseLogNumber + ")";
     FillReleaseinfo(connectapi.GrabReleaseLogDetails(releaseLogNumber));
     Startprocessfortreeview();
     Treeview.ExpandAll();
     log4net.Config.XmlConfigurator.Configure();
     log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
     log.Info("Opened Item Details " + releaseLogNumber + " ");
     // Resume the layout logic
     this.ResumeLayout();
 }
Esempio n. 6
0
        private void TreeView1_DragDrop(object sender, DragEventArgs e)
        {
            var rowToMove  = e.Data.GetData(typeof(DataGridViewRow)) as DataGridViewRow;
            var itemnumber = Convert.ToString(rowToMove.Cells[0].Value);

            if (itemnumber == assynotxt.Text)
            {
                MessageBox.Show("Cannot add parent item as child", "SPM Conect", MessageBoxButtons.OK, MessageBoxIcon.Information);
                itemnotxt.Clear();
                return;
            }
            var description = Convert.ToString(rowToMove.Cells[1].Value);
            var family      = Convert.ToString(rowToMove.Cells[2].Value);
            var oem         = Convert.ToString(rowToMove.Cells[3].Value);
            var oemitem     = Convert.ToString(rowToMove.Cells[4].Value);

            _SearchNodes(itemnumber, Treeview.Nodes[0]);

            if (itemexists != "yes")
            {
                bool isrevised = IsRevised();
                var  child     = new TreeNode
                {
                    Text = itemnumber + " - " + description + " (1)",
                    Tag  = itemnumber + "][" + description + "][" + family + "][" + oem + "][" + oemitem + "][" + "1" + "][" + " " + "][" + (isrevised ? "1" : "0")
                };
                if (isrevised)
                {
                    child.BackColor = Color.LightYellow;
                }
                else
                {
                    child.BackColor = Color.LightGreen;
                }
                root.Nodes.Add(child);

                CallRecursive();
                if (!(root.IsExpanded))
                {
                    Treeview.ExpandAll();
                }

                savbttn.Visible = true;
            }
            else
            {
                itemexists = null;
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 双击treeview
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tview_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            TreeNode node = Treeview.SelectedNode;

            if (node == null)
            {
                return;
            }

            if (node.Level == 0)
            {
                node.Nodes.Clear();
                getServers();
                Treeview.ExpandAll();
            }
            else if (node.Level == 1)
            {
                node.Nodes.Clear();

                getDatabaseinfo(node);
            }
            else if (node.Level == 4)
            {
                if (null != newcontentForm)
                {
                    ConnectionModel conModel = _ConnectList.Find(delegate(ConnectionModel con) { return(con.ID.ToString().Equals(Treeview.SelectedNode.Parent.Parent.Parent.Tag.ToString())); });

                    if (conModel.DbType.Equals(DatabaseType.MongoDB.ToString()))
                    {
                        //todo

                        MongoDBTool.Connect(conModel.ConnectionString).GetList(node.Parent.Parent.Text, node.Text, "{\"find\":\"Account\", limit:20, sort:{AddTime:-1}}");
                    }
                    else
                    {
                        conConnectionString = Treeview.SelectedNode.Parent.Parent.Tag.ToString();
                        try
                        {
                            conModel.TableName = Treeview.SelectedNode.Text;
                            conModel.Database  = Treeview.SelectedNode.Parent.Parent.Text;
                            conModel.IsView    = Treeview.SelectedNode.Tag.ToString().Equals("V");
                            newcontentForm?.Invoke(conModel);
                        }
                        catch { }
                    }
                }
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 获取服务器列表
        /// </summary>
        private void getServers()
        {
            Treeview.Nodes.Clear();

            Treeview.Nodes.Add("服务器", "数据库服务器", 0);

            _ConnectList = UtilsHelper.GetConnectionList();

            TreeNode node = Treeview.Nodes[0];

            node.ContextMenuStrip = contextMenuStripTop;

            foreach (Connection connection in _ConnectList)
            {
                TreeNode nnode = new TreeNode(connection.Name, 0, 0);
                nnode.ContextMenuStrip = contextMenuStripDatabase;
                nnode.Tag = connection.ID.ToString();
                node.Nodes.Add(nnode);
            }

            Treeview.ExpandAll();
        }
Esempio n. 9
0
        private void Addbutton_Click(object sender, EventArgs e)
        {
            try
            {
                errorProvider1.Clear();
                if (qtytxtbox.Text.Length > 0 && qtytxtbox.Text != "0" && itemnotxt.Text.Length > 0)
                {
                    if (itemnotxt.Text == assynotxt.Text)
                    {
                        MessageBox.Show("Cannot add parent item as child", "SPM Conect", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        itemnotxt.Clear();
                        return;
                    }
                    var iteminfo = new DataTable();
                    iteminfo.Clear();
                    iteminfo = connectapi.GetIteminfo(itemnotxt.Text);
                    var r = iteminfo.Rows[0];
                    if (iteminfo.Rows.Count > 0)
                    {
                        var _itemno       = itemnotxt.Text;
                        var _description  = r["Description"].ToString();
                        var _family       = r["FamilyCode"].ToString();
                        var _oem          = r["Manufacturer"].ToString();
                        var _manufacturer = r["ManufacturerItemNumber"].ToString();
                        var qty           = qtytxtbox.Text;
                        var notes         = itemnotestxt.Text;

                        SearchNodes(_itemno, Treeview.Nodes[0]);

                        if (itemexists != "yes")
                        {
                            bool isrevised = IsRevised();
                            var  child     = new TreeNode
                            {
                                Text = _itemno + " - " + _description + " (" + qty + ")",
                                Tag  = _itemno + "][" + _description + "][" + _family + "][" + _manufacturer + "][" + _oem + "][" + qty + "][" + notes + "][" + (isrevised ? "1" : "0") + "][5445"
                            };

                            Treeview.SelectedNode = Treeview.Nodes[0];
                            child.BackColor       = isrevised ? Color.LightYellow : Color.LightGreen;
                            root.Nodes.Add(child);
                            CallRecursive();
                            if (!root.IsExpanded)
                            {
                                Treeview.ExpandAll();
                            }

                            savbttn.Visible = true;
                            itemnotxt.Clear();
                        }
                        else
                        {
                            savbttn.Visible = false;
                            itemexists      = null;
                            itemnotxt.Clear();
                        }
                    }
                }
                else
                {
                    if (itemnotxt.Text.Length > 0)
                    {
                        errorProvider1.SetError(qtytxtbox, "Qty cannot be null");
                    }
                    else
                    {
                        errorProvider1.SetError(itemnotxt, "ItemNo cannot be null");
                    }
                }
            }
            catch
            {
                return;
            }
        }
Esempio n. 10
0
 public LeftPanelForm()
 {
     InitializeComponent();
     Treeview.ExpandAll();
 }
Esempio n. 11
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void 刷新ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     refreshConnectionList();
     Treeview.ExpandAll();
 }