Esempio n. 1
0
        public static UserTable GetNamePinyin(UserModel u, string isFormat)
        {
            UserTable au       = new UserTable();
            string    xingming = u.SurnameChinese + u.NameChinese;

            au.Name   = xingming;
            au.ID     = u.UUID.ToString();
            au.UserID = u.UUID + "";



            try
            {
                if (xingming.Length == 2)
                {
                    if (XingDuoYin.ContainsKey(xingming[0].ToString()))
                    {
                        au.CName  = xingming[0].ToString();
                        au.PYName = XingDuoYin[xingming[0].ToString()];
                    }
                    else
                    {
                        au.CName  = xingming[0].ToString();
                        au.PYName = ConvertPinyin(xingming[0], isFormat);
                    }

                    au.CSurname  = xingming[1].ToString();
                    au.PYSurname = ConvertPinyin(xingming[1], isFormat);
                }
                else
                {
                    int isFuXing = Fuxing.Count(s => xingming.StartsWith(s)) > 0 ? 2 : 1;
                    for (int i = 0; i < xingming.Length; i++)
                    {
                        if (i == 0 && isFuXing == 1 && XingDuoYin.ContainsKey(xingming[0].ToString()))
                        {
                            au.CName  = xingming[0].ToString();
                            au.PYName = XingDuoYin[xingming[0].ToString()];
                        }
                        else if (i < isFuXing)
                        {
                            au.PYName += ConvertPinyin(xingming[i], isFormat);
                            au.CName  += xingming[i];
                        }
                        else
                        {
                            au.PYSurname += ConvertPinyin(xingming[i], isFormat);
                            au.CSurname  += xingming[i];
                        }
                    }
                }
            }
            catch { }

            return(au);
        }
Esempio n. 2
0
        public static UserTableS GetNamePinyin1(UserModel u)
        {
            geshi      geshi = new geshi();
            UserTableS aus   = new UserTableS();
            UserTable  au    = new UserTable();

            au.Name = u.SurnameChinese + u.NameChinese;
            au.ID   = u.UUID.ToString();

            string xingming = u.SurnameChinese + u.NameChinese;

            try
            {
                if (xingming.Length == 2)
                {
                    if (XingDuoYin.ContainsKey(xingming[0].ToString()))
                    {
                        au.CName  = xingming[0].ToString();
                        au.PYName = XingDuoYin[xingming[0].ToString()];
                    }
                    else
                    {
                        au.CName  = xingming[0].ToString();
                        au.PYName = ConvertPinyin(xingming[0], "big");
                    }

                    au.CSurname  = xingming[1].ToString();
                    au.PYSurname = ConvertPinyin(xingming[1], "big");


                    string dade  = ConvertPinyin(xingming[1], "big");
                    string dadeN = GetUpper(dade);


                    geshi.q6  = dade + " " + GetUpper(au.PYName);
                    geshi.q7  = au.PYName + " " + dade;
                    geshi.q8  = au.PYName + " " + dade + "-";
                    geshi.q9  = au.PYName + " " + dadeN + ".";
                    geshi.q10 = au.PYName + " " + dadeN + ".-";
                    geshi.q11 = dade + " " + au.PYName;
                    geshi.q12 = dade + "-" + " " + au.PYName;
                    geshi.q13 = au.PYName + "," + dade;
                    geshi.q14 = au.PYName + "," + dade;
                    geshi.q15 = au.PYName + "," + dadeN;
                    geshi.q16 = au.PYName + "," + dade + "-";
                    geshi.q17 = au.PYName + ", " + dadeN + ".";
                    geshi.q18 = au.PYName + ", " + dadeN + ".-";
                    geshi.q19 = au.PYName + " " + dade + "(" + au.Name + ")";
                    geshi.q20 = au.PYName + " " + dade + " (" + au.Name + ")";
                    geshi.q21 = au.PYName + " " + dade + "(" + au.Name + ")";
                    geshi.q22 = au.PYName + " " + dade + " (" + au.Name + ")";
                    geshi.q23 = dade + " " + au.PYName;
                    geshi.q24 = au.PYName + " " + dade;
                    geshi.q25 = au.PYName + ", " + dade + "(" + au.Name + ")";
                    geshi.q26 = au.PYName + ", " + dade + " (" + au.Name + ")";
                    geshi.q27 = au.PYName + ", " + dade + " (" + au.Name + ")";
                    geshi.q28 = au.PYName + " " + dadeN + "(" + au.Name + ")";
                    geshi.q29 = au.PYName + " " + dadeN + " (" + au.Name + ")";
                }
                else
                {
                    int isFuXing = Fuxing.Count(s => xingming.StartsWith(s)) > 0 ? 2 : 1;
                    for (int i = 0; i < xingming.Length; i++)
                    {
                        if (i == 0 && isFuXing == 1 && XingDuoYin.ContainsKey(xingming[0].ToString()))
                        {
                            au.CName  = xingming[0].ToString();
                            au.PYName = XingDuoYin[xingming[0].ToString()];
                        }
                        else if (i < isFuXing)
                        {
                            au.PYName += ConvertPinyin(xingming[i], "big");
                            au.CName  += xingming[i];
                        }
                        else
                        {
                            string dade   = ConvertPinyin(xingming[i], "big");
                            string xiaode = ConvertPinyin(xingming[i], "little");

                            if (i == isFuXing)
                            {
                                geshi.q6  += dade;
                                geshi.q7  += dade;
                                geshi.q8  += dade + "-";
                                geshi.q10 += GetUpper(dade) + ".-";
                                geshi.q11 += dade;
                                geshi.q12 += dade + "-";
                                geshi.q14 += dade;
                                geshi.q16 += dade + "-";
                                geshi.q18 += GetUpper(dade) + ".-";
                                geshi.q19 += dade;
                                geshi.q20 += dade;
                                geshi.q23 += dade;
                                geshi.q24 += dade;
                                geshi.q27 += dade;
                            }
                            else
                            {
                                geshi.q6  += xiaode;
                                geshi.q7  += xiaode;
                                geshi.q8  += xiaode;
                                geshi.q10 += GetUpper(dade) + ".";
                                geshi.q11 += xiaode;
                                geshi.q12 += xiaode;
                                geshi.q14 += xiaode;
                                geshi.q16 += xiaode;
                                geshi.q18 += GetUpper(dade) + ".";
                                geshi.q19 += xiaode;
                                geshi.q20 += xiaode;
                                geshi.q23 += "-" + xiaode;
                                geshi.q24 += "-" + xiaode;
                                geshi.q27 += xiaode;
                            }
                            geshi.q9  += GetUpper(dade) + ".";
                            geshi.q13 += dade;
                            geshi.q15 += GetUpper(dade);
                            geshi.q17 += GetUpper(dade) + ".";
                            geshi.q21 += dade;
                            geshi.q22 += dade;
                            geshi.q25 += dade;
                            geshi.q26 += dade;
                            geshi.q28 += GetUpper(dade);
                            geshi.q29 += GetUpper(dade);

                            au.CSurname += xingming[i];
                        }
                    }
                    geshi.q6  = geshi.q6 + " " + GetUpper(au.PYName);
                    geshi.q7  = au.PYName + " " + geshi.q7;
                    geshi.q8  = au.PYName + " " + geshi.q8;
                    geshi.q9  = au.PYName + " " + geshi.q9;
                    geshi.q10 = au.PYName + " " + geshi.q10;
                    geshi.q11 = geshi.q11 + " " + au.PYName;
                    geshi.q12 = geshi.q12 + " " + au.PYName;
                    geshi.q13 = au.PYName + "," + geshi.q13;
                    geshi.q14 = au.PYName + "," + geshi.q14;
                    geshi.q15 = au.PYName + "," + geshi.q15;
                    geshi.q16 = au.PYName + "," + geshi.q16;
                    geshi.q17 = au.PYName + ", " + geshi.q17;
                    geshi.q18 = au.PYName + ", " + geshi.q18;
                    geshi.q19 = au.PYName + " " + geshi.q19 + "(" + au.Name + ")";
                    geshi.q20 = au.PYName + " " + geshi.q20 + " (" + au.Name + ")";
                    geshi.q21 = au.PYName + " " + geshi.q21 + "(" + au.Name + ")";
                    geshi.q22 = au.PYName + " " + geshi.q22 + " (" + au.Name + ")";
                    geshi.q23 = geshi.q23 + " " + au.PYName;
                    geshi.q24 = au.PYName + " " + geshi.q24;
                    geshi.q25 = au.PYName + ", " + geshi.q25 + "(" + au.Name + ")";
                    geshi.q26 = au.PYName + ", " + geshi.q26 + " (" + au.Name + ")";
                    geshi.q27 = au.PYName + ", " + geshi.q27 + " (" + au.Name + ")";
                    geshi.q28 = au.PYName + " " + geshi.q28 + "(" + au.Name + ")";
                    geshi.q29 = au.PYName + " " + geshi.q29 + " (" + au.Name + ")";
                }
            }
            catch { }
            aus.GS = geshi;
            aus.UT = au;
            return(aus);
        }