private Sms_Credentils_Model getSmsCredentials() { String query = "Select * from smsCredentials_tb where id=1"; Sms_Credentils_Model creModel = new Sms_Credentils_Model(); try { using (SqlConnection connect = new SqlConnection(this.connection)) { connect.Open(); SqlCommand com = new SqlCommand(query, connect); SqlDataReader reader = com.ExecuteReader(); while (reader.Read()) { creModel.user_number = reader["user_number"].ToString(); creModel.user_password = reader["user_password"].ToString(); } return(creModel); } } catch (Exception e) { creModel.errorMessage = e.Message; return(creModel); } }
public NotifySMS() { connection = DbContext.ConnectDb(); smsCreMd = getSmsCredentials(); this.username = smsCreMd.user_number; this.password = smsCreMd.user_password; }