/// <summary>
 /// 多次导入导数据的方法
 /// </summary>
 /// <param name="oracledb"></param>
 /// <param name="xmldb"></param>
 /// <param name="GC_ID"></param>
 /// <param name="smzq"></param>
 /// <param name="appenshiptime"></param>
 /// <param name="qj"></param>
 public void TwoImport(OracleDBManager oracledb, XmlDBManager xmldb, string GC_ID, string smzq, DateTime appenshiptime, string qj)
 {
     try
     {
         ElectronTransferServicePro.uploadPro(oracledb, xmldb, smzq, GC_ID, appenshiptime, qj);
         CYZLog.writeLog("End 增量的增删改");
         UploadEventHandler.CONTAIN_N(oracledb, xmldb, GC_ID, smzq, appenshiptime, qj);
         CYZLog.writeLog("End 更新包含关系表");
         UploadEventHandler.CONNECTIVITY_N(oracledb, xmldb, GC_ID, smzq, appenshiptime, qj);
         CYZLog.writeLog("End 更新连接关系表");
         UploadEventHandler.UploadDetailreference_n(oracledb, xmldb, GC_ID, smzq, appenshiptime, qj);
         CYZLog.writeLog("End 更新祥图关系表");
         UploadEventHandler.UploadGg_jx_jlb_pt(oracledb, xmldb, GC_ID, smzq, appenshiptime, qj);
         CYZLog.writeLog("End 更新计量表与变压器和计量柜对照表");
         UploadEventHandler.UploadGg_jx_shbd_pt(oracledb, xmldb, GC_ID, smzq, appenshiptime, qj);
         CYZLog.writeLog("End 更新户表与集抄对照表");
     }
     catch (Exception ex)
     {
         CYZLog.writeLog(ex.ToString(), "");
     }
 }
        public string UpLoadAppend(string AppendFile, string GC_ID)
        {
            string    ss        = "TRUE";
            int       SjBVerion = 0;
            string    smzq      = "";
            bool      bbreval   = false;
            string    UserName  = "";
            string    PassWord  = "";
            string    QjPz      = "";
            CDBManger cdm       = null;

            try
            {
                DateTime appenshiptime = DateTime.Now;

                CYZLog.writeLog("UpLoadAppend(" + AppendFile + "," + GC_ID + ")");



                string gistick = "";
                smzq = Smzq(GC_ID, ref gistick);

                if (smzq == "")
                {
                    return("工单不存在。");
                }
                bbreval = false;

                var xmldb = new XmlDBManager();
                xmldb.FileName = Application["dataappendpath"] + GC_ID + "\\" + AppendFile.Substring(AppendFile.LastIndexOf("/") + 1, AppendFile.Length - AppendFile.LastIndexOf("/") - 1);
                xmldb.Initialize();

                if (xmldb.Count() <= 0)
                {
                    CYZLog.writeLog("数据格式不正确");
                    return("数据格式不正确请重新导出");
                }

                int ZlVerion = -1;
                var CadV     = xmldb.GetEntity <CadVersion>(o => o.G3E_FID == 1); //这个版本号是从增量文件得到的

                ZlVerion = CadV.Version;

                //对比tickship里面的版本号
                cdm = new CDBManger();
                GetUserNamePwd(GC_ID, ref UserName, ref PassWord, ref QjPz);
                if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(PassWord) || string.IsNullOrEmpty(QjPz))
                {
                    CYZLog.writeLog("账号或密码不存在");
                    return("账号或密码不存在");
                }

                var oracledb = new OracleDBManager {
                    UserName = UserName, Password = PassWord
                };
                //var oracledb = new OracleDBManager();

                string    str = "select VERSION from cadgis.appendship t  where t.gcticket_id='" + GC_ID + "'";
                DataTable tab = cdm.ExecuteTable(str);
                if (tab != null && tab.Rows.Count > 0)
                {
                    SjBVerion = int.Parse(tab.Rows[0][0].ToString());
                    if (ZlVerion == 1 || SjBVerion == 1)//数据库的版本等于1是说明这个数据从来没有到过直接按原来的导入即使是导过一次版本都等于1也是要撤销重新导入的
                    {
                        if (!TickHelper.qxtick1(GC_ID, UserName, PassWord, QjPz))
                        {
                            return("FALSE");
                        }
                        OnceImport(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz);
                    }
                    else
                    {
                        if (ZlVerion <= SjBVerion)
                        {
                            if (!TickHelper.qxtick1(GC_ID, UserName, PassWord, QjPz))
                            {
                                return("FALSE");
                            }                                                                            //发现增量文件版本低与tickship里面的版本号,就撤销工单.
                            OnceImport(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz);
                        }
                        else//如果要导入的版本高于数据库的版本执行下面的导入
                        {
                            TwoImport(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz);
                        }
                    }
                }
                else
                {
                    if (!TickHelper.qxtick1(GC_ID, UserName, PassWord, QjPz))
                    {
                        return("FALSE");
                    }
                    OnceImport(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz);
                }
                if (cdm != null)
                {
                    cdm.close();
                }
                //增量的增删改

                //更新公共属性表里面的从属关系
                UploadEventHandler.COMMON_N(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz);
                CYZLog.writeLog("End 更新公共属性表里面的从属关系");
                UploadEventHandler.GG_PD_GNWZMC_N(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz);
                CYZLog.writeLog("End 更新功能位置表");
                //更新计量表坐标的
                UploadEventHandler.UploadGg_jx_jlb_pt_sdogeom(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz);
                CYZLog.writeLog("End 更新计量表坐标的");
                //更新户表坐标的
                UploadEventHandler.UploadGg_jx_shbd_pt_sdogeom(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz);
                CYZLog.writeLog("End 更新户表坐标的");
                // UploadEventHandler.UploadGg_gl_zxbz_n(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz);
                CYZLog.writeLog("End 更新杂项标注");
                UploadEventHandler.UpLoadGg_gz_tj_n(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz);
                CYZLog.writeLog("End 更新杂项标注");
                UploadEventHandler.UpLoadGg_pd_cbx_n(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz);
                CYZLog.writeLog("End 更新集抄所属变压器");
                UploadEventHandler.UpGg_pd_dykg_n(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz);
                CYZLog.writeLog("End 更新低压开关所属变压器");
                UploadEventHandler.UpGg_jc_pwy_n(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz);
                CYZLog.writeLog("End 更新配网仪所属变压器");
                //修改所有新增修改删除数据的版本
                cdm = new CDBManger();
                string strSql  = "update cadgis.ticketship set version=" + ZlVerion + " where gcticket_id='" + GC_ID + "'";
                string strSql2 = "update cadgis.appendship  set version=" + ZlVerion + " where gcticket_id='" + GC_ID + "'";
                string StrSql3 = "update cadgis.appendfidship  set version=" + ZlVerion + " where gcticket_id='" + GC_ID + "'";

                cdm.ExecuteNonQuery(strSql);
                cdm.ExecuteNonQuery(strSql2);
                cdm.ExecuteNonQuery(StrSql3);

                TickHelper.SxSj(smzq, QjPz, UserName, PassWord);
                string tzdz     = Application["dataappendpath"] + GC_ID;
                string filename = null;
                GetAllDbFiles(tzdz, ref filename);
                //上传生产的增量
                TZInterface.UpLoadTZData(gistick.ToString(),
                                         System.Web.HttpUtility.UrlEncode(Application["dataftppath"].ToString().Replace("export", "import") + GC_ID + "/" + filename, Encoding.UTF8).Replace("%", "<M>")
                                         );
            }
            catch (Exception ex)
            {
                bbreval = false;
                ss      = ex.ToString();
                CYZLog.writeLog(ex.ToString());
            }
            finally
            {
                if (cdm != null)
                {
                    cdm.close();
                }
            }

            CYZLog.writeLog("End UpLoadAppend");
            return(ss);
        }
        public void UploadFile(ISiteSetting siteSetting, UploadItem uploadItem, IConnectorExplorer connectorExplorer, bool canUpdateItemInGrid, bool saveAsWord, UploadEventHandler UploadSucceeded, UploadEventHandler UploadFailed)
        {
            IServiceManager serviceManager          = ServiceManagerFactory.GetServiceManager(siteSetting.SiteSettingType);
            bool            isListItemAndAttachment = ConfigurationManager.GetInstance().GetListItemAndAttachmentOption();
            IItem           item      = null;
            bool            isSuccess = serviceManager.UploadFile(siteSetting, uploadItem, isListItemAndAttachment, out item);
            UploadEventArgs e         = new UploadEventArgs();

            e.UploadItem          = uploadItem;
            e.UploadedItem        = item;
            e.CanUpdateItemInGrid = canUpdateItemInGrid;
            e.ConnectorExplorer   = connectorExplorer;



            if (isSuccess == true)
            {
                UploadSucceeded(null, e);
            }
            else
            {
                e.ErrorMessage = Languages.Translate("Upload failed");
                UploadFailed(null, e);
            }
        }