public static bool Evalue(string query) { ConnectionMySQL.Connect(); MySqlCommand command = new MySqlCommand(query, ConnectionMySQL.GetConnection()); MySqlDataReader readerm = command.ExecuteReader(); bool flag = false; while (readerm.Read()) { flag = true; } ConnectionMySQL.Disconnect(); return(flag); }
public static string GetInternCode() { ConnectionMySQL.Connect(); string query = "select max(abs(intern_code)) from authorizations"; MySqlCommand command = new MySqlCommand(query, ConnectionMySQL.GetConnection()); MySqlDataReader readerm = command.ExecuteReader(); string intern_code = "0"; while (readerm.Read()) { string valor = readerm.GetValue(0).ToString(); if (valor == "0" || valor == null || valor == "" || Convert.ToInt32(valor) <= 15000) { intern_code = "15001"; } else { intern_code = (Convert.ToInt32(valor) + 1).ToString(); } } ConnectionMySQL.Disconnect(); return(intern_code); }
public static string GetClinicHistoryCode() { ConnectionMySQL.Connect(); string query = "select max(abs(clinic_history_code)) from patients"; MySqlCommand command = new MySqlCommand(query, ConnectionMySQL.GetConnection()); MySqlDataReader readerm = command.ExecuteReader(); string clinic_history_code = "0"; while (readerm.Read()) { string valor = readerm.GetValue(0).ToString(); if (valor == "0" || valor == null || valor == "" || Convert.ToInt32(valor) <= 5000) { clinic_history_code = "5001"; } else { clinic_history_code = (Convert.ToInt32(valor) + 1).ToString(); } } ConnectionMySQL.Disconnect(); return(clinic_history_code); }