Exemple #1
0
        public UserReviewBO GetCurrentUserRatingById(int currentUserId)
        {
            UserReviewBO        objFinalResponse = new UserReviewBO();
            List <UserReviewBO> resultlist       = objProfileInfoDAO.GetAllUserReviewsByUser(currentUserId, 0);

            resultlist = (List <UserReviewBO>)resultlist.Where(o => o.RatingGivenTo == currentUserId).ToList();
            if (resultlist.Count > 0)
            {
                objFinalResponse = resultlist[0];
                int Performance   = 0;
                int Communication = 0;
                int QOW           = 0;
                foreach (UserReviewBO item in resultlist)
                {
                    Performance   += item.Performance;
                    Communication += item.Communication;
                    QOW           += item.QOW;
                    switch (item.Rating)
                    {
                    case 5:
                        objFinalResponse.Starts5 += 1;
                        break;

                    case 4:
                        objFinalResponse.Starts4 += 1;
                        break;

                    case 3:
                        objFinalResponse.Starts3 += 1;
                        break;

                    case 2:
                        objFinalResponse.Starts2 += 1;
                        break;

                    case 1:
                        objFinalResponse.Starts1 += 1;
                        break;

                    default:
                        break;
                    }
                }
                objFinalResponse.Performance       = Convert.ToInt32(Performance / resultlist.Count);
                objFinalResponse.Communication     = Convert.ToInt32(Communication / resultlist.Count);
                objFinalResponse.QOW               = Convert.ToInt32(QOW / resultlist.Count);
                objFinalResponse.NoofRatingsGiven  = resultlist.Count; //objFinalResponse.Starts5 + objFinalResponse.Starts4 + objFinalResponse.Starts3 + objFinalResponse.Starts2 + objFinalResponse.Starts1;
                objFinalResponse.TotalRatingsCount = 5 * objFinalResponse.Starts5 + 4 * objFinalResponse.Starts4 + 3 * objFinalResponse.Starts3 + 2 * objFinalResponse.Starts2 + objFinalResponse.Starts1;
                if (objFinalResponse.NoofRatingsGiven > 0)
                {
                    objFinalResponse.OverallRating = Math.Round((Convert.ToDecimal(objFinalResponse.TotalRatingsCount) / Convert.ToDecimal(objFinalResponse.NoofRatingsGiven)) * 4, MidpointRounding.ToEven) / 4;
                }
                else
                {
                    objFinalResponse.OverallRating = 0;
                }
            }
            return(objFinalResponse);
        }
Exemple #2
0
 public bool SaveReviewForUsers(UserReviewBO objUserReviewBO)
 {
     try
     {
         objUserReviewBO.Rating = ((objUserReviewBO.Performance + objUserReviewBO.Communication + objUserReviewBO.QOW) / 3);
     }
     catch (Exception ex)
     {
         objUserReviewBO.Rating = 0;
     }
     return(objProfileInfoDAO.SaveReviewForUsers(objUserReviewBO));
 }
 public IHttpActionResult UpdateUsersReviewAsHelpful([FromBody] UserReviewBO objUserReviewBO)
 {
     return(ResponseMessage(Request.CreateResponse(HttpStatusCode.OK, objProfileInfoService.UpdateUsersReviewAsHelpful(objUserReviewBO))));
 }
Exemple #4
0
 public bool UpdateUsersReviewAsHelpful(UserReviewBO objUserReviewBO)
 {
     return(objProfileInfoDAO.UpdateUsersReviewAsHelpful(objUserReviewBO));
 }
 public IHttpActionResult SaveReviewForUsers([FromBody] UserReviewBO objUserReviewBO)
 {
     return(ResponseMessage(Request.CreateResponse(HttpStatusCode.OK, objProfileInfoService.SaveReviewForUsers(objUserReviewBO))));
 }