Ejemplo n.º 1
0
 public BankLib.Model.BankMaster GetDetails(string query)
 {
     using (SqlConnection connection = DBConnection.GetConnection())
     {
         connection.Open();
         SqlCommand command = connection.CreateCommand();
         command.Connection = connection;
         try
         {
             command.CommandText = query;
             var reader = command.ExecuteReader();
             while (reader.Read())
             {
                 if (reader.HasRows)
                 {
                     BankLib.Model.BankMaster bankMaster = new Model.BankMaster(Convert.ToString(reader.GetValue(0)), Convert.ToString(reader.GetValue(1)), Convert.ToDouble(reader.GetValue(2)));
                     return(bankMaster);
                 }
             }
             return(null);
         }
         catch (Exception)
         {
             return(null);
         }
     }
 }
Ejemplo n.º 2
0
 public bool IsValidUser(string query, string name, string password)
 {
     using (SqlConnection connection = DBConnection.GetConnection())
     {
         connection.Open();
         SqlCommand command = connection.CreateCommand();
         command.Connection = connection;
         try
         {
             command.CommandText = query;
             var reader = command.ExecuteReader();
             while (reader.Read())
             {
                 if (reader.HasRows)
                 {
                     BankLib.Model.BankMaster bankMaster = new Model.BankMaster(Convert.ToString(reader.GetValue(0)), Convert.ToString(reader.GetValue(1)), Convert.ToDouble(reader.GetValue(2)));
                     return(true);
                 }
             }
             return(false);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }