Example #1
0
 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;
     }
 }
Example #2
0
 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;
     }
 }
Example #3
0
        /// <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);
        }
Example #4
0
 /// <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());
 }
Example #5
0
            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;
                }
            }
Example #6
0
 /// <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());
 }
Example #7
0
 /// <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());
 }
Example #8
0
 /// <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());
 }
Example #9
0
        /// <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
        }
Example #10
0
 /// <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());
 }
Example #11
0
            private LogContext(DContext context, DLog[] loggers)
            {
                Context = context;
                var dLogs = ((loggers != null) && (loggers.Length > 0)) ? loggers : null;

                if (dLogs != null)
                {
                    this.loggers = dLogs.ToList();
                }
            }
Example #12
0
 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;
 }
Example #14
0
        /// <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));
        }
Example #15
0
 /// <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));
 }
Example #16
0
 /// <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);
     }
 }
Example #17
0
 /// <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);
     }
 }
Example #18
0
 /// <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));
 }
Example #19
0
        /// <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);
        }
Example #20
0
            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)
            };
        }
Example #22
0
 /// <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)));
     }
 }
Example #23
0
 /// <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));
 }
Example #24
0
 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);
     }
 }
Example #25
0
 /// <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);
 }
Example #26
0
 public RecordRepository(DContext context)
 {
     this.db = context;
 }
Example #27
0
 public TheService(DContext dContext)
 {
     this.dContext = dContext;
 }
Example #28
0
 public EFUnitOfWork()
 {
     db = new DContext("Hospital13App");
 }
Example #29
0
 /// <summary>
 /// Default ctor
 /// </summary>
 private OutputPaneLog(IIdeOutputPane outputPane, Levels minLevel,DContext? limitToContext)
 {
     this.outputPane = outputPane;
     this.minLevel = minLevel;
     _limitToContext = limitToContext;
 }
Example #30
0
 /// <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());
 }
Example #31
0
 /// <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());
 }
Example #32
0
 /// <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);
 }
Example #33
0
 protected static void AddToContext(DContext ctx, DLog log)
 {
     GetContext(ctx).AddLogger(log);
     additionalLoggers.TryAdd(log, log);
 }
Example #34
0
 /// <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;
 }
Example #36
0
 /// <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);
Example #37
0
 /// <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);
Example #38
0
 /// <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);
 }
Example #39
0
 /// <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));
 }
Example #40
0
 /// <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);
 }
Example #41
0
 /// <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());
 }
Example #42
0
 public DoctorRepository(DContext context)
 {
     this.db = context;
 }
Example #43
0
 private LogContext(DContext context, DLog[] loggers)
 {
     Context = context;
     Loggers = ((loggers != null) && (loggers.Length > 0)) ? loggers : null;
 }
Example #44
0
 public SearchPeopleController(DContext context)
 {
     _context = context;
 }
Example #45
0
 /// <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();
        }
Example #47
0
 /// <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);
     }
 }
Example #48
0
 public EFUnitOfWork(string connectionString)
 {
     db = new DContext(connectionString);
 }
Example #49
0
 /// <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));
     }                
 }
Example #50
0
 public PatientRepository(DContext context)
 {
     this.db = context;
 }
Example #51
0
 /// <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);
 }
Example #52
0
 private LogContext(DContext context, DLog[] loggers)
 {
     Context = context;
     var dLogs = ((loggers != null) && (loggers.Length > 0)) ? loggers : null;
     if(dLogs != null)
         this.loggers = dLogs.ToList();
 }
Example #53
0
 /// <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);
 }
Example #54
0
 public ValuesController(DContext context)
 {
     _context = context;
 }
Example #55
0
 /// <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);
 }
Example #56
0
        /// <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
        }
Example #57
0
 /// <summary>
 /// Format the given context.
 /// </summary>
 protected static string FormatContext(DContext context)
 {
     return string.Format("[{0:D5}] ", (int) context);
 }