Inheritance: TableStorageEntity
Example #1
0
 public ReviewerEntity(ReviewerEntity entity)
     : base(PARTITION_KEY, entity.RowKey)
 {
     ReviewerId    = entity.ReviewerId;
     ReviewerName  = entity.ReviewerName;
     ReviewerImage = entity.ReviewerImage;
     Affilation    = entity.Affilation;
 }
Example #2
0
 public ReviewerEntity(ReviewerEntity entity)
     : base(PARTITION_KEY, entity.RowKey)
 {
     ReviewerId = entity.ReviewerId;
     ReviewerName = entity.ReviewerName;
     ReviewerImage = entity.ReviewerImage;
     Affilation = entity.Affilation;
 }
Example #3
0
        public static ReviewerEntity CreateAffilationEntity(string reviewerName, string reviewerImage, string affilation)
        {
            var reviewerId = Guid.NewGuid().ToString();
            var entity = new ReviewerEntity(reviewerId);
            entity.ReviewerId = reviewerId;
            entity.ReviewerName = reviewerName;
            entity.ReviewerImage = reviewerImage;
            entity.Affilation = affilation;

            return entity;
        }
Example #4
0
        public static ReviewerEntity CreateAffilationEntity(string reviewerName, string reviewerImage, string affilation)
        {
            var reviewerId = Guid.NewGuid().ToString();
            var entity     = new ReviewerEntity(reviewerId);

            entity.ReviewerId    = reviewerId;
            entity.ReviewerName  = reviewerName;
            entity.ReviewerImage = reviewerImage;
            entity.Affilation    = affilation;

            return(entity);
        }
Example #5
0
        public static string SetReviewer(string reviewerName, string affiliation)
        {
            string reviewerKey = string.Empty;
            try
            {
                #region Add Reviewer In DB
                TableManager tblMgr = new TableManager();
                ReviewerEntity reviewer = new ReviewerEntity();

                bool isReviewerAlreadyPresent = false;

                var reviewers = tblMgr.GetAllReviewer();

                for (int rid = 0; rid < reviewers.Keys.Count; rid++)
                {
                    string key = reviewers.ElementAt(rid).Key;
                    if (reviewers[key].ReviewerName.Trim() == reviewerName.Trim())
                    {
                        isReviewerAlreadyPresent = true;
                        reviewerKey = key;
                        break;
                    }
                }

                if (!isReviewerAlreadyPresent)
                {
                    reviewer.RowKey = reviewer.ReviewerId = Guid.NewGuid().ToString();
                    reviewer.ReviewerName = reviewerName.Trim();
                    reviewer.Affilation = affiliation.Trim();
                    reviewer.ReviewerImage = string.Empty;
                    tblMgr.UpdateReviewerById(reviewer);

                    reviewerKey = reviewer.ReviewerId;
                }
                #endregion
            }
            catch (Exception)
            {
            }

            return reviewerKey;
        }
Example #6
0
        /// <summary>
        /// Update the reviewer by reviewerid
        /// </summary>
        /// <param name="store"></param>
        /// <param name="reviewer"></param>
        /// <returns></returns>
        public static bool UpdateReviewerById(this IStore store, ReviewerEntity reviewer)
        {
            Debug.Assert(reviewer != null);
            var list = new List<ReviewerEntity> { reviewer };
            var retList = store.UpdateReviewers(list);

            Debug.Assert(retList.Count == 1);
            return retList[retList.Keys.FirstOrDefault()];
        }