Esempio n. 1
0
        public LogType StringToEnmLogType(string setting, bool throwIfError)
        {
            switch (setting.Trim().ToUpper())
            {
            case "USERACTION":
                return(LogType.UserAction);

            case "ACTION":
                return(LogType.Action);

            case "WARNING":
                return(LogType.Warning);

            case "ERROR":
                return(LogType.Error);

            case "NONE":
                return(LogType.None);

            default:
                if (throwIfError == true)
                {
                    throw new System.Exception("Cant convert '" + setting + "' to enmLogType");
                }
                else
                {
                    SystemLogData vData = new SystemLogData(this.GetType().Name, "StringToEnmLogType", new System.Exception("Cant convert '" + setting + "' to enmLogType"));
                    Write(vData);
                    return(LogType.Error);
                }
            }
        }
Esempio n. 2
0
        public void Constructor(string connectionString, Dictionary <DataColumn, object> staticData)
        {
            if (staticData == null)
            {
                staticData = new Dictionary <DataColumn, object>();
            }

            this.staticData = staticData;
            this.writer     = new MsSqlWriter(this, connectionString);

            this.logLevel         = LogType.UserAction;
            this.emailLevelLoggin = LogType.None;
            if (Environment.OSVersion.Platform != PlatformID.WinCE)
            {
                try
                {
                    this.emailLoggin = new Email(this);
                }
                catch (Exception ex)
                {
                    SystemLogData errorData = new SystemLogData(this.GetType().Name, "New", ex);
                    this.Write(errorData);
                    this.emailLoggin = null;
                }
            }
            else
            {
                this.emailLoggin = null;
            }

            lock (instances)
            {
                instances.Add(this);
            }

            if (current == null)
            {
                current = this;
            }
        }