Esempio n. 1
0
 /// <summary>
 /// 珠海的不要DWG字库,不要原文
 /// </summary>
 /// <returns></returns>
 private bool CreateXML2()
 {
     try
     {
         ERM.CBLL.CreateSip projectFactory = new ERM.CBLL.CreateSip(Globals.ProjectNO);
         GetProjectXML(projectFactory);
         GetListArchiveXML(projectFactory);
         GetDocumentXML(projectFactory);
         lblMsg.Text = "正在输出元数据信息...";
         Application.DoEvents();
         DataSet ds = CBFinalArchive.GetFinal_FileISP("ProjectNO='" + Globals.ProjectNO + "'");
         for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
             GetZHDocModel(ds, i);
             if (progressBar2.Value < progressBar2.Maximum)
             {
                 progressBar2.Value++;
             }
             else
             {
                 progressBar2.Value = 1;
             }
             Application.DoEvents();
         }
         return(true);
     }
     catch (System.SystemException ex)
     {
         MyCommon.DeleteAndCreateEmptyDirectory(Application.StartupPath + "\\temp");
         return(false);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 得到字体信息
        /// </summary>
        /// <returns></returns>
        //private List<string> GetDWGFontInfo()
        //{
        //    lblMsg.Text = "正在检查并处理字库信息...";
        //    Application.DoEvents();
        //    DirectoryInfo fontdir = new DirectoryInfo(Globals.DWGFont);
        //    List<string> fontList = new List<string>();
        //    if (fontdir.Exists)
        //    {
        //        DirectoryInfo[] fontDirName = fontdir.GetDirectories();
        //        FileCopy fileCopy = new FileCopy();
        //        foreach (DirectoryInfo dir in fontDirName)
        //        {
        //            if (dir.GetFiles().Length != 0)//空目录不拷
        //            {
        //                string strRela = "\\" + dir.Parent.Name + "\\" + dir.Name;
        //                if (fileCopy.CopyDir(Application.StartupPath + "\\temp" + strRela, dir.FullName))
        //                {
        //                    fontList.Add(strRela);
        //                }
        //            }
        //        }
        //    }
        //    return fontList;
        //}
        /// <summary>
        /// 文件信息 a#sgwj_document.xml
        /// </summary>
        /// <param name="projectFactory"></param>
        private void GetDocumentXML(ERM.CBLL.CreateSip projectFactory)
        {
            DataSet dsFinalFile = projectFactory.GetListFile(Globals.ProjectNO, "");

            dsFinalFile.DataSetName         = "文件信息";
            dsFinalFile.Tables[0].TableName = "记录";
        }
Esempio n. 3
0
        /// <summary>
        /// 廊坊系统,需要字库CAD文件的
        /// </summary>
        /// <param name="projectFactory"></param>
        /// <param name="fontList">字库列表</param>
        private static void GetProjectXML(ERM.CBLL.CreateSip projectFactory, List <string> fontList)
        {
            StreamWriter gc = new StreamWriter(Application.StartupPath + "\\temp\\a#sgwj_gc.xml", false, Encoding.Default);

            gc.WriteLine("<?xml version=\"1.0\" encoding=\"gb2312\" standalone=\"no\"?>");
            gc.WriteLine("<项目工程信息>");
            gc.WriteLine("  <项目信息>");
            foreach (System.Collections.DictionaryEntry objDE in projectFactory.Item)
            {
                if (projectFactory.Item[objDE.Key].GetType() != typeof(System.String[]))
                {
                    gc.WriteLine("    <" + objDE.Key + ">" + objDE.Value + "</" + objDE.Key + ">");
                }
                else
                {
                    gc.WriteLine("    <" + objDE.Key + ">" + ((string[])projectFactory.Item[objDE.Key])[0] + "</" + objDE.Key + ">");
                }
            }
            gc.WriteLine("  </项目信息>");
            gc.WriteLine("  <工程信息>");
            foreach (System.Collections.DictionaryEntry objDE in projectFactory.ProjectDetail)
            {
                if (projectFactory.ProjectDetail[objDE.Key].GetType() != typeof(System.String[]))
                {
                    gc.WriteLine("    <" + objDE.Key + ">" + objDE.Value + "</" + objDE.Key + ">");
                }
                else
                {
                    gc.WriteLine("    <" + objDE.Key + ">" + ((string[])projectFactory.ProjectDetail[objDE.Key])[0] + "</" + objDE.Key + ">");
                }
            }
            gc.WriteLine("  </工程信息>");
            gc.WriteLine("  <字库信息>");
            foreach (string str in fontList)
            {
                gc.WriteLine("    <记录>");
                gc.WriteLine("      <字库目录>" + str + "</字库目录>");
                gc.WriteLine("    </记录>");
            }
            gc.WriteLine("  </字库信息>");
            gc.WriteLine("</项目工程信息>");
            gc.Flush();
            gc.Close();
        }
Esempio n. 4
0
        private void GetListArchiveXMLEx(string archiveID)
        {
            ERM.CBLL.CreateSip projectFactory = new ERM.CBLL.CreateSip(Globals.ProjectNO);
            DataSet            dsFinalArchive = projectFactory.GetListArchive(Globals.ProjectNO, archiveID);

            dsFinalArchive.DataSetName         = "案卷信息";
            dsFinalArchive.Tables[0].TableName = "记录";
            string _filename = Application.StartupPath + "\\temp\\a#sgwj_file.xml";

            if (System.IO.File.Exists(_filename))
            {
                try
                {
                    System.IO.File.Delete(_filename);
                }
                catch { }
            }
            WriteXmlToFile(dsFinalArchive, _filename);
        }
Esempio n. 5
0
        private void GetDocumentXMLEx(string archiveID, string filepath_flg)
        {
            ERM.CBLL.CreateSip projectFactory = new ERM.CBLL.CreateSip(Globals.ProjectNO);
            //DataSet dsFinalFile = projectFactory.GetListFile(Globals.ProjectNO, archiveID);
            DataSet dsFinalFile = new ERM.UI.Common.XmlMapping.File().pb_setXmlInfo(archiveID, Globals.ProjectNO, "pb_queryByFileNo");

            dsFinalFile.DataSetName         = "文件信息";
            dsFinalFile.Tables[0].TableName = "记录";
            string _filename = filepath_flg + "\\a#sgwj_document.xml";

            if (System.IO.File.Exists(_filename))
            {
                try
                {
                    System.IO.File.Delete(_filename);
                }
                catch { }
            }
            WriteXmlToFile(dsFinalFile, _filename);
        }
Esempio n. 6
0
        private void GetListArchiveXMLEx(string archiveID, string filepath_flg)
        {
            ERM.CBLL.CreateSip projectFactory = new ERM.CBLL.CreateSip(Globals.ProjectNO);
            //DataSet dsFinalArchive = projectFactory.GetListArchive(Globals.ProjectNO, archiveID);
            DataSet dsFinalArchive = new Archive().pb_setXmlInfo(Globals.ProjectNO, archiveID);

            dsFinalArchive.DataSetName         = "案卷信息";
            dsFinalArchive.Tables[0].TableName = "记录";
            string _filename = filepath_flg + "\\a#sgwj_file.xml";

            if (System.IO.File.Exists(_filename))
            {
                try
                {
                    System.IO.File.Delete(_filename);
                }
                catch { }
            }
            WriteXmlToFile(dsFinalArchive, _filename);
        }
Esempio n. 7
0
        /// <summary>
        /// 案卷信息 a#sgwj_file.xml
        /// </summary>
        /// <param name="projectFactory"></param>
        private void GetListArchiveXML(ERM.CBLL.CreateSip projectFactory)
        {
            DataSet dsFinalArchive = projectFactory.GetListArchive(Globals.ProjectNO, "");

            dsFinalArchive.DataSetName         = "案卷信息";
            dsFinalArchive.Tables[0].TableName = "记录";
            string _filename = Application.StartupPath + "\\temp\\a#sgwj_file.xml";

            _filename = Application.StartupPath + "\\temp\\index.dat";
            System.IO.TextWriter w1 = System.IO.File.CreateText(_filename);
            if (dsFinalArchive != null && dsFinalArchive.Tables.Count > 0 && dsFinalArchive.Tables[0].Rows.Count > 0)
            {
                for (int i1 = 0; i1 < dsFinalArchive.Tables[0].Rows.Count; i1++)
                {
                    w1.WriteLine("<FileList><File>" + dsFinalArchive.Tables[0].Rows[i1][0].ToString() + ".sip</File>");
                    w1.WriteLine("<Title>" + dsFinalArchive.Tables[0].Rows[i1]["案卷题名"].ToString() + "</Title></FileList>");
                }
            }
            w1.Close();
        }
Esempio n. 8
0
        /// <summary>
        /// 案卷信息 a#sgwj_file.xml
        /// </summary>
        /// <param name="projectFactory"></param>
        private void GetListArchiveXML(ERM.CBLL.CreateSip projectFactory, string filepath_flg)
        {
            Archive archive = new Archive();
            //DataSet dsFinalArchive = projectFactory.GetListArchive(Globals.ProjectNO, "");
            DataSet dsFinalArchive = archive.pb_setXmlInfo();

            dsFinalArchive.DataSetName         = "案卷信息";
            dsFinalArchive.Tables[0].TableName = "记录";
            string       _filename = filepath_flg + "\\index.dat";
            StreamWriter w1        = new StreamWriter(_filename, false, Encoding.Default);

            if (dsFinalArchive != null && dsFinalArchive.Tables.Count > 0 && dsFinalArchive.Tables[0].Rows.Count > 0)
            {
                for (int i1 = 0; i1 < dsFinalArchive.Tables[0].Rows.Count; i1++)
                {
                    w1.WriteLine("<FileList><File>" + dsFinalArchive.Tables[0].Rows[i1][0].ToString() + ".sip</File>");
                    w1.WriteLine("<Title>" + dsFinalArchive.Tables[0].Rows[i1]["案卷题名"].ToString() + "</Title></FileList>");
                }
            }
            w1.Close();
        }
Esempio n. 9
0
        /// <summary>
        /// 按案卷上报
        /// </summary>
        /// <returns></returns>
        private bool?ConfirmSplitForfrmArchive()
        {
            if (txtLoc.Text == "")
            {
                TXMessageBoxExtensions.Info("请选择导出文件的存储路径!");
                txtLoc.Focus();
                return(null);
            }
            string destFilename = Globals.Projectname;

            destFolder = txtLoc.Text;

            string dest_temp = Path.GetDirectoryName(txtLoc.Text);

            if (!Directory.Exists(dest_temp))
            {
                TXMessageBoxExtensions.Info("存储的路径不存在!");
                return(null);
            }

            double             projectSize = Convert.ToDouble(DirectoryInfoCommon.GetDirectorySpace(Application.StartupPath + "\\Project\\" + Globals.ProjectNO) / Convert.ToDouble(1024 * 1024 * 1024));
            ReadWriteAppConfig config      = new ReadWriteAppConfig();

            if (config.Read("Upload_ProjectSize") == "")
            {
                config.Write("Upload_ProjectSize", "4");
            }
            string upload_size = config.Read("Upload_ProjectSize");

            if (projectSize > Convert.ToDouble(upload_size))
            {
                DialogResult dresult = TXMessageBoxExtensions.Question("上报工程大于" + upload_size + "G,当前工程大小为:" + System.Math.Round(projectSize, 2) + "G \r\n\n 【温馨提示:工程太大,生成移交文件需要比较长得时间】  \r\n\n 是否继续生成移交?");
                if (dresult != DialogResult.OK)
                {
                    return(null);
                }
            }
            else if (MyCommon.CheckDisk(destFolder) < projectSize)
            {
                //硬盘空间不足
                TXMessageBoxExtensions.Info("上报工程大小为:" + System.Math.Round(projectSize, 2) + "G 保存目录硬盘空间不足,无法生成! \r\n 【温馨提示:请选择比较空闲的盘符】");
                txtLoc.Focus();
                return(null);
            }

            tempFullName = dest_temp + "\\" + Guid.NewGuid().ToString();
            if (System.IO.Directory.Exists(tempFullName))
            {
                MyCommon.DeleteAndCreateEmptyDirectory(tempFullName, false);
            }
            MyCommon.DeleteAndCreateEmptyDirectory(tempFullName);

            MyCommon.DeleteAndCreateEmptyDirectory(destFolder, false);
            MyCommon.DeleteAndCreateEmptyDirectory(destFolder, true);

            panelBottom.Visible = true;
            panelTop.Visible    = false;
            Application.DoEvents();
            butClose.Enabled = false;
            ERM.CBLL.CreateSip projectFactory = new ERM.CBLL.CreateSip(Globals.ProjectNO);
            //DataSet dsFinalArchive = projectFactory.GetListArchive(Globals.ProjectNO, "");
            DataSet dsFinalArchive = new Archive().pb_setXmlInfo();

            if (dsFinalArchive.Tables.Count < 1 || dsFinalArchive.Tables[0].Rows.Count < 1)
            {
                TXMessageBoxExtensions.Info("没有任何案卷可以移交!");
                return(false);
            }
            int  count_FinalArchive = dsFinalArchive.Tables[0].Rows.Count;
            bool checkfile_flag     = true;

            for (int i = 0; i < count_FinalArchive; i++)
            {
                BLL.T_FileList_BLL     fileBLL  = new ERM.BLL.T_FileList_BLL();
                IList <MDL.T_FileList> fileList = fileBLL.FindByArchiveID2(dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString(), Globals.ProjectNO);
                foreach (MDL.T_FileList obj in fileList)
                {
                    if (obj.selected == 1 || obj.filepath == null || obj.filepath == "")
                    {
                        ConvertAllEFileToPDF(obj.FileID);
                    }
                    else
                    {
                        string tFilePath = obj.filepath.Replace("MPDF\\", "");
                        string sourMfile = Globals.ProjectPath + obj.filepath;
                        if (!System.IO.File.Exists(sourMfile))
                        {
                            ConvertAllEFileToPDF(obj.FileID);
                        }
                    }
                    IList <MDL.T_CellAndEFile> cellList   = (new ERM.BLL.T_CellAndEFile_BLL()).FindByGdFileID(obj.FileID, Globals.ProjectNO);
                    ERM.MDL.T_FileList         file_model = (new ERM.BLL.T_FileList_BLL()).Find(obj.FileID, Globals.ProjectNO);
                    if ((file_model.filepath == null || file_model.filepath == "") &&
                        cellList.Count > 0)
                    {
                        TXMessageBoxExtensions.Info("提示:文件【" + obj.gdwj + "】电子文件信息有误!无法移交,请审查");
                        checkfile_flag = false;
                        break;
                    }
                }
                if (!checkfile_flag)
                {
                    break;
                }
            }
            if (!checkfile_flag)
            {
                return(false);
            }

            progressBar2.Maximum = count_FinalArchive;
            progressBar2.Minimum = 0;
            progressBar2.MarqueeAnimationSpeed = 1000;
            progressBar2.Step = 1;
            lblMsg.Text       = "正在输出元数据信息...";
            Application.DoEvents();

            GetListArchiveXML(projectFactory, tempFullName);
            try
            {
                for (int i = 0; i < count_FinalArchive; i++)
                {
                    if (!Directory.Exists(tempFullName))
                    {
                        MyCommon.DeleteAndCreateEmptyDirectory(tempFullName, true);
                    }
                    //20120530 屏蔽XML文件
                    GetProjectXML(projectFactory, tempFullName);

                    if (Convert.ToBoolean(Properties.Settings.Default.SipIncludeDoc))
                    {
                        //20120530 屏蔽XML文件
                        GetListArchiveXMLEx(dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString(), tempFullName);
                        GetDocumentXMLEx(dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString(), tempFullName);

                        BLL.T_FileList_BLL     fileBLL  = new ERM.BLL.T_FileList_BLL();
                        IList <MDL.T_FileList> fileList = fileBLL.FindByArchiveID2(dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString(), Globals.ProjectNO);
                        foreach (MDL.T_FileList obj in fileList)
                        {
                            //20120530 屏蔽XML文件
                            //getDocModel(obj);
                            getDocModel_NEW(obj, tempFullName);
                        }
                    }
                    lblMsg.Text = "正在对数据包进行封装...";
                    Application.DoEvents();

                    if (System.IO.File.Exists(tempFullName + "\\index.dat"))//Application.StartupPath + "\\temp\\index.dat"
                    {
                        System.IO.File.Move(tempFullName + "\\index.dat", destFolder + "\\index.dat");

                        string gcInfo  = System.IO.File.ReadAllText(tempFullName + "\\a#sgwj_gc.xml", Encoding.GetEncoding("gb2312"));
                        string docList = System.IO.File.ReadAllText(destFolder + "\\index.dat");
                        gcInfo = gcInfo.Replace("</项目工程信息>", "<ArchiveFileList>" + docList + "</ArchiveFileList></项目工程信息>");
                        System.IO.File.WriteAllText(destFolder + "\\index.dat", gcInfo, Encoding.GetEncoding("gb2312"));
                    }

                    SevenZip.SevenZipCompressor.SetLibraryPath(Application.StartupPath + "\\7z.dll");
                    SevenZip.SevenZipCompressor tmp = new SevenZip.SevenZipCompressor();
                    {
                        tmp.ArchiveFormat = SevenZip.OutArchiveFormat.Zip;
                        tmp.CompressDirectory(tempFullName, destFolder + "\\" + dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString() + ".sip");
                    }
                    MyCommon.DeleteAndCreateEmptyDirectory(tempFullName, false);
                    progressBar2.Value = progressBar2.Value + 1;
                }
            }
            catch (Exception ex)
            {
                MyCommon.DeleteAndCreateEmptyDirectory(tempFullName, false);
                TXMessageBoxExtensions.Info("封装数据时发生意外错误!错误002");
                MyCommon.WriteLog("生成移交文件时失败!错误信息:" + ex.Message);
                return(false);
            }
            butClose.Text    = "关闭";
            butClose.Enabled = true;
            TXMessageBoxExtensions.Info("已经成功生成上报文件!");
            return(true);
        }
Esempio n. 10
0
        private bool StartRemove(string saveLoc, System.ComponentModel.BackgroundWorker _bgWorker)
        {
            string destFilename = Globals.Projectname;

            destFolder = saveLoc;

            string dest_temp = Path.GetDirectoryName(saveLoc);

            tempFullName = dest_temp + "\\" + Guid.NewGuid().ToString();
            if (System.IO.Directory.Exists(tempFullName))
            {
                MyCommon.DeleteAndCreateEmptyDirectory(tempFullName, false);
            }
            MyCommon.DeleteAndCreateEmptyDirectory(tempFullName);

            MyCommon.DeleteAndCreateEmptyDirectory(destFolder, false);
            MyCommon.DeleteAndCreateEmptyDirectory(destFolder, true);

            if (Index_temp > 100)
            {
                Index_temp = 0;
            }
            _bgWorker.ReportProgress(Index_temp++);


            ERM.CBLL.CreateSip projectFactory = new ERM.CBLL.CreateSip(Globals.ProjectNO);
            // DataSet dsFinalArchive = projectFactory.GetListArchive(Globals.ProjectNO, "");
            DataSet dsFinalArchive = new Archive().pb_setXmlInfo();

            if (dsFinalArchive.Tables.Count < 1 || dsFinalArchive.Tables[0].Rows.Count < 1)
            {
                TXMessageBoxExtensions.Info("没有任何案卷可以移交!");
                return(false);
            }
            int count_FinalArchive = dsFinalArchive.Tables[0].Rows.Count;

            //DataSet dsFinalArchive_temp = projectFactory.GetListArchive(Globals.ProjectNO, "");
            DataSet dsFinalArchive_temp = dsFinalArchive;

            dsFinalArchive_temp.DataSetName         = "案卷信息";
            dsFinalArchive_temp.Tables[0].TableName = "记录";

            string       _filename = tempFullName + "\\index.dat";
            StreamWriter w1        = new StreamWriter(_filename, false, Encoding.Default);

            if (dsFinalArchive_temp != null && dsFinalArchive_temp.Tables.Count > 0 && dsFinalArchive_temp.Tables[0].Rows.Count > 0)
            {
                for (int i1 = 0; i1 < dsFinalArchive_temp.Tables[0].Rows.Count; i1++)
                {
                    w1.WriteLine("<FileList><File>" + dsFinalArchive_temp.Tables[0].Rows[i1][0].ToString() + ".sip</File>");
                    w1.WriteLine("<Title>" + dsFinalArchive_temp.Tables[0].Rows[i1]["案卷题名"].ToString() + "</Title></FileList>");
                }
            }
            w1.Flush();
            w1.Close();

            if (Index_temp > 100)
            {
                Index_temp = 0;
            }
            _bgWorker.ReportProgress(Index_temp++);

            try
            {
                for (int i = 0; i < count_FinalArchive; i++)
                {
                    if (Index_temp > 100)
                    {
                        Index_temp = 0;
                    }
                    _bgWorker.ReportProgress(Index_temp++);

                    if (!Directory.Exists(tempFullName))
                    {
                        MyCommon.DeleteAndCreateEmptyDirectory(tempFullName, true);
                    }

                    StreamWriter gc = new StreamWriter(tempFullName + "\\a#sgwj_gc.xml", false, Encoding.Default);
                    gc.WriteLine("<?xml version=\"1.0\" encoding=\"gb2312\" standalone=\"no\"?>");
                    gc.WriteLine("<项目工程信息>");
                    gc.WriteLine("  <项目信息>");
                    DataSet   ds    = new Item().pb_setXmlInfo(new T_Projects_BLL().Find(Globals.ProjectNO).ItemID);
                    Hashtable _Item = new Hashtable();
                    if (ds.Tables.Count > 0)
                    {
                        for (int n = 0; n < ds.Tables[0].Rows.Count; n++)
                        {
                            for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
                            {
                                _Item.Add(ds.Tables[0].Columns[j].ColumnName, ds.Tables[0].Rows[n][j].ToString());
                            }
                        }

                        foreach (System.Collections.DictionaryEntry objDE in _Item)
                        {
                            if (_Item[objDE.Key] != null)
                            {
                                if (_Item[objDE.Key].GetType() != typeof(System.String[]))
                                {
                                    gc.WriteLine("    <" + objDE.Key + ">" + objDE.Value + "</" + objDE.Key + ">");
                                }
                                else
                                {
                                    gc.WriteLine("    <" + objDE.Key + ">" + ((string[])_Item[objDE.Key])[0] + "</" + objDE.Key + ">");
                                }
                            }
                            else
                            {
                                gc.WriteLine("    <" + objDE.Key + "></" + objDE.Key + ">");
                            }
                        }
                    }
                    gc.WriteLine("  </项目信息>");
                    gc.WriteLine("  <工程信息>");
                    Hashtable _detail = new Hashtable();
                    DataSet   ds1     = new ERM.UI.Common.XmlMapping.Project().pb_setXmlInfo(new T_Projects_BLL().Find(Globals.ProjectNO).ProjectCategory);
                    if (ds1.Tables.Count > 0)
                    {
                        for (int n = 0; n < ds1.Tables[0].Rows.Count; n++)
                        {
                            for (int j = 0; j < ds1.Tables[0].Columns.Count; j++)
                            {
                                _detail.Add(ds1.Tables[0].Columns[j].ColumnName, ds1.Tables[0].Rows[n][j].ToString());
                            }
                        }

                        foreach (System.Collections.DictionaryEntry objDE in _detail)
                        {
                            if (_detail[objDE.Key] != null)
                            {
                                if (_detail[objDE.Key].GetType() != typeof(System.String[]))
                                {
                                    gc.WriteLine("    <" + objDE.Key + ">" + objDE.Value + "</" + objDE.Key + ">");
                                }
                                else
                                {
                                    gc.WriteLine("    <" + objDE.Key + ">" + ((string[])_detail[objDE.Key])[0] + "</" + objDE.Key + ">");
                                }
                            }
                            else
                            {
                                gc.WriteLine("    <" + objDE.Key + "></" + objDE.Key + ">");
                            }
                        }
                        gc.WriteLine("  </工程信息>");
                        gc.WriteLine("</项目工程信息>");
                        gc.Flush();
                        gc.Close();
                    }

                    if (Convert.ToBoolean(Properties.Settings.Default.SipIncludeDoc))
                    {
                        #region ==================================
                        //20120530 屏蔽XML文件

                        //DataSet dsFinalArchive_temp1 = projectFactory.GetListArchive(Globals.ProjectNO, dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString());
                        DataSet dsFinalArchive_temp1 = new Archive().pb_setXmlInfo(Globals.ProjectNO, dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString());
                        dsFinalArchive_temp1.DataSetName         = "案卷信息";
                        dsFinalArchive_temp1.Tables[0].TableName = "记录";

                        _filename = tempFullName + "\\a#sgwj_file.xml";
                        if (System.IO.File.Exists(_filename))
                        {
                            try
                            {
                                System.IO.File.Delete(_filename);
                            }
                            catch { }
                        }

                        gc = new StreamWriter(_filename, true, Encoding.Default);
                        gc.WriteLine("<?xml version=\"1.0\" encoding=\"gb2312\" standalone=\"no\"?>");
                        gc.Flush();
                        gc.Close();
                        System.IO.FileStream     stream_archive    = new System.IO.FileStream(_filename, System.IO.FileMode.Append);
                        System.Xml.XmlTextWriter xmlWriter_archive = new System.Xml.XmlTextWriter(stream_archive, System.Text.Encoding.Default);
                        dsFinalArchive_temp1.WriteXml(xmlWriter_archive);
                        xmlWriter_archive.Close();

                        #endregion

                        #region ===========================

                        //DataSet dsFinalFile = projectFactory.GetListFile(Globals.ProjectNO,
                        //  dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString());
                        DataSet dsFinalFile = new ERM.UI.Common.XmlMapping.File().pb_setXmlInfo("pb_queryByFileNo", dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString(), Globals.ProjectNO);

                        dsFinalFile.DataSetName         = "文件信息";
                        dsFinalFile.Tables[0].TableName = "记录";

                        _filename = tempFullName + "\\a#sgwj_document.xml";
                        if (System.IO.File.Exists(_filename))
                        {
                            try
                            {
                                System.IO.File.Delete(_filename);
                            }
                            catch { }
                        }

                        gc = new StreamWriter(_filename, true, Encoding.Default);
                        gc.WriteLine("<?xml version=\"1.0\" encoding=\"gb2312\" standalone=\"no\"?>");
                        gc.Flush();
                        gc.Close();
                        System.IO.FileStream     stream_file    = new System.IO.FileStream(_filename, System.IO.FileMode.Append);
                        System.Xml.XmlTextWriter xmlWriter_file = new System.Xml.XmlTextWriter(stream_file, System.Text.Encoding.Default);
                        dsFinalFile.WriteXml(xmlWriter_file);
                        xmlWriter_file.Close();

                        #endregion

                        BLL.T_FileList_BLL fileBLL = new ERM.BLL.T_FileList_BLL();
                        //IList<MDL.T_FileList> fileList = fileBLL.FindByArchiveID2(dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString(), Globals.ProjectNO);
                        DataSet fileList = new ERM.UI.Common.XmlMapping.File().pb_setXmlInfo("pb_FindByArchiveID2", dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString(), Globals.ProjectNO);
                        if (fileList.Tables.Count > 0)
                        {
                            for (int j = 0; j < fileList.Tables[0].Rows.Count; j++)
                            {
                                DataRow obj = fileList.Tables[0].Rows[j];
                                if (Index_temp > 100)
                                {
                                    Index_temp = 0;
                                }
                                _bgWorker.ReportProgress(Index_temp++);

                                string FileID = obj["FileID"].ToString();
                                if (obj["filepath"] != null)
                                {
                                    string tFilePath = obj["filepath"].ToString().Replace("MPDF\\", "");
                                    string decMfile  = tempFullName + "\\" + tFilePath;
                                    string sourMfile = Globals.ProjectPath + obj["filepath"];
                                    try
                                    {
                                        if (System.IO.File.Exists(sourMfile))
                                        {
                                            System.IO.File.Copy(sourMfile, decMfile, true);
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        MyCommon.WriteLog("生成移交文件时,拷贝文件失败!错误信息:" + ex.Message);
                                    }
                                }
                                BLL.T_CellAndEFile_BLL     cellBLL  = new ERM.BLL.T_CellAndEFile_BLL();
                                IList <MDL.T_CellAndEFile> cellList = cellBLL.FindByFileID(FileID, Globals.ProjectNO, 1);

                                foreach (MDL.T_CellAndEFile obj2 in cellList)
                                {
                                    string yswjpath = obj2.filepath.Replace("ODOC\\", "");

                                    string dec  = tempFullName + "\\" + yswjpath;
                                    string sour = Globals.ProjectPath + obj2.filepath;
                                    try
                                    {
                                        if (System.IO.File.Exists(sour))
                                        {
                                            System.IO.File.Copy(sour, dec, true);
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        MyCommon.WriteLog("生成移交文件时,拷贝原文件失败!错误信息:" + ex.Message);
                                    }
                                }
                            }
                        }
                    }
                    if (System.IO.File.Exists(tempFullName + "\\index.dat"))
                    {
                        System.IO.File.Move(tempFullName + "\\index.dat", destFolder + "\\index.dat");

                        string gcInfo  = System.IO.File.ReadAllText(tempFullName + "\\a#sgwj_gc.xml", Encoding.GetEncoding("gb2312"));
                        string docList = System.IO.File.ReadAllText(destFolder + "\\index.dat");
                        gcInfo = gcInfo.Replace("</项目工程信息>", "<ArchiveFileList>" + docList + "</ArchiveFileList></项目工程信息>");
                        System.IO.File.WriteAllText(destFolder + "\\index.dat", gcInfo, Encoding.GetEncoding("gb2312"));
                    }
                    SevenZip.SevenZipCompressor.SetLibraryPath(Application.StartupPath + "\\7z.dll");
                    SevenZip.SevenZipCompressor tmp = new SevenZip.SevenZipCompressor();
                    tmp.ArchiveFormat = SevenZip.OutArchiveFormat.Zip;
                    tmp.CompressDirectory(tempFullName, destFolder + "\\" + dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString() + ".sip");

                    MyCommon.DeleteAndCreateEmptyDirectory(tempFullName, false);
                }
            }
            catch (Exception ex)
            {
                MyCommon.DeleteAndCreateEmptyDirectory(tempFullName, false);
                TXMessageBoxExtensions.Info("封装数据时发生意外错误!错误002");
                MyCommon.WriteLog("生成移交文件时失败!错误信息:" + ex.Message);
                return(false);
            }
            return(true);
        }
Esempio n. 11
0
        /// <summary>
        /// 系统不需要字库的
        /// </summary>
        /// <param name="projectFactory"></param>
        private static void GetProjectXML(ERM.CBLL.CreateSip projectFactory, string filepath_flg)
        {
            StreamWriter gc = new StreamWriter(filepath_flg + "\\a#sgwj_gc.xml", false, Encoding.Default);

            gc.WriteLine("<?xml version=\"1.0\" encoding=\"gb2312\" standalone=\"no\"?>");
            gc.WriteLine("<项目工程信息>");
            gc.WriteLine("  <项目信息>");
            DataSet   ds    = new Item().pb_setXmlInfo(new T_Projects_BLL().Find(Globals.ProjectNO).ItemID);
            Hashtable _Item = new Hashtable();

            if (ds.Tables.Count == 0 || ds.Tables == null)
            {
                return;
            }

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
                {
                    _Item.Add(ds.Tables[0].Columns[j].ColumnName, ds.Tables[0].Rows[i][j].ToString());
                }
            }

            foreach (System.Collections.DictionaryEntry objDE in _Item)
            {
                if (_Item[objDE.Key] != null)
                {
                    if (_Item[objDE.Key].GetType() != typeof(System.String[]))
                    {
                        gc.WriteLine("    <" + objDE.Key + ">" + objDE.Value + "</" + objDE.Key + ">");
                    }
                    else
                    {
                        gc.WriteLine("    <" + objDE.Key + ">" + ((string[])_Item[objDE.Key])[0] + "</" + objDE.Key + ">");
                    }
                }
                else
                {
                    gc.WriteLine("    <" + objDE.Key + "></" + objDE.Key + ">");
                }
            }
            gc.WriteLine("  </项目信息>");
            gc.WriteLine("  <工程信息>");

            Hashtable _detail     = new Hashtable();
            string    projectType = new T_Projects_BLL().Find(Globals.ProjectNO).ProjectCategory;
            DataSet   ds1         = new ERM.UI.Common.XmlMapping.Project().pb_setXmlInfo(projectType);

            if (ds1.Tables.Count > 0)
            {
                for (int n = 0; n < ds1.Tables[0].Rows.Count; n++)
                {
                    for (int j = 0; j < ds1.Tables[0].Columns.Count; j++)
                    {
                        _detail.Add(ds1.Tables[0].Columns[j].ColumnName, ds1.Tables[0].Rows[n][j].ToString());
                    }
                }
                projectFactory.UnitSetting(_detail);
                foreach (System.Collections.DictionaryEntry objDE in _detail)
                {
                    if (_detail[objDE.Key] != null)
                    {
                        if (_detail[objDE.Key].GetType() != typeof(System.String[]))
                        {
                            gc.WriteLine("    <" + objDE.Key + ">" + objDE.Value + "</" + objDE.Key + ">");
                        }
                        else
                        {
                            gc.WriteLine("    <" + objDE.Key + ">" + ((string[])_detail[objDE.Key])[0] + "</" + objDE.Key + ">");
                        }
                    }
                    else
                    {
                        gc.WriteLine("    <" + objDE.Key + "></" + objDE.Key + ">");
                    }
                }

                if (projectType == "Traffic")
                {
                    DataSet _trafficDetail = new Traffic().PB_setXmlInfo(ds1.Tables[0].Rows[0]["ID"].ToString());
                    if (_trafficDetail.Tables.Count > 0)
                    {
                        gc.WriteLine("<交通管道详细>");
                        for (int n = 0; n < _trafficDetail.Tables[0].Rows.Count; n++)
                        {
                            gc.WriteLine("<" + ReplaceColumnName(_trafficDetail.Tables[0].Rows[n]["Types"].ToString()) + ">");
                            for (int j = 0; j < _trafficDetail.Tables[0].Columns.Count; j++)
                            {
                                if (_trafficDetail.Tables[0].Columns[j].ColumnName != "Types")
                                {
                                    gc.WriteLine("    <" + _trafficDetail.Tables[0].Columns[j].ColumnName + ">" + _trafficDetail.Tables[0].Rows[n][j].ToString() + "</" + _trafficDetail.Tables[0].Columns[j].ColumnName + ">");
                                }
                            }
                            gc.WriteLine("</" + ReplaceColumnName(_trafficDetail.Tables[0].Rows[n]["types"].ToString()) + ">");
                        }
                        gc.WriteLine("</交通管道详细>");
                    }
                }

                gc.WriteLine("  </工程信息>");
                gc.WriteLine("</项目工程信息>");
                gc.Flush();
                gc.Close();
            }
        }
Esempio n. 12
0
        /// <summary>
        /// 按案卷上报
        /// </summary>
        /// <returns></returns>
        private bool?ConfirmSplitForfrmArchive()
        {
            if (txtLoc.Text == "")
            {
                MyCommon.ShowWarning("请选择导出文件的存储路径!");
                txtLoc.Focus();
                return(null);
            }
            string destFilename = Globals.ProjectNO;

            destFolder = txtLoc.Text + "\\" + destFilename;
            MyCommon.DeleteAndCreateEmptyDirectory(destFolder);
            panelBottom.Visible = true;
            panelTop.Visible    = false;
            Application.DoEvents();
            butClose.Enabled = false;
            ERM.CBLL.CreateSip projectFactory = new ERM.CBLL.CreateSip(Globals.ProjectNO);
            DataSet            dsFinalArchive = projectFactory.GetListArchive(Globals.ProjectNO, "");

            if (dsFinalArchive.Tables.Count < 1 || dsFinalArchive.Tables[0].Rows.Count < 1)
            {
                MyCommon.ShowWarning("没有任何案卷可以移交!");
                return(false);
            }
            int count_FinalArchive = dsFinalArchive.Tables[0].Rows.Count;

            progressBar2.Maximum = count_FinalArchive;
            progressBar2.Minimum = 0;
            progressBar2.MarqueeAnimationSpeed = 1000;
            progressBar2.Step = 1;
            lblMsg.Text       = "正在输出元数据信息...";
            Application.DoEvents();
            MyCommon.DeleteAndCreateEmptyDirectory(Application.StartupPath + "\\temp");
            //List<string> fontList = GetDWGFontInfo();
            //GetProjectXML(projectFactory, fontList);
            GetProjectXML(projectFactory);
            GetListArchiveXML(projectFactory);
            GetDocumentXML(projectFactory);
            for (int i = 0; i < count_FinalArchive; i++)
            {
                if (!Directory.Exists(Application.StartupPath + "\\temp"))
                {
                    Directory.CreateDirectory(Application.StartupPath + "\\temp");
                }
                if (Properties.Settings.Default.SipIncludeDoc)
                {
                    GetListArchiveXMLEx(dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString());
                    GetDocumentXMLEx(dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString());
                    BLL.T_FileList_BLL     fileBLL  = new ERM.BLL.T_FileList_BLL();
                    IList <MDL.T_FileList> fileList = fileBLL.FindByArchiveID(dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString(), Globals.ProjectNO);
                    foreach (MDL.T_FileList obj in fileList)
                    {
                        getDocModel(obj);
                    }
                }
                lblMsg.Text = "正在对数据包进行封装...";
                Application.DoEvents();
                try
                {
                    if (System.IO.File.Exists(Application.StartupPath + "\\temp\\index.dat"))
                    {
                        System.IO.File.Move(Application.StartupPath + "\\temp\\index.dat", destFolder + "\\index.dat");
                        string gcInfo  = System.IO.File.ReadAllText(Application.StartupPath + "\\temp\\a#sgwj_gc.xml", Encoding.GetEncoding("gb2312"));
                        string docList = System.IO.File.ReadAllText(destFolder + "\\index.dat");
                        gcInfo = gcInfo.Replace("</项目工程信息>", "<ArchiveFileList>" + docList + "</ArchiveFileList></项目工程信息>");
                        System.IO.File.WriteAllText(destFolder + "\\index.dat", gcInfo, Encoding.GetEncoding("gb2312"));
                    }
                }
                catch { }
                Common.ZipFile zip = new Common.ZipFile(Application.StartupPath + "\\temp", destFolder + "\\" + dsFinalArchive.Tables[0].Rows[i]["案卷ID"].ToString() + ".sip");
                if (!zip.StartZip())
                {
                    MyCommon.DeleteAndCreateEmptyDirectory(Application.StartupPath + "\\temp");
                    MyCommon.ShowWarning("封装数据时发生意外!");
                    return(false);
                }
                MyCommon.DeleteAndCreateEmptyDirectory(Application.StartupPath + "\\temp");
                progressBar2.Value = progressBar2.Value + 1;
            }
            butClose.Text    = "关闭";
            butClose.Enabled = true;
            return(true);
        }