本文整理汇总了C#中ContentAPI.AddEditContentRating方法的典型用法代码示例。如果您正苦于以下问题:C# ContentAPI.AddEditContentRating方法的具体用法?C# ContentAPI.AddEditContentRating怎么用?C# ContentAPI.AddEditContentRating使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentAPI
的用法示例。
在下文中一共展示了ContentAPI.AddEditContentRating方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Handler_AddEditContentRating
public string Handler_AddEditContentRating()
{
StringBuilder sbRet = new StringBuilder();
ContentAPI apiContent = new ContentAPI();
int iRating = 0;
long iContent = 0;
int iret = 0;
bool bapproved = true;
string sReview = "";
string skey = "";
try
{
string visitorid;
// Check and see if the cookie has been set by the user
if (Page.Request.Cookies["ekContentRatingID"] == null && ! Page.IsPostBack)
{
visitorid = (string) (System.Guid.NewGuid().ToString().Replace("-", ""));
Page.Response.Cookies.Add(new System.Web.HttpCookie("ekContentRatingID", visitorid));
Page.Response.Cookies["ekContentRatingID"].Expires = DateTime.MaxValue;
}
else
{
try
{
visitorid = Page.Request.Cookies["ekContentRatingID"].Value;
}
catch (Exception)
{
visitorid = string.Empty;
}
}
if (Request.QueryString["review"] != "")
{
sReview = EkFunctions.HtmlEncode(Request.QueryString["review"]);
}
if (Request.QueryString["key"] != "")
{
skey = EkFunctions.HtmlEncode(Request.QueryString["key"]);
}
iRating = Convert.ToInt32(Request.QueryString["rating"]);
iContent = Convert.ToInt64(Request.QueryString["contentid"]);
if ((Request.QueryString["LangType"] != null)&& Request.QueryString["LangType"] != "")
{
apiContent.ContentLanguage = Convert.ToInt32(Page.Request.QueryString["LangType"]);
}
else
{
System.Web.HttpCookie ecmCookie = Ektron.Cms.CommonApi.GetEcmCookie();
apiContent.ContentLanguage = Convert.ToInt32(ecmCookie["SiteLanguage"].ToString());
}
bapproved = Convert.ToBoolean(Request.QueryString["approved"]);
if (bapproved == false && sReview == "")
{
bapproved = true; //if there is no review text, it goes live auto.
}
iret = (Int32)apiContent.AddEditContentRating(iContent, visitorid, iRating, bapproved, sReview);
sReview = HttpUtility.UrlDecode(sReview);
sbRet.Append(" <method>AddEditRating</method>").Append(Environment.NewLine);
sbRet.Append(" <result>").Append(iRating).Append("</result>").Append(Environment.NewLine);
sbRet.Append(" <key>").Append(skey).Append("</key>").Append(Environment.NewLine);
return sbRet.ToString();
}
catch (Exception)
{
}
return sbRet.ToString();
}