private bool InsertTask(string Message)
        {
            try
            {
                _bStopped = false;
                var  dp    = new DynamicParameters();
                Guid Keyid = Guid.NewGuid();
                dp.Add("@Keyid", Keyid, DbType.Guid, ParameterDirection.Input);
                dp.Add("@Name", Name, DbType.AnsiString, ParameterDirection.Input);
                dp.Add("@Message", Message, DbType.AnsiString, ParameterDirection.Input);
                dp.Add("@ThreadNum", ThreadNum, DbType.Int32, ParameterDirection.Input);
                dp.Add("@NIterations", NIterations, DbType.Int32, ParameterDirection.Input);
                dp.Add("@Actived", 1, DbType.Int32, ParameterDirection.Input);
                int Id = ActionExTask.Insert(dp);

                if (Keyid.ToString().Length > 0)
                {
                    _log.Keyid = Keyid;
                }

                _logMessage(this.ToString(), 0, " - Insert Task: " + Message);
                _logMessageDbLog(this.ToString(), 0, "Insert Task in Db: " + Message);

                return(true);
            }
            catch (Exception ex)
            {
                _logMessage(this.ToString(), ex.HResult, ex.Message);
                _logMessageDbLog(this.ToString(), ex.HResult, ex.Message);
            }
            return(false);
        }
Ejemplo n.º 2
0
        public void ToDbLog(string objectname, int hresult, string message)
        {
            message = hresult > 0 ? message + ": error = " + hresult.ToString() : message;
            message = string.Format("{0}: ", objectname) + message;
            DynamicParameters dp = new DynamicParameters();

            dp.Add("@Keyid", this.Keyid, System.Data.DbType.Guid, System.Data.ParameterDirection.Input);
            dp.Add("@HResult", hresult, System.Data.DbType.Int32, System.Data.ParameterDirection.Input);
            dp.Add("@Message", message, System.Data.DbType.AnsiString, System.Data.ParameterDirection.Input);
            ActionTaskLog = new ActionDBExplorer <ExplorerTasksLog>(this);
            ActionTaskLog.Insert(dp);
        }