protected override void Write(Levels level, DContext context, string url, int column, int lineNr, string msg, Exception exception, object[] args) { if (level < Levels.Warning) return; if ((msg == null) && (exception != null)) msg = exception.Message; if (msg == null) return; lineNr = Math.Max(0, lineNr); column = Math.Max(0, column); switch (level) { case Levels.Warning: if (url != null) log.LogWarning(null, null, null, url, lineNr, column, 0, 0, msg, args); else log.LogWarning(msg, args); break; case Levels.Error: if (url != null) log.LogError(null, null, null, url, lineNr, column, 0, 0, msg, args); else log.LogError(msg, args); break; } }
protected override void Write(Levels level, DContext context, string url, int column, int lineNr, Func<string> messageBuilder) { if (level < Levels.Info) return; lineNr = Math.Max(0, lineNr); column = Math.Max(0, column); switch (level) { //case Levels.Info: // log.LogMessage(messageBuilder()); // break; case Levels.Info: //TODO: get LogMessage to work. case Levels.Warning: if (url != null) log.LogWarning(null, null, null, url, lineNr, column, 0, 0, messageBuilder()); else log.LogWarning(messageBuilder()); break; case Levels.Error: if (url != null) log.LogError(null, null, null, url, lineNr, column, 0, 0, messageBuilder()); else log.LogError(messageBuilder()); break; } }
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> protected override void Write(Levels level, DContext context, string url, int column, int lineNr, string msg, Exception exception, object[] args) { if (context != DContext.VSStatusBar) { return; } if ((msg == null) && (exception != null)) { msg = exception.Message; } if (msg == null) { return; } if (!Show(level, context)) { return; } string text = string.Format(msg, args); SetText(level, text); }
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> protected override void Write(Levels level, DContext context, string url, int column, int lineNr, Func<string> messageBuilder) { if (level < Levels.Error) return; outputPane.EnsureLoaded(); outputPane.LogLine(FormatLevel(level) + messageBuilder()); }
protected override void Write(Levels level, DContext context, string url, int column, int lineNr, Func <string> messageBuilder) { if (level < Levels.Warning) { return; } lineNr = Math.Max(0, lineNr); column = Math.Max(0, column); switch (level) { case Levels.Warning: if (url != null) { log.LogWarning(null, null, null, url, lineNr, column, 0, 0, messageBuilder()); } else { log.LogWarning(messageBuilder()); } break; case Levels.Error: if (url != null) { log.LogError(null, null, null, url, lineNr, column, 0, 0, messageBuilder()); } else { log.LogError(messageBuilder()); } break; } }
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> protected override void Write(Levels level, DContext context, string url, int column, int lineNr, Func <string> messageBuilder) { if (context != DContext.VSStatusBar) { return; } SetText(level, messageBuilder()); }
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> protected override void Write(Levels level, DContext context, string url, int column, int lineNr, Func <string> messageBuilder) { if (!Show(level, context)) { return; } Console.WriteLine(FormatLevel(level) + messageBuilder()); }
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> protected override void Write(Levels level, DContext context, string url, int column, int lineNr, Func <string> messageBuilder) { if (!Show(level, context)) { return; } System.Diagnostics.Debug.WriteLine(FormatLevel(level) + FormatContext(context) + messageBuilder()); }
/// <summary> /// Show messages for the given leven and context? /// </summary> protected static bool Show(Levels level, DContext context) { #if DEBUG return(true); #else return(level > Levels.Debug); #endif }
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> protected override void Write(Levels level, DContext context, string url, int column, int lineNr, Func <string> messageBuilder) { if (level < Levels.Error) { return; } outputPane.EnsureLoaded(); outputPane.LogLine(FormatLevel(level) + messageBuilder()); }
private LogContext(DContext context, DLog[] loggers) { Context = context; var dLogs = ((loggers != null) && (loggers.Length > 0)) ? loggers : null; if (dLogs != null) { this.loggers = dLogs.ToList(); } }
private void read_Click(object sender, RoutedEventArgs e) { using (var context = new DContext()) { var s = context.Users.Select(u => u); foreach (var item in s) { } } }
public UsersController(IUnitOfWork unitOfWork, IMapper mapper, DContext context, IPhotoService photoService, UserManager <AppUser> userManager, RoleManager <AppRole> roleManager) { this._roleManager = roleManager; this._userManager = userManager; this._photoService = photoService; _context = context; this._unitOfWork = unitOfWork; this._mapper = mapper; }
/// <summary> /// Gets the logging context for the given context index. /// </summary> private static LogContext GetContext(DContext context) { LogContext logContext; if (contexts.TryGetValue(context, out logContext)) { return(logContext); } logContext = LogContext.LoadFromRegistry(context, defaultLoggers); contexts.TryAdd(context, logContext); return(GetContext(context)); }
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> protected override void Write(Levels level, DContext context, string url, int column, int lineNr, string msg, Exception exception, object[] args) { if (level < Levels.Error) return; if ((msg == null) && (exception != null)) msg = exception.Message; if (msg == null) return; if (!Show(level, context)) return; outputPane.EnsureLoaded(); outputPane.LogLine(FormatLevel(level) + FormatContext(context) + string.Format(msg, args)); }
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> internal void Write(Levels level, DContext context, string url, int column, int lineNr, string msg, Exception exception, object[] args) { //Console.WriteLine("LOGWRITE_A: " + (int)level); if (loggers != null) { foreach (var log in loggers) { log.Write(level, context, url, column, lineNr, msg, exception, args); } } foreach (var log in additionalLoggers.Keys) { log.Write(level, context, url, column, lineNr, msg, exception, args); } }
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> internal void Write(Levels level, DContext context, string url, int column, int lineNr, Func <string> messageBuilder) { //Console.WriteLine("LOGWRITE_B: " + (int)level); if (loggers != null) { foreach (var log in loggers) { log.Write(level, context, url, column, lineNr, messageBuilder); } } foreach (var log in additionalLoggers.Keys) { log.Write(level, context, url, column, lineNr, messageBuilder); } }
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> protected override void Write(Levels level, DContext context, string url, int column, int lineNr, string msg, Exception exception, object[] args) { if ((msg == null) && (exception != null)) { msg = exception.Message; } if (msg == null) { return; } if (!Show(level, context)) { return; } Console.WriteLine(FormatLevel(level) + string.Format(msg, args)); }
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> protected override void Write(Levels level, DContext context, string url, int column, int lineNr, string msg, Exception exception, object[] args) { if (context != DContext.VSStatusBar) return; if ((msg == null) && (exception != null)) msg = exception.Message; if (msg == null) return; if (!Show(level, context)) return; string text = string.Format(msg, args); SetText(level, text); }
protected override void Write(Levels level, DContext context, string url, int column, int lineNr, string msg, Exception exception, object[] args) { if (level < Levels.Info) { return; } if ((msg == null) && (exception != null)) { msg = exception.Message; } if (msg == null) { return; } lineNr = Math.Max(0, lineNr); column = Math.Max(0, column); switch (level) { //case Levels.Info: // log.LogMessage(msg, args); // break; case Levels.Info: //TODO: get LogMessage to work. case Levels.Warning: if (url != null) { log.LogWarning(null, null, null, url, lineNr, column, 0, 0, msg, args); } else { log.LogWarning(msg, args); } break; case Levels.Error: if (url != null) { log.LogError(null, null, null, url, lineNr, column, 0, 0, msg, args); } else { log.LogError(msg, args); } break; } }
public MainWindow() { InitializeComponent(); user = Repository.CurrUser; repo = new Repository(); db = new DContext(); pets = repo.LoadUsersPetsInto(Repository.CurrUser.userID).ToList(); YourPetsCB.ItemsSource = pets.Select(u => u.petNAME); string path = "pack://application:,,,/Resources/Lang/Lang" + Repository.lang + ".xaml"; this.Resources = new ResourceDictionary() { Source = new Uri(path) }; }
/// <summary> /// Load a context from current user registry. /// </summary> public static LogContext LoadFromRegistry(DContext context, DLog[] defaultLoggers) { using (var key = Registry.CurrentUser.OpenSubKey(RegistryConstants.LOGGING)) { if (key == null) { return(new LogContext(context, defaultLoggers)); } var valueName = ((int)context).ToString(CultureInfo.InvariantCulture); var value = key.GetValue(valueName) as string; if (value == null) { value = key.GetValue("") as string; } if (value == null) { return(new LogContext(context, defaultLoggers)); } return(new LogContext(context, ParseLoggers(value))); } }
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> protected override void Write(Levels level, DContext context, string url, int column, int lineNr, string msg, Exception exception, object[] args) { if (level < Levels.Error) { return; } if ((msg == null) && (exception != null)) { msg = exception.Message; } if (msg == null) { return; } if (!Show(level, context)) { return; } outputPane.EnsureLoaded(); outputPane.LogLine(FormatLevel(level) + FormatContext(context) + string.Format(msg, args)); }
private void insert_Click(object sender, RoutedEventArgs e) { try { var user = new UserEntity() { Name = "Test", Hobby = "ddd", Age = 29 }; using (var context = new DContext()) { context.Users.Add(user); context.SaveChanges(); var accountUsers = context.Users.ToList(); } Console.Write("{0}", user.Id); } catch (Exception ex) { Console.Write("{0}", ex); } }
/// <summary> /// Log the given warning. /// </summary> public static void Warning(DContext context, Exception exception, params object[] args) { GetContext(context).Write(Levels.Warning, context, null, -1, -1, null, exception, args); }
public RecordRepository(DContext context) { this.db = context; }
public TheService(DContext dContext) { this.dContext = dContext; }
public EFUnitOfWork() { db = new DContext("Hospital13App"); }
/// <summary> /// Default ctor /// </summary> private OutputPaneLog(IIdeOutputPane outputPane, Levels minLevel,DContext? limitToContext) { this.outputPane = outputPane; this.minLevel = minLevel; _limitToContext = limitToContext; }
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> protected override void Write(Levels level, DContext context, string url, int column, int lineNr, Func<string> messageBuilder) { if (context != DContext.VSStatusBar) return; SetText(level, messageBuilder()); }
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> protected override void Write(Levels level, DContext context, string url, int column, int lineNr, Func<string> messageBuilder) { if (!Show(level, context)) return; System.Diagnostics.Debug.WriteLine(FormatLevel(level) + FormatContext(context) + messageBuilder()); }
/// <summary> /// Log the given info message. /// </summary> public static void Info(DContext context, string msg, params object[] args) { GetContext(context).Write(Levels.Info, context, null, -1, -1, msg, null, args); }
protected static void AddToContext(DContext ctx, DLog log) { GetContext(ctx).AddLogger(log); additionalLoggers.TryAdd(log, log); }
/// <summary> /// Gets the logging context for the given context index. /// </summary> private static LogContext GetContext(DContext context) { LogContext logContext; if (contexts.TryGetValue(context, out logContext)) return logContext; logContext = LogContext.LoadFromRegistry(context, defaultLoggers); contexts.TryAdd(context, logContext); return GetContext(context); }
public BuggyController(DContext context) { _context = context; }
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> protected abstract void Write(Levels level, DContext context, string url, int column, int lineNr, Func<string> messageBuilder);
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> protected abstract void Write(Levels level, DContext context, string url, int column, int lineNr, string msg, Exception exception, object[] args);
/// <summary> /// Log the given debug message. /// </summary> public static void Debug(DContext context, string msg, Exception exception, params object[] args) { GetContext(context).Write(Levels.Debug, context, null, -1, -1, msg, exception, args); }
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> protected override void Write(Levels level, DContext context, string url, int column, int lineNr, string msg, Exception exception, object[] args) { if ((msg == null) && (exception != null)) msg = exception.Message; if (msg == null) return; if (!Show(level, context)) return; Console.WriteLine(FormatLevel(level) + string.Format(msg, args)); }
/// <summary> /// Log the given warning. /// </summary> public static void Warning(DContext context, Exception exception, params object[] args) { GetContext(context).Write(Levels.Warning, context, null, -1, -1, null, exception, args); }
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> protected override void Write(Levels level, DContext context, string url, int column, int lineNr, Func<string> messageBuilder) { if (!Show(level, context)) return; Console.WriteLine(FormatLevel(level) + messageBuilder()); }
public DoctorRepository(DContext context) { this.db = context; }
private LogContext(DContext context, DLog[] loggers) { Context = context; Loggers = ((loggers != null) && (loggers.Length > 0)) ? loggers : null; }
public SearchPeopleController(DContext context) { _context = context; }
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> internal void Write(Levels level, DContext context, string url, int column, int lineNr, string msg, Exception exception, object[] args) { //Console.WriteLine("LOGWRITE_A: " + (int)level); if (Loggers != null) { foreach (var log in Loggers) { log.Write(level, context, url, column, lineNr, msg, exception, args); } } foreach (var log in additionalLoggers.Keys) { log.Write(level, context, url, column, lineNr, msg, exception, args); } }
/// <summary> /// InitalizeTimeTableContext /// </summary> private void InitalizeTimeTableContext() { TimeTableContext = new DContext(); // Create List Columns TimeTableContext.Columns = new ObservableCollection <DColumn> { }; // Add Label Column DColumn labelColum = new DColumn { Width = 20 }; TimeTableContext.Columns.Add(labelColum); // Add 7x12 column for content for (var i = 0; i < 84; i++) { var contentColumn = new DColumn() { Width = 30 }; TimeTableContext.Columns.Add(contentColumn); } TimeTableContext.Rows = new ObservableCollection <DRow>() { }; // Add row for Day var dayRow = new DRow() { Height = 20 }; TimeTableContext.Rows.Add(dayRow); // Add row for index var indexRow = new DRow() { Height = 15 }; TimeTableContext.Rows.Add(indexRow); // Add 50 content Row for (var i = 0; i < 50; i++) { var contentRow = new DRow() { Height = 30 }; TimeTableContext.Rows.Add(contentRow); } // Add Monday var mondayCell = new DCell(0, 1, 1, 12); mondayCell.BackgroundContent = "Monday"; mondayCell.UIContent = new lessonView(); TimeTableContext.AddCell(mondayCell); AddLessonIndex(1, 12); // Add Tuesday var tuesdayCell = new DCell(0, 13, 1, 12); tuesdayCell.BackgroundContent = "Tuesday"; TimeTableContext.AddCell(tuesdayCell); AddLessonIndex(13, 12); // Add Wednesday var wednesDayCell = new DCell(0, 25, 1, 12); wednesDayCell.BackgroundContent = "Wesnesday"; TimeTableContext.AddCell(wednesDayCell); AddLessonIndex(25, 12); // Add Thursday var thursdayCell = new DCell(0, 37, 1, 12); thursdayCell.BackgroundContent = "Thursday"; TimeTableContext.AddCell(thursdayCell); AddLessonIndex(37, 12); // Add Friday var fridayCell = new DCell(0, 49, 1, 12); fridayCell.BackgroundContent = "Friday"; TimeTableContext.AddCell(fridayCell); AddLessonIndex(49, 12); // Add Saturday var saturdayCell = new DCell(0, 61, 1, 12); saturdayCell.BackgroundContent = "Saturday"; TimeTableContext.AddCell(saturdayCell); AddLessonIndex(61, 12); // Add Sunday var sundayCell = new DCell(0, 73, 1, 12); sundayCell.BackgroundContent = "Sunday"; TimeTableContext.AddCell(sundayCell); AddLessonIndex(73, 12); //var dumyCell = new DCell(1, 1, 1, 1); //TimeTableContext.AddCell(dumyCell); // InsertBackgroudForAllTimeItems InsertBackgroudForAllTimeItems(); }
/// <summary> /// Record the given log entry if the level is sufficient. /// </summary> internal void Write(Levels level, DContext context, string url, int column, int lineNr, Func<string> messageBuilder) { //Console.WriteLine("LOGWRITE_B: " + (int)level); if (Loggers != null) { foreach (var log in Loggers) { log.Write(level, context, url, column, lineNr, messageBuilder); } } foreach (var log in additionalLoggers.Keys) { log.Write(level, context, url, column, lineNr, messageBuilder); } }
public EFUnitOfWork(string connectionString) { db = new DContext(connectionString); }
/// <summary> /// Load a context from current user registry. /// </summary> public static LogContext LoadFromRegistry(DContext context, DLog[] defaultLoggers) { using (var key = Registry.CurrentUser.OpenSubKey(RegistryConstants.LOGGING)) { if (key == null) return new LogContext(context, defaultLoggers); var valueName = ((int) context).ToString(CultureInfo.InvariantCulture); var value = key.GetValue(valueName) as string; if (value == null) { value = key.GetValue("") as string; } if (value == null) return new LogContext(context, defaultLoggers); return new LogContext(context, ParseLoggers(value)); } }
public PatientRepository(DContext context) { this.db = context; }
/// <summary> /// Log the given error. /// </summary> public static void Error(DContext context, string url, int column, int lineNr, string msg, params object[] args) { GetContext(context).Write(Levels.Error, context, url, column, lineNr, msg, null, args); }
private LogContext(DContext context, DLog[] loggers) { Context = context; var dLogs = ((loggers != null) && (loggers.Length > 0)) ? loggers : null; if(dLogs != null) this.loggers = dLogs.ToList(); }
/// <summary> /// Log the given error. /// </summary> public static void Error(DContext context, Exception exception, params object[] args) { GetContext(context).Write(Levels.Error, context, null, -1, -1, null, exception, args); ErrorLog.DumpError(exception); }
public ValuesController(DContext context) { _context = context; }
/// <summary> /// Log the given debug message. /// </summary> public static void Debug(DContext context, Func<string> messageBuilder) { GetContext(context).Write(Levels.Debug, context, null, -1, -1, messageBuilder); }
/// <summary> /// Show messages for the given leven and context? /// </summary> protected static bool Show(Levels level, DContext context) { #if DEBUG return true; #else return (level > Levels.Debug); #endif }
/// <summary> /// Format the given context. /// </summary> protected static string FormatContext(DContext context) { return string.Format("[{0:D5}] ", (int) context); }