Ejemplo n.º 1
0
 public static string ConvertCreditAndAmountToWord(int credit, int amount)
 {
     if (credit < 1 || credit > 8)
     {
         return("0");
     }
     string[] validScoreName = Scoresets.GetValidScoreName();
     string[] validScoreUnit = Scoresets.GetValidScoreUnit();
     return(string.Format("{0}:{1}{2}", validScoreName[credit], amount, validScoreUnit[credit]));
 }
Ejemplo n.º 2
0
        public static void WriteUserCreditsCookie(IUser userInfo, string groupTitle)
        {
            if (userInfo == null)
            {
                return;
            }
            string[] validScoreName = Scoresets.GetValidScoreName();
            string[] validScoreUnit = Scoresets.GetValidScoreUnit();
            string   text           = "积分:" + userInfo.Credits + ",";

            text = text + "用户组:" + groupTitle + ",";
            for (int i = 0; i < validScoreName.Length; i++)
            {
                string key;
                if (!Utils.StrIsNullOrEmpty(validScoreName[i]) && (key = "Extcredits" + i) != null)
                {
                    switch (key)
                    {
                    case "Extcredits1":
                    {
                        object obj = text;
                        text = obj + validScoreName[i] + ": " + userInfo.ExtCredits1 + validScoreUnit[1] + ",";
                        break;
                    }

                    case "Extcredits2":
                    {
                        object obj2 = text;
                        text = obj2 + validScoreName[i] + ": " + userInfo.ExtCredits2 + validScoreUnit[2] + ",";
                        break;
                    }

                    case "Extcredits3":
                    {
                        object obj3 = text;
                        text = obj3 + validScoreName[i] + ": " + userInfo.ExtCredits3 + validScoreUnit[3] + ",";
                        break;
                    }

                    case "Extcredits4":
                    {
                        object obj4 = text;
                        text = obj4 + validScoreName[i] + ": " + userInfo.ExtCredits4 + validScoreUnit[4] + ",";
                        break;
                    }

                    case "Extcredits5":
                    {
                        object obj5 = text;
                        text = obj5 + validScoreName[i] + ": " + userInfo.ExtCredits5 + validScoreUnit[5] + ",";
                        break;
                    }

                    case "Extcredits6":
                    {
                        object obj6 = text;
                        text = obj6 + validScoreName[i] + ": " + userInfo.ExtCredits6 + validScoreUnit[6] + ",";
                        break;
                    }

                    case "Extcredits7":
                    {
                        object obj7 = text;
                        text = obj7 + validScoreName[i] + ": " + userInfo.ExtCredits7 + validScoreUnit[7] + ",";
                        break;
                    }

                    case "Extcredits8":
                    {
                        object obj8 = text;
                        text = obj8 + validScoreName[i] + ": " + userInfo.ExtCredits8 + validScoreUnit[8] + ",";
                        break;
                    }
                    }
                }
            }
            HttpCookie httpCookie = HttpContext.Current.Request.Cookies["dntusertips"];

            if (httpCookie == null)
            {
                httpCookie = new HttpCookie("dntusertips");
            }
            httpCookie.Values["userinfotips"] = Utils.UrlEncode(text.TrimEnd(','));
            httpCookie.Expires = DateTime.Now.AddMinutes(5.0);
            HttpContext.Current.Response.AppendCookie(httpCookie);
        }
Ejemplo n.º 3
0
        public static string GetUserRankHtml(IUser[] users, string type, int maxrows)
        {
            var    sb   = new StringBuilder();
            string text = "";
            int    num  = maxrows;

            //int i = 0;
            //while (i < users.Length)
            for (int i = 0; i < users.Length; i++, num--)
            {
                var user = users[i];
                if (user == null)
                {
                    continue;
                }

                string str = string.Empty;
                if (type != null)
                {
                    switch (type)
                    {
                    case "credits":
                        str = user.Credits + "";
                        break;

                    case "extcredits1":
                        str  = user.ExtCredits1 + "";
                        text = Scoresets.GetValidScoreUnit()[1];
                        break;

                    case "extcredits2":
                        str  = user.ExtCredits2 + "";
                        text = Scoresets.GetValidScoreUnit()[2];
                        break;

                    case "extcredits3":
                        str  = user.ExtCredits3 + "";
                        text = Scoresets.GetValidScoreUnit()[3];
                        break;

                    case "extcredits4":
                        str  = user.ExtCredits4 + "";
                        text = Scoresets.GetValidScoreUnit()[4];
                        break;

                    case "extcredits5":
                        str  = user.ExtCredits5 + "";
                        text = Scoresets.GetValidScoreUnit()[5];
                        break;

                    case "extcredits6":
                        str  = user.ExtCredits6 + "";
                        text = Scoresets.GetValidScoreUnit()[6];
                        break;

                    case "extcredits7":
                        str  = user.ExtCredits7 + "";
                        text = Scoresets.GetValidScoreUnit()[7];
                        break;

                    case "extcredits8":
                        str  = user.ExtCredits8 + "";
                        text = Scoresets.GetValidScoreUnit()[8];
                        break;

                    case "digestposts":
                        str = user.DigestPosts + "";
                        break;

                    case "onlinetime":
                        str  = Math.Round(user["OnlineTime"].ToDouble() / 60.0, 2).ToString();
                        text = "小时";
                        break;

                    default:
                        //goto IL_259;
                        break;
                    }
                }
                //IL_259:
                str = user.Posts.ToString();
                //    goto IL_26A;
                //IL_26A:
                sb.AppendFormat("<li><em>{0}</em><a href=\"{1}\" target=\"_blank\">{2}</a></li>", str + ((text == string.Empty) ? string.Empty : (" " + text)), Urls.UserInfoAspxRewrite(user.ID), user.Name);
                //num--;
                //i++;
                //continue;
            }
            for (int j = 0; j < num; j++)
            {
                sb.Append("<li>&nbsp;</li>");
            }
            return(sb.ToString());
        }