Example #1
0
 //---------------------------------------------------------------------------------------------------------------------------------------------------------------
 /// <summary>
 ///     Returns the first n chars in lower case of the pattern stored in this SeachPattern ...
 /// </summary>
 /// <param name="fetFirstNChars">The maximum number of characters to return</param>
 /// <returns></returns>
 public string PatternStartsWith(int firstNChars)
 {
     if (SearchType == SearchType.Text)
     {
         return(Pattern.Substring(0, firstNChars).ToLower());
     }
     else
     {
         // Expand out the score to remove the scientific notation
         return(ScoreMin.ToString("0." + new string('#', 339)));
     }
 }
Example #2
0
        public OrganizationRank SaveOrganizationRank()
        {
            SqlDataReader      result;
            DatabaseConnection dbconn     = new DatabaseConnection();
            SqlCommand         command    = new SqlCommand();
            SqlConnection      connection = new SqlConnection(dbconn.SQLSEVERConnString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "InsertUpdate_OrganizationRank";
                command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationRankID", SqlDbType.Int, OrganizationRankID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationID", SqlDbType.Int, OrganizationID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationRankLevel", SqlDbType.Int, OrganizationRankLevel.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ScoreMin", SqlDbType.Int, ScoreMin.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ScoreMax", SqlDbType.Int, ScoreMax.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Title", SqlDbType.VarChar, Title, 400));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Benefits", SqlDbType.VarChar, Benefits, 4000));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Duties", SqlDbType.Int, Duties, 4000));
                result = command.ExecuteReader();

                result.Read();
                SetReaderToObject(ref result);
            }
            catch
            {
                Exception e = new Exception();
                this._insertUpdateOK = false;
                this._insertUpdateMessage.Append(e.Message.ToString());
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this);
        }