Пример #1
0
        public static List <PersonalizedMedicine_User> getRelatedEditorsChoiceSection(int?Geneid, int?Userid)
        {
            var editorcommentslist = new List <PersonalizedMedicine_User>();

            int[] newpmid;
            using (EditorsEntities entity = new EditorsEntities())
            {
                var getrelatededitorscomments = (entity.lib_GetEditorsChoiceCommentsForGeneByGeneID(Geneid)).ToList();
                var commentslist = new List <PersonalizedMedicine_User>();
                foreach (var item in getrelatededitorscomments)
                {
                    var editorcmnts = new PersonalizedMedicine_User();
                    newpmid = Getpmids(item.CommentID);

                    foreach (var data in newpmid)
                    {
                        editorcmnts = DisplayPmids(Userid, data.ToString(), 2, 1);

                        editorcmnts.EditorCommentID    = item.CommentID;
                        editorcmnts.EditorCommnet      = item.Comment;
                        editorcmnts.EditorCommentDate  = Convert.ToInt32(item.CommentDate);
                        editorcmnts.EditorCommentMonth = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(Convert.ToInt32(item.CommentMonth));

                        editorcmnts.EditorCommentAuthor = item.Author;
                        editorcmnts.Getspecialties      = (from ecc in entity.EditorialComments
                                                           join stref in entity.SubTopicReferences on ecc.ThreadID equals stref.ThreadID
                                                           join sbtpc in entity.SubTopics on stref.SubTopicID equals sbtpc.SubTopicID
                                                           join tpc in entity.Topics on sbtpc.TopicID equals tpc.TopicID
                                                           join sp in entity.Specialties on tpc.SpecialtyID equals sp.SpecialtyID
                                                           where ecc.CommentID == item.CommentID
                                                           select new PersonalizedMedicinespecialties
                        {
                            SpecialtyName = sp.SpecialtyName,
                            Topicname = tpc.TopicName,
                            Subtopicname = sbtpc.SubTopicName
                        }).ToList();

                        commentslist.Add(editorcmnts);
                        editorcommentslist = commentslist;
                    }
                }
                return(editorcommentslist);
            }
        }