Beispiel #1
0
        private static void ImportFCDA(string slbh, string FCslbh, string user, ref int count)
        {
            List <Result>    list     = new List <Result>();
            List <VolEleArc> vol_list = ImportDAL.GetVolEleArc_list(FCslbh);
            string           errStr   = "";

            foreach (VolEleArc vol in vol_list)
            {
                Result res = new Result();
                string cid = GetCID(slbh, vol.EleArcName, "文件夹", user);
                List <VolEleArcDtl> dtlList = ImportDAL.GetVolEleArcDtlByVol(vol.EleArcVol_ID);
                if (null != dtlList && dtlList.Count > 0)
                {
                    count = dtlList.Count;
                    for (int i = 0; i < dtlList.Count; i++)
                    {
                        try
                        {
                            VolEleArcDtl v = dtlList[i];
                            v.imgName = v.imgName.Replace(@"\\192.168.134.245\", "").Replace(@"\\192.168.100.202\", "").Replace(@"K:\", "").Replace(@"\\192.168.100.202 \", "");
                            v.imgName = v.imgName.Replace("\\", "/");
                            DOC_BINFILE doc_binfile = new DOC_BINFILE();
                            string      EleArcName  = "";
                            if (i == 0)
                            {
                                EleArcName = vol.EleArcName;
                            }
                            if (i > 0)
                            {
                                EleArcName = vol.EleArcName + "-" + i;
                            }
                            string binid = GetCID(slbh, EleArcName, "文件", user, cid);//att.CID;
                            doc_binfile.BINID        = binid;
                            doc_binfile.FTPATH       = v.imgName;
                            doc_binfile.FILEID       = Guid.NewGuid().ToString();
                            doc_binfile.FILENAME     = vol.EleArcName;
                            doc_binfile.EXTNAME      = GetExtName(v.imgName);
                            doc_binfile.ISCOMPRESSED = "否";
                            doc_binfile.ISENCRYPTED  = "否";

                            UploadToFtp(FCslbh, doc_binfile);


                            if (ImportDAL.ExistDoc_binfile(doc_binfile))
                            {
                                ImportDAL.UpDateDoc_binfile(doc_binfile);
                            }
                            else
                            {
                                ImportDAL.InsertDoc_binfile(doc_binfile);
                            }
                        }
                        catch (Exception ex)
                        {
                            if (!errStr.Contains(ex.Message))
                            {
                                errStr += ex.Message;
                            }
                            continue;
                        }
                    }
                }
            }

            if (!string.IsNullOrEmpty(errStr))
            {
                throw new Exception(errStr);
            }
        }