• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Rating类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Rating的典型用法代码示例。如果您正苦于以下问题:C# Rating类的具体用法?C# Rating怎么用?C# Rating使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Rating类属于命名空间,在下文中一共展示了Rating类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AddRatingToRecipe

        public void AddRatingToRecipe(Rating rate, Recipe r, User u)
        {
            SqlConnection con = CreateConnection();

            try
            {
                con.Open();
                SqlCommand cmd = con.CreateCommand();
                cmd.CommandText = "AddRatingToRecipe";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@recipeID", r.Id);
                cmd.Parameters.AddWithValue("@userID", u.Id);
                cmd.Parameters.AddWithValue("@rating", rate);

                cmd.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
                throw /*ex*/;
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }
        }
开发者ID:mattwest92,项目名称:HackathonOne,代码行数:28,代码来源:SqlRecipeManager.cs


示例2: UpdateProductRating

        public void UpdateProductRating(Rating r)
        {
            entities.Rating.Attach(GetRating(r.ProductID,r.Username));
            entities.Rating.ApplyCurrentValues(r);

            entities.SaveChanges();
        }
开发者ID:kappuna,项目名称:DSAAssignment1Sit1,代码行数:7,代码来源:ProductRep.cs


示例3: Picture

 internal Picture(string name, string displayName, Rating rating, IEnumerable<Category> categories)
 {
     this.name = name;
     this.displayName = displayName;
     this.rating = rating;
     this.categories = ImmutableHashSet.Create(categories);
 }
开发者ID:JDanielSmith,项目名称:Projects,代码行数:7,代码来源:Picture.cs


示例4: Search

 public Task<List<ImageResult>> Search(string search, Rating rating = Rating.Strict, ResultSize resultSize = ResultSize.Twenty, int offset = 0)
 {
     return Task.Run<List<ImageResult>>(() =>
                                            {
                                                return new List<ImageResult>();
                                            });
 }
开发者ID:schmidp,项目名称:GettingStartedWithMetroApps,代码行数:7,代码来源:NullImageSearchService.cs


示例5: RecipeRater

        public RecipeRater(IKPCContext context, Recipe recipe, Rating rating)
        {
            this.context = context;
            this.newRatings = new Dictionary<Recipe, Rating>();

            this.newRatings.Add(recipe, rating);
        }
开发者ID:KaloyanTodorov,项目名称:Teamwork,代码行数:7,代码来源:RecipeRater.cs


示例6: CreateTermLoan

 public static Loan CreateTermLoan(decimal amount, DateTime start, DateTime maturity, Rating riskRating, IRiskFactor factors)
 {
     var loan = new Loan(null, maturity, amount, amount, factors, null);
     loan.riskRating = riskRating;
     loan.start = start;
     return loan;
 }
开发者ID:NeilSorensen,项目名称:RefactorToPatterns,代码行数:7,代码来源:Loan.cs


示例7: Reset

 public void Reset()
 {
     m_LastScore = Rating.None;
     m_Score = Rating.None;
     m_LastTotalScore = 0;
     m_TotalScore = 0;
 }
开发者ID:stijndelaruelle,项目名称:ggj2016,代码行数:7,代码来源:PlayerScore.cs


示例8: Comment

 /// <summary> 
 /// Full constructor. 
 /// </summary>
 public Comment(Rating rating, string text, User fromUser, Item item)
 {
     this.rating = rating;
     this.text = text;
     this.fromUser = fromUser;
     this.item = item;
 }
开发者ID:krwhite,项目名称:sync,代码行数:10,代码来源:Comment.cs


示例9: CreateRating

        public ActionResult CreateRating([DataSourceRequest]DataSourceRequest request, IEnumerable<AdministrationRatingsViewModel> models)
        {
            var result = new List<AdministrationRatingsViewModel>();
            if (this.ModelState.IsValid && models != null)
            {
                foreach (var model in models)
                {
                    var ratingUser = this.users.GetByUsername(model.UserName).FirstOrDefault();
                    var petToUpdate = this.pets.GetByIntId(model.PetId).FirstOrDefault();
                    if (ratingUser != null && petToUpdate != null)
                    {
                        var newRating = new Rating { RatingValue = model.RatingValue, PetId = model.PetId, Author = ratingUser };
                        this.ratings.Add(newRating);
                        petToUpdate.CurrentRating = petToUpdate.Ratings.Average(r => r.RatingValue);
                        this.pets.Update(petToUpdate);
                        model.CreatedOn = newRating.CreatedOn;
                        model.Id = newRating.Id;
                        result.Add(model);
                    }
                }

                return this.Json(result.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
            }

            return null;
        }
开发者ID:KonstantinAdamu,项目名称:PetRescue,代码行数:26,代码来源:RatingsAdministrationController.cs


示例10: Execute

		public bool Execute ()
		{
			this.CreateDialog ("rating_filter_dialog");
			
			if (query.RatingRange != null) {
				minrating_value = (int) query.RatingRange.MinRating;
				maxrating_value = (int) query.RatingRange.MaxRating;
			}
			minrating = new Rating (minrating_value);
			maxrating = new Rating (maxrating_value);
			minrating_hbox.PackStart (minrating, false, false, 0);
			maxrating_hbox.PackStart (maxrating, false, false, 0);

			Dialog.TransientFor = parent_window;
			Dialog.DefaultResponse = ResponseType.Ok;

			ResponseType response = (ResponseType) this.Dialog.Run ();

			bool success = false;

			if (response == ResponseType.Ok) {
				query.RatingRange = new RatingRange ((uint) minrating.Value, (uint) maxrating.Value);
				success = true;
			}
			
			this.Dialog.Destroy ();
			return success;
		}
开发者ID:guadalinex-archive,项目名称:guadalinex-v6,代码行数:28,代码来源:RatingFilter.cs


示例11: GravatarImage

        /// <summary>
        /// Returns a Globally Recognised Avatar as an &lt;img /&gt; - http://gravatar.com
        /// </summary>
        /// <param name="emailAddress">Email Address for the Gravatar</param>
        /// <param name="defaultImage">Default image if user hasn't created a Gravatar</param>
        /// <param name="size">Size in pixels (default: 80)</param>
        /// <param name="defaultImageUrl">URL to a custom default image (e.g: 'Url.Content("~/images/no-grvatar.png")' )</param>
        /// <param name="forceDefaultImage">Prefer the default image over the users own Gravatar</param>
        /// <param name="rating">Gravatar content rating (note that Gravatars are self-rated)</param>
        /// <param name="forceSecureRequest">Always do secure (https) requests</param>
        public static HtmlString GravatarImage(
          this HtmlHelper htmlHelper,
          string emailAddress,
          int size = 80,
          DefaultImage defaultImage = DefaultImage.Default,
          string defaultImageUrl = "",
          bool forceDefaultImage = false,
          Rating rating = Rating.G,
          bool forceSecureRequest = false)
        {
            var imgTag = new TagBuilder("img");

            emailAddress = string.IsNullOrEmpty(emailAddress) ? string.Empty : emailAddress.Trim().ToLower();

            imgTag.Attributes.Add("src",
                string.Format("{0}://{1}.gravatar.com/avatar/{2}?s={3}{4}{5}{6}",
                    htmlHelper.ViewContext.HttpContext.Request.IsSecureConnection || forceSecureRequest ? "https" : "http",
                    htmlHelper.ViewContext.HttpContext.Request.IsSecureConnection || forceSecureRequest ? "secure" : "www",
                    GetMd5Hash(emailAddress),
                    size.ToString(),
                    "&d=" + (!string.IsNullOrEmpty(defaultImageUrl) ? HttpUtility.UrlEncode(defaultImageUrl) : defaultImage.GetDescription()),
                    forceDefaultImage ? "&f=y" : "",
                    "&r=" + rating.GetDescription()
                    )
                );

            //imgTag.Attributes.Add("class", "gravatar");
            imgTag.Attributes.Add("class", "uk-border-rounded");
            imgTag.Attributes.Add("alt", "Gravatar image");
            return new HtmlString(imgTag.ToString(TagRenderMode.SelfClosing));
        }
开发者ID:AptechC1203L,项目名称:eProjectSem3,代码行数:41,代码来源:GravatarHtmlHelper.cs


示例12: Rate

        public double Rate(int clinicId, string userId, int ratingValue)
        {
            var rating = this.ratings.All().FirstOrDefault(x => x.AuthorId == userId && x.ClinicId == clinicId);

            if (rating == null)
            {
                rating = new Rating()
                {
                    AuthorId = userId,
                    ClinicId = clinicId,
                    Value = ratingValue
                };

                this.ratings.Add(rating);
            }
            else
            {
                rating.Value = ratingValue;
            }

            this.ratings.Save();

            double clinicRating = this.ratings
                .All()
                .Where(x => x.ClinicId == clinicId)
                .Average(x => x.Value);

            return clinicRating;
        }
开发者ID:g-yonchev,项目名称:VetSystem,代码行数:29,代码来源:RatingsService.cs


示例13: Gravatar

        /// <summary>
        /// Gets the URI of the Gravatar image for the specifications.
        /// </summary>
        /// <param name="urlHelper">The UrlHelper object getting the URI.</param>
        /// <param name="email">The email whose Gravatar source should be returned.</param>
        /// <param name="size">The size of the requested Gravatar.</param>
        /// <param name="defaultImage">The default image to return if no Gravatar is found for the specified <paramref name="email"/>.</param>
        /// <param name="maxRating">The maximum Gravatar rating to allow for requested images..</param>
        /// <returns>The URI of the Gravatar for the specifications.</returns>
        public static string Gravatar(this UrlHelper urlHelper, string email, int? size, string defaultImage, Rating? maxRating) {
            var gravatar = new Gravatar();
            gravatar.DefaultImage = defaultImage;
            if (size.HasValue) gravatar.Size = size.Value;
            if (maxRating.HasValue) gravatar.MaxRating = maxRating.Value;

            return gravatar.GetImageSource(email);
        }
开发者ID:ultrasharp,项目名称:PJS.ThemeStarter,代码行数:17,代码来源:UrlHelperExtensions.cs


示例14: AddRating

        public void AddRating(int postId, byte value, string authorId)
        {
            var newRating = new Rating { PostId = postId, Value = value, AuthorId = authorId };

            this.ratings.Add(newRating);

            this.ratings.SaveChanges();
        }
开发者ID:plamenyovchev,项目名称:Bloggable,代码行数:8,代码来源:RatingsDataService.cs


示例15: PointsExchanged

        public static int PointsExchanged(Rating winnerRating, Rating loserRating)
        {
            var difference = (double)loserRating.Value - winnerRating.Value;
            var expected = 1 / (1 + (Math.Pow(10,(difference/Volatility))));

            var exchanged = (Int32)Math.Round((Factor * (1 - expected)), MidpointRounding.AwayFromZero);
            return exchanged;
        }
开发者ID:MSIH,项目名称:ELO,代码行数:8,代码来源:EloCalc.cs


示例16: LoadMore

 public async Task LoadMore(SearchInstance instance, Rating rating, ResultSize resultSize)
 {
     var imagesToAdd = await Search(instance.Query, rating, resultSize, instance.Images.Count + 1);
     foreach (var image in imagesToAdd)
     {
         instance.Images.Add(image);
     }
 }
开发者ID:schmidp,项目名称:GettingStartedWithMetroApps,代码行数:8,代码来源:BingImageSearchService.cs


示例17: GestureKey

 public GestureKey(Rating rating, string name, DateTime recorded, int framenum, TimeSpan timestamp)
 {
     this.rating = rating;
     this.name = name;
     this.recorded = recorded;
     this.framenum = framenum;
     this.timestamp = timestamp;
 }
开发者ID:nathad02,项目名称:CITS3200--Group-H,代码行数:8,代码来源:Gestures.cs


示例18: AddProductRating

        /// <summary>
        /// Add a rating to the product
        /// </summary>
        /// <param name="r">The rating to be added</param>
        public void AddProductRating(Rating r)
        {
            if (r.Rating1 < 0)
                r.Rating1 = 0;
            else if (r.Rating1 > 5)
                r.Rating1 = 5;

               new RatingRep().AddProductRating(r);
        }
开发者ID:kappuna,项目名称:DSAAssignment1Sit1,代码行数:13,代码来源:WCFProduct.svc.cs


示例19: RateGameMenuEntrySelected

        void RateGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            currentRating++;

            if (currentRating > Rating.Superb)
                currentRating = 0;

            SetMenuEntryText();
        }
开发者ID:tdeeb,项目名称:DEPW,代码行数:9,代码来源:OptionsMenuScreen.cs


示例20: EqualityIgnoresTime

        public void EqualityIgnoresTime()
        {
            var r1000_1 = new Rating { Value = 1000, TimeFrom = DateTime.UtcNow};
            var r1000_2 = new Rating { Value = 1000, TimeFrom = DateTime.UtcNow.AddHours(1)};
            var r1002 = new Rating { Value = 1002 };

            Assert.AreEqual(r1000_1, r1000_2);
            Assert.AreNotEqual(r1000_1, r1002);
        }
开发者ID:MSIH,项目名称:ELO,代码行数:9,代码来源:RatingTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Rational类代码示例发布时间:2022-05-24
下一篇:
C# Rank类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap