Esempio n. 1
0
        /// <summary>
        /// 写通用日志
        /// </summary>
        /// <param name="message">日志内容</param>
        /// <param name="level">日志级别</param>
        /// <param name="fileName">日志文件名</param>
        /// <returns>true:成功;false:失败</returns>
        public override bool WriteLog(string message, int level, string fileName)
        {
            if (level < this.logLevel)
            {
                return(true);
            }

            string commandText = string.Format("INSERT INTO LOG_COMMON(MESSAGE,RECORDLEVEL,CREATEDATE,STATIONID,SYSTEMID) VALUES({0},'{1}',to_date('{2}','yyyy-MM-dd HH24:mi:ss'),{3},{4}) ",
                                               ":prmMessage", level, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                                               ":prmStationID", ":prmSystemID");

            #region 定义参数
            OracleParameter[] para = new OracleParameter[3];

            para[0]               = new OracleParameter();
            para[0].Direction     = ParameterDirection.Input;
            para[0].OracleType    = OracleType.VarChar;
            para[0].ParameterName = "prmSystemID";
            para[0].Value         = StringHelper.GetSubStr(SystemID, 30);

            para[1]               = new OracleParameter();
            para[1].Direction     = ParameterDirection.Input;
            para[1].OracleType    = OracleType.VarChar;
            para[1].ParameterName = "prmStationID";
            para[1].Value         = StringHelper.GetSubStr(StationID, 30);

            para[2]               = new OracleParameter();
            para[2].Direction     = ParameterDirection.Input;
            para[2].OracleType    = OracleType.VarChar;
            para[2].ParameterName = "prmMessage";
            para[2].Value         = StringHelper.GetSubStr(message, 2000);
            #endregion

            return(OracleAppender.ExecuteNonQuery(connectionString, commandText, para) > 0);
        }
Esempio n. 2
0
        /// <summary>
        /// 写异常日志
        /// </summary>
        /// <param name="data">日志内容</param>
        /// <param name="level">日志级别</param>
        /// <returns>true:成功;false:失败</returns>
        public override bool WriteExceptionLog(ExceptionLogEventData data, int level)
        {
            if (level < this.logLevel)
            {
                return(true);
            }

            data.StationID = this.StationID;
            data.SystemID  = this.SystemID;

            string commandText = string.Format("INSERT INTO LOG_EXCEPTION(APPID,EXCEPTIONSOURCE,EXCEPTIONTYPE,MESSAGE,EXCEPTIONSTACKTRACE,RECORDLEVEL,CREATEDATE,STATIONID,SYSTEMID)" +
                                               "VALUES('{0}',{1},'{2}',{3},{4},{5},to_date('{6}','yyyy-MM-dd HH24:mi:ss'),{7},{8}) ",
                                               StringHelper.GetSubStr(data.AppID, 30),
                                               ":prmSource",
                                               StringHelper.GetSubStr(data.Type, 30),
                                               ":prmMessage",
                                               ":prmStackTrace",
                                               data.Level,
                                               System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                                               ":prmStationID",
                                               ":prmSystemID");

            #region 定义参数
            OracleParameter[] para = new OracleParameter[5];

            para[0]               = new OracleParameter();
            para[0].Direction     = ParameterDirection.Input;
            para[0].OracleType    = OracleType.VarChar;
            para[0].ParameterName = "prmSystemID";
            para[0].Value         = StringHelper.GetSubStr(data.SystemID, 30);

            para[1]               = new OracleParameter();
            para[1].Direction     = ParameterDirection.Input;
            para[1].OracleType    = OracleType.VarChar;
            para[1].ParameterName = "prmStationID";
            para[1].Value         = StringHelper.GetSubStr(data.StationID, 30);

            para[2]               = new OracleParameter();
            para[2].Direction     = ParameterDirection.Input;
            para[2].OracleType    = OracleType.VarChar;
            para[2].ParameterName = "prmMessage";
            para[2].Value         = StringHelper.GetSubStr(data.Message, 2000);

            para[3]               = new OracleParameter();
            para[3].Direction     = ParameterDirection.Input;
            para[3].OracleType    = OracleType.VarChar;
            para[3].ParameterName = "prmStackTrace";
            para[3].Value         = StringHelper.GetSubStr(data.StackTrace, 1000);

            para[4]               = new OracleParameter();
            para[4].Direction     = ParameterDirection.Input;
            para[4].OracleType    = OracleType.VarChar;
            para[4].ParameterName = "prmSource";
            para[4].Value         = StringHelper.GetSubStr(data.Source, 30);
            #endregion
            return(OracleAppender.ExecuteNonQuery(connectionString, commandText, para) > 0);
        }
Esempio n. 3
0
        /// <summary>
        /// 写操作日志
        /// </summary>
        /// <param name="data">日志内容</param>
        /// <param name="level">日志级别</param>
        /// <returns>true:成功;false:失败</returns>
        public override bool WriteOperateLog(OperateLogEventData data, int level)
        {
            if (level < this.logLevel)
            {
                return(true);
            }

            data.StationID = this.StationID;
            data.SystemID  = this.SystemID;
            string commandText = string.Format("INSERT INTO LOG_OPERATE(APPID,OPERATEUSER,OPERATEDATE,MESSAGE,OPERATELEVEL,OPERATERESULT,OPERATECATEGORY,RECORDLEVEL,CREATEDATE,STATIONID,SYSTEMID)" +
                                               "VALUES('{0}','{1}',to_date('{2}','yyyy-MM-dd HH24:mi:ss'),{3},'{4}',{5},'{6}',{7},to_date('{8}','yyyy-MM-dd HH24:mi:ss'),{9},{10}) ",
                                               StringHelper.GetSubStr(data.AppID, 30),
                                               StringHelper.GetSubStr(data.Operator, 50),
                                               data.RecordDate.ToString("yyyy-MM-dd HH:mm:ss"),
                                               ":prmMessage",
                                               StringHelper.GetSubStr(data.OperateLevel.ToString(), 30),
                                               ":prmOperateResult",
                                               StringHelper.GetSubStr(data.OperateCategory, 30),
                                               data.Level,
                                               System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                                               ":prmStationID",
                                               ":prmSystemID");

            #region 定义参数
            OracleParameter[] para = new OracleParameter[4];

            para[0]               = new OracleParameter();
            para[0].Direction     = ParameterDirection.Input;
            para[0].OracleType    = OracleType.VarChar;
            para[0].ParameterName = "prmSystemID";
            para[0].Value         = StringHelper.GetSubStr(data.SystemID, 30);

            para[1]               = new OracleParameter();
            para[1].Direction     = ParameterDirection.Input;
            para[1].OracleType    = OracleType.VarChar;
            para[1].ParameterName = "prmStationID";
            para[1].Value         = StringHelper.GetSubStr(data.StationID, 30);

            para[2]               = new OracleParameter();
            para[2].Direction     = ParameterDirection.Input;
            para[2].OracleType    = OracleType.VarChar;
            para[2].ParameterName = "prmMessage";
            para[2].Value         = StringHelper.GetSubStr(data.Message, 2000);

            para[3]               = new OracleParameter();
            para[3].Direction     = ParameterDirection.Input;
            para[3].OracleType    = OracleType.VarChar;
            para[3].ParameterName = "prmOperateResult";
            para[3].Value         = StringHelper.GetSubStr(data.OperateResult, 30);
            #endregion

            return(OracleAppender.ExecuteNonQuery(connectionString, commandText, para) > 0);
        }
Esempio n. 4
0
        /// <summary>
        /// 写应用日志
        /// </summary>
        /// <param name="data">日志内容</param>
        /// <param name="level">日志级别</param>
        /// <returns>true:成功;false:失败</returns>
        public override bool WriteApplicationLog(ApplicationEventData data, int level)
        {
            if (level < this.logLevel)
            {
                return(true);
            }

            data.StationID = this.StationID;
            data.SystemID  = this.SystemID;

            string commandText = string.Format("INSERT INTO LOG_APPLICATION(APPID,COMPONENTNAME,ERRTYPE,Message,MessagePOSITION,RECORDLEVEL,CREATEDATE,STATIONID,SYSTEMID)" +
                                               "VALUES( '{0}','{1}','{2}',{3}, {4},{5},to_date('{6}','yyyy-MM-dd HH24:mi:ss'),{7},{8}) ",
                                               StringHelper.GetSubStr(data.AppID, 30),
                                               StringHelper.GetSubStr(data.ComponentName, 30),
                                               StringHelper.GetSubStr(data.ErrType, 30),
                                               ":prmMessage",
                                               ":prmMessagePosition",

                                               data.Level,
                                               System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                                               ":prmStationID",
                                               ":prmSystemID");

            #region 定义参数
            OracleParameter[] para = new OracleParameter[4];

            para[0]               = new OracleParameter();
            para[0].Direction     = ParameterDirection.Input;
            para[0].OracleType    = OracleType.VarChar;
            para[0].ParameterName = "prmSystemID";
            para[0].Value         = StringHelper.GetSubStr(data.SystemID, 30);

            para[1]               = new OracleParameter();
            para[1].Direction     = ParameterDirection.Input;
            para[1].OracleType    = OracleType.VarChar;
            para[1].ParameterName = "prmStationID";
            para[1].Value         = StringHelper.GetSubStr(data.StationID, 30);

            para[2]               = new OracleParameter();
            para[2].Direction     = ParameterDirection.Input;
            para[2].OracleType    = OracleType.VarChar;
            para[2].ParameterName = "prmMessage";
            para[2].Value         = StringHelper.GetSubStr(data.Message, 2000);

            para[3]               = new OracleParameter();
            para[3].Direction     = ParameterDirection.Input;
            para[3].OracleType    = OracleType.VarChar;
            para[3].ParameterName = "prmMessagePosition";
            para[3].Value         = StringHelper.GetSubStr(data.MessagePosition, 50);
            #endregion

            return(OracleAppender.ExecuteNonQuery(connectionString, commandText, para) > 0);
        }
Esempio n. 5
0
        /// <summary>
        /// 写客户反馈
        /// </summary>
        /// <param name="data">日志内容</param>
        /// <param name="level">日志级别</param>
        /// <returns>true:成功;false:失败</returns>
        public override bool WriteFeedbackLog(FeedbackEventData data, int level)
        {
            if (level < this.logLevel)
            {
                return(true);
            }

            data.StationID = this.StationID;
            data.SystemID  = this.SystemID;

            string commandText = string.Format("INSERT INTO LOG_FEEDBACK(APPID,FEEDTYPE,Message,FEEDBACKDESC,FEEDBACKUSER,RECORDLEVEL,CREATEDATE,STATIONID,SYSTEMID)" +
                                               "VALUES('{0}','{1}',{2},{3},'{4}',{5},to_date('{6}','yyyy-MM-dd HH24:mi:ss'),{7},{8}) ",
                                               StringHelper.GetSubStr(data.AppID, 30),
                                               StringHelper.GetSubStr(data.FeedbackType, 30),
                                               ":prmMessage",
                                               ":prmFeedbackDesc",
                                               StringHelper.GetSubStr(data.FeedbackUser, 32),
                                               data.Level,
                                               System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                                               ":prmStationID",
                                               ":prmSystemID");

            #region 定义参数
            OracleParameter[] para = new OracleParameter[4];

            para[0]               = new OracleParameter();
            para[0].Direction     = ParameterDirection.Input;
            para[0].OracleType    = OracleType.VarChar;
            para[0].ParameterName = "prmSystemID";
            para[0].Value         = StringHelper.GetSubStr(data.SystemID, 30);

            para[1]               = new OracleParameter();
            para[1].Direction     = ParameterDirection.Input;
            para[1].OracleType    = OracleType.VarChar;
            para[1].ParameterName = "prmStationID";
            para[1].Value         = StringHelper.GetSubStr(data.StationID, 30);

            para[2]               = new OracleParameter();
            para[2].Direction     = ParameterDirection.Input;
            para[2].OracleType    = OracleType.VarChar;
            para[2].ParameterName = "prmMessage";
            para[2].Value         = StringHelper.GetSubStr(data.Message, 2000);

            para[3]               = new OracleParameter();
            para[3].Direction     = ParameterDirection.Input;
            para[3].OracleType    = OracleType.VarChar;
            para[3].ParameterName = "prmFeedbackDesc";
            para[3].Value         = StringHelper.GetSubStr(data.FeedbackDesc, 32);
            #endregion

            return(OracleAppender.ExecuteNonQuery(connectionString, commandText, para) > 0);
        }
Esempio n. 6
0
        /// <summary>
        /// 写登陆日志
        /// </summary>
        /// <param name="data">日志内容</param>
        /// <param name="level">日志级别</param>
        /// <returns>true:成功;false:失败</returns>
        public override bool WriteLoginLog(LoginLogEventData data, int level)
        {
            if (level < this.logLevel)
            {
                return(true);
            }

            data.StationID = this.StationID;
            data.SystemID  = this.SystemID;

            string commandText = string.Format("INSERT INTO LOG_LOGIN(APPID,USERCODE,MESSAGE,LOGINDATE,IP,ISWARN,LOGINTYPE,RECORDLEVEL,CREATEDATE,STATIONID,SYSTEMID)" +
                                               "VALUES('{0}','{1}',{2},to_date('{3}','yyyy-MM-dd HH24:mi:ss'),'{4}',{5},{6},{7},to_date('{8}','yyyy-MM-dd HH24:mi:ss'),{9},{10}) ",
                                               StringHelper.GetSubStr(data.AppID, 30),
                                               StringHelper.GetSubStr(data.UserCode, 30),
                                               ":prmMessage",
                                               data.LoginDate.ToString("yyyy-MM-dd HH:mm:ss"),
                                               StringHelper.GetSubStr(data.IP, 32),
                                               data.IsWarn == true ? 1 : 0,
                                               data.LoginType,
                                               data.Level,
                                               System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                                               ":prmStationID",
                                               ":prmSystemID");

            #region 定义参数
            OracleParameter[] para = new OracleParameter[3];

            para[0]               = new OracleParameter();
            para[0].Direction     = ParameterDirection.Input;
            para[0].OracleType    = OracleType.VarChar;
            para[0].ParameterName = "prmSystemID";
            para[0].Value         = StringHelper.GetSubStr(data.SystemID, 30);

            para[1]               = new OracleParameter();
            para[1].Direction     = ParameterDirection.Input;
            para[1].OracleType    = OracleType.VarChar;
            para[1].ParameterName = "prmStationID";
            para[1].Value         = StringHelper.GetSubStr(data.StationID, 30);

            para[2]               = new OracleParameter();
            para[2].Direction     = ParameterDirection.Input;
            para[2].OracleType    = OracleType.VarChar;
            para[2].ParameterName = "prmMessage";
            para[2].Value         = StringHelper.GetSubStr(data.Message, 2000);

            #endregion

            return(OracleAppender.ExecuteNonQuery(connectionString, commandText, para) > 0);
        }
Esempio n. 7
0
        /// <summary>
        /// 写业务日志数据
        /// </summary>
        /// <param name="systemID">子系统编号</param>
        /// <param name="stationID">工作站编号</param>
        /// <param name="empCode">职员代码</param>
        /// <param name="outid">学工号</param>
        /// <param name="name">姓名</param>
        /// <param name="message">消息</param>
        /// <param name="logType">日志类型</param>
        /// <returns></returns>
        public bool WriteLog(string systemID, string stationID, int empID, string outid, int Customerid, int Cardsn, long Cardno,
                             string name, string message, int logType)
        {
            string commandText = string.Format(" INSERT INTO LOG_OPERATION (SYSTEMID,STATIONID ,EMPID  ,CUSTOMERID, CARDNO, CARDSN, OUTID  ,NAME ,MESSAGE ,LOGTYPE)" +
                                               " VALUES({0},{1},{2}, {3},{4},{5},{6},{7},{8},{9})",
                                               ":prmSystemID", ":prmStationID", empID, Customerid, Cardno, Cardsn,
                                               ":PrmOutid", ":PrmName", ":prmMessage",
                                               logType);

            #region 定义参数
            OracleParameter[] para = new OracleParameter[5];

            para[0]               = new OracleParameter();
            para[0].Direction     = ParameterDirection.Input;
            para[0].OracleType    = OracleType.VarChar;
            para[0].ParameterName = "prmSystemID";
            para[0].Value         = StringHelper.GetSubStr(systemID, 30);

            para[1]               = new OracleParameter();
            para[1].Direction     = ParameterDirection.Input;
            para[1].OracleType    = OracleType.VarChar;
            para[1].ParameterName = "prmStationID";
            para[1].Value         = StringHelper.GetSubStr(stationID, 30);

            para[2]               = new OracleParameter();
            para[2].Direction     = ParameterDirection.Input;
            para[2].OracleType    = OracleType.VarChar;
            para[2].ParameterName = "prmMessage";
            para[2].Value         = StringHelper.GetSubStr(message, 2000);


            para[3]               = new OracleParameter();
            para[3].Direction     = ParameterDirection.Input;
            para[3].OracleType    = OracleType.VarChar;
            para[3].ParameterName = "PrmOutid";
            para[3].Value         = StringHelper.GetSubStr(outid, 20);


            para[4]               = new OracleParameter();
            para[4].Direction     = ParameterDirection.Input;
            para[4].OracleType    = OracleType.VarChar;
            para[4].ParameterName = "PrmName";
            para[4].Value         = StringHelper.GetSubStr(name, 20);
            #endregion

            return(OracleAppender.ExecuteNonQuery(connectionString, commandText, para) > 0);
        }