当前位置: 首页>>代码示例>>C#>>正文


C# ContentAPI.AddEditContentRating方法代码示例

本文整理汇总了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();
    }
开发者ID:jaytem,项目名称:minGit,代码行数:72,代码来源:AJAXbase.aspx.cs


注:本文中的ContentAPI.AddEditContentRating方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。