public string CheckTickes(List <string> GC_FNOFIDS) { string ss = ""; try { foreach (string s in GC_FNOFIDS) { ss += s + ","; } if (ss != "") { ss = ss.Substring(0, ss.Length - 1); } CYZLog.writeLog("CheckTickes(" + ss + ")"); //TickHelper.checkSpatial(GC_FNOFIDS); ss = "TRUE"; } catch (Exception ex) { CYZLog.writeLog(ex.ToString()); ss = "ERROR:" + ex.ToString(); } CYZLog.writeLog("End CheckTickes"); return(ss); }
public string DisableTicket2(List <string> FNOFIDS) { string ss = ""; try { foreach (string s in FNOFIDS) { ss += s + ","; } if (ss != "") { ss = ss.Substring(0, ss.Length - 1); } CYZLog.writeLog("DisableTicket2(" + ss + ")"); if (TickHelper.qxtick2(FNOFIDS)) { ss = "TRUE"; } } catch (Exception ex) { CYZLog.writeLog(ex.ToString()); ss = "ERROR:" + ex.ToString(); } CYZLog.writeLog("End DisableTicket2 (" + ss + ")"); return(ss); }
/// <summary> /// /// </summary> /// <param name="sqlstr"></param> /// <returns></returns> public DataTable ExecuteTable(string sqlstr) { DataTable reval = null; try { using (OracleConnection connexc = new OracleConnection(connstring)) { connexc.Open(); OracleCommand cmd = new OracleCommand(sqlstr, connexc); OracleDataAdapter da = new OracleDataAdapter(cmd); reval = new DataTable(); da.Fill(reval); } } catch (Exception ex) { CYZLog.writeLog(sqlstr); CYZLog.writeLog(ex.ToString()); reval = null; } return(reval); }
/// <summary> /// 刷新数据到modlog /// </summary> /// <param name="sqlstr"></param> /// <returns></returns> public bool ExecuteNonQuerySxsj(string sqlstr) { bool reval = false; try { string[] connectiongStr = connstring.Split(';'); var ipStr = connectiongStr[2].Split('=')[1]; var connStr = string.Format("User Id={0};Password={1};Data Source={2}", UserName, Password, ipStr); using (OracleConnection connexc = new OracleConnection(connStr)) { connexc.Open(); OracleCommand cmd = new OracleCommand(sqlstr, connexc); cmd.ExecuteNonQuery(); close(); reval = true; } } catch (Exception ex) { CYZLog.writeLog(sqlstr); CYZLog.writeLog(ex.ToString()); throw ex; } return(reval); }
/// <summary> /// 截取台帐包下载路径 /// </summary> /// <param name="infoString"></param> /// <returns></returns> private static string GetTzPacketPath(string infoString) { var tzPacketPath = string.Empty; try { if (!string.IsNullOrEmpty(infoString)) { if (infoString.Contains("true")) { //{'status':true,'errorInfo':'Http://10.128.6.117:9230/emmis/downloadDBFile.gis?projectName=白沙10kV沙岭线F723_wzj888'} var index = infoString.IndexOf("errorInfo':'"); var pwscemmisPath = infoString.Substring(index, infoString.Length - index - 2); index = pwscemmisPath.IndexOf(':'); pwscemmisPath = pwscemmisPath.Substring(index + 2, pwscemmisPath.Length - (index + 2)); tzPacketPath = pwscemmisPath.Replace("\\", @"\"); } } } catch (Exception) { CYZLog.writeLog("获取台帐包路径失败!"); } return(tzPacketPath); }
/// <summary> /// /// </summary> /// <param name="Xmin"></param> /// <param name="Xmax"></param> /// <param name="Ymin"></param> /// <param name="Ymax"></param> /// <returns></returns> public string getKXNameByFw(double Xmin, double Xmax, double Ymin, double Ymax) { CDBManger cdb = new CDBManger(); OracleDataReader odr = null; string sql = "select kxmc from gg_kxinfo t1, gg_kxmanage t2 where t1.kx_id=t2.kx_id and t1.yx_fid="; string gisid = ""; try { odr = cdb.ExecuteReader(sql); if (odr.Read()) { gisid = odr["kxmc"].ToString(); } } catch (Exception ex) { CYZLog.writeLog(ex.ToString(), ""); } finally { CloseOracleDataReader(odr, cdb); } return(gisid); }
public List <string> DisableTicket3(List <string> FNOFIDS, string gc_id) { //List<string> FNOFIDS //List<string> FNOFIDS = new List<string>(); List <string> FildFNOFIDS = new List <string>(); string ss = ""; try { foreach (string s in FNOFIDS) { ss += s + ","; } if (ss != "") { ss = ss.Substring(0, ss.Length - 1); } CYZLog.writeLog("DisableTicket3(" + ss + ")"); LockKgg(ref FNOFIDS); FildFNOFIDS = TickHelper.qxtick3(FNOFIDS, gc_id); } catch (Exception ex) { CYZLog.writeLog(ex.ToString()); ss = "ERROR:" + ex.ToString(); } CYZLog.writeLog("End DisableTicket3()"); return(FildFNOFIDS); }
public bool InsertBulk(IEnumerable <DBEntity> entities, bool byView, params ISurround[] surrounds) { try { using (var conn = GetConnection()) { conn.Open(); Runsurrounds(surrounds, conn); foreach (var entity in entities) { //if ((int)entity.GetValue("G3E_FNO") == 84) //{ // LogManager.Instance.Error("ASAS"); //} InsertItemWrap(entity.GetType(), entity, byView, conn); CYZLog.writeLog(entity.GetType().ToString() + ":", ((long)entity.GetValue("G3E_ID")).ToString() + "."); } RunEnds(surrounds, conn); } } catch (Exception ex) { LogManager.Instance.Error(ex); throw ex; } return(true); }
/// <summary> /// /// </summary> /// <param name="GcId"></param> /// <returns></returns> public string GisId(string GcId) { string gisid = ""; OracleDataReader odr = null; string sql = "select GCTICKET_ID from cadgis.ticketship t where t.gcticket_id='" + GcId + "'"; CDBManger cdb = new CDBManger(); try { odr = cdb.ExecuteReader(sql); if (odr.Read()) { gisid = odr["GCTICKET_ID"].ToString(); } } catch (Exception ex) { CYZLog.writeLog(ex.ToString(), ""); } finally { CloseOracleDataReader(odr, cdb); } return(gisid); }
public string LockGisSb(List <string> GC_FNOFIDS, string GC_ID, string ltt_name) { string ss = ""; try { foreach (string s in GC_FNOFIDS) { ss += s + ","; } if (ss != "") { ss = ss.Substring(0, ss.Length - 1); } CYZLog.writeLog("LockGisSb(" + ss + "," + GC_ID + ")"); LockKgg(ref GC_FNOFIDS); //锁定依附与房之类的开关柜 LockHb(ref GC_FNOFIDS); //锁定依附与集抄得户表 ss = TickHelper.LockSb(GC_FNOFIDS, ltt_name, GC_ID, tickerrh * 100000 + (tickerre++)); // SxSj(ltt_name); } catch (Exception ex) { CYZLog.writeLog(ex.ToString()); ss = "ERROR:" + ex.ToString(); } CYZLog.writeLog("End LockGisSb"); return(ss); }
public string UpLoadTz(string GC_ID) { string ss = ""; string smzq = ""; string gistick = ""; try { smzq = Smzq(GC_ID, ref gistick); 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) { CYZLog.writeLog(ex.ToString()); throw ex; } return(ss); }
public string OpenTicket(List <string> GC_FNOFIDS, string GC_UserName, string GC_ID) { string ss = ""; try { foreach (string s in GC_FNOFIDS) { ss += s + ","; } if (ss != "") { ss = ss.Substring(0, ss.Length - 1); } CYZLog.writeLog("OpenTicket(" + ss + "," + GC_UserName + "," + GC_ID + ")"); ss = TickHelper.openticks(GC_FNOFIDS, GC_UserName, GC_ID, tickerrh * 100000 + (tickerre++)); } catch (Exception ex) { CYZLog.writeLog(ex.ToString()); ss = "ERROR:" + ex.ToString(); } CYZLog.writeLog("End OpenTicket"); return(ss); }
/// <summary> /// /// </summary> /// <param name="sqlstr"></param> /// <returns></returns> public bool ExecuteNonQuery(string sqlstr) { bool reval = false; try { using (OracleConnection connexc = new OracleConnection(connstring)) { connexc.Open(); OracleCommand cmd = new OracleCommand(sqlstr, connexc); cmd.ExecuteNonQuery(); reval = true; } } catch (Exception ex) { CYZLog.writeLog(sqlstr); CYZLog.writeLog(ex.ToString()); throw ex; }finally { close(); } return(reval); }
public string PublishAppend(string GC_ID) { string ss = "TRUE"; try { CYZLog.writeLog("PublishAppend(" + GC_ID + ")"); var userName = string.Empty; var oldVersion = string.Empty; string gistick = string.Empty; string smzq = Smzq(GC_ID, ref gistick); if (smzq == "") { return("工单不存在。"); } ss = TickHelper.posttick(GC_ID); } catch (Exception ex) { CYZLog.writeLog(ex.ToString()); ss = "ERROR:" + ex.ToString(); } CYZLog.writeLog("End PublishAppend"); return(ss); }
/// <summary> /// 下载台账数据 /// </summary> /// <param name="GIS_ID">GIS在线工单ID</param> /// <param name="tempTableName">中间表名</param> /// <param name="downDataFilePath">存放*db文件路径</param> /// <returns></returns> public static string DownTZData(string GIS_ID, string tempTableName, string downDataFilePath) { string ss = ""; try { CYZLog.writeLog("start to 下载台账数据 DownTZData('" + GIS_ID + "','" + tempTableName + "','" + downDataFilePath + "')"); string TZUrl = ConfigurationManager.AppSettings["DownTZUrl"]; string TZServerPath = ConfigurationManager.AppSettings["TZServerPath"]; string DownStr = string.Format(TZUrl, TZServerPath, GIS_ID, tempTableName, downDataFilePath); CYZLog.writeLog("DownStr='" + DownStr + "'"); WebClient wc = new WebClient(); wc.DownloadDataCompleted += wc_DownloadDataCompleted; wc.BaseAddress = DownStr; wc.DownloadDataAsync(new Uri(DownStr)); } catch (Exception ex) { ss = ex.Message; CYZLog.writeLog(ss); } return(ss); }
public bool close() { bool reval = false; try { if (conn != null) { if (conn.State == System.Data.ConnectionState.Open) { conn.Close(); } } } catch (Exception ex) { CYZLog.writeLog(ex.ToString()); } finally { if (conn != null) { conn.Dispose(); } } return(reval); }
public string DownByFW(double Xmin, double Xmax, double Ymin, double Ymax, string ZYDY, string GC_ID, string SESSION_ID, List <string> FidFnoList) { //string str = "144,115404825,146,115404715"; string reval = ""; try { string str = ""; string sj = DateTime.Now.ToString("MMddHHmm"); if (FidFnoList.Count > 0) { foreach (var v in FidFnoList) { str += v + ","; } str = str.Substring(0, str.Length - 1); } CYZLog.writeLog("DownByFW(" + Xmin + "," + Xmax + "," + Ymin + "," + Ymax + "," + ZYDY + "," + GC_ID + "," + SESSION_ID + "," + str + ");"); string kxmc = ""; List <string> args = new List <string>(); args.Add("DownByFW"); args.Add(Xmin.ToString()); args.Add(Xmax.ToString()); args.Add(Ymin.ToString()); args.Add(Ymax.ToString()); args.Add(ZYDY.ToString()); args.Add(GC_ID.ToString()); args.Add(SESSION_ID.ToString()); args.Add(kxmc); args.Add(sj); args.Add(str); System.Threading.Thread tt = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(ElectronTransferServicePro.Pro)); tt.Start(args); reval = kxmc + "_" + SESSION_ID + ".zip<R>" + Application["dataftppath"].ToString() + System.Web.HttpUtility.UrlEncode(kxmc + "_" + SESSION_ID + ".zip", Encoding.GetEncoding("GB2312")); } catch (Exception ex) { CYZLog.writeLog(ex.ToString(), ""); reval = ex.ToString(); } finally { CYZLog.writeLog("DownByFW return:" + reval, ""); } CYZLog.writeLog("End DownByFW"); return(reval); }
public string CheckDownState(string SESSION_ID) { try { CYZLog.writeLog("CheckDownState(" + SESSION_ID + ")", ""); return(PublicMethod.read_state(Application["datapackagepath"].ToString(), SESSION_ID)); } catch (Exception ex) { CYZLog.writeLog(ex.ToString(), ""); return("-100"); } }
public string DownByKXandFW(string SSDW_ID, string KX_ID, string ZYDY, string GC_ID, string SESSION_ID, List <string> FidFnoList)//这面要新增一个新的参数 List<string> FidFnoList { string reval = ""; try { string str = ""; if (FidFnoList.Count > 0) { foreach (var v in FidFnoList) { str += v + ","; } str = str.Substring(0, str.Length - 1); } string kxmc = getKXNameByKxfid(KX_ID); CYZLog.writeLog("DownByKXandFW(" + SSDW_ID + "," + KX_ID + "," + ZYDY + "," + GC_ID + "," + SESSION_ID + "," + str + ")", ""); List <string> args = new List <string>(); args.Add("DownByKXandFW"); args.Add(SSDW_ID.ToString()); args.Add(KX_ID.ToString()); args.Add(ZYDY.ToString()); args.Add(GC_ID.ToString()); args.Add(SESSION_ID.ToString()); args.Add(kxmc); args.Add(str); System.Threading.Thread tt = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(ElectronTransferServicePro.Pro)); tt.Start(args); reval = kxmc + "_" + SESSION_ID + ".zip<R>" + Application["dataftppath"].ToString() + System.Web.HttpUtility.UrlEncode(kxmc + "_" + SESSION_ID + ".zip", Encoding.GetEncoding("UTF-8")); } catch (Exception ex) { CYZLog.writeLog(ex.ToString(), ""); reval = ex.ToString(); } finally { CYZLog.writeLog("DownByKXandFW return:" + reval, ""); } CYZLog.writeLog("End DownByKXandFW"); return(reval); }
public CyzEventWaitHandle(string name) { try { if (!Directory.Exists(CyzEventPath + "CyzEvent\\")) { Directory.CreateDirectory(CyzEventPath + "CyzEvent\\"); } eventname = name; eventfullname = CyzEventPath + "CyzEvent\\" + name; } catch (Exception ex) { CYZLog.writeLog(ex.ToString()); } }
public bool WaitOne() { bool reval = false; try { if (File.Exists(eventfullname)) { reval = true; } } catch (Exception ex) { CYZLog.writeLog(ex.ToString()); } return(reval); }
public static CyzEventWaitHandle OpenExisting(string name) { CyzEventWaitHandle mcewh = null; try { if (File.Exists(CyzEventPath + name)) { mcewh = new CyzEventWaitHandle(name); } } catch (Exception ex) { CYZLog.writeLog(ex.ToString()); } return(mcewh); }
protected void RunEnds(ISurround[] surrounds, DbConnection conn) { try { foreach (var surround in surrounds) { CYZLog.writeLog(surround.ToString()); var cmd = conn.CreateCommand(); cmd.CommandText = surround.End(); cmd.ExecuteNonQuery(); } }catch (Exception ex) { CYZLog.writeLog(ex.ToString()); throw ex; } }
protected void Application_Start(object sender, EventArgs e) { // new UploadExecutionFactory(); // new ExportExecutionFactory(); //var currentAssembly = Assembly.GetExecutingAssembly(); //var assemblies = ReflectionUtils.GetReferencedAssemblies(currentAssembly).ToList(); //assemblies.Add(currentAssembly); //assemblies.ForEach(ExecutionManager.Instance.EnsureInitialize); Application["dataappendpath"] = ConfigurationManager.AppSettings["dataappendpath"]; Application["datapackagepath"] = ConfigurationManager.AppSettings["datapackagepath"]; Application["dataftppath"] = ConfigurationManager.AppSettings["dataftppath"]; Application["QJConfig"] = ConfigurationManager.AppSettings["QJConfig"]; Application["cadEventName"] = ConfigurationManager.AppSettings["cadEventName"]; Application["spatialEventName"] = ConfigurationManager.AppSettings["spatialEventName"]; Application["NewTime"] = DateTime.Today.ToString("yyyy-MM-dd"); ElectronTransferServicePro.dataappendpath = Application["dataappendpath"].ToString(); ElectronTransferServicePro.datapackagepath = Application["datapackagepath"].ToString(); ElectronTransferServicePro.dataftppath = Application["dataftppath"].ToString(); ElectronTransferServicePro.QJConfig = Application["QJConfig"].ToString(); ElectronTransferServicePro.cadEventName = Application["cadEventName"].ToString(); ElectronTransferServicePro.spatialEventName = Application["spatialEventName"].ToString(); try { bool bbEvent1 = false; using (EventWaitHandle mmEvent = new EventWaitHandle(false, EventResetMode.AutoReset, @"Global\spatialSyncService", out bbEvent1)) { if (mmEvent != null) { if (mmEvent.Reset()) { CYZLog.writeLog("Start event spatialSyncService"); } } } } catch (Exception ex) { CYZLog.writeLog("ex=" + ex.ToString()); } }
/// <summary> /// 提取台账文件名 /// </summary> /// <returns></returns> /// <summary> /// /// </summary> /// <returns></returns> public void GetAllDbFiles(string path, ref string fileName) { try { if (Directory.Exists(path)) { var dbDirInfo = new DirectoryInfo(path); var dbFileInfo = dbDirInfo.GetFileSystemInfos("*.zip"); foreach (var file in dbFileInfo) { fileName = file.Name; } } } catch (Exception ex) { CYZLog.writeLog(ex.ToString(), ""); } }
/// <summary> /// /// </summary> /// <param name="sqlstr"></param> /// <returns></returns> public OracleDataReader ExecuteReader(string sqlstr) { OracleDataReader reval = null; try { if (open()) { var cmd = new OracleCommand(sqlstr, conn); reval = cmd.ExecuteReader(); } } catch (Exception ex) { CYZLog.writeLog(sqlstr); CYZLog.writeLog(ex.ToString()); } return(reval); }
public bool ExecuteNonQueryNoClose(string sqlstr) { bool reval = false; try { OracleCommand cmd = new OracleCommand(sqlstr, conn); cmd.ExecuteNonQuery(); reval = true; } catch (Exception ex) { CYZLog.writeLog(sqlstr); CYZLog.writeLog(ex.ToString()); } finally { } return(reval); }
public string DisableAllTicket() { string ss = ""; CDBManger dbm = null; try { dbm = new CDBManger(); DataTable dt = dbm.ExecuteTable("select distinct t.gcticket_id from cadgis.ticketship t"); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { string GC_ID = dt.Rows[i][0].ToString(); CYZLog.writeLog("DisableTicket1(" + GC_ID + ")"); if (TickHelper.qxtick1(GC_ID)) { ss = "TRUE"; } Thread.Sleep(1000); } } } catch (Exception ex) { CYZLog.writeLog(ex.ToString(), ""); ss = "ERROR:" + ex; } finally { if (dbm != null) { dbm.close(); } } CYZLog.writeLog("End DisableTicket; return " + ss); return(ss); }
public bool open() { bool reval = false; try { close(); conn = new OracleConnection(connstring); conn.Open(); reval = true; } catch (Exception ex) { CYZLog.writeLog(ex.ToString()); throw ex; } finally { } return(reval); }
public bool Reset() { bool reval = false; try { bool bb = false; using (Mutex mm = new Mutex(false, eventname, out bb)) { if (mm != null) { bool waitbb = mm.WaitOne(); if (waitbb) { try { if (File.Exists(eventfullname)) { File.Delete(eventfullname); reval = true; } } catch (Exception ex) { CYZLog.writeLog(ex.ToString()); } finally { mm.ReleaseMutex(); } } } } } catch (Exception ex) { CYZLog.writeLog(ex.ToString()); } return(reval); }