public bool ReStartService(string ServiceName) { try { ServiceController _sc = new ServiceController(ServiceName); if (_sc.Status == ServiceControllerStatus.Stopped) { _sc.Start(); //等待服务停止,3分钟后超时 try { _sc.WaitForStatus(ServiceControllerStatus.Running, new TimeSpan(0, 3, 0)); } catch (Exception ex) { throw new Exception(string.Format("再次启动服务时出错:{0}", ex)); } } else { return(false); } return(_sc.Status == ServiceControllerStatus.Running); } catch (Exception ex) { string _error = string.Format("启动服务[{1}]时发生错误!{0} ", ex.Message, ServiceName); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(false); } }
/// <summary> /// 应用程序的主入口点。 /// </summary> static void Main() { // 初始化服务器端配置 //建立系统日志和用户日志的写入器 SystemLogWriter.ICS_SystemLog = new OraSysLogWriter(); UserLogWriter.ICS_UserLog = new OraUserLogWriter(); Dictionary <string, ServiceHost> hostLib = new Dictionary <string, ServiceHost>(); hostLib.Add("AuthorizeService", new ServiceHost(typeof(AuthorizeService))); hostLib.Add("CommonService", new ServiceHost(typeof(CommonService))); hostLib.Add("MetaDataService", new ServiceHost(typeof(MetaDataService))); hostLib.Add("UserManagerService", new ServiceHost(typeof(UserManagerService))); hostLib.Add("MetaDataQueryService", new ServiceHost(typeof(MetaDataQueryService))); hostLib.Add("ReportService", new ServiceHost(typeof(ReportService))); if (ConfigFile.WindowsService) { //启动服务 SystemLogWriter.WriteLog("开始启动服务!", EventLogEntryType.Information); System.ServiceProcess.ServiceBase.Run(new SinoSZMainService(hostLib)); SystemLogWriter.WriteLog("服务结束!", EventLogEntryType.Information); } else { //启动程序 SystemLogWriter.WriteLog("启动程序完成!", EventLogEntryType.Information); Application.Run(new frmMain("系统服务程序监控端", hostLib)); SystemLogWriter.WriteLog("程序结束!", EventLogEntryType.Information); } }
public SinoUser LoginSys(string SystemID, string UserName, string Password, string CheckType) { try { OraAuthorizeFactroy _of = new OraAuthorizeFactroy(); _su = _of.LoginSys(SystemID, UserName, Password, CheckType); SystemLogWriter.WriteUserLog(decimal.Parse(_su.UserID), "系统登录(执法办案平台CS客户端)", string.Format("用户{0}登录执法办案平台CS客户端成功!", UserName), 1, _su.IPAddress, _su.HostName, SystemID); return(_su); } catch (Exception ex) { string _ipaddr = WCFClientInfo.IPAddr; string _hostName = ""; try { _hostName = Dns.GetHostEntry(_ipaddr).HostName; } catch { _hostName = _ipaddr; } SystemLogWriter.WriteUserLog(-1, "系统登录(执法办案平台CS客户端)", string.Format("用户{0}登录执法办案平台CS客户端失败!", UserName), 2, _ipaddr, _hostName, SystemID); return(null); } }
public static SinoUser GetNoRegisterUserByUserID(decimal _yhid) { SinoUser _su = new SinoUser(); using (SqlConnection cn = SqlHelper.OpenConnection()) { try { StringBuilder _sb = new StringBuilder(); _sb.Append(" select yh.YHM,yh.YHID,yh.XM,jg.ZZJGID DWID,jg.ZZJGDM DWDM ,jg.JGQC DWMC from yw_qd_hbryxx hb "); _sb.Append(" join QX2_HGJG jg on hb.PARENT_GUID= jg.DWGUID "); _sb.Append(" join qx2_hgyh yh on hb.GUID=yh.YHGUID "); _sb.Append(" where yh.YHID=:YHID and ROWNUM=1 "); SqlCommand _cmd = new SqlCommand(_sb.ToString(), cn); _cmd.Parameters.Add(":YHID", _yhid); SqlDataReader dr = _cmd.ExecuteReader(); while (dr.Read()) { _su.LoginName = dr.IsDBNull(0) ? "" : dr.GetString(0); _su.IsSignOn = true; _su.Dwdm = dr.IsDBNull(4) ? "" : dr.GetString(4); _su.DwID = dr.IsDBNull(3) ? "" : dr.GetDecimal(3).ToString(); _su.DwName = dr.IsDBNull(5) ? "" : dr.GetString(5); _su.UserID = dr.IsDBNull(1) ? "" : dr.GetDecimal(1).ToString(); _su.UserName = dr.IsDBNull(2) ? "" : dr.GetString(2); _su.SecretLevel = 0; _su.QxszJB = ""; //级别限定已经无用,现在处理时是按照岗位所在的级别。 } } catch (Exception ex) { SystemLogWriter.WriteLog(string.Format("通用YHID取非注册用户信息失败!YHID={0} 错误信息:{1}", _yhid, ex.Message), EventLogEntryType.Error); throw; } try { //取岗位信息 _su.Posts = new List <SinoPost>(); SinoPost _sp = new SinoPost("未注册用户岗位", "-1", _su.DwID, _su.DwName, _su.Dwdm, "未注册用户岗位", 0, true); _su.Posts.Add(_sp); _sp.Rights = C_GetGWInfo.GetRightsOfPost("-1", ""); _su.DefaultPost = _sp; _su.CurrentPost = _sp; } catch (Exception ex) { SystemLogWriter.WriteLog(string.Format("通用YHID取非注册用户岗位信息失败!YHID={0} 错误信息:{1}", _yhid, ex.Message), EventLogEntryType.Error); throw; } cn.Close(); } return(_su); }
public bool WriteMessage(string _message) { StringBuilder _sb = new StringBuilder(); _sb.Append("["); _sb.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); _sb.Append("] "); _sb.Append(_message); SystemLogWriter.WriteLog(_sb.ToString(), EventLogEntryType.Information); return(true); }
public List <Base.Authorize.SinoOrganize> GetRootDwListEx(string RootDWID, decimal LevelNum, string OrgType) { try { OraAuthorizeFactroy _of = new OraAuthorizeFactroy(); return(_of.GetRootDwListEx(RootDWID, LevelNum, OrgType)); } catch (Exception ex) { string _error = string.Format("取GetRootDwListEx[RootDWID={1} LevelNum={2} OrgType={3}]时发生错误!{0}", ex.Message, RootDWID, LevelNum, OrgType); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(new List <Base.Authorize.SinoOrganize>()); } }
public List <Base.RefCode.RefCodeData> GetChildRefCodeData(string _refCodeName, string _fatherCode) { try { OraRefTableFactory _of = new OraRefTableFactory(); return(_of.GetChildRefCodeData(_refCodeName, _fatherCode)); } catch (Exception ex) { string _error = string.Format("取代码表子级记录[RefCodeName={1} FatherCode={2}]时发生错误!{0}", ex.Message, _refCodeName, _fatherCode); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(new List <Base.RefCode.RefCodeData>()); } }
public void WriteExportLog(int ExportRowCount, string ExportDataMsg) { try { OraAuthorizeFactroy _of = new OraAuthorizeFactroy(); _of.WriteExportLog(ExportRowCount, ExportDataMsg); } catch (Exception ex) { string _error = string.Format("写入导出日志时[ExportRowCount={1} ExportDataMsg={2}]时发生错误!{0}", ex.Message, ExportRowCount, ExportDataMsg); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); throw new FaultException(_error, new FaultCode("服务")); } }
public System.Data.DataTable GetNotifyList(int _num) { try { OraSysManagerFactroy _of = new OraSysManagerFactroy(); return(_of.GetNotifyList(_num)); } catch (Exception ex) { string _error = string.Format("取提示列表时发生错误!{0}", ex.Message); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(null); } }
public bool SaveDataInfo(WC_DataInfo DataInfo) { try { OraSysManagerFactroy _of = new OraSysManagerFactroy(); return(_of.SaveDataInfo(DataInfo)); } catch (Exception ex) { string _error = string.Format("保存工作日历的日期设置时发生错误!{0}", ex.Message); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(false); } }
public string GetServiceState(string ServiceName) { try { ServiceController _sc = new ServiceController(ServiceName); return(_sc.Status.ToString()); } catch (Exception ex) { string _error = string.Format("取服务[{1}]的状态时发生错误!{0} ", ex.Message, ServiceName); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return("ERROR"); } }
public Base.TaskInfo.SinoTaskInfo GetTaskInfo(string TaskID) { try { OraSysManagerFactroy _of = new OraSysManagerFactroy(); return(_of.GetTaskInfo(TaskID)); } catch (Exception ex) { string _error = string.Format("取任务信息[TaskID={1}]时发生错误!{0}", ex.Message, TaskID); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(null); } }
public WC_TJSB_Settings GetTJSBSettings() { try { OraSysManagerFactroy _of = new OraSysManagerFactroy(); return(_of.GetTJSBSettings()); } catch (Exception ex) { string _error = string.Format("取统计上报日默认日期时发生错误!{0}", ex.Message); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(null); } }
public List <Base.OrganizeExt.OrgExtInfo> GetOrgExtChildData(string _fid, List <Base.OrganizeExt.OrgExtFieldDefine> PropertieDefines) { try { OraSysManagerFactroy _of = new OraSysManagerFactroy(); return(_of.GetOrgExtChildData(_fid, PropertieDefines)); } catch (Exception ex) { string _error = string.Format("取扩展组织机构子数据信息时发生错误!{0}", ex.Message); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(new List <Base.OrganizeExt.OrgExtInfo>()); } }
public bool SaveOrgExtList(List <Base.OrganizeExt.OrgExtInfo> BeSavedDataList, List <Base.OrganizeExt.OrgExtFieldDefine> PropertieDefines) { try { OraSysManagerFactroy _of = new OraSysManagerFactroy(); return(_of.SaveOrgExtList(BeSavedDataList, PropertieDefines)); } catch (Exception ex) { string _error = string.Format("保存扩展组织机构信息时发生错误!{0}", ex.Message); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(false); } }
public bool DeleteNotifyInfo(Base.Notify.NotifyInfo CurrentInfo) { try { OraSysManagerFactroy _of = new OraSysManagerFactroy(); return(_of.DeleteNotifyInfo(CurrentInfo)); } catch (Exception ex) { string _error = string.Format("删除提示信息[NotifyInfoID={1}]时发生错误!{0}", ex.Message, CurrentInfo.ID); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(false); } }
public bool SaveNotifyInfo(Base.Notify.NotifyInfo _info) { try { OraSysManagerFactroy _of = new OraSysManagerFactroy(); return(_of.SaveNotifyInfo(_info)); } catch (Exception ex) { string _error = string.Format("保存提示信息时发生错误!{0}", ex.Message); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(false); } }
public Base.Notify.NotifyInfo GetNotifyInfo(string _msgid) { try { OraSysManagerFactroy _of = new OraSysManagerFactroy(); return(_of.GetNotifyInfo(_msgid)); } catch (Exception ex) { string _error = string.Format("取提示信息[MsgID={1}]时发生错误!{0}", ex.Message, _msgid); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(null); } }
public Base.RefCode.RefCodeData GetRefCodeByCode(string _refCodeName, string _value) { try { OraRefTableFactory _of = new OraRefTableFactory(); return(_of.GetRefCodeByCode(_refCodeName, _value)); } catch (Exception ex) { string _error = string.Format("通过代码值取代码数据记录[RefCodeName={1} Code={2}]时发生错误!{0}", ex.Message, _refCodeName, _value); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(null); } }
public System.Data.DataTable GetTaskLog(string TaskID, DateTime LastTime, bool GetStartData, bool OnlyErrorData) { try { OraSysManagerFactroy _of = new OraSysManagerFactroy(); return(_of.GetTaskLog(TaskID, LastTime, GetStartData, OnlyErrorData)); } catch (Exception ex) { string _error = string.Format("取任务处理日志[TaskID={1}]时发生错误!{0}", ex.Message, TaskID); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(null); } }
public List <Base.WorkCalendar.WC_DataInfo> GetDataInfo(int Year) { try { OraSysManagerFactroy _of = new OraSysManagerFactroy(); return(_of.GetDataInfo(Year)); } catch (Exception ex) { string _error = string.Format("取工作日历记录[YEAR={1} ]时发生错误!{0}", ex.Message, Year); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(new List <WC_DataInfo>()); } }
public string SetTaskState(string TaskID, int NewState, int LimitState) { try { OraSysManagerFactroy _of = new OraSysManagerFactroy(); return(_of.SetTaskState(TaskID, NewState, LimitState)); } catch (Exception ex) { string _error = string.Format("设置任务状态[TaskID={1}]时发生错误!{0}", ex.Message, TaskID); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(""); } }
public bool SaveTJSBSettings(WC_TJSB_Settings Settings) { try { OraSysManagerFactroy _of = new OraSysManagerFactroy(); return(_of.SaveTJSBSettings(Settings)); } catch (Exception ex) { string _error = string.Format("保存统计上报日默认日期时发生错误!{0}", ex.Message); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(false); } }
public List <Base.UserLog.UserLogRecord> GetUserLog(DateTime StartDate, DateTime EndDate, string UserName, string Context) { try { OraSysManagerFactroy _of = new OraSysManagerFactroy(); return(_of.GetUserLog(StartDate, EndDate, UserName, Context)); } catch (Exception ex) { string _error = string.Format("取用户操作日志时[UserName={1} Context={2}]时发生错误!{0}", ex.Message, UserName, Context); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(new List <Base.UserLog.UserLogRecord>()); } }
public bool WriteUserLog(decimal YHID, string CZLX, string CXNR, decimal ResultType, string IpAddr, string HostName, string SystemID) { try { OraSysManagerFactroy _of = new OraSysManagerFactroy(); return(_of.WriteUserLog(YHID, CZLX, CXNR, ResultType, IpAddr, HostName, SystemID)); } catch (Exception ex) { string _error = string.Format("写入用户操作日志时时发生错误!{0}", ex.Message); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(false); } }
public List <Base.SystemLog.QueryLogRecord> GetQueryLog(DateTime _startDate, DateTime _endDate, string _userName) { try { OraSysManagerFactroy _of = new OraSysManagerFactroy(); return(_of.GetQueryLog(_startDate, _endDate, _userName)); } catch (Exception ex) { string _error = string.Format("取查询日志信息[UserName={1}]时发生错误!{0}", ex.Message, _userName); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(new List <QueryLogRecord>()); } }
public decimal GetDWIDByDWDM(string _dwdm) { try { OraAuthorizeFactroy _of = new OraAuthorizeFactroy(); return(_of.GetDWIDByDWDM(_dwdm)); } catch (Exception ex) { string _error = string.Format("取GetDWIDByDWDM[{1}]时发生错误!{0}", ex.Message, _dwdm); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); throw new FaultException(_error, new FaultCode("服务")); } }
public Base.RefCode.RefCodeTablePropertie GetRefCodePropertie(string _refCodeName) { try { OraRefTableFactory _of = new OraRefTableFactory(); return(_of.GetRefCodePropertie(_refCodeName)); } catch (Exception ex) { string _error = string.Format("取代码表属性定义[RefCodeName={1}]时发生错误!{0}", ex.Message, _refCodeName); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(null); } }
public string ResetTaskParam(string TaskID, DateTime NextTime, string NewParam) { try { OraSysManagerFactroy _of = new OraSysManagerFactroy(); return(_of.ResetTaskParam(TaskID, NextTime, NewParam)); } catch (Exception ex) { string _error = string.Format("重置任务参数[TaskID={1}]时发生错误!{0}", ex.Message, TaskID); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(null); } }
public List <Base.SystemLog.SystemLogRecord> GetSystemLog(DateTime StartDate, DateTime EndDate, string LogType, string Context) { try { OraSysManagerFactroy _of = new OraSysManagerFactroy(); return(_of.GetSystemLog(StartDate, EndDate, LogType, Context)); } catch (Exception ex) { string _error = string.Format("取系统运行日志时时发生错误!{0}", ex.Message); SystemLogWriter.WriteLog(_error, System.Diagnostics.EventLogEntryType.Error); return(new List <SystemLogRecord>()); } }