private void LogStatus(LogStatusType type, string message) { if (LogStatusEvent != null) { LogStatusEvent(type, message); } }
public bool SetText(string strNewText, LogStatusType lsType) { if (strNewText == null) { return(true); } if (lsType != LogStatusType.Info) { return(true); } if (m_bUseThread && (m_th == null)) { ThreadStart ts = new ThreadStart(this.GuiThread); m_th = new Thread(ts); m_th.Start(); } if (!m_bUseThread && (m_dlgModal == null)) { m_dlgModal = ConstructStatusDialog(); } lock (m_objSync) { m_strProgress = strNewText; } return((m_dlgModal != null) ? m_dlgModal.SetText(strNewText, lsType) : true); }
public static void LogStatus(LogStatusType logtype, string message) { lock (_consoleLock) { switch (logtype) { case LogStatusType.MSG_IN: Console.ForegroundColor = ConsoleColor.Green; Console.Write("[<---] "); break; case LogStatusType.MSG_OUT: Console.ForegroundColor = ConsoleColor.Gray; Console.Write("[--->] "); break; case LogStatusType.WARN: Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("[WARN] "); break; case LogStatusType.ERROR: Console.ForegroundColor = ConsoleColor.Red; Console.Write("[ERROR] "); break; default: Console.Write("[INFO] "); Console.ForegroundColor = ConsoleColor.White; break; } Console.WriteLine(message); Console.ResetColor(); } }
public void OnLogEvent(LogStatusType type, string message) { if (LogStatusEvent != null) { LogStatusEvent(type, message); } }
// ......................................................................................... public static LogStatusType GetLogStatus(string userId) { LogStatusType logStatus = new LogStatusType(); try { DataProvider.ExecuteNonQuery(GetConnection, "dbo.LogStatus_GetStatus", inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@UserId", userId); var p = new SqlParameter("@LogStatus", System.Data.SqlDbType.Int); p.Direction = System.Data.ParameterDirection.Output; paramCollection.Add(p); }, returnParameters : delegate(SqlParameterCollection param) { LogStatusType.TryParse(param["@LogStatus"].Value.ToString(), out logStatus); }); } catch { logStatus = LogStatusType.Error; } return(logStatus); }
public bool SetText(string strNewText, LogStatusType lsType) { switch (lsType) { case LogStatusType.Info: System.Diagnostics.Debug.WriteLine(strNewText); break; case LogStatusType.Warning: System.Diagnostics.Debug.WriteLine($"WARNING: {strNewText}"); break; case LogStatusType.Error: System.Diagnostics.Debug.WriteLine($"ERROR: {strNewText}"); break; case LogStatusType.AdditionalInfo: System.Diagnostics.Debug.WriteLine($"Additional Info: {strNewText}"); break; default: throw new ArgumentOutOfRangeException(nameof(lsType), lsType, null); } return(true); }
public bool SetText(string strNewText, LogStatusType lsType) { if (m_dlg == null) { Debug.Assert(false); return(true); } return(m_dlg.SetText(strNewText, lsType)); }
public bool SetText(string strNewText, LogStatusType lsType) { Debug.Assert(m_bActive); if ((m_slForm == null) && ((lsType == LogStatusType.Warning) || (lsType == LogStatusType.Error))) { m_slForm = new StatusLoggerForm(); m_slForm.InitEx(false); m_slForm.Show(); m_slForm.BringToFront(); bool bLoggingStarted = false; foreach (KeyValuePair <LogStatusType, string> kvp in m_vCachedMessages) { if (!bLoggingStarted) { m_slForm.StartLogging(kvp.Value, true); bLoggingStarted = true; } else { m_slForm.SetText(kvp.Value, kvp.Key); } } Debug.Assert(bLoggingStarted); m_vCachedMessages.Clear(); } bool b = !m_bCancelled; if (m_sbDefault != null) { if (!m_sbDefault.SetText(strNewText, lsType)) { b = false; } } if (m_slForm != null) { if (!m_slForm.SetText(strNewText, lsType)) { b = false; } } if (m_slForm == null) { m_vCachedMessages.Add(new KeyValuePair <LogStatusType, string>( lsType, strNewText)); } return(b); }
// report error details private void reportError(String msg, String heading, IStatusLogger slLogger, LogStatusType lst) { MessageBox.Show(msg, heading, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); slLogger.SetText(msg, lst); }
private void UpdateMessage(string message, LogStatusType lsType) { if (lsType == LogStatusType.AdditionalInfo) { UpdateSubMessage(message); } else { UpdateMessage(message); } }
public bool SetText(string strNewText, LogStatusType lsType) { Debug.Assert(m_bStartedLogging && !m_bEndedLogging); if ((m_sbText != null) && (lsType == LogStatusType.Info)) { m_sbText.Text = strNewText; Application.DoEvents(); } return(true); }
public bool SetText(string strNewText, LogStatusType lsType) { Debug.Assert(m_bActive); if ((m_sbText != null) && (lsType == LogStatusType.Info)) { m_sbText.Text = (strNewText ?? string.Empty); UIUtil.DoEventsByTime(true); } return(true); }
/// <summary> /// Set the current status text. /// </summary> /// <param name="strNewText">Status text.</param> /// <param name="lsType">Type of the message.</param> /// <returns>Returns <c>true</c> if the caller should continue /// the current work.</returns> public bool SetText(string strNewText, LogStatusType lsType) { // Debug.Assert(m_bStartedLogging && !m_bEndedLogging); m_vCachedMessages.Clear(); bool b = true; m_vCachedMessages.Add(new KeyValuePair <LogStatusType, string>( lsType, strNewText)); return(b); }
public bool SetText(string strNewText, LogStatusType lsType) { if (m_mf != null) { if (!string.IsNullOrEmpty(strNewText)) { m_mf.SetStatusEx(strNewText); Application.DoEvents(); } } return(true); }
public static bool CreateNewLog(string userId, NewUserLogInsertRequest model) { bool isSuccess = true; // verify log does not already exist LogStatusType logStatus = LogService.Data.GetLogStatus(userId); if (logStatus != LogStatusType.NewUser) { throw new ApplicationException("A log already exists for the current user."); } DateTime today = DateTime.Today; DateTime startOfThisYear = LogService.GetYearStartOfDate(today); DateTime startOfThisMonth = LogService.GetMonthStartOfDate(today); string defaultMonthGoalType = "Fixed"; int defaultMonthFixedGoal = 100; var firstMonth = new DbMonth( monthId: 0, userId: userId, startDate: startOfThisMonth, grossCredits: 0, grossDebits: 0, startAmount: model.StartAmount, previousMonthId: null, isStartAmountConfirmed: true); try { // Create Preferences LogService.Data.InsertUserPreferences(userId, defaultMonthGoalType, defaultMonthFixedGoal); // Create Year LogService.Data.InsertYear(userId, startOfThisYear, model.StartAmount, model.YearGoal); // Create Month LogService.Data.InsertDbMonth(firstMonth); // Create Categories LogService.Data.SetDefaultCategories(userId); } catch (Exception e) { isSuccess = false; throw e; } return(isSuccess); }
public bool SetText(string strNewText, LogStatusType lsType) { if (strNewText.StartsWith("KP2AKEY_")) { UiStringKey key; if (Enum.TryParse(strNewText.Substring("KP2AKEY_".Length), true, out key)) { UpdateMessage(_app.GetResourceString(key), lsType); return true; } } UpdateMessage(strNewText, lsType); return true; }
public bool SetText(string strNewText, LogStatusType lsType) { if (strNewText.StartsWith("KP2AKEY_")) { UiStringKey key; if (Enum.TryParse(strNewText.Substring("KP2AKEY_".Length), true, out key)) { UpdateMessage(_app.GetResourceString(key), lsType); return(true); } } UpdateMessage(strNewText, lsType); return(true); }
public bool SetText(string strNewText, LogStatusType lsType) { if ((m_mf != null) && !string.IsNullOrEmpty(strNewText)) { m_strText = strNewText; m_mf.SetStatusEx(strNewText); UIUtil.DoEventsByTime(true); } else { UIUtil.DoEventsByTime(false); } return(true); }
public bool SetText(string strNewText, LogStatusType lsType) { if(strNewText == null) return true; if(lsType != LogStatusType.Info) return true; if(m_bUseThread && (m_th == null)) { ThreadStart ts = new ThreadStart(this.GuiThread); m_th = new Thread(ts); m_th.Start(); } if(!m_bUseThread && (m_dlgModal == null)) m_dlgModal = ConstructStatusDialog(); lock(this) { m_strProgress = strNewText; } return ((m_dlgModal != null) ? m_dlgModal.SetText(strNewText, lsType) : true); }
public ActionResult NewYear() { LogStatusType currentStatus = LogService.GetStatusForCurrentMonth(); switch (currentStatus) { case LogStatusType.NewYear: return(View()); case LogStatusType.OK: return(RedirectToAction("Index")); case LogStatusType.NewUser: return(RedirectToAction("NewUser")); default: return(RedirectToAction("Error", "Home")); } }
public bool SetText(string strNewText, LogStatusType lsType) { if (strNewText != null) { m_lvMessages.Items.Add(strNewText, (int)lsType); m_lvMessages.EnsureVisible(m_lvMessages.Items.Count - 1); } if (lsType == LogStatusType.Warning) { ++uWarnings; } else if (lsType == LogStatusType.Error) { ++uErrors; } ProcessResize(); Application.DoEvents(); return(!m_bCancelled); }
public bool SetText(string strNewText, LogStatusType lsType) { if(m_dlg == null) { Debug.Assert(false); return true; } return m_dlg.SetText(strNewText, lsType); }
/// <summary> /// Set the current status text. /// </summary> /// <param name="strNewText">Status text.</param> /// <param name="lsType">Type of the message.</param> /// <returns>Returns <c>true</c> if the caller should continue /// the current work.</returns> public bool SetText(string strNewText, LogStatusType lsType) { Debug.Assert(m_bStartedLogging && !m_bEndedLogging); if((m_slForm == null) && ((lsType == LogStatusType.Warning) || (lsType == LogStatusType.Error))) { m_slForm = new StatusLoggerForm(); m_slForm.InitEx(false); m_slForm.Show(); m_slForm.BringToFront(); bool bLoggingStarted = false; foreach(KeyValuePair<LogStatusType, string> kvp in m_vCachedMessages) { if(!bLoggingStarted) { m_slForm.StartLogging(kvp.Value, true); bLoggingStarted = true; } else m_slForm.SetText(kvp.Value, kvp.Key); } Debug.Assert(bLoggingStarted); m_vCachedMessages.Clear(); } bool b = true; if(m_sbDefault != null) b &= m_sbDefault.SetText(strNewText, lsType); if(m_slForm != null) b &= m_slForm.SetText(strNewText, lsType); if(m_slForm == null) m_vCachedMessages.Add(new KeyValuePair<LogStatusType, string>( lsType, strNewText)); return b; }
public bool SetText(string strNewText, LogStatusType lsType) { return(true); }
public bool SetText(string strNewText, LogStatusType lsType) { this.StoreLine(strNewText); return(true); }
public bool SetText(string strNewText, LogStatusType lsType) { if(m_mf != null) { if(!string.IsNullOrEmpty(strNewText)) { m_mf.SetStatusEx(strNewText); Application.DoEvents(); } } return true; }
public bool SetText(string strNewText, LogStatusType lsType) { Debug.Assert(m_bStartedLogging && !m_bEndedLogging); if((m_sbText != null) && (lsType == LogStatusType.Info)) { m_sbText.Text = strNewText; Application.DoEvents(); } return true; }
public void OnLogEvent(LogStatusType logType, string message) { _protocolEngine.OnLogEvent(logType, message); }
public bool SetText(string strNewText, LogStatusType lsType) { return SetProgressGlobal(strNewText, -1); }
public bool SetText(string strNewText, LogStatusType lsType) { if(strNewText != null) { m_lvMessages.Items.Add(strNewText, (int)lsType); m_lvMessages.EnsureVisible(m_lvMessages.Items.Count - 1); } if(lsType == LogStatusType.Warning) ++uWarnings; else if(lsType == LogStatusType.Error) ++uErrors; ProcessResize(); Application.DoEvents(); return !m_bCancelled; }
public bool SetText(string strNewText, LogStatusType lsType) { Console.WriteLine(strNewText); return(true); }
public bool SetText(string strNewText, LogStatusType lsType) { return(SetProgressGlobal(strNewText, -1)); }
/// <summary> /// Log function for the KPSimpleBackup plugin. It should be used only /// by KPSimpleBackup, since it puts the plugin name in front of each /// log line. /// </summary> /// <param name="text">Text that will be logged</param> /// <param name="lsType">Status Type</param> public void Log(string text, LogStatusType lsType) { this.StoreLine("[KPSimpleBackup] [" + lsType + "] " + text); }
public bool SetText(string strNewText, LogStatusType lsType) { return true; }