예제 #1
0
        /// <summary>
        /// 帮助中心分类列表
        /// </summary>
        /// <returns></returns>
        public List <HelpCategoryModel> GetHelpCategories()
        {
            List <HelpCategoryModel> result = new List <HelpCategoryModel>();
            var c1List = TopicFacade.GetHelperCenterCategory() ?? new List <NewsInfo>();

            foreach (var c1 in c1List)
            {
                if (c1.SysNo == 1)
                {
                    //排除编号为1的根结点
                    continue;
                }
                var categoryModel = MapHelpCategory(c1);

                var c2List = TopicFacade.GetTopHelperCenterList(c1.SysNo.ToString(), 1000) ?? new List <NewsInfo>();
                foreach (var c2 in c2List)
                {
                    var subCategoryModel = MapHelpCategory(c2);
                    categoryModel.SubCategories.Add(subCategoryModel);
                }

                result.Add(categoryModel);
            }

            return(result);
        }
예제 #2
0
 private void RetrieveInstances(TopicFacade facade)
 {
     if (CurrentUserContext.IsAdmin || CurrentUserContext.IsEmployee)
     {
         CurrentInstances = facade.RetrieveAllTopic(new TopicConverter());
     }
 }
예제 #3
0
        public ActionResult Ajax_QueryNews()
        {
            NewsQueryFilter query = new NewsQueryFilter();

            query.PageInfo           = new PageInfo();
            query.PageInfo.PageSize  = 5;
            query.PageInfo.PageIndex = 1;
            //新闻类型
            //query.ReferenceSysNo = Model;

            string strPageIndex = Request["page"];

            if (!string.IsNullOrWhiteSpace(strPageIndex))
            {
                int pageIndex = 1;
                int.TryParse(strPageIndex, out pageIndex);
                query.PageInfo.PageIndex = pageIndex;
            }
            ViewDataDictionary     dic      = new ViewDataDictionary();
            QueryResult <NewsInfo> newsList = TopicFacade.QueryNewsInfo(query);

            var result = new AjaxResult {
                Success = true
            };

            result.Data = newsList;

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
예제 #4
0
 private void RetrieveData()
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         TopicFacade facade = new TopicFacade(uow);
         Topics = facade.RetrieveAllTopic(new TopicInfoConverter());
     }
 }
예제 #5
0
 public TestController(TestFacade testFacade, TopicFacade topicFacade,
                       StudentGroupFacade studentGroupFacade, TestResultFacade testResultFacade)
 {
     this.testFacade         = testFacade;
     this.topicFacade        = topicFacade;
     this.studentGroupFacade = studentGroupFacade;
     this.testResultFacade   = testResultFacade;
 }
예제 #6
0
 private void RetrieveData()
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         TopicFacade facade = new TopicFacade(uow);
         RetrieveInstances(facade);
     }
 }
예제 #7
0
 private IFacadeUpdateResult <TopicData> SaveCreatedTopic(TopicInfoDto topic, PostInfoDto post)
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         TopicFacade facade = new TopicFacade(uow);
         IFacadeUpdateResult <TopicData> result = facade.CreateTopic(topic, post);
         return(result);
     }
 }
예제 #8
0
 public TopicsController(TeamCommunicationDbContext context)
 {
     _context     = context;
     this.factory = new DbContextFactory();
     repo         = new TopicRepository(factory);
     commRepo     = new CommentRepository(factory);
     query        = new GetTopicsQuery(factory.CreateDbContext);
     facade       = new TopicFacade(repo, query);
 }
예제 #9
0
        public static NewsInfoViewModel GetNewsDetail(int sysNo)
        {
            var config = AppSettings.GetCachedConfig();

            return(EntityConverter <NewsInfo, NewsInfoViewModel> .Convert(TopicFacade.GetNewsInfoBySysNo(sysNo), (s, t) =>
            {
                t.CreateTimeString = s.CreateDate.ToString("yyyy-MM-dd");
                t.Title = StringUtility.RemoveHtmlTag(t.Title);
                t.Content = config.NewsContentTemplate.Replace("${content}", s.Content);
            }));
        }
예제 #10
0
        private void RetrieveData()
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                TopicFacade facade = new TopicFacade(uow);
                CurrentInstance = facade.RetrieveOrNewTopic(InstanceId, new TopicConverter());

                PostFacade postFacade = new PostFacade(uow);
                CurrentInstance.Posts = postFacade.RetrievePostsByTopic(InstanceId, new PostConverter());
            }
        }
예제 #11
0
        /// <summary>
        /// 根据系统编号获取文章详情
        /// </summary>
        /// <param name="sysNo"></param>
        /// <returns></returns>
        public NewsContentModel GetNewsContent(int sysNo)
        {
            var news = TopicFacade.GetTopHelperCenterBySysNo(sysNo);

            if (news != null)
            {
                return(MapHelpContent(news));
            }

            throw new BusinessException(string.Format("内容#{0}不存在。", sysNo.ToString()));
        }
예제 #12
0
 private void RetrieveData()
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         TopicFacade facade = new TopicFacade(uow);
         CurrentInstance = facade.RetrieveTopicInfo(InstanceId, new TopicBriefInfoConverter());
         // Get Posts of current topic
         PostFacade postFacade = new PostFacade(uow);
         CurrentInstance.Posts = postFacade.RetrievePostsByTopic(InstanceId, new PostInfoConverter());
     }
 }
예제 #13
0
 private void RetrieveData()
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         TopicFacade facade   = new TopicFacade(uow);
         TopicDto    instance = facade.RetrieveOrNewTopic(InstanceId, new TopicConverter());
         if (instance.IsNew)
         {
             instance.IssuedById = CurrentUserContext.User.UserId;
         }
         CurrentInstance = instance;
     }
 }
예제 #14
0
        public JsonResult SubscriptEmail()
        {
            string email = Request["email"];

            if (string.IsNullOrWhiteSpace(email))
            {
                var data = new
                {
                    error   = true,
                    message = "输入错误:邮箱为空!"
                };
                return(new JsonResult {
                    Data = data
                });
            }
            else
            {
                string pattern = @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
                Regex  regex   = new Regex(pattern);
                if (!regex.IsMatch(email))
                {
                    var data = new
                    {
                        error   = true,
                        message = "输入错误:邮箱格式错误!"
                    };
                    return(new JsonResult {
                        Data = data
                    });
                }
            }


            //订阅类别:7-泰隆优选让利促销活动
            List <int> list = new List <int>()
            {
                7
            };

            TopicFacade.InsertSubscriptionEmail(list, email);

            return(new JsonResult()
            {
                Data = "订阅成功,谢谢!"
            });
        }
예제 #15
0
        protected void ucIList_InstanceRowDeleting(object sender, InstanceRowDeletingEventArgs e)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                TopicFacade facade = new TopicFacade(uow);
                IFacadeUpdateResult <TopicData> result = facade.DeleteTopic(e.Instance.Id);
                e.IsSuccessful = result.IsSuccessful;

                if (result.IsSuccessful)
                {
                    // Refresh whole list
                    RetrieveInstances(facade);
                }
                else
                {
                    // Deal with Update result
                    ProcUpdateResult(result.ValidationResult, result.Exception);
                }
            }
        }
예제 #16
0
        protected void ucIEdit_InstanceSaving(object sender, InstanceSavingEventArgs e)
        {
            TopicDto instance = e.Instance as TopicDto;

            if (instance != null)
            {
                using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
                {
                    TopicFacade facade = new TopicFacade(uow);
                    IFacadeUpdateResult <TopicData> result = facade.SaveTopic(instance);
                    e.IsSuccessful = result.IsSuccessful;
                    if (result.IsSuccessful)
                    {
                        // Refresh Instance
                        CurrentInstance = result.ToDto <TopicDto>(new TopicConverter());
                    }
                    else
                    {
                        // Deal with Update result
                        ProcUpdateResult(result.ValidationResult, result.Exception);
                    }
                }
            }
        }
예제 #17
0
        public static QueryResult <NewsInfoViewModel> GetNewsList(int pageIndex, int pageSize)
        {
            NewsQueryFilter queryFilter = new NewsQueryFilter()
            {
                PageInfo = new PageInfo()
                {
                    PageIndex = pageIndex + 1, PageSize = pageSize
                }, NewsType = NewsType.HomePageNews
            };

            return(EntityConverter <QueryResult <NewsInfo>, QueryResult <NewsInfoViewModel> > .Convert(TopicFacade.QueryNewsInfo(queryFilter), (s, t) =>
            {
                for (int i = 0; i < s.ResultList.Count; i++)
                {
                    t.ResultList[i].CreateTimeString = s.ResultList[i].CreateDate.ToString("yyyy-MM-dd");
                    t.ResultList[i].Title = StringUtility.RemoveHtmlTag(t.ResultList[i].Title);
                    string rawHtmlContent = t.ResultList[i].Content;
                    if (!string.IsNullOrEmpty(rawHtmlContent))
                    {
                        string plainTextContent = StringUtility.RemoveHtmlTag(rawHtmlContent).Replace("&nbsp;", "");
                        t.ResultList[i].Content = (plainTextContent.Length > 60 ? plainTextContent.Substring(0, 60) + "..." : plainTextContent);
                        t.ResultList[i].ImageUrl = ExtractImageSrc(rawHtmlContent);
                    }
                }
            }));
        }
 public TopicController(TopicFacade topicFacade)
 {
     this.topicFacade = topicFacade;
 }
 public QuestionController(QuestionFacade questionFacade, TopicFacade topicFacade, AnswerFacade answerFacade)
 {
     this.questionFacade = questionFacade;
     this.topicFacade    = topicFacade;
     this.answerFacade   = answerFacade;
 }