public Log_message(string str, Message_level level, Message_type type) { message = str; this.level = level; this.type = type; datetime = DateTime.Now; }
public List <Message_type> getAllMessageType() { try { List <Message_type> lu = new List <Message_type>(); string sql = @"SELECT * FROM message_type"; SqlCommand cmd = new SqlCommand(sql, sqlConnection); sqlConnection.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Message_type u = new Message_type(); u.id_message_type = reader.GetInt32(0); u.message_code = SafeGetString(reader, 1); u.message_description = SafeGetString(reader, 2); lu.Add(u); } sqlConnection.Close(); return(lu); } catch (Exception ex) { sqlConnection.Close(); throw ex; } }
public void ShowMessage(string title, string message, Message_type type) { MessageBoxIcon msgIco; switch (type) { case Message_type.error: msgIco = MessageBoxIcon.Error; break; case Message_type.info: msgIco = MessageBoxIcon.Asterisk; break; case Message_type.warning: msgIco = MessageBoxIcon.Warning; break; default: msgIco = MessageBoxIcon.None; break; } MessageBox.Show(message, title, MessageBoxButtons.OK, msgIco); }
public static void AddText(string new_messag, Message_level level, Message_type type) { log_text.Add(new Log_message(new_messag, level, type)); OnRefresh?.Invoke(log_text); }