本文整理汇总了C#中Functions.kindTime方法的典型用法代码示例。如果您正苦于以下问题:C# Functions.kindTime方法的具体用法?C# Functions.kindTime怎么用?C# Functions.kindTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Functions
的用法示例。
在下文中一共展示了Functions.kindTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getGift
public void getGift()
{
StringBuilder sb = new StringBuilder();
Hashtable[] gifts;
gifts = myFunctions.giftGet(18);
moyu.Functions myFunction = new Functions();
foreach (Hashtable gift in gifts)
{
try
{
string number = gift["message"].ToString().Split(new char[3] { '|', '|', '|' })[0];
sb.Append("<li>" + gift["message"].ToString().Substring(0, 3) + "**" + number.Substring(number.Length - 2, 2) + "在<span>" + myFunction.kindTime(Convert.ToDateTime(gift["date"])) + "</span>获得了");
sb.Append(gift["gift"]);
sb.Append("</li>");
}
catch
{ }
}
Response.Write(sb);
}
示例2: getMore
private void getMore()
{
string tag;
Hashtable[] posts;
int last = Convert.ToInt32(theContext.Request.Form["last"]);
switch (theContext.Request.Form["type"].ToString())
{
case "tag":
tag = HttpUtility.UrlDecode(theContext.Request.Params["tag"].ToString());
posts = myGroup.postGetByTat(tag, last, 15);
break;
case "group":
tag = theContext.Request.Params["tag"];
posts = myGroup.topicGet(Convert.ToInt32(tag), last, 15);
break;
case "user":
tag = theContext.Session["niceName"].ToString() + "发表的内容";
posts = myGroup.postGetByUser(Convert.ToInt32(theContext.Session["id"]), last, 15);
break;
case "atMe":
tag = "@" + theContext.Session["niceName"].ToString();
posts = myGroup.postGetByMessage(Convert.ToInt32(theContext.Session["id"]), last, 15);
break;
case "elite":
tag = "精华帖子";
posts = myGroup.postGetByElite(last, 15);
break;
default:
posts=null;
break;
}
StringBuilder sb = new StringBuilder();
string userName = "";
Hashtable userPoint = new Hashtable();
moyu.User.Functions myFunction = new moyu.User.Functions();
string bodyClass = "";
int power = Convert.ToInt32(theContext.Session["power"]);
moyu.Functions myOtherFunction = new Functions();
foreach (Hashtable p in posts)
{
userPoint = myFunction.getPoint(Convert.ToInt32(p["uid"]));
if (p["tag"].ToString() == "秘密")
{
userName = "就不告诉你";
}
else
{
userName = (p["niceName"].ToString() == "" ? "匿名用户" : p["niceName"].ToString());
userName = "<a href=\"weixin://profile/" + p["weixinId"] + "\" class=\"" + (Convert.ToInt32(userPoint["signInDays"]) > 15 ? "red" : "") + "\">" + userName + "</a>";
}
bodyClass = Convert.ToBoolean(p["isElite"]) ? "f" : "c";
bodyClass = p["tag"].ToString() == "秘密" ? "e" : bodyClass;
sb.Append("<li data-id=\"" + p["id"] + "\" class=\"postItem ui-body ui-body-" + bodyClass + "\">");
sb.Append("<h2 class=\"group-post-info clear\" style=\"text-indent:0;\">");
if (Convert.ToBoolean(p["isElite"]))
{
sb.Append("<span class=\"left group-post-info-tag group_tag_4\">精华</span>");
}
if (Convert.ToBoolean(p["isTop"]))
{
sb.Append("<span class=\"left group-post-info-tag group_tag_9\">置顶</span>");
}
sb.Append("<span class=\"left group-post-info-tag group_tag_" + p["id"].ToString().Substring(p["id"].ToString().Length - 1) + "\">" + p["tag"] + "</span>");
sb.Append("<span class=\"left group-post-info-user\">");
sb.Append(userName);
sb.Append("</span><span class=\"right group-post-info-date\">");
sb.Append(myOtherFunction.kindTime(Convert.ToDateTime(p["postDate"])));
sb.Append("</span></h2>");
sb.Append(p["body"].ToString().Replace("src=\"upload/images", "src=\"http://www.ai0932.com/upload/images"));
sb.Append("<div class=\"group-post-functions\">");
sb.Append("<a class=\"viewComments\" href=\"javascript:void(0)\">评论(" + p["commentsCount"] + ")</a>");
sb.Append("<a class=\"shareThisItem\" href=\"javascript:void(0)\" onclick=\"weixinShare('" + p["title"] + "','真是太有意思啦','http://www.ai0932.com/Mobile/post-show.aspx?type=g&id=" + p["id"] + "');\">分享</a>");
if (power > 0)
{
if (Convert.ToInt32(p["gid"]) == -10)
{
sb.Append("<a target=\"_self\" href=\"../Services/Information_group.ashx?action=back&tid=" + p["id"] + "\">恢复</a>");
}
else
{
sb.Append("<a target=\"_self\" href=\"../Services/Information_group.ashx?action=del&tid=" + p["id"] + "\">删</a>");
}
if (Convert.ToBoolean(p["isElite"]))
{
sb.Append("<a target=\"_self\" href=\"../Services/Information_group.ashx?action=delElite&tid=" + p["id"] + "\">消精</a>");
}
else
{
sb.Append("<a target=\"_self\" href=\"../Services/Information_group.ashx?action=addElite&tid=" + p["id"] + "\">加精</a>");
}
}
if (power > 5)
{
if (Convert.ToBoolean(p["isTop"]))
{
sb.Append("<a class=\"goTop\" target=\"_self\" href=\"../Services/Information_group.ashx?action=delTop&tid=" + p["id"] + "\">消顶</a>");
}
else
{
sb.Append("<a class=\"goTop\" target=\"_self\" href=\"../Services/Information_group.ashx?action=addTop&tid=" + p["id"] + "\">置顶</a>");
//.........这里部分代码省略.........
示例3: getContent
public void getContent()
{
StringBuilder sb = new StringBuilder();
string userName = "";
Hashtable userPoint=new Hashtable();
moyu.User.Functions myFunction=new User.Functions();
string bodyClass = "";
moyu.Functions myOtherFunction = new Functions();
foreach (Hashtable p in posts)
{
userPoint=myFunction.getPoint( Convert .ToInt32(p["uid"]));
if (p["tag"].ToString() == "秘密")
{
userName = "就不告诉你";
}
else
{
userName = (p["niceName"].ToString() == "" ? "匿名用户" : p["niceName"].ToString());
userName = "<a href=\"weixin://profile/" + p["weixinId"] + "\" class=\"" + (Convert.ToInt32(userPoint["signInDays"]) > 15 ? "red" : "") + "\">" + userName + "</a>";
}
bodyClass = Convert.ToBoolean(p["isElite"]) ? "f" : "c";
bodyClass = p["tag"].ToString() == "秘密" ? "e" : bodyClass;
sb.Append("<li data-id=\"" + p["id"] + "\" class=\"postItem ui-body ui-body-" + bodyClass + "\">");
sb.Append("<h2 class=\"group-post-info clear\" style=\"text-indent:0;\">");
if (Convert.ToBoolean(p["isElite"]))
{
sb.Append("<span class=\"left group-post-info-tag group_tag_4\">精华</span>");
}
if (Convert.ToBoolean(p["isTop"]))
{
sb.Append("<span class=\"left group-post-info-tag group_tag_9\">置顶</span>");
}
sb.Append("<span class=\"left group-post-info-tag group_tag_"+p["id"].ToString().Substring(p["id"].ToString().Length-1)+"\">" + p["tag"] + "</span>");
sb.Append("<span class=\"left group-post-info-user\">");
sb.Append(userName);
sb.Append("</span><span class=\"right group-post-info-date\">");
sb.Append( myOtherFunction.kindTime(Convert.ToDateTime( p["postDate"])));
sb.Append("</span></h2>");
sb.Append(p["body"].ToString().Replace("src=\"upload/images", "src=\"http://www.ai0932.com/upload/images"));
sb.Append("<div class=\"group-post-functions\">");
sb.Append("<a class=\"viewComments\" href=\"javascript:void(0)\">评论(" + p["commentsCount"] + ")</a>");
sb.Append("<a class=\"shareThisItem\" href=\"javascript:void(0)\" onclick=\"weixinShare('" + p["title"] + "','真是太有意思啦','http://www.ai0932.com/Mobile/post-show.aspx?type=g&id=" + p["id"] + "');\">分享</a>");
if (power > 0)
{
if (Convert.ToInt32(p["gid"]) == -10)
{
sb.Append("<a target=\"_self\" href=\"../Services/Information_group.ashx?action=back&tid=" + p["id"] + "\">恢复</a>");
}
else
{
sb.Append("<a target=\"_self\" href=\"../Services/Information_group.ashx?action=del&tid=" + p["id"] + "\">删</a>");
}
if (Convert.ToBoolean(p["isElite"]))
{
sb.Append("<a target=\"_self\" href=\"../Services/Information_group.ashx?action=delElite&tid=" + p["id"] + "\">消精</a>");
}
else
{
sb.Append("<a target=\"_self\" href=\"../Services/Information_group.ashx?action=addElite&tid=" + p["id"] + "\">加精</a>");
}
}
if (power > 5)
{
if (Convert.ToBoolean(p["isTop"]))
{
sb.Append("<a class=\"goTop\" target=\"_self\" href=\"../Services/Information_group.ashx?action=delTop&tid=" + p["id"] + "\">消顶</a>");
}
else
{
sb.Append("<a class=\"goTop\" target=\"_self\" href=\"../Services/Information_group.ashx?action=addTop&tid=" + p["id"] + "\">置顶</a>");
}
}
else
{
sb.Append("<a class=\"goTop\" target=\"_self\" href=\"#\">顶部</a>");
}
sb.Append("</div>");
sb.Append("</li>");
}
Response.Write(sb);
}