예제 #1
0
        public decimal GetOverrallFeedbackByContext(Enums.ContextType contextType, Guid contextId)
        {
            decimal returnVal;

            List <Comment> comments = CommentDAO.SelectCommentListByContext((int)contextType, contextId);

            comments.RemoveAll(comm => comm.CommentTypeId != (int)Enums.CommentType.Feedback);

            decimal totalFeedbackScore = 0;

            foreach (Comment comment in comments)
            {
                if (comment.RatingValue > 0)
                {
                    totalFeedbackScore += comment.RatingValue;
                }
            }

            if (totalFeedbackScore > 0)
            {
                returnVal = totalFeedbackScore / comments.Count();
            }
            else
            {
                returnVal = 0.1M;
            }

            return(returnVal);
        }
예제 #2
0
 public Comment(Enums.ContextType contextType, Guid contextId)
 {
     ContextTypeId = (int)contextType;
     ContextType   = contextType;
     ContextId     = contextId;
 }
예제 #3
0
 public Comment(Enums.ContextType contextType)
 {
     ContextTypeId = (int)contextType;
     ContextType   = contextType;
 }
예제 #4
0
파일: Photo.cs 프로젝트: tjsas1/RHP
 public DataSet SelectDataSetBycontextId(Guid contextId, Enums.ContextType ContextType)
 {
     return(new PhotoDAO().SelectByContext((int)ContextType, contextId));
 }
예제 #5
0
파일: Photo.cs 프로젝트: tjsas1/RHP
 public Photo(Enums.ContextType contextType, Guid contextId)
 {
     ContextTypeId = (int)contextType;
     ContextType   = contextType;
     ContextId     = contextId;
 }
예제 #6
0
        /// <summary>
        /// Returns a collection of T. T must be an Entity class
        /// </summary>
        public static List <Comment> GetAllByFieldValue(string fieldName, Guid fieldValue, Enums.ContextType contextType)
        {
            List <Comment> returnEntityCollection = new List <Comment>();

            Database  db        = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING);
            DbCommand dbCommand = db.GetStoredProcCommand("usp_CommentSelectAllBy" + fieldName);

            db.AddInParameter(dbCommand, fieldName, DbType.Guid, fieldValue);
            db.AddInParameter(dbCommand, "ContextTypeId", DbType.Int32, (int)contextType);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    Comment entity = new Comment();

                    Utility.Generic.AssignDataReaderToEntity(dataReader, entity);
                    returnEntityCollection.Add(entity);
                }
            }

            return(returnEntityCollection);
        }