Esempio n. 1
0
        public void SendComment(Guid?From, Guid?Article, string type)
        {
            Guid?Id = null;

            if (type == "Article")
            {
                var dao     = new ArticleDAO();
                var article = dao.GetById(Article);
                if (article.ACCOUNT_Id == From)
                {
                    var To = new UniversityMagazineDBContext().ACCOUNTs.Where(x => x.ROLEGROUP.ROLEGROUP_Code == "MARKETINGCOORDINATOR" && x.FACULTY_Id == article.FACULTY_Id).FirstOrDefault().ACCOUNT_Id;
                    if (type == "Article")
                    {
                        Id = new CommentArticleDAO().CreateNotificationComment(From, To, "/Upload/Articles/Article/" + article.ARTICLE_FileName, type);
                    }
                    LoadNotification(To);
                }
                else
                {
                    if (type == "Article")
                    {
                        Id = new CommentArticleDAO().CreateNotificationComment(From, article.ACCOUNT_Id, "/MyUpload/File/" + article.ARTICLE_FileName, type);
                    }
                    LoadNotification(article.ACCOUNT_Id);
                }
            }
            else if (type == "Image")
            {
                var dao   = new ImageDAO();
                var image = dao.GetById(Article);
                if (image.ACCOUNT_Id == From)
                {
                    var To = new UniversityMagazineDBContext().ACCOUNTs.Where(x => x.ROLEGROUP.ROLEGROUP_Code == "MARKETINGCOORDINATOR" && x.FACULTY_Id == image.FACULTY_Id).FirstOrDefault().ACCOUNT_Id;
                    if (type == "Image")
                    {
                        Id = new CommentArticleDAO().CreateNotificationComment(From, To, "/Upload/Images/Image/" + image.IMAGE_FileName, type);
                    }
                    LoadNotification(To);
                }
                else
                {
                    if (type == "Image")
                    {
                        Id = new CommentArticleDAO().CreateNotificationComment(From, image.ACCOUNT_Id, "/MyUpload/Image/" + image.IMAGE_FileName, type);
                    }
                    LoadNotification(image.ACCOUNT_Id);
                }
            }
            if (Id != null)
            {
                LoadDetailNotification(Id);
            }
        }