Пример #1
0
 public bool SetQuery(string songName, string artistName, int fromYear, int toYear)
 {
     try
     {
         bool songNamePresent   = !songName.Equals(string.Empty);
         bool artistNamePresent = !artistName.Equals(string.Empty);
         this.command = IKnowWhatIWantQuriesBank.GetArtistQuery(artistNamePresent, songNamePresent, this.conn.Connection);
         if (songNamePresent)
         {
             command.Parameters["@songName"].Value = "%" + songName + "%";
         }
         if (artistNamePresent)
         {
             command.Parameters["@artistName"].Value = "%" + artistName + "%";
         }
         command.Parameters["@fromYear"].Value = fromYear;
         command.Parameters["@toYear"].Value   = toYear;
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }