void BindData()
    {
        LettersType         lt  = LettersType.Category;
        NameValueCollection req = Request.QueryString;

        try { lt = (LettersType)(int.Parse(req["t"])); }
        catch { }

        string w = "a";

        if (!string.IsNullOrEmpty(req["w"]))
        {
            w = req["w"];
            if (char.IsLetter(w, 0))
            {
                w = w[0].ToString();
            }
            else
            {
                w = "a";
            }
        }
        w = w.ToUpper();
        llCategory.LetterType  = lt;
        llCategory.FirstLetter = w;
        ltLetterType.Text      = "按首字母<span class=\"needed\">\"" + w + "\"</span>检索【" + GetDesc(lt) + "】";
    }
Example #2
0
 /// <summary>
 /// Возвращает массив символов, представляющих арабские цифры и все литеры латинского алфавита. Символы в массиве отсортированы и встречаются только один раз.
 /// </summary>
 /// <param name="LettersType">Категория литер, которая должна присутствовать в выводном массиве.</param>
 /// <returns></returns>
 public static Char[] DigitsAndLatinLetters(LettersType LettersType)
 {
     Char[] temp1 = CharSeqGen.DigitsOnly();
     Char[] temp2 = CharSeqGen.LatinLetters(LettersType);
     Char[] output = new Char[temp1.Length + temp2.Length];
     Array.ConstrainedCopy(temp1, 0, output, 0, temp1.Length);
     Array.ConstrainedCopy(temp2, 0, output, temp1.Length, temp2.Length);
     return output;
 }
    string GetDesc(LettersType lt)
    {
        switch (lt)
        {
        case LettersType.Category:
            return("产品类别");

        case LettersType.Brand:
            return("产品品牌");

        case LettersType.Industry:
            return("产品行业");
        }
        return("——");
    }
Example #4
0
 /// <summary>
 /// Возвращает массив символов, представляющих все литеры латинского алфавита. Символы в массиве отсортированы и встречаются только один раз.
 /// </summary>
 /// <param name="LettersType">Категория литер, которая должна присутствовать в выводном массиве.</param>
 /// <returns></returns>
 public static Char[] LatinLetters(LettersType LettersType)
 {
     Char[] output;
     switch (LettersType)
     {
         case LettersType.AllCase:
             output = new Char[26 * 2];
             for (Int32 i = 0x41, j = 0; i <= 0x5A; i++, j++)
             {
                 output[j] = (Char)i;
             }
             for (Int32 i = 0x61, j = 26; i <= 0x7A; i++, j++)
             {
                 output[j] = (Char)i;
             }
             break;
         case LettersType.OnlyCapitalCase:
             output = new Char[26];
             for (Int32 i = 0x41, j = 0; i <= 0x5A; i++, j++)
             {
                 output[j] = (Char)i;
             }
             break;
         case LettersType.OnlyLowerCase:
             output = new Char[26];
             for (Int32 i = 0x61, j = 0; i <= 0x7A; i++, j++)
             {
                 output[j] = (Char)i;
             }
             break;
         default:
             throw new InvalidEnumArgumentException("LettersType", (Int32)LettersType, LettersType.GetType());
     }
     return output;
 }