Beispiel #1
0
        public static Dictionary <string, int> CalculateCommentsScore(Review review)
        {
            var ct     = new CommentServices().GetCommentTotalsByEmployeeID(review.EnteredFor, review.StartDate.ToShortDateString(), review.DueDate.ToShortDateString());
            var result = new Dictionary <string, int>();

            if (ct != null)
            {
                decimal score = 0;
                if ((ct.LeftForPositive + ct.LeftForConstructive) > 0)
                {
                    score = (Convert.ToDecimal(ct.LeftForPositive) / Convert.ToDecimal(ct.LeftForPositive + ct.LeftForConstructive)) * 100;
                }
                if (score < 1)
                {
                    score = 0;
                }
                int weighted = Convert.ToInt16(score * (review.CommentsWeight * (decimal)0.01));
                result.Add("Natural", (int)score);
                result.Add("Weighted", weighted);
            }
            else
            {
                result.Add("Natural", 0);
                result.Add("Weighted", 0);
            }
            return(result);
        }
Beispiel #2
0
        public string GetCommentListByFilters(string userID)
        {
            var    list = new CommentServices().GetByEnteredBy(Convert.ToInt16(userID));
            string s    = "";

            foreach (var item in list)
            {
                s += "{\"name\":\"" + item.EnteredForRef.FirstName + " " + item.EnteredForRef.LastName + "\",\"commentType\":\"" + item.CommentType.ToString() + "\",\"message\":\"" + item.Message + "\",\"enteredBy\":\"" + item.EnteredByRef.FirstName + " " + item.EnteredByRef.LastName + "\",\"commentDate\":\"" + item.DateCreated.ToShortDateString() + "\"}";
            }
            return("");
        }