Exemplo n.º 1
0
        /// <summary>
        /// 廊坊的   原文打包
        /// </summary>
        /// <param name="ds"></param>
        /// <param name="i"></param>
        private void getDocModel_NEW(MDL.T_FileList obj, string filepath_flg)
        {
            string FileID = obj.FileID;

            if (obj.filepath != null)
            {
                string tFilePath = obj.filepath.Replace("MPDF\\", "");
                string decMfile  = filepath_flg + "\\" + 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  = filepath_flg + "\\" + 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 (progressBar1.Value < progressBar1.Maximum)
                {
                    progressBar1.Value++;
                }
                else
                {
                    progressBar1.Value = 1;
                }
                Application.DoEvents();
            }
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 重新生成PDF
        /// </summary>
        /// <param name="FileID">节点ID</param>
        private void ConvertAllEFileToPDF(string FileID)
        {
            BLL.T_FileList_BLL         fileBLL  = new ERM.BLL.T_FileList_BLL();
            MDL.T_FileList             fileMDL  = fileBLL.Find(FileID, Globals.ProjectNO);
            BLL.T_CellAndEFile_BLL     cellBLL  = new ERM.BLL.T_CellAndEFile_BLL();
            IList <MDL.T_CellAndEFile> cellList =
                cellBLL.FindByGdFileID(FileID, Globals.ProjectNO);

            System.Collections.ArrayList fileArryList = new System.Collections.ArrayList();
            bool isUpdateFileSelect_flg = false;

            foreach (MDL.T_CellAndEFile cellMDL in cellList)
            {
                string pdfPath = "";
                if (cellMDL.DocYs == null || cellMDL.DocYs == 1 || cellMDL.fileTreePath == String.Empty || cellMDL.fileTreePath == "")
                {
                    if (!isUpdateFileSelect_flg)
                    {
                        isUpdateFileSelect_flg = true;
                    }

                    using (ConvertCell2PDF c1 = new ConvertCell2PDF())
                    {
                        try
                        {
                            int iPageCount = c1.PrintCellToPDF(Globals.ProjectPath + cellMDL.filepath, Globals.ProjectPath + "PDF\\" + cellMDL.CellID + ".pdf");
                            if (iPageCount == 0)
                            {
                                cellMDL.fileTreePath = "";
                            }
                            else
                            {
                                cellMDL.fileTreePath = "PDF\\" + cellMDL.CellID + ".pdf";
                            }
                            cellMDL.DocYs    = 0;
                            cellMDL.DoStatus = 1;
                            cellMDL.ys       = iPageCount;
                            cellBLL.Update(cellMDL);
                        }
                        catch (Exception e)
                        {
                            cellMDL.fileTreePath = "";
                            MyCommon.WriteLog("PDF转换失败!错误信息:" + e.Message);
                        }
                        pdfPath = cellMDL.fileTreePath;
                    }
                }
                else
                {
                    pdfPath = cellMDL.fileTreePath;
                }

                if (!System.IO.File.Exists(Globals.ProjectPath + pdfPath))
                {
                    continue;
                }
                fileArryList.Add(Globals.ProjectPath + pdfPath);
            }
            string[] FileList = new string[fileArryList.Count];
            for (int i = 0; i < fileArryList.Count; i++)
            {
                FileList[i] = fileArryList[i].ToString();
            }
            using (ConvertCell2PDF c1 = new ConvertCell2PDF())
            {
                int iPageCount = 0;
                if (FileList.Length > 0)
                {
                    try
                    {
                        iPageCount = c1.MergePDF(FileList, Globals.ProjectPath + "MPDF\\" + FileID + ".pdf");
                        if (iPageCount == 0)
                        {
                            fileMDL.filepath = "";
                        }
                        else
                        {
                            fileMDL.filepath = "MPDF\\" + FileID + ".pdf";
                        }
                    }
                    catch (Exception ex)
                    {
                        iPageCount       = 0;
                        fileMDL.filepath = "";
                        MyCommon.WriteLog("合并PDF失败!错误信息:" + ex.Message);
                    }
                }
                else
                {
                    fileMDL.filepath = "";
                }

                //1 文字数量  2声像 3照片数量
                int         EFileType_flg = 1;
                TreeFactory treeFactory   = new TreeFactory();
                treeFactory.GetParentNodeType(FileID, ref EFileType_flg);
                if (EFileType_flg == 1)
                {
                    fileMDL.sl = iPageCount;
                }
                else if (EFileType_flg == 3)
                {
                    int tzz = MyCommon.ToInt(fileMDL.tzz);
                    int dtz = MyCommon.ToInt(fileMDL.dtz);
                    int zpz = MyCommon.ToInt(fileMDL.zpz);
                    int dpz = MyCommon.ToInt(fileMDL.dpz);

                    fileMDL.dw  = (iPageCount + dtz).ToString();
                    fileMDL.tzz = (iPageCount).ToString();
                    fileMDL.dtz = dtz.ToString();

                    fileMDL.wzz = (zpz + dpz).ToString();
                    fileMDL.zpz = zpz.ToString();
                    fileMDL.dpz = dpz.ToString();
                }
                else if (EFileType_flg == 2)
                {
                    int tzz = MyCommon.ToInt(fileMDL.tzz);
                    int dtz = MyCommon.ToInt(fileMDL.dtz);
                    int zpz = MyCommon.ToInt(fileMDL.zpz);
                    int dpz = MyCommon.ToInt(fileMDL.dpz);

                    fileMDL.dw  = (tzz + dtz).ToString();
                    fileMDL.tzz = tzz.ToString();
                    fileMDL.dtz = dtz.ToString();

                    fileMDL.wzz = (iPageCount + dpz).ToString();
                    fileMDL.zpz = (iPageCount).ToString();
                    fileMDL.dpz = dpz.ToString();
                }
                fileMDL.selected = 0;
                fileBLL.Update(fileMDL);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 复制
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Click(object sender, EventArgs e)
        {
            frm2PDFProgressMsg fmessage = new frm2PDFProgressMsg();

            fmessage.Text = "工程复制中...";
            try
            {
                string     sourceNO   = string.Empty;
                string     sourceName = string.Empty;
                string     targeNO    = string.Empty;
                string     targeName  = string.Empty;
                T_Projects sourcePorj;
                T_Projects targePorj;

                (cbx_Source.SelectedItem as System.Data.DataRowView)[0].ToString();

                if (cbx_Source.Items.Count == 1 || cbx_Trage.Items.Count == 1)
                {
                    TXMessageBoxExtensions.Info("提示:请选择需要复制的工程!");
                    cbx_Source.Focus();
                    return;
                }
                else if ((cbx_Source.SelectedItem as System.Data.DataRowView)[0].ToString() == "--请选择")
                {
                    TXMessageBoxExtensions.Info("提示:请选择复制的工程!");
                    cbx_Source.Focus();
                    return;
                }
                else if ((cbx_Trage.SelectedItem as System.Data.DataRowView)[0].ToString() == "--请选择")
                {
                    TXMessageBoxExtensions.Info("提示:请选择复制的目的工程!");
                    cbx_Trage.Focus();
                    return;
                }
                else
                {
                    sourceNO   = (cbx_Source.SelectedItem as System.Data.DataRowView)[1].ToString(); //要编辑的主键
                    sourceName = (cbx_Source.SelectedItem as System.Data.DataRowView)[0].ToString(); //要编辑的主键
                    targeNO    = (cbx_Trage.SelectedItem as System.Data.DataRowView)[1].ToString();  //要编辑的主键
                    targeName  = (cbx_Trage.SelectedItem as System.Data.DataRowView)[0].ToString();  //要编辑的主键

                    //根据工程编号查询工程类别
                    sourcePorj = projectBLL.Find(sourceNO);
                    targePorj  = projectBLL.Find(targeNO);
                    if (sourcePorj.ProjectCategory != targePorj.ProjectCategory)
                    {
                        TXMessageBoxExtensions.Info("复制的工程类别必须一致!");
                        return;
                    }
                    if (sourceNO == targeNO)
                    {
                        TXMessageBoxExtensions.Info("提示:同一工程不能复制!");
                        return;
                    }
                }
                if (TXMessageBoxExtensions.Question("提示:确定将工程\n编号:" + sourceNO + " 名称:" +
                                                    sourceName + "\n复制到工程\n编号:" + targeNO + " 名称:" + targeName
                                                    + "\n【温馨提示:复制之后工程信息将无法恢复!请慎重!!!】") == DialogResult.OK)
                {
                    status_flg        = true;
                    btn_Copy.Enabled  = false;
                    btn_Colse.Enabled = false;

                    fmessage      = new frm2PDFProgressMsg();
                    fmessage.Text = "工程复制中...";
                    fmessage.progressBar1.Maximum = 4;

                    fmessage.label2.Text        = "正在删除工程编号:" + targeNO + "信息...";
                    fmessage.progressBar1.Value = 1;
                    fmessage.Show();
                    Application.DoEvents();

                    //删除目的工程下信息
                    BLL.BLLMore bllMore = new BLL.BLLMore();
                    bllMore.DeleteUnitByProjectNO(targeNO);
                    bllMore.DeleteFileListByProjectNO(targeNO);
                    bllMore.DeleteCellFileByProjectNO(targeNO);
                    bllMore.DeleteArchiveByProjectNO(targeNO);
                    bllMore.DeleteGdFileByProjectNO(targeNO);//删除归档类别

                    #region add deleteProject
                    bllMore.DeleteTrafficByProjectNO(targeNO);
                    bllMore.DeleteRoadLampByProjectNO(targeNO);
                    bllMore.DeleteBrigeByProjectNO(targeNO);
                    bllMore.DeletePointByPorjectNo(targeNO);
                    #endregion

                    MyCommon.DeleteAndCreateEmptyDirectory(Globals.ProjectPathParent + targeNO);

                    //将源工程信息Copy到目的工程
                    fmessage.label2.Text        = "正在更新工程编号:" + targeNO + "信息...";
                    fmessage.progressBar1.Value = 2;
                    Application.DoEvents();

                    BLL.T_Projects_BLL Proj_bll        = new ERM.BLL.T_Projects_BLL();
                    ERM.MDL.T_Projects targe_proj_MDL  = Proj_bll.Find(targeNO);
                    ERM.MDL.T_Projects source_proj_MDL = Proj_bll.Find(sourceNO);
                    targe_proj_MDL.address     = source_proj_MDL.address;
                    targe_proj_MDL.area1       = source_proj_MDL.area1;
                    targe_proj_MDL.area2       = source_proj_MDL.area2;
                    targe_proj_MDL.begindate   = source_proj_MDL.begindate;
                    targe_proj_MDL.bgyfmj      = source_proj_MDL.bgyfmj;
                    targe_proj_MDL.bjdate      = source_proj_MDL.bjdate;
                    targe_proj_MDL.category    = source_proj_MDL.category;
                    targe_proj_MDL.cfmj        = source_proj_MDL.cfmj;
                    targe_proj_MDL.createdate  = source_proj_MDL.createdate;
                    targe_proj_MDL.district    = source_proj_MDL.district;
                    targe_proj_MDL.dxsmj       = source_proj_MDL.dxsmj;
                    targe_proj_MDL.enddate     = source_proj_MDL.enddate;
                    targe_proj_MDL.floors1     = source_proj_MDL.floors1;
                    targe_proj_MDL.floors2     = source_proj_MDL.floors2;
                    targe_proj_MDL.ghcode      = source_proj_MDL.ghcode;
                    targe_proj_MDL.high        = source_proj_MDL.high;
                    targe_proj_MDL.hjqk        = source_proj_MDL.hjqk;
                    targe_proj_MDL.jldwshr     = source_proj_MDL.jldwshr;
                    targe_proj_MDL.jsdwshr     = source_proj_MDL.jsdwshr;
                    targe_proj_MDL.passwd      = source_proj_MDL.passwd;
                    targe_proj_MDL.price1      = source_proj_MDL.price1;
                    targe_proj_MDL.price2      = source_proj_MDL.price2;
                    targe_proj_MDL.projecttype = source_proj_MDL.projecttype;
                    targe_proj_MDL.qtyfmj      = source_proj_MDL.qtyfmj;
                    targe_proj_MDL.sgbzz       = source_proj_MDL.sgbzz;
                    targe_proj_MDL.sgcode      = source_proj_MDL.sgcode;
                    targe_proj_MDL.stru        = source_proj_MDL.stru;
                    targe_proj_MDL.syyfmj      = source_proj_MDL.syyfmj;
                    targe_proj_MDL.tbr         = source_proj_MDL.tbr;
                    targe_proj_MDL.tempid      = source_proj_MDL.tempid;
                    targe_proj_MDL.ts1         = source_proj_MDL.ts1;
                    targe_proj_MDL.ts2         = source_proj_MDL.ts2;
                    targe_proj_MDL.ts3         = source_proj_MDL.ts3;
                    targe_proj_MDL.ts4         = source_proj_MDL.ts4;
                    targe_proj_MDL.tstotal     = source_proj_MDL.tstotal;
                    targe_proj_MDL.ydpzcode    = source_proj_MDL.ydpzcode;
                    targe_proj_MDL.ydxkcode    = source_proj_MDL.ydxkcode;
                    targe_proj_MDL.zjy         = source_proj_MDL.zjy;
                    targe_proj_MDL.zygz        = source_proj_MDL.zygz;
                    targe_proj_MDL.zzmj        = source_proj_MDL.zzmj;

                    targe_proj_MDL.ztcw   = source_proj_MDL.ztcw;
                    targe_proj_MDL.dstcw  = source_proj_MDL.dstcw;
                    targe_proj_MDL.dxtcw  = source_proj_MDL.dxtcw;
                    targe_proj_MDL.kzsfcd = source_proj_MDL.kzsfcd;
                    targe_proj_MDL.ts5    = source_proj_MDL.ts5;
                    targe_proj_MDL.XMJL   = source_proj_MDL.XMJL;
                    targe_proj_MDL.yjdw   = source_proj_MDL.yjdw;
                    targe_proj_MDL.XCJL   = source_proj_MDL.XCJL;

                    Proj_bll.Update(targe_proj_MDL);

                    //坐标信息
                    IList <T_Point> t_point_source = new T_Point_BLL().GetList(sourceNO);
                    foreach (var item in t_point_source)
                    {
                        item.ID        = Guid.NewGuid().ToString();
                        item.ProjectNo = targeNO;
                        new T_Point_BLL().Insert(item);
                    }

                    //电子文件
                    bllMore.CopyFileAndEFileList(sourceNO, targeNO);

                    BLL.T_Archive_BLL      archive_bll  = new ERM.BLL.T_Archive_BLL();      //案卷信息
                    BLL.T_FileList_BLL     filelist_bll = new ERM.BLL.T_FileList_BLL();     //文件表
                    BLL.T_CellAndEFile_BLL cellAndEfile = new ERM.BLL.T_CellAndEFile_BLL(); //电子文件
                    //单位
                    BLL.T_Units_BLL     units_bll = new ERM.BLL.T_Units_BLL();              //施工单位
                    IList <MDL.T_Units> IUnits    = units_bll.FindByProjectNO(sourceNO);
                    if (IUnits != null && IUnits.Count > 0)
                    {
                        foreach (MDL.T_Units units in IUnits)
                        {
                            units.UnitID    = Guid.NewGuid().ToString();
                            units.ProjectNO = targeNO;
                            units_bll.Add(units);//保存
                        }
                    }

                    //扩展信息
                    switch (sourcePorj.ProjectCategory)
                    {
                    case "Traffic":
                        T_Traffic_BLL trafficBll = new T_Traffic_BLL();
                        T_Traffic     traffic    = trafficBll.QueryTraffic_ByProjID(sourceNO);
                        if (traffic != null)
                        {
                            traffic.ID        = Guid.NewGuid().ToString();
                            traffic.ProjectID = targeNO;
                            trafficBll.Insert(traffic);
                        }
                        break;

                    case "RoadLamp":
                        T_Project_RoadLamp_BLL roadLampBll = new T_Project_RoadLamp_BLL();
                        T_Project_RoadLamp     roadLamp    = roadLampBll.QueryRoadLamp_ByProjID(sourceNO);
                        if (roadLamp != null)
                        {
                            roadLamp.ProjectID = targeNO;
                            roadLamp.ID        = Guid.NewGuid().ToString();
                            roadLampBll.Insert(roadLamp);
                        }
                        break;

                    case "Brige":
                        T_Project_Brige_BLL brigeBll = new T_Project_Brige_BLL();
                        T_Project_Brige     brige    = brigeBll.QueryBrige_ByProjID(sourceNO);
                        if (brige != null)
                        {
                            brige.ID        = Guid.NewGuid().ToString();
                            brige.ProjectID = targeNO;
                            brigeBll.Insert(brige);
                        }
                        break;
                    }

                    fmessage.progressBar1.Value = 3;
                    Application.DoEvents();

                    //迁移文件夹
                    string   mprojectPath  = Application.StartupPath + "\\Project\\" + sourceNO;
                    string   tprojectPath  = Application.StartupPath + "\\Project\\" + targeNO;
                    string[] DirectoryList = new string[] { "MPDF", "ODOC", "PDF" };

                    if (System.IO.Directory.Exists(tprojectPath))
                    {
                        MyCommon.DeleteAndCreateEmptyDirectory(tprojectPath, false);
                        MyCommon.DeleteAndCreateEmptyDirectory(tprojectPath, true);
                    }
                    else
                    {
                        MyCommon.DeleteAndCreateEmptyDirectory(tprojectPath, true);
                    }
                    string tempText  = fmessage.label2.Text;
                    char[] tempChar  = tempText.ToCharArray();
                    int    tempIndex = 0;
                    foreach (string dic in DirectoryList)
                    {
                        MyCommon.DeleteAndCreateEmptyDirectory(tprojectPath + "\\" + dic, true);
                        fmessage.label2.Text = "";
                        if (System.IO.Directory.Exists(mprojectPath))
                        {
                            if (System.IO.Directory.Exists(mprojectPath + "\\" + dic))
                            {
                                string[] files = System.IO.Directory.GetFiles(mprojectPath + "\\" + dic);
                                foreach (string filename in files)
                                {
                                    fmessage.label2.Text += tempChar[tempIndex];
                                    Application.DoEvents();
                                    tempIndex++;
                                    if (tempIndex >= tempChar.Length)
                                    {
                                        tempIndex            = 0;
                                        fmessage.label2.Text = "";
                                    }
                                    System.IO.FileInfo fileinfo = new System.IO.FileInfo(filename);
                                    if (System.IO.File.Exists(filename))
                                    {
                                        System.IO.File.Copy(filename, tprojectPath + "\\" + dic + "\\" + fileinfo.Name, true);
                                    }
                                }
                            }
                        }
                    }

                    fmessage.progressBar1.Value = 4;
                    Application.DoEvents();
                    fmessage.Close();

                    btn_Copy.Enabled  = true;
                    btn_Colse.Enabled = true;

                    TXMessageBoxExtensions.Info("提示:复制成功!");
                    BindGridViewData();
                }
            }
            catch (Exception ex)
            {
                if (fmessage != null)
                {
                    fmessage.Close();
                }
                TXMessageBoxExtensions.Info("提示:复制失败!");
                MyCommon.WriteLog("复制工程错误:" + ex.Message);
                btn_Copy.Enabled  = true;
                btn_Colse.Enabled = true;
            }
        }