private void FtpTrans(SysBackupServerEntity model, string backupPath, string virtualPath, string strPath, string chkDrop)
        {
            Task.Run(() =>
            {
                if (model != null)
                {
                    FTPHelper ftp = new FTPHelper(model.F_FtpServerIp, "", model.F_FtpUserId, model.F_FtpPassword);
                    if (!ftp.IsDirectoryExist(backupPath))
                    {
                        ftp.CreateDirectory(backupPath);
                    }
                    ftp = new FTPHelper(model.F_FtpServerIp, backupPath, model.F_FtpUserId, model.F_FtpPassword);

                    ZipFloClass Zc = new ZipFloClass();               //将文件夹进行GZip压缩
                    Zc.ZipFile(Server.MapPath(virtualPath), strPath); //生成压缩包

                    if (chkDrop == "true")
                    {
                        //遍历删除当前目录文件
                        List <FileStruct> ListFiles = ftp.ListFiles();
                        if (ListFiles.Count > 0)
                        {
                            foreach (var item in ListFiles)
                            {
                                ftp.DeleteFile(item.Name);
                            }
                        }
                    }
                    ftp.Upload(strPath);            //通过ftp传到服务器
                    FileHelper.DeleteFile(strPath); //删除临时压缩包
                }
            });
        }
Ejemplo n.º 2
0
        private void BackupFolder()
        {
            //确保当前目录下的备份文件符合设置的最大数
            DirectoryInfo theFolder = new DirectoryInfo(SavePath);

            while (theFolder.GetFiles().Count() >= MaxFileCount)
            {
                FileInfo[] fileInfo = theFolder.GetFiles();
                fileInfo[0].Delete();
            }

            string savePath = SavePath + "FolderTemp" + System.IO.Path.DirectorySeparatorChar;
            string saveZip  = SavePath + DateTime.Now.ToString("yyMMdd-HHmmss") + ".zip";

            //复制文件夹(因为文件可能是被占用状态,复制再处理就无视被占用的情况)
            CopyFolder(FolderPath, savePath);

            //压缩保存的文件夹
            ZipFloClass Zc = new ZipFloClass();

            Zc.ZipFile(savePath, saveZip);

            //删除复制的文件
            DirectoryInfo di = new DirectoryInfo(SavePath + "FolderTemp");

            di.Delete(true);

            //更新日志
            tbLogs.Dispatcher.Invoke(new Action(() => { tbLogs.Text += "[" + DateTime.Now.ToString() + "] " + saveZip + "\n"; }));
        }
Ejemplo n.º 3
0
 static void Main2(string[] args)
 {
     if (args.Length > 0)
     {
         Console.WriteLine("执行:" + args[0]);
         if (args[0] == "-e")
         {
             string[] FileProperties = new string[2];
             FileProperties[0] = "D:\\123\\unzipped\\"; //待压缩文件目录
             FileProperties[1] = "D:\\123\\zip\\a.zip"; //压缩后的目标文件
             ZipFloClass Zc = new ZipFloClass();
             Zc.ZipFile(FileProperties[0], FileProperties[1]);
         }
         else if (args[0] == "-d")
         {
             string[] FileProperties = new string[2];
             FileProperties[0] = "D:\\123\\zip\\a.zip";  //待解压的文件
             FileProperties[1] = "D:\\123\\unzipped2\\"; //解压后放置的目标目录
             UnZipFloClass UnZc = new UnZipFloClass();
             UnZc.unZipFile(FileProperties[0], FileProperties[1]);
         }
     }
     else
     {
         Console.WriteLine("无效的命令行:" + args[0]);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 压缩事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnZipFlo_Click(object sender, EventArgs e)
        {
            string[] strs = new string[2];
            //待压缩文件目录
            strs[0] = "D:\\DeBug1\\";
            //压缩后的目标文件
            strs[1] = "D:\\Debug2\\FrpTest.zip";
            ZipFloClass zc = new ZipFloClass();

            zc.ZipFile(strs[0], strs[1]);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 下载文件
        /// </summary>
        /// <param name="pathList">文件路径集合(相对路径)</param>
        /// <returns></returns>
        public void DownloadFile(string pathList)
        {
            if (!string.IsNullOrEmpty(pathList))
            {
                List <string> lstid = pathList.Split(',').ToList <string>();
                if (lstid.Count == 1)
                {
                    var absolutePath = Server.MapPath(lstid[0]);//转成绝对路径
                    var fullName     = System.IO.Path.GetFileName(absolutePath);
                    if (System.IO.File.Exists(absolutePath))
                    {
                        FileDownHelper.DownLoadold(absolutePath, fullName);
                        return;
                    }
                }
                else if (lstid.Count == 0)
                {
                    return;
                }

                //将文件拷贝至指定临时路径并压缩打包
                string newFilename = DateTime.Now.ToString("yyyyMMddHHmmss");
                string newFolder   = "/Temp/" + newFilename + "/";
                string newZip      = Server.MapPath("/Temp/" + newFilename + ".zip"); //压缩包
                FileHelper.CreateDirectory(Server.MapPath(newFolder));                //创建一个临时文件夹

                for (int i = 0; i < lstid.Count; i++)
                {
                    var filepath = Server.MapPath(lstid[i]);
                    var fullName = System.IO.Path.GetFileName(filepath);

                    if (FileDownHelper.FileExists(filepath))
                    {
                        FileHelper.Copy(filepath, Server.MapPath(newFolder + fullName));//将文件拷贝到临时文件夹
                    }
                }
                //将文件夹进行GZip压缩
                ZipFloClass Zc = new ZipFloClass();
                Zc.ZipFile(Server.MapPath(newFolder), newZip);//生成压缩包
                if (FileDownHelper.FileExists(newZip))
                {
                    FileDownHelper.DownLoadold(newZip, newFilename + ".zip");//下载压缩包
                }
                //删除文件夹
                FileHelper.DeleteDirectory(newFolder); //删除文件夹
                FileHelper.DeleteFile(newZip);         //删除临时压缩包
            }
            return;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 批量压缩事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnBatchZipFlo_Click(object sender, EventArgs e)
        {
            string path1 = "D:\\DeBug1\\";   //待压缩的目录文件
            string path2 = "D:\\Debug2\\";   //压缩后存放目录文件

            //获取指定目录下所有文件和子文件名称(所有待压缩的文件)
            string[]    files = Directory.GetFileSystemEntries(path1);
            ZipFloClass zc    = new ZipFloClass();

            //遍历指定目录下文件路径
            foreach (string file in files)
            {
                //截取文件路径的文件名
                var filename = file.Substring(file.LastIndexOf("\\") + 1);
                //调用压缩方法(参数1:待压缩的文件目录,参数2:压缩后的文件目录(包含后缀))
                zc.ZipFile(path1 + filename, path2 + filename + ".zip");
            }
        }
Ejemplo n.º 7
0
        public void DownloadBackup(string keyValue)
        {
            if (!string.IsNullOrEmpty(keyValue))
            {
                List <string> lstid = StringHelper.GetStrArray(keyValue, ',', false);
                if (lstid.Count == 1)
                {
                    var data = pictureApp.GetForm(lstid[0]);
                    //将压缩包下载
                    FileDownHelper.DownLoadold(Server.MapPath(data.F_FilePath), data.F_FullName);//单个图片直接下载
                    return;
                }

                //将图片拷贝至指定临时路径并压缩打包
                string newFilename = DateTime.Now.ToString("yyyyMMddHHmmss");
                string newFolder   = "/Temp/" + newFilename + "/";
                string newZip      = Server.MapPath("/Temp/" + newFilename + ".zip"); //压缩包
                FileHelper.CreateDirectory(Server.MapPath(newFolder));                //创建一个临时文件夹

                for (int i = 0; i < lstid.Count; i++)
                {
                    var    data     = pictureApp.GetForm(lstid[i]);
                    string filename = Server.UrlDecode(data.F_FullName);
                    string filepath = Server.MapPath(data.F_FilePath);
                    if (FileDownHelper.FileExists(filepath))
                    {
                        FileHelper.Copy(filepath, Server.MapPath(newFolder + data.F_FullName));//将文件拷贝到临时文件夹
                    }
                }
                //将文件夹进行GZip压缩
                ZipFloClass Zc = new ZipFloClass();
                Zc.ZipFile(Server.MapPath(newFolder), newZip);//生成压缩包
                if (FileDownHelper.FileExists(newZip))
                {
                    FileDownHelper.DownLoadold(newZip, newFilename + ".zip");//下载压缩包
                }
                //删除文件夹
                FileHelper.DeleteDirectory(newFolder); //删除文件夹
                FileHelper.DeleteFile(newZip);         //删除临时压缩包
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 拷贝图片
        /// </summary>
        /// <param name="PatientInfoList"></param>
        public async Task <bool> CopyPicture(BindingList <MDL.Mdl_MPatientInfo> mPatientInfo)
        {
            bool bif = false;

            BLL.BLL_BIsEnough           bEnough          = new BLL.BLL_BIsEnough();
            string                      Reel             = bEnough.f_listFiles();
            List <MDL.Mdl_MPatientInfo> PatientInfoList1 = new List <MDL.Mdl_MPatientInfo>();

            MDL.Mdl_MPatientInfo mPatientInfoll = new MDL.Mdl_MPatientInfo();
            string   FileFath = Directory.GetCurrentDirectory() + "\\INIConfig\\OptionsSave.ini";
            INIClass iniClass = new INIClass(FileFath);

            if (string.IsNullOrEmpty(Reel))
            {
                return(false);
            }
            try
            {
                string Md5result;
                if (!MainWindow.IsTwoINFO)
                {
                    for (int i = 0; i < mPatientInfo.Count; i++)
                    {
                        #region ---------压缩文件返回MD5码
                        try
                        {
                            filename = "......";
                            descfile = "正在压缩,请等待";
                            comfile  = "正在压缩,请等待";
                            string CompressUrl = string.Format("api/File/GetCompress_bool?&ProcessNumber={0}", mPatientInfo[i].VL_V_ProcessNumber);
                            Md5result = httpClientHelper.GetResponse(CompressUrl);
                            if (Md5result == "false")
                            {
                                return(false);
                            }
                        }
                        catch (Exception ex)
                        {
                            return(false);
                        }
                        #endregion
                        #region ---------下载文件
                        string url = @"api/File/GetDownload_bool";
                        descfile = url;
                        string ProcessNumber = $"'{mPatientInfo[i].VL_V_ProcessNumber}'";
                        filename = mPatientInfo[i].VL_V_ProcessNumber + ".zip";

                        string UCardName = Tool.UCardCheck.UCardName;//优盘识别
                        if (string.IsNullOrEmpty(UCardName))
                        {
                            return(false);
                        }
                        try
                        {
                            //优盘中文件下载位置
                            string localfile = $"{UCardName}Procedure\\IMAGE\\DICOM\\{mPatientInfo[i].VL_V_MODALITY}\\{mPatientInfo[i].VL_V_ProcessNumber}.zip";
                            comfile = localfile;
                            System.Net.HttpWebResponse response = httpWebResponseHelper.HttpPost(url, ProcessNumber);
                            //检查是否存在文件夹
                            string localfilePath = $"{UCardName}Procedure\\IMAGE\\DICOM\\{mPatientInfo[i].VL_V_MODALITY}";
                            if (false == System.IO.Directory.Exists(localfilePath))
                            {
                                //创建文件夹
                                System.IO.Directory.CreateDirectory(localfilePath);
                            }
                            using (Stream readStream = response.GetResponseStream())
                            {
                                bool   b    = Download(localfile, response.ContentLength, readStream);
                                string md5F = getMD5Hash(localfile);
                                if (md5F == Md5result)
                                {
                                }
                                else
                                {
                                    b = Download(localfile, response.ContentLength, readStream);
                                    string md5S = getMD5Hash(localfile);
                                    if (md5S != Md5result)
                                    {
                                        MessageBox.Show("校验出错,请重试!");
                                        return(false);
                                    }
                                }
                                readStream.Close();
                            }
                            response.Close();
                        }
                        catch (Exception ex)
                        {
                            return(false);
                        }

                        #endregion
                        #region ---------删除文件
                        try
                        {
                            ProgressVa = 500;
                            string deleteUrl   = string.Format("api/File/GetDelete_file?&ProcessNumber={0}", mPatientInfo[i].VL_V_ProcessNumber);
                            string deledetbool = httpClientHelper.GetResponse(deleteUrl);
                            return(Convert.ToBoolean(deledetbool));
                        }
                        catch (Exception ex)
                        {
                            return(false);
                        }
                        #endregion
                    }
                }
                else
                {
                    try
                    {
                        //FPT文件下载
                        for (int i = 0; i < mPatientInfo.Count; i++)
                        {
                            PatientInfoList1.Add(mPatientInfo[i]);
                            foreach (var item in PatientInfoList1)
                            {
                                //ProgressVa = 3;
                                filename = item.VL_V_ProcessNumber + ".zip";
                                // mPatientInfoll.VL_V_PathNO = item.VL_V_PathNO;
                                string compresss = iniClass.IniReadValue("DownloadPath", "DownloadPathL");
                                //图片保存的路径
                                string downloadpath = Directory.GetCurrentDirectory() + compresss;

                                DateTime?timedate     = item.VL_D_StudyDate;
                                string   time         = timedate.Value.ToString("yyyyMMdd");
                                string   mddality     = item.VL_V_MODALITY;
                                string   ftp          = iniClass.IniReadValue("PACSPicutrePath", "URI");
                                string   downlodepath = ftp + "/" + mddality + "/" + time;
                                mPatientInfoll.VL_V_PathNO = System.IO.Path.Combine(downlodepath, item.VL_V_ProcessNumber);
                                string DesPath = string.Format("{0}\\{1}\\{2}\\", downloadpath, item.VL_V_MODALITY, item.VL_V_ProcessNumber);
                                descfile = mPatientInfoll.VL_V_PathNO;
                                if (false == System.IO.Directory.Exists(DesPath))
                                {
                                    //创建文件夹
                                    System.IO.Directory.CreateDirectory(DesPath);
                                }
                                comfile = DesPath;
                                bool PictureCopyB = await PictureCopy(mPatientInfoll.VL_V_PathNO, DesPath, item.VL_V_ProcessNumber, downlodepath);

                                if (!PictureCopyB)
                                {
                                    return(false);
                                }

                                //压缩文件
                                FileSystemInfo[] fileinfo       = new DirectoryInfo(DesPath).GetFileSystemInfos();
                                List <string>    sourceFileList = new List <string>();
                                foreach (FileSystemInfo il in fileinfo)
                                {
                                    sourceFileList.Add(il.FullName);
                                }
                                //CompressHelper ch = new Base.Common.CompressHelper();
                                string TopPathName = iniClass.IniReadValue("DesPathName", "PathName");
                                if (!Directory.Exists(TopPathName))
                                {
                                    Directory.CreateDirectory(TopPathName);
                                }
                                string filenameq = TopPathName + "\\" + item.VL_V_ProcessNumber + ".zip";
                                //ch.CompressMulti(sourceFileList.ToArray(), filenameq);
                                ZipFloClass Zc = new ZipFloClass();
                                //Base.Log.Log4Net.GetLog4Net().WriteLog("DEBUG", "FileURL:" + filename);
                                comfile = filenameq;
                                Zc.ZipFile(DesPath, filenameq);

                                new System.Threading.Thread(delegate() { Directory.Delete(DesPath, true); }).Start(); //删除下载的dicm文件

                                //复制文件
                                string UDesPath = string.Format("{0}:\\Procedure\\IMAGE\\DICOM\\{1}\\", Reel, item.VL_V_MODALITY);
                                comfile = UDesPath;
                                if (!Directory.Exists(UDesPath))
                                {
                                    Directory.CreateDirectory(UDesPath);
                                }
                                DirectoryInfo    dir         = new DirectoryInfo(TopPathName);
                                FileSystemInfo[] fileinfolll = dir.GetFileSystemInfos();
                                foreach (FileSystemInfo ippp in fileinfolll)
                                {
                                    //不是文件夹即复制文件,true表示可以覆盖同名文件
                                    File.Copy(ippp.FullName, UDesPath + "\\" + ippp.Name, true);
                                    ProgressVa = 500;
                                }
                                new System.Threading.Thread(delegate() { File.Delete(filenameq); }).Start(); //删除压缩文件
                            }
                        }
                        bif = true;
                    }
                    catch (Exception ex)
                    {
                        bif = false;
                    }
                }
                return(true);
            }
            catch (Exception e)
            {
                return(bif);
            }
        }
Ejemplo n.º 9
0
        private void button_finish_Click(object sender, EventArgs e)
        {
            if (!check1())
            {
                //MessageBox.Show("数据填写不完整!");
                return;
            }
            if (!check2())
            {
                return;
            }
            if (!check3())
            {
                return;
            }
            if (!check4())
            {
                return;
            }
            if (!check5())
            {
                return;
            }

            FolderBrowserDialog saveFileDialog1 = new System.Windows.Forms.FolderBrowserDialog();
            saveFileDialog1.Description = "请选择文件保存路径";
            saveFileDialog1.ShowNewFolderButton = true;
            if (saveFileDialog1.ShowDialog() != DialogResult.OK)
                return;

            string filepath = saveFileDialog1.SelectedPath;

            // 创建一个临时文件夹
            string tmppath = Path.GetTempPath() + "\\" + Path.GetRandomFileName();
            Directory.CreateDirectory(tmppath);

            // 供应商信息
            XmlTextWriter writer = new XmlTextWriter(tmppath + "\\supportor.xml", Encoding.UTF8);
            writer.Formatting = Formatting.Indented;  //缩进格式
            writer.Indentation = 4;
            writer.WriteStartDocument();
            writer.WriteStartElement("DTO");
            writer.WriteStartElement("ROW");
            setXmlElem(writer, "SUPNAME", this.textBox_fullName.Text);
            //setXmlElem(writer, "SUPENNAME", "");
            setXmlElem(writer, "CREATEDATE", this.dateTimePicker_creat.Text);
            setXmlElem(writer, "ABBREVIATION", this.textBox_shortName.Text);
            setXmlElem(writer, "ADDRESS", this.textBox_adress.Text);
            setXmlElem(writer, "POSTCODE", this.textBox_postid.Text);
            setXmlElem(writer, "NETADDR", this.textBox_website.Text);
            setXmlElem(writer, "ORGANIZECODE", this.textBox_organizationId.Text);
            try
            {
                foreach (KeyValuePair<string, SDict> item in _dict[14])
                {
                    if (this.comboBox_economyNature.Text == item.Value.name)
                    {
                        setXmlElem(writer, "ECONOMYID", item.Value.code);
                    }
                }
            }
            catch
            {
                setXmlElem(writer, "ECONOMYID", "");
            }
            setXmlElem(writer, "ECONOMY", this.comboBox_economyNature.Text);
            try
            {
                foreach (KeyValuePair<string, SDict> item in _dict[11])
                {
                    if (this.comboBox_supplierType.Text == item.Value.name)
                    {
                        setXmlElem(writer, "TYPECODE", item.Value.code);
                    }
                }
            }
            catch
            {
                setXmlElem(writer, "TYPECODE", "");
            }
            setXmlElem(writer, "TYPE", this.comboBox_supplierType.Text);
            try
            {
                foreach (KeyValuePair<string, SDict> item in _dict[6])
                {
                    if (this.comboBox_purchaseType.Text == item.Value.name)
                    {
                        setXmlElem(writer, "PURCHASETYPEID", item.Value.code);
                    }
                }
            }
            catch
            {
                setXmlElem(writer, "PURCHASETYPEID", "");
            }
            setXmlElem(writer, "PURCHASETYPE", this.comboBox_purchaseType.Text);
            setXmlElem(writer, "IFTURNOVER", this.comboBox_purchaseSuccese.Text);
            try
            {
                foreach (KeyValuePair<string, SDict> item in _dict[12])
                {
                    if (this.comboBox_bank.Text == item.Value.name)
                    {
                        setXmlElem(writer, "BANKID", item.Value.code);
                    }
                }
            }
            catch
            {
                setXmlElem(writer, "BANKID", "");
            }
            setXmlElem(writer, "BANK", this.comboBox_bank.Text);
            setXmlElem(writer, "ACCOUNT", this.textBox_bankId.Text);
            try
            {
                foreach (KeyValuePair<string, SDict> item in _dict[13])
                {
                    if (this.comboBox_creditLevel.Text == item.Value.name)
                    {
                        setXmlElem(writer, "CREDITID", item.Value.code);
                    }
                }
            }
            catch
            {
                setXmlElem(writer, "CREDITID", "");
            }
            setXmlElem(writer, "CREDIT", this.comboBox_creditLevel.Text);
            setXmlElem(writer, "CREDITORG", this.textBox_creditOrg.Text);
            setXmlElem(writer, "CREDITDATE", this.dateTimePicker_creditDate.Text);
            setXmlElem(writer, "INSURANCE", this.comboBox_bankHasPay.Text);
            setXmlElem(writer, "ILLEGAL", this.comboBox_bankHasIllegal.Text);
            setXmlElem(writer, "CORPORATION", this.textBox_referee.Text);
            setXmlElem(writer, "CORPPHONE", this.textBox_telephone.Text);
            setXmlElem(writer, "CORPMOBILE", this.textBox_mobile.Text);
            setXmlElem(writer, "CONTACT", this.textBox_supplierContact.Text);
            setXmlElem(writer, "CONTACTPHONE", this.textBox_supplierTelephone.Text);
            setXmlElem(writer, "CONTACTMOBILE", this.textBox_supplierMobile.Text);
            setXmlElem(writer, "CONTACTFAX", this.textBox_supplierFax.Text);
            //setXmlElem(writer, "CONTACTEMAIL", this.textBox_fullName.Text);
            setXmlElem(writer, "LICNO", this.textBox_regId.Text);
            setXmlElem(writer, "LICORG", this.textBox_businessLicOrg.Text);
            setXmlElem(writer, "LICCAPITAL", this.textBox_regCapital.Text);
            setXmlElem(writer, "LICADDR", this.comboBox_regProvice.Text + "," + this.comboBox_regCity.Text);
            setXmlElem(writer, "L1LOC", this.comboBox_regProvice.Text);
            setXmlElem(writer, "L2LOC", this.comboBox_regCity.Text);
            setXmlElem(writer, "LICVALSTART", this.dateTimePicker_businessLicDateStart.Text);
            setXmlElem(writer, "LICVALEND", this.dateTimePicker_businessLicDateEnd.Text);
            setXmlElem(writer, "LICEXADATE", this.dateTimePicker_businessLicCheckDate.Text);
            setXmlElem(writer, "LICMAINOPT", this.textBox_mainScope.Text);
            setXmlElem(writer, "LICOTHEROPT", this.textBox_secodeScope.Text);
            setXmlElem(writer, "STATETAXNO", this.textBox_natualTaxId.Text);
            setXmlElem(writer, "LOCALTAXNO", this.textBox_landTaxId.Text);
            setXmlElem(writer, "STATETAXORG", this.textBox_natualTaxOrg.Text);
            setXmlElem(writer, "LOCALTAXORG", this.textBox_landTaxOrg.Text);
            setXmlElem(writer, "STATETAXVALSTART", this.dateTimePicker_natualTaxDateStart.Text);
            setXmlElem(writer, "STATETAXVALEND", this.dateTimePicker_natualTaxDateEnd.Text);
            setXmlElem(writer, "LOCALTAXVALSTART", this.dateTimePicker_landTaxDateStart.Text);
            setXmlElem(writer, "LOCALTAXVALEND", this.dateTimePicker_landTaxDateEnd.Text);
            setXmlElem(writer, "IFSTATETAX", this.comboBox_natualTaxPay.Text);
            setXmlElem(writer, "IFLOCALTAX", this.comboBox_landTaxPay.Text);
            //setXmlElem(writer, "SUPTYPECODE", this.textBox_fullName.Text);
            //setXmlElem(writer, "SUPTYPE", this.textBox_fullName.Text);
            //setXmlElem(writer, "SUMMARY", this.textBox_fullName.Text);
            //setXmlElem(writer, "IMAGE", this.textBox_fullName.Text);
            //setXmlElem(writer, "LOCATION", this.textBox_fullName.Text);
            //setXmlElem(writer, "LONGITUDE", this.textBox_fullName.Text);
            //setXmlElem(writer, "LATITUDE", this.textBox_fullName.Text);
            //setXmlElem(writer, "PRODUCTSCLASS", this.textBox_fullName.Text);
            //setXmlElem(writer, "MANUFACTURERCONTACT", this.textBox_fullName.Text);
            //setXmlElem(writer, "MANUFACTURERPHONE", this.textBox_fullName.Text);
            //setXmlElem(writer, "MANUFACTURERFAX", this.textBox_fullName.Text);
            //setXmlElem(writer, "MANUFACTUREREMAIL", this.textBox_fullName.Text);
            //setXmlElem(writer, "MANUFACTURERADDRESS", this.textBox_fullName.Text);
            //setXmlElem(writer, "MANUFACTURERPERFORMANCE", this.textBox_fullName.Text);
            //setXmlElem(writer, "MANUFACTURERSUMMARY", this.textBox_fullName.Text);
            //setXmlElem(writer, "MANUFACTURER", this.textBox_fullName.Text);
            setXmlElem(writer, "STOREHOUSEAREA", this.textBox_storehouseArea.Text);
            setXmlElem(writer, "WAREHOUSEAREA", this.textBox_warehouseArea.Text);
            setXmlElemFile(writer, "STOREHOUSEIMAGE", this.textBox_storehouseImage.Text, tmppath);
            setXmlElemFile(writer, "LICBUSIMAGE", this.textBox_businessLicId.Text, tmppath);
            setXmlElemFile(writer, "ORGSTRIMAGE", this.textBox_organizationImage.Text, tmppath);
            setXmlElemFile(writer, "BANKPROVE", this.textBox_bankProve.Text, tmppath);
            setXmlElemFile(writer, "QUALITYPROVE", this.textBox_qualityProve.Text, tmppath);
            setXmlElemFile(writer, "OTHERPROVE", this.textBox_otherProve.Text, tmppath);
            setXmlElemFile(writer, "AUDITLAST3Y", this.textBox_designRep2009.Text, tmppath);
            //setXmlElem(writer, "PURCHASETYPE", this.textBox_fullName.Text);
            //setXmlElem(writer, "IFTURNOVER", this.textBox_fullName.Text);
            writer.WriteEndElement();
            writer.WriteEndElement();
            writer.Flush();
            writer.Close();

            // 股东信息
            writer = new XmlTextWriter(tmppath + "\\supportor_stock.xml", Encoding.UTF8);
            writer.Formatting = Formatting.Indented;  //缩进格式
            writer.Indentation = 4;
            writer.WriteStartDocument();
            writer.WriteStartElement("DTO");
            {
                writer.WriteStartElement("ROW");
                setXmlElem(writer, "STOCKHOLDERNAME", this.textBox_stockholderName.Text);
                setXmlElem(writer, "CAPITAL", this.textBox_stockholderCapital.Text);
                setXmlElem(writer, "RATIO", this.textBox_stockholderRatio.Text);
                setXmlElem(writer, "STOCKDATE", this.dateTimePicker_stockholderStockDate.Text);
                writer.WriteEndElement();
            }
            foreach (CStockholderControl sh in _shcs)
            {
                writer.WriteStartElement("ROW");
                setXmlElem(writer, "STOCKHOLDERNAME", sh.textBoxStockholderName.Text);
                setXmlElem(writer, "CAPITAL", sh.textBoxStockholderCapital.Text);
                setXmlElem(writer, "RATIO", sh.textBoxStockholderRatio.Text);
                setXmlElem(writer, "STOCKDATE", sh.dateTimePickerStockholderStockDate.Text);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
            writer.Flush();
            writer.Close();

            // 产品
            writer = new XmlTextWriter(tmppath + "\\supportor_product.xml", Encoding.UTF8);
            writer.Formatting = Formatting.Indented;  //缩进格式
            writer.Indentation = 4;
            writer.WriteStartDocument();
            writer.WriteStartElement("DTO");
            {
                writer.WriteStartElement("ROW");
                setXmlElem(writer, "GOODNAME", this.textBox_productType.Text);
                setXmlElem(writer, "PRODTYPE", (string)this.textBox_productType.Tag);
                setXmlElem(writer, "PRODNAME", this.textBox_productName.Text);
                setXmlElem(writer, "MEASURUNIT", this.textBox_productUnit.Text);
                setXmlElem(writer, "PRODNO", this.textBox_productMode.Text);
                setXmlElem(writer, "AVGOUTPUT", this.textBox_productYieldYearAvg.Text);
                setXmlElem(writer, "MAXOUTPUT", this.textBox_productYeildYearMax.Text);
                setXmlElem(writer, "SINGLEMAXOUTPUT", this.textBox_productYeildMax.Text);
                setXmlElem(writer, "SINGLEMAXDATE", this.textBox_productDayofMaxYeild.Text);
                setXmlElemFile(writer, "PRODIMAGE", this.textBox_productPhoto.Text, tmppath);
                //setXmlElem(writer, "remark", this.textBox_productType.Text);
                writer.WriteEndElement();
            }
            foreach (CProductControl pc in _pcs)
            {
                writer.WriteStartElement("ROW");
                setXmlElem(writer, "GOODNAME", pc.textBoxProductType.Text);
                setXmlElem(writer, "PRODNAME", pc.textBoxProductName.Text);
                setXmlElem(writer, "MEASURUNIT", pc.textBoxProductUnit.Text);
                setXmlElem(writer, "PRODNO", pc.textBoxProductMode.Text);
                setXmlElem(writer, "AVGOUTPUT", pc.textBoxProductYieldYearAvg.Text);
                setXmlElem(writer, "MAXOUTPUT", pc.textBoxProductYeildYearMax.Text);
                setXmlElem(writer, "SINGLEMAXOUTPUT", pc.textBoxProductYeildMax.Text);
                setXmlElem(writer, "SINGLEMAXDATE", pc.textBoxProductDayofMaxYeild.Text);
                setXmlElem(writer, "PRODIMAGE", pc.textBoxProductPhoto.Text);
                //setXmlElem(writer, "remark", pc.textBoxProductType.Text);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
            writer.Flush();
            writer.Close();

            // 售后信息
            writer = new XmlTextWriter(tmppath + "\\supportor_org.xml", Encoding.UTF8);
            writer.Formatting = Formatting.Indented;  //缩进格式
            writer.Indentation = 4;
            writer.WriteStartDocument();
            writer.WriteStartElement("DTO");
            {
                writer.WriteStartElement("ROW");
                setXmlElem(writer, "ORGNAME", this.textBox_aftersalesName.Text);
                try
                {
                    foreach (KeyValuePair<string, SDict> item in _dict[17])
                    {
                        if (this.comboBox_aftersalesType.Text == item.Value.name)
                        {
                            setXmlElem(writer, "ORGTYPEID", item.Value.code);
                        }
                    }
                }
                catch
                {
                    setXmlElem(writer, "ORGTYPEID", "");
                }
                setXmlElem(writer, "ORGTYPE", this.comboBox_aftersalesType.Text);
                setXmlElem(writer, "LOCATION", this.comboBox_aftersalesProvice.Text + "," + this.comboBox_aftersalesCity.Text);
                setXmlElem(writer, "DIRECTOR", this.textBox_aftersalesContext.Text);
                setXmlElem(writer, "PHONE", this.textBox_aftersalesTel.Text);
                writer.WriteEndElement();
            }
            foreach (CAftersalesControl asc in _ascs)
            {
                writer.WriteStartElement("ROW");
                setXmlElem(writer, "ORGNAME", asc.textBoxAftersalesName.Text);
                try
                {
                    foreach (KeyValuePair<string, SDict> item in _dict[17])
                    {
                        if (asc.comboBoxAftersalesType.Text == item.Value.name)
                        {
                            setXmlElem(writer, "ORGTYPEID", item.Value.code);
                        }
                    }
                }
                catch
                {
                    setXmlElem(writer, "ORGTYPEID", "");
                }
                setXmlElem(writer, "ORGTYPE", asc.comboBoxAftersalesType.Text);
                setXmlElem(writer, "LOCATION", asc.comboBoxAftersalesProvice.Text + "," + asc.comboBoxAftersalesCity.Text);
                setXmlElem(writer, "DIRECTOR", asc.textBoxAftersalesContext.Text);
                setXmlElem(writer, "PHONE", asc.textBoxAftersalesTel.Text);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
            writer.Flush();
            writer.Close();

            // 高速公路信息
            writer = new XmlTextWriter(tmppath + "\\supportor_highway.xml", Encoding.UTF8);
            writer.Formatting = Formatting.Indented;  //缩进格式
            writer.Indentation = 4;
            writer.WriteStartDocument();
            writer.WriteStartElement("DTO");
            {
                writer.WriteStartElement("ROW");
                setXmlElem(writer, "HIWID", this.textBox_transportHighwayID.Text);
                setXmlElem(writer, "HIWNAME", this.textBox_transportHighwayName.Text);
                setXmlElem(writer, "HIWIN", this.textBox_transportHighwayEnterName.Text);
                setXmlElem(writer, "HIWINID", this.textBox_transportHighwayEnterID.Text);
                setXmlElem(writer, "HIWDIS", this.textBox_transportHighwayDistance.Text);
                writer.WriteEndElement();
            }
            //foreach (CAftersalesControl asc in _ascs)
            //{
            //    writer.WriteStartElement("ROW");
            //    setXmlElem(writer, "ORGNAME", asc.textBoxAftersalesName.Text);
            //    setXmlElem(writer, "ORGTYPE", asc.comboBoxAftersalesType.Text);
            //    setXmlElem(writer, "LOCATION", asc.comboBoxAftersalesProvice.Text + "," + asc.comboBoxAftersalesCity.Text);
            //    setXmlElem(writer, "DIRECTOR", asc.textBoxAftersalesContext.Text);
            //    setXmlElem(writer, "PHONE", asc.textBoxAftersalesTel.Text);
            //    writer.WriteEndElement();
            //}
            writer.WriteEndElement();
            writer.Flush();
            writer.Close();

            // 运输信息
            writer = new XmlTextWriter(tmppath + "\\supportor_tran.xml", Encoding.UTF8);
            writer.Formatting = Formatting.Indented;  //缩进格式
            writer.Indentation = 4;
            writer.WriteStartDocument();
            writer.WriteStartElement("DTO");
            writer.WriteStartElement("ROW");
            setXmlElem(writer, "COMNAME", this.textBox_transportName.Text);
            try
            {
                foreach (KeyValuePair<string, SDict> item in _dict[18])
                {
                    if (this.comboBox_transportType.Text == item.Value.name)
                    {
                        setXmlElem(writer, "TRUCKTYPEID", item.Value.code);
                    }
                }
            }
            catch
            {
                setXmlElem(writer, "TRUCKTYPEID", "");
            }
            setXmlElem(writer, "TRUCKTYPE", this.comboBox_transportType.Text);
            setXmlElem(writer, "DEADWEIGHT", this.textBox_transportDeadweight.Text);
            setXmlElem(writer, "COUNT", this.textBox_transportNum.Text);
            setXmlElem(writer, "NEARRAILWAY", this.textBox_transportRailwayName.Text);
            setXmlElem(writer, "RWDIS", this.textBox_transportRailwayDistance.Text);
            setXmlElem(writer, "NEARPORT", this.textBox_transportPortName.Text);
            setXmlElem(writer, "PORTDIS", this.textBox_transportPortDistance.Text);
            setXmlElem(writer, "NEARAIRPORT", this.textBox_transportAirportName.Text);
            setXmlElem(writer, "APDIS", this.textBox_transportAirportDistance.Text);
            writer.WriteEndElement();
            writer.WriteEndElement();
            writer.Flush();
            writer.Close();

            // 路径
            string datfile = filepath + "\\" + this.textBox_fullName.Text + "-" + DateTime.Now.ToString("yyyyMMdd") + ".dat";
            // 压缩
            ZipFloClass Zc = new ZipFloClass();
            Zc.ZipFile(tmppath + "\\", datfile);

            DirectoryInfo di = new DirectoryInfo(tmppath);
            di.Delete(true);

            MessageBox.Show("数据导出成功!");
        }