public enmLogType StringToEnmLogType(string Setting, bool ThrowIfError) { switch (Setting.Trim().ToUpper()) { case "USERACTION": return(enmLogType.UserAction); case "ACTION": return(enmLogType.Action); case "WARNING": return(enmLogType.Warning); case "ERROR": return(enmLogType.Error); case "NONE": return(enmLogType.None); default: if (ThrowIfError == true) { throw new System.Exception("Cant convert '" + Setting + "' to enmLogType"); } else { SysLogData vData = new SysLogData(this.GetType().Name, "StringToEnmLogType", new System.Exception("Cant convert '" + Setting + "' to enmLogType")); Write(vData); return(enmLogType.Error); } } }
private void Constructor(string ConnectionString, Dictionary <DataColumn, object> StaticData) { if (StaticData == null) { StaticData = new Dictionary <DataColumn, object>(); } _StaticData = StaticData; _Writer = new MsSqlWriter(this, ConnectionString); _LogLevel = enmLogType.UserAction; _eMailLevel = enmLogType.None; if (Environment.OSVersion.Platform != PlatformID.WinCE) { try { _eMail = new EMail(this); } catch (Exception ex) { SysLogData vErrData = new SysLogData(this.GetType().Name, "New", ex); Write(vErrData); _eMail = null; } } else { _eMail = null; } lock (_Instances) { _Instances.Add(this); } if (_Current == null) { _Current = this; } }