Beispiel #1
0
 private void BindPxInfo(string ParentID, int Flg)
 {
     if (Flg == 0)
     {
         BLL.T_FileList_BLL FileList_BLL = new ERM.BLL.T_FileList_BLL();
         DataTable          tbl_FileList = FileList_BLL.GetFileByGDID(Globals.ProjectNO, ParentID);
         if (tbl_FileList != null && tbl_FileList.Rows.Count > 0)
         {
             int index = 1;
             foreach (DataRow f_row in tbl_FileList.Rows)
             {
                 dgv_PX.Rows.Add();
                 dgv_PX.Rows[dgv_PX.Rows.Count - 1].Cells["cl_ID"].Value    = f_row["FileID"].ToString();
                 dgv_PX.Rows[dgv_PX.Rows.Count - 1].Cells["cl_Index"].Value = index;
                 dgv_PX.Rows[dgv_PX.Rows.Count - 1].Cells["cl_Name"].Value  = f_row["wjtm"].ToString();
                 index++;
             }
         }
     }
     else if (Flg == 1)
     {
         BLL.T_CellAndEFile_BLL     CellAndEFile_BLL = new ERM.BLL.T_CellAndEFile_BLL();
         IList <MDL.T_CellAndEFile> CellAndEFile_List
             = CellAndEFile_BLL.FindByGdFileID(ParentID, Globals.ProjectNO);
         int index = 1;
         foreach (MDL.T_CellAndEFile ef_MDL in CellAndEFile_List)
         {
             dgv_PX.Rows.Add();
             dgv_PX.Rows[dgv_PX.Rows.Count - 1].Cells["cl_ID"].Value    = ef_MDL.CellID;
             dgv_PX.Rows[dgv_PX.Rows.Count - 1].Cells["cl_Index"].Value = index;
             dgv_PX.Rows[dgv_PX.Rows.Count - 1].Cells["cl_Name"].Value  = ef_MDL.title;
             index++;
         }
     }
 }
Beispiel #2
0
        private void DeleteRecycle(string FileID, ref frm2PDFProgressMsg frmMsg)
        {
            BLL.T_FileList_BLL     fileBLL  = new ERM.BLL.T_FileList_BLL();
            IList <MDL.T_FileList> fileList = fileBLL.FindByParentID(FileID, Globals.ProjectNO);

            foreach (MDL.T_FileList obj in fileList)
            {
                DeleteRecycle(obj.FileID, ref frmMsg);
            }

            BLL.T_CellAndEFile_BLL     cellBLL  = new ERM.BLL.T_CellAndEFile_BLL();
            IList <MDL.T_CellAndEFile> cellList = cellBLL.FindByFileID(FileID, Globals.ProjectNO, 0);

            foreach (MDL.T_CellAndEFile obj in cellList)
            {
                if (System.IO.File.Exists(Globals.ProjectPath + obj.filepath))
                {
                    System.IO.File.Delete(Globals.ProjectPath + obj.filepath);
                }
                if (System.IO.File.Exists(Globals.ProjectPath + obj.fileTreePath))
                {
                    System.IO.File.Delete(Globals.ProjectPath + obj.fileTreePath);
                }
                cellBLL.Delete(obj.CellID, Globals.ProjectNO);
            }

            fileBLL.Delete(FileID, Globals.ProjectNO);

            if (frmMsg.progressBar1.Value < frmMsg.progressBar1.Maximum)
            {
                frmMsg.progressBar1.Value++;
            }
            frmMsg.label2.Text = "正在删除:" + frmMsg.progressBar1.Value.ToString() + "/" + frmMsg.progressBar1.Maximum.ToString();
            Application.DoEvents();
        }
Beispiel #3
0
        /// <summary>
        /// 廊坊的   原文打包
        /// </summary>
        /// <param name="ds"></param>
        /// <param name="i"></param>
        private void getDocModel(MDL.T_FileList obj)
        {
            string FileID       = obj.FileID;// ds.Tables[0].Rows[fileIndex]["FileID"].ToString();
            string decFilePath  = Application.StartupPath + "\\temp\\" + obj.FileID + ".xml";
            string sourFilePath = Application.StartupPath + "\\Reports\\model.xml";

            System.IO.File.Copy(sourFilePath, decFilePath);
            XmlDocument document = new XmlDocument();

            document.Load(decFilePath);
            XmlNode rootFirst = document.SelectSingleNode("元数据/内容信息/数据对象");
            XmlNode childNode = rootFirst.FirstChild;

            if (childNode.Name == "数字对象")
            {
                string tFilePath = obj.filepath.Replace("MPDF\\", "");
                string decMfile  = Application.StartupPath + "\\temp\\" + tFilePath;
                string sourMfile = Globals.ProjectPath + obj.filepath;
                try
                {
                    System.IO.File.Copy(sourMfile, decMfile);
                    childNode.InnerText = obj.filepath;
                    document.Save(decFilePath);
                }
                catch { }
            }
            BLL.T_CellAndEFile_BLL     cellBLL  = new ERM.BLL.T_CellAndEFile_BLL();
            IList <MDL.T_CellAndEFile> cellList = cellBLL.FindByFileID(FileID, Globals.ProjectNO, 1);
            XmlNode root1 = document.SelectSingleNode("元数据/内容信息/数据对象/物理对象");

            foreach (MDL.T_CellAndEFile obj2 in cellList)
            {
                string     yswjpath      = obj2.filepath.Replace("ODOC\\", "");
                XmlElement elementRecord = document.CreateElement("记录");
                elementRecord.InnerText = "";
                XmlElement element = document.CreateElement("对象名称");
                element.InnerText = yswjpath;                                  // dsAttachment.Tables[0].Rows[ii]["yswjpath"].ToString();
                elementRecord.AppendChild(element);
                string dec  = Application.StartupPath + "\\temp\\" + yswjpath; // dsAttachment.Tables[0].Rows[ii]["yswjpath"];
                string sour = Globals.ProjectPath + obj2.filepath;             // dsAttachment.Tables[0].Rows[ii]["yswjpath"];
                try
                {
                    System.IO.File.Copy(sour, dec);
                }
                catch { }
                if (progressBar1.Value < progressBar1.Maximum)
                {
                    progressBar1.Value++;
                }
                else
                {
                    progressBar1.Value = 1;
                }
                Application.DoEvents();
            }
            document.Save(decFilePath);
        }
Beispiel #4
0
        public IList <MDL.T_CellAndEFile> GetNodeChildren(string nodeid, string ProjectNO, string path, int type_flg)
        {
            BLL.T_CellAndEFile_BLL     cellBLL  = new ERM.BLL.T_CellAndEFile_BLL();
            IList <MDL.T_CellAndEFile> cellList = (type_flg == 0 ? cellBLL.FindByFileID(nodeid, ProjectNO) : cellBLL.FindByFileID(nodeid, ProjectNO, 1));

            BLL.T_FileList_BLL     fileBLL  = new ERM.BLL.T_FileList_BLL();
            IList <MDL.T_FileList> fileList = fileBLL.FindByParentID(nodeid, ProjectNO);

            foreach (MDL.T_FileList fileMDL in fileList)
            {
                IList <MDL.T_CellAndEFile> cellList2 = GetNodeChildren(fileMDL.FileID, ProjectNO, path, type_flg);
                foreach (MDL.T_CellAndEFile obj in cellList2)
                {
                    cellList.Add(obj);
                }
            }
            return(cellList);
        }
        /// <summary>
        /// 浏览
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnExplorer_Click(object sender, EventArgs e)
        {
            openFileDialog1.InitialDirectory = Globals.CellPath;
            openFileDialog1.Filter           = "(*.cll)| *.cll";
            openFileDialog1.Title            = "选择自定义模板";
            openFileDialog1.FileName         = "";
            DialogResult ret = openFileDialog1.ShowDialog();

            if (ret == DialogResult.OK)
            {
                ;
                txtLocalPath.Text = openFileDialog1.FileName;
                string strPath = txtLocalPath.Text.ToLower();
                if (txtTitle.Text.Trim() == "")
                {
                    txtTitle.Text = Path.GetFileNameWithoutExtension(strPath);
                }
                if (strPath.StartsWith(Globals.CellPath.ToLower()))
                {
                    DataView dv = new ERM.BLL.T_CellAndEFile_BLL().GetList(" filepath='" + strPath.Remove(0, Globals.CellPath.Length) + "'").Tables[0].DefaultView;
                    if (dv.Count > 0)
                    {
                        //if (txtCodeno.Text.Trim() == "")
                        //    txtCodeno.Text = dv[0]["codeno"].ToString();
                    }
                }
                if (txtLocalPath.Text.Trim() != "")
                {
                    btnSure.Enabled = true;
                }
                else
                {
                    btnSure.Enabled = false;
                }
            }
        }
Beispiel #6
0
        private void frmDelInfo_Shown(object sender, EventArgs e)
        {
            if (_Action_Flg == 1)
            {
                TreeNode nodeGD = new TreeNode();
                nodeGD.Text = _TNode.Text;
                nodeGD.Tag  = _TNode.Name;
                nodeGD.SelectedImageIndex = 1;
                nodeGD.ImageIndex         = 1;
                nodeGD.Name = _TNode.Name;

                (new TreeFactory()).InitGDTree(Globals.ProjectNO, _TreeNodeState_flg, nodeGD,
                                               true, 2, true);

                //BLL.T_FileList_BLL FileList_BLL = new BLL.T_FileList_BLL();
                ////归档类别
                //DataTable tbl_FileInfo = FileList_BLL.GetFileByGDID(Globals.ProjectNO, _TNode.Name);
                //if (tbl_FileInfo != null)
                //{
                //    foreach (DataRow f_row in tbl_FileInfo.Rows)
                //    {
                //        TreeNode File_Node = new TreeNode();
                //        File_Node.Text = f_row["wjtm"].ToString();
                //        File_Node.Tag = f_row["FileID"].ToString();
                //        File_Node.StateImageKey = f_row["filepath"].ToString();
                //        File_Node.Name = f_row["FileID"].ToString();

                //        int fileStatus = MyCommon.ToInt(f_row["fileStatus"]);
                //        if (fileStatus == 6)
                //            File_Node.SelectedImageIndex = 4;//组卷
                //        else
                //        {
                //            if (fileStatus == 4)//判断是否登记
                //                File_Node.SelectedImageIndex = 5;
                //            else
                //            {
                //                if (isShowEFileCount)
                //                    tNode.SelectedImageIndex = (EfileCount_flg == true) ? 7 : 2;//判断是否有电子文件
                //                else
                //                {
                //                    DataRow[] ERows = dTable2.Select("FileID='" + tNode.Name + "' AND DoStatus='1'");
                //                    if (ERows != null && ERows.Length > 0)//判断是否有电子文件
                //                        tNode.SelectedImageIndex = 7;
                //                    else
                //                        tNode.SelectedImageIndex = 2;
                //                }
                //            }
                //        }


                //        if (f_row["fileStatus"] != null &&
                //            f_row["fileStatus"].ToString() == "6")
                //        {
                //            File_Node.SelectedImageIndex = 4;
                //            File_Node.ImageIndex = 4;
                //        }
                //        else
                //        {
                //            File_Node.SelectedImageIndex = 2;
                //            File_Node.ImageIndex = 2;
                //        }
                //        nodeGD.Nodes.Add(File_Node);
                //    }
                //}
                tv_Info.Nodes.Add(nodeGD);
                tv_Info.ExpandAll();
            }
            else if (_Action_Flg == 2)
            {
                //删除电子文件
                TreeNode nodeFile = new TreeNode();
                nodeFile.Text = _TNode.Text;
                nodeFile.Tag  = _TNode.Name;
                nodeFile.SelectedImageIndex = 1;
                nodeFile.ImageIndex         = 1;
                nodeFile.Name = _TNode.Name;

                BLL.T_CellAndEFile_BLL     cellFile = new ERM.BLL.T_CellAndEFile_BLL();
                IList <MDL.T_CellAndEFile> cellList =
                    cellFile.FindByGdFileID(_TNode.Name, Globals.ProjectNO);
                foreach (MDL.T_CellAndEFile obj in cellList)
                {
                    TreeNodeEx cnode = new TreeNodeEx();
                    cnode.Text               = obj.title;
                    cnode.Name               = obj.CellID;
                    cnode.NodeValue          = obj.filepath;
                    cnode.ImageIndex         = 3;
                    cnode.SelectedImageIndex = 3;
                    nodeFile.Nodes.Add(cnode);
                }
                tv_Info.Nodes.Add(nodeFile);
                tv_Info.ExpandAll();
            }
        }
Beispiel #7
0
        private void menuPasteFile_Click(object sender, EventArgs e)
        {
            TreeNodeEx theNode = treeView1.SelectedNode as TreeNodeEx;

            if (theNode == null)
            {
                return;
            }
            if (CopyFileID != "")
            {
                BLL.T_FileList_BLL fileBLL = new ERM.BLL.T_FileList_BLL();
                //fileBLL.FindByFileID(

                MDL.T_FileList fileMDL   = fileBLL.Find(CopyFileID, Globals.ProjectNO);
                string         OldFileID = fileMDL.FileID;
                string         NewFileID = Guid.NewGuid().ToString().ToUpper();
                fileMDL.FileID     = NewFileID;
                fileMDL.ParentID   = theNode.Name;
                fileMDL.ArchiveID  = "";
                fileMDL.fileStatus = "0";
                fileMDL.wjtm      += "_复制";
                fileMDL.gdwj      += "_复制";
                fileMDL.OrderIndex = fileBLL.GetMaxOrderIndex(theNode.Name, Globals.ProjectNO) + 1;
                fileBLL.Add(fileMDL);

                BLL.T_CellAndEFile_BLL     cellTplBLL  = new ERM.BLL.T_CellAndEFile_BLL();
                IList <MDL.T_CellAndEFile> cellTplList = cellTplBLL.FindByFileID(CopyFileID, Globals.ProjectNO);//cellTplBLL.FindByFileID(CopyFileID, Globals.ProjectNO, 0);

                foreach (MDL.T_CellAndEFile obj in cellTplList)
                {
                    string newCellID = Guid.NewGuid().ToString().ToUpper();
                    string fileName  = Globals.ProjectPath + obj.filepath;

                    if (System.IO.File.Exists(fileName))
                    {
                        System.IO.File.Copy(fileName, fileName.ToUpper().Replace(obj.CellID.ToUpper(), newCellID), true);
                        obj.filepath = obj.filepath.ToUpper().Replace(obj.CellID.ToUpper(), newCellID);
                    }
                    else
                    {
                        obj.filepath = "";
                    }

                    string fileNamePDF = Globals.ProjectPath + obj.fileTreePath;
                    if (System.IO.File.Exists(fileNamePDF))
                    {
                        System.IO.File.Copy(fileNamePDF, fileNamePDF.ToUpper().Replace(obj.CellID.ToUpper(), newCellID), true);
                        obj.fileTreePath = obj.fileTreePath.ToUpper().Replace(obj.CellID.ToUpper(), newCellID);
                    }
                    else
                    {
                        obj.fileTreePath = "";
                    }

                    obj.CellID = newCellID;
                    obj.FileID = NewFileID;

                    cellTplBLL.Add(obj);
                }

                TreeNodeEx newNode = new TreeNodeEx();
                newNode.Name               = fileMDL.FileID;
                newNode.Text               = fileMDL.wjtm;
                newNode.ImageIndex         = (treeFactory.CheckEFileByFileID(newNode.Name, 1) == true) ? 7 : 2;//判断是否有电子文件;
                newNode.SelectedImageIndex = newNode.ImageIndex;
                newNode.NodeValue          = fileMDL.FileID;

                theNode.Nodes.Add(newNode);
            }
            else
            {
                TXMessageBoxExtensions.Info("请先复制!");
            }
        }
Beispiel #8
0
 /// <summary>
 /// 去掉路径中的[0],*
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 public string OpeartPath(TreeNodeEx node)
 {
     BLL.T_CellAndEFile_BLL efileBLL = new ERM.BLL.T_CellAndEFile_BLL();
     return(efileBLL.Find(node.Name, Globals.ProjectNO).filepath);
 }
Beispiel #9
0
        private void CreateFile(string TableName, string ID, string TempSavePath)
        {
            if (TableName == "T_FileList")
            {
                BLL.T_FileList_BLL fileBLL = new ERM.BLL.T_FileList_BLL();
                MDL.T_FileList     fileMDL = fileBLL.Find(ID, Globals.ProjectNO);
                if (fileMDL != null)
                {
                    List <MDL.T_FileList> fileList = new List <ERM.MDL.T_FileList>();
                    fileList.Add(fileMDL);
                    DataTable ds = MyCommon.ToDataTable <MDL.T_FileList>(fileList);
                    ds.TableName = "T_FileList_" + ID;
                    ds.WriteXml(TempSavePath + "\\T_FileList\\" + ID + ".xml", XmlWriteMode.WriteSchema);

                    lblTitle.Text = @"正在导出:" + fileMDL.wjtm;

                    if (!string.IsNullOrEmpty(fileMDL.filepath) &&
                        System.IO.File.Exists(Globals.ProjectPath + fileMDL.filepath))//pdf文件
                    {
                        System.IO.File.Copy(Globals.ProjectPath + fileMDL.filepath,
                                            TempSavePath + "\\T_CellAndEFile\\" + fileMDL.filepath, true);
                    }
                }
                else
                {
                    MDL.T_GdList gdList_MDL = (new BLL.T_GdList_BLL()).FindIDAndProjectNo(ID, Globals.ProjectNO);
                    if (gdList_MDL != null)
                    {
                        List <MDL.T_GdList> GdList = new List <ERM.MDL.T_GdList>();
                        GdList.Add(gdList_MDL);
                        DataTable ds = MyCommon.ToDataTable <MDL.T_GdList>(GdList);
                        ds.TableName = "T_GdList_" + ID;
                        ds.WriteXml(TempSavePath + "\\T_GdList\\" + ID + ".xml", XmlWriteMode.WriteSchema);

                        lblTitle.Text = @"正在导出:" + gdList_MDL.GdName;
                    }
                }
                if (curIndex < progressBar1.Maximum)
                {
                    progressBar1.Value = curIndex++;
                }
                else
                {
                    progressBar1.Value = progressBar1.Maximum - 1;
                }
                Application.DoEvents();
            }
            else if (TableName == "T_CellAndEFile")
            {
                BLL.T_CellAndEFile_BLL     cellBLL  = new ERM.BLL.T_CellAndEFile_BLL();
                IList <MDL.T_CellAndEFile> cellList = cellBLL.FindByGdFileID(ID, Globals.ProjectNO);
                if (cellList.Count > 0)
                {
                    ///移除没有保存的电子表格
                    //    for (int i = 0; i < cellList.Count; i++)
                    //    {
                    //        if (cellList[i].DoStatus != 1)
                    //        {
                    //            cellList.RemoveAt(i);
                    //            i--;
                    //        }
                    //    }

                    if (cellList.Count > 0)
                    {
                        BLL.T_CellFileTemplate_BLL cellTplBLL = new ERM.BLL.T_CellFileTemplate_BLL();
                        foreach (MDL.T_CellAndEFile cellMDL in cellList)
                        {
                            if (cellMDL.filepath == null || cellMDL.filepath.Trim() == "")
                            {
                                MDL.T_CellFileTemplate cellTplMDL = cellTplBLL.Find(cellMDL.CellID);
                                if (cellTplMDL != null)
                                {
                                    string CelllTplFile = Application.StartupPath + "\\Template" + cellTplMDL.filepath;
                                    if (System.IO.File.Exists(CelllTplFile))
                                    {
                                        FileInfo fileInfo      = new FileInfo(CelllTplFile);
                                        string   NewCellFileID = cellMDL.CellID;
                                        cellMDL.filepath = "ODOC\\" + NewCellFileID + fileInfo.Extension;
                                        string NewCellFile = TempSavePath + "\\T_CellAndEFile\\ODOC\\" + NewCellFileID + fileInfo.Extension;
                                        System.IO.File.Copy(CelllTplFile, NewCellFile, true);
                                    }
                                }
                            }
                            else
                            {
                                if (System.IO.File.Exists(Globals.ProjectPath + cellMDL.filepath))//原件
                                {
                                    System.IO.File.Copy(Globals.ProjectPath + cellMDL.filepath, TempSavePath + "\\T_CellAndEFile\\" + cellMDL.filepath, true);
                                }
                                if (System.IO.File.Exists(Globals.ProjectPath + cellMDL.fileTreePath))//pdf文件
                                {
                                    System.IO.File.Copy(Globals.ProjectPath + cellMDL.fileTreePath, TempSavePath + "\\T_CellAndEFile\\" + cellMDL.fileTreePath, true);
                                }
                            }
                        }
                        DataTable ds2 = MyCommon.ToDataTable <MDL.T_CellAndEFile>(cellList);
                        ds2.TableName = "T_CellAndEFile_" + ID;
                        ds2.WriteXml(TempSavePath + "\\T_CellAndEFile\\" + ID + ".xml", XmlWriteMode.WriteSchema);
                    }
                }
                if (curIndex < progressBar1.Maximum)
                {
                    progressBar1.Value = curIndex++;
                }
                else
                {
                    progressBar1.Value = progressBar1.Maximum - 1;
                }
                Application.DoEvents();
            }
        }