Exemple #1
0
        private void SetBrench2(List <string> newPaths, List <TreeNode> xnode)
        {
            List <TreeNode> tnodes  = new List <TreeNode>();
            List <string>   pathsss = new List <string>();

            for (int i = 0; i < newPaths.Count() || i < xnode.Count(); i++)
            //for (int i = 0; i <3; i++)
            {
                List <string> getNewFolder = new List <string>();
                List <string> getNewFile   = new List <string>();
                getNewFolder = GetDirFile.FTPGetDirctory(newPaths[i], ftpUserName, ftpPassword);
                getNewFile   = GetDirFile.FTPGetFile(newPaths[i], ftpUserName, ftpPassword);
                if (getNewFolder == null)
                {
                    break;
                }
                else if (getNewFolder != null)
                {
                    getNewFolder.Remove("paracast");
                    getNewFolder.Remove("pics");
                    getNewFolder.Remove("precast");
                    foreach (string TypeDirName in getNewFolder)
                    {
                        TreeNode tnode = new TreeNode(TypeDirName);
                        tnode.Name = TypeDirName;
                        tnode.Tag  = tnode.Name;
                        pathsss.Add(newPaths[i] + TypeDirName + "/");
                        tnodes.Add(tnode);

                        xnode[i].Nodes.Add(tnode);
                    }
                    SetBrench(pathsss, tnodes);
                }
            }
        }
Exemple #2
0
        private void SetRoot2()
        {
            //FTPConnection FTPConnection = new FTPConnection();
            List <string> getFtpFolder = new List <string>();
            List <string> getFtpFile   = new List <string>();

            string rootPath = ftpConnectionLocation + "DB_Family_Library_FTP/";

            getFtpFolder = GetDirFile.FTPGetDirctory(rootPath, ftpUserName, ftpPassword);
            getFtpFile   = GetDirFile.FTPGetFile(rootPath, ftpUserName, ftpPassword);

            List <TreeNode> tnodes  = new List <TreeNode>();
            List <string>   pathsss = new List <string>();

            getFtpFolder.Remove("paracast");
            getFtpFolder.Remove("pics");
            getFtpFolder.Remove("precast");

            foreach (string ProDirName in getFtpFolder)
            {
                TreeNode tnode = new TreeNode(ProDirName);
                tnode.Name = ProDirName;
                tnode.Tag  = tnode.Name;
                tnodes.Add(tnode);
                pathsss.Add(rootPath + ProDirName + "/");
                this.tvw_Family.Nodes.Add(tnode);
            }
            SetBrench2(pathsss, tnodes);
        }
        //------------------------------------------------------
        #region 树状结构2
        private void SetTreeRoot()
        {
            //tvw_Family2.LabelEdit = true;

            //FTPConnection FTPConnection = new FTPConnection();
            List <string> getFtpFolder  = new List <string>();
            List <string> getFtpFile    = new List <string>();
            List <string> getFtpFolderX = new List <string>();

            string rootPath = ftpConnectionLocation + "DB_Family_Library_FTP/";

            getFtpFolder = GetDirFile.FTPGetDirctory(rootPath, ftpUserName, ftpPassword);
            getFtpFile   = GetDirFile.FTPGetFile(rootPath, ftpUserName, ftpPassword);

            getFtpFolder.Remove("paracast");
            getFtpFolder.Remove("pics");
            getFtpFolder.Remove("precast");

            foreach (string porName in getFtpFolder.Distinct())
            {
                TreeNode treeNode = new TreeNode();
                treeNode.Text = porName;
                //tvw_Family2.Nodes.Add(treeNode);
                getFtpFolderX = GetDirFile.FTPGetDirctory(rootPath + porName + "/", ftpUserName, ftpPassword);
                foreach (string catName in getFtpFolderX)
                {
                    TreeNode treeNodeX = new TreeNode();
                    treeNodeX.Text = catName;
                    treeNode.Nodes.Add(treeNodeX);
                }
                //this.tvw_Family2.Nodes.Add(treeNode);
            }
        }
Exemple #4
0
        public RevitFamilyManagerFormULS()
        {
            InitializeComponent();
            configFile();
            //ExecuteEventU = new ExecuteEventU();
            //ExternalEventU = ExternalEvent.Create(ExecuteEventU);

            //电压等级初始化
            cmb_ValLevel.Items.Add("1000kV");
            cmb_ValLevel.Items.Add("500kV");
            cmb_ValLevel.Items.Add("220kV");
            cmb_ValLevel.Items.Add("110kV");
            cmb_ValLevel.Items.Add("66kV");
            cmb_ValLevel.Items.Add("35kV");
            cmb_ValLevel.Items.Add("10kV");
            cmb_ValLevel.Items.Add("0.4kV");
            cmb_ValLevel.Items.Add("其他");
            //
            cmb_Source.Items.Add("Autodesk_Default_Family");
            cmb_Source.Items.Add("科技信息部预设");
            cmb_Source.Items.Add("SEPD-KXB-OLD-VERSION");
            cmb_Source.Items.Add("《输变电工程数字化移交标准》");
            cmb_Source.Items.Add("《城市轨道交通BIM应用系列标准》");
            cmb_Source.Items.Add("其他");

            //显示树状图
            this.SetRoot();
            //this.SetRoot2();
            List <string> xlsFileNames = GetDirFile.FTPGetFile(ftpConnectionLocation + "DB_Family_Library_FTP/precast/", ftpUserName, ftpPassword);

            //foreach (var xls in xlsFileNames)
            //{ cmb_Precast.Items.Add(xls); }
            if (allFamilyTypes == null)
            {
                MessageBox.Show("!!!!!!!!!!!!!");
            }
            else
            {
                foreach (var aft in allFamilyTypes)
                {
                    //cmb_allFamilyTypes.Items.Add(aft);
                }
            }
        }
        public RevitFamilyManagerFormUB()
        {
            InitializeComponent();

            #region  拉框初始化
            //电压等级初始化
            cmb_ValLevel.Items.Add("1000kV");
            cmb_ValLevel.Items.Add("500kV");
            cmb_ValLevel.Items.Add("220kV");
            cmb_ValLevel.Items.Add("110kV");
            cmb_ValLevel.Items.Add("66kV");
            cmb_ValLevel.Items.Add("35kV");
            cmb_ValLevel.Items.Add("10kV");
            cmb_ValLevel.Items.Add("0.4kV");
            cmb_ValLevel.Items.Add("其他");
            //
            cmb_Source.Items.Add("Autodesk_Default_Family");
            cmb_Source.Items.Add("科技信息部预设");
            cmb_Source.Items.Add("SEPD-KXB-OLD-VERSION");
            cmb_Source.Items.Add("《输变电工程数字化移交标准》");
            cmb_Source.Items.Add("《城市轨道交通BIM应用系列标准》");
            cmb_Source.Items.Add("其他");
            #endregion

            //显示树状图
            this.SetRoot();
            this.SetRoot2();
            //this.tvw_Family2 = this.tvw_Family;

            this.SetTreeRoot();

            List <string> xlsFileNames = GetDirFile.FTPGetFile(ftpConnectionLocation + "DB_Family_Library_FTP/precast/", ftpUserName, ftpPassword);

            if (allFamilyTypes == null)
            {
                MessageBox.Show("!!!!!!!!!!!!!");
            }
        }
        private void tvw_Family_MouseCaptureChanged(object sender, EventArgs e)
        {
            TreeNode tn = new TreeNode();

            try
            {
                foreach (TreeNode x in this.tvw_Family.SelectedNode.Parent.Nodes)
                {
                    if (x.IsSelected == true)
                    {
                        tn = x;
                    }
                }
            }
            catch (Exception exx)
            {
                //MessageBox.Show(exx.Message);
            }

            if (tn != null && tn.Parent != null)
            {
                familyPro  = tn.Parent.Name;
                familyType = tn.Name;

                lbl_ProText.Text  = familyPro;
                lbl_TypeText.Text = familyType;
            }

            #region listbox显示操作
            //将下属所有文件显示在listbox
            if (tn != null && tn.Parent != null)
            {
                //this.lsb_FamilyList.Items.Clear();
                //MessageBox.Show(tn.Parent.Name);
                //MessageBox.Show(tn.Name);
                //MessageBox.Show(tn.Name);
                familyPro  = tn.Parent.Name;
                familyType = tn.Name;
                List <string> fileList = GetDirFile.FTPGetFile(ftpConnectionLocation + "DB_Family_Library_FTP/" + tn.Parent.Name + "/" + tn.Name + "/", ftpUserName, ftpPassword);
                //MessageBox.Show()
                //DirectoryInfo DI = new DirectoryInfo(@"ftp://10.193.217.38/DB_Family_Library_FTP/" + tn.Parent.Name + "/" + tn.Name + "/");
                //MessageBox.Show(@"ftp://10.193.217.38/DB_Family_Library_FTP/" + tn.Parent.Name + "/" + tn.Name + "/");
                try
                {
                    //FileInfo[] files = DI.GetFiles();
                    if (fileList != null)
                    {
                        foreach (var fl in fileList)
                        {
                            //this.lsb_FamilyList.Items.Add(fl);
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
            #endregion

            #region datagridview显示操作

            //dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;

            ////sql查询
            ////sql链接初始化
            //SqlCompose SqlCompose = new SqlCompose(sqlConnectionLocation);
            ////SqlCompose.Con.Close();
            //this.dataGridView1.Rows.Clear();

            //string readPath = "SELECT * FROM table_p_Family WHERE f_Cat ='" + familyType + "'";
            //DataSet ds = SqlCompose.ExecuteSqlQuery(readPath);
            //DataTable dtTree = new DataTable();
            ////MessageBox.Show(ds.Tables[1].ToString());
            //dtTree = ds.Tables[0];
            //dgvDataTable = dtTree;
            //dtp = dtTree;
            //try
            //{
            //    List<string> picPathList = new List<string>();
            //    var ftp = new FtpHelper0(serverIP, ftpUserName, ftpPassword);

            //    lastPageNumCount = dtTree.Rows.Count % pageSize;
            //    if (lastPageNumCount != 0)
            //    {
            //        pageCount = dtTree.Rows.Count / pageSize + 1;
            //    }
            //    else if (lastPageNumCount == 0)
            //    {
            //        pageCount = dtTree.Rows.Count / pageSize;
            //    }
            //    //MessageBox.Show(dt.Rows.Count.ToString());
            //    int startRow = 0;
            //    int endRow = 0;
            //    if (pageCount == 0)
            //    { endRow = lastPageNumCount; }
            //    else if (pageCount > 0)
            //    { endRow = pageSize; }

            //    lbl_pageCount.Text = pageCount.ToString();
            //    lbl_currentPage.Text = "1";
            //    lbl_recordCount.Text = dtTree.Rows.Count.ToString();
            //    //MessageBox.Show(endRow.ToString());
            //    //MessageBox.Show(dtTree.Rows.Count.ToString());
            //    for (int i = startRow; i < endRow; i++)
            //    {
            //        int index = this.dataGridView1.Rows.Add();
            //        //var dd = dt.Rows[i]["f_Path"];
            //        //this.dataGridView1.Rows[i].Cells[0].Value = ;
            //        this.dataGridView1.Rows[index].Cells["dgv_FamilyName"].Value = dtTree.Rows[i]["f_Name"].ToString();
            //        this.dataGridView1.Rows[index].Cells["dgv_Version"].Value = "1.0";
            //        this.dataGridView1.Rows[index].Cells["dgv_Date"].Value = dtTree.Rows[i]["f_UploadDate"].ToString();
            //        this.dataGridView1.Rows[index].Cells["dgv_Type"].Value = familyType;
            //        this.dataGridView1.Rows[index].Cells["dgv_Hash"].Value = dtTree.Rows[i]["f_Hash"].ToString();
            //        this.dataGridView1.Rows[index].Cells["dgv_FamilyLoc"].Value = dtTree.Rows[i]["f_Path"].ToString();
            //        this.dataGridView1.Rows[index].Cells["dgv_ParaLoc"].Value = dtTree.Rows[i]["f_ConfigParaLocation"].ToString();
            //        this.dataGridView1.Rows[index].Cells["dgv_ValLevel"].Value = dtTree.Rows[i]["f_ValLevel"].ToString();
            //        this.dataGridView1.Rows[index].Cells["dgv_Manufacturer"].Value = dtTree.Rows[i]["f_manufacturer"].ToString();
            //        this.dataGridView1.Rows[index].Cells["dgv_Source"].Value = dtTree.Rows[i]["f_Source"].ToString();
            //        this.dataGridView1.Rows[index].Cells["dgv_DeviceType"].Value = dtTree.Rows[i]["f_DeviceType"].ToString();

            //        try
            //        {
            //            if (dtTree.Rows[i]["f_Pic"].ToString() != null)
            //            {
            //                ftp.DownloadFile(dtTree.Rows[i]["f_Pic"].ToString().Replace(ftpConnectionLocation, "").Replace("/", "\\"), xlsLocation + @"parameter_perview\");
            //                string iconPath = xlsLocation + @"parameter_perview\" + Path.GetFileName(dtTree.Rows[i]["f_Pic"].ToString());
            //                this.dataGridView1.Rows[index].Cells["dgv_Pics"].Value = Image.FromFile(iconPath);
            //            }
            //            else
            //            { continue; }
            //        }
            //        catch (Exception erew)
            //        { }
            //    }



            //}
            //catch (Exception eex)
            //{
            //    //MessageBox.Show(eex.ToString());
            //}

            #endregion
        }