Exemple #1
0
        public ActionResult ChannelList(string alias)
        {
            //根据别名获得技术分类详细信息
            var techModel = TechService.GetTechInfoByAlias(alias);

            if (techModel.Id == 0 || techModel.IsDeleted)
            {
                return(Content("Argument error."));
            }
            //获得栏目ID
            int catId   = CECRequest.GetQueryInt("catid", 0);
            var catInfo = ColumnService.GetById(catId);

            int pageIndex = CECRequest.GetQueryInt("page", 1);

            var articleList = ArticleService.List(new Models.ArticleSearchSetting()
            {
                PageIndex = pageIndex,
                ColumnIds = new int[] { catId },
                TechIds   = new int[] { techModel.Id },
                IsDeleted = false
            });

            ViewBag.TechInfo    = techModel;
            ViewBag.ColumnInfo  = catInfo;
            ViewBag.ArticleList = articleList;
            return(View());
        }
Exemple #2
0
        public ActionResult Add()
        {
            int id          = CECRequest.GetQueryInt("id", 0);
            var articleInfo = ArticleService.GetById(id);

            //初始化栏目类别
            var allColumnList = ColumnService.List().ToList();
            var dropdownList  = new List <ColumnInfo>();

            ColumnService.BuildListForTree(dropdownList, allColumnList, 0);
            ViewBag.ColumnDropDownList = dropdownList;

            //输出技术分类
            ViewBag.TechList = TechService.List().Where(m => m.IsDeleted == false);
            //输出行业分类
            ViewBag.IndustryList = IndustryService.List().Where(m => m.IsDeleted == false);

            //已选择的技术分类和行业分类
            ViewBag.SelectTechList     = ArticleService.Article2CategoryListByArticleIdAndType(articleInfo.Id, CatType.Tech);
            ViewBag.SelectIndustryList = ArticleService.Article2CategoryListByArticleIdAndType(articleInfo.Id, CatType.Industry);

            string companyName = string.Empty;

            if (articleInfo.CompanyId > 0)
            {
                //对CompanyName进行赋值
                //数据库中只保存CompanyId,没有保存CompanyName,只能在这里处理一下
                companyName = MemberService.GetBaseCompanyInfo(articleInfo.CompanyId).CompanyName;
            }
            ViewBag.CompanyName = companyName;

            return(View(articleInfo));
        }
Exemple #3
0
        //get table columns for modal
        public ContentResult GetColumns(string tableId)
        {
            //var tableId = _Datatable.GetFindValue(dt, "tableId");
            var rows = new ColumnService().GetRows(tableId);

            return(Content(rows == null ? "" : rows.ToString(), _Web.AppJson));
        }
Exemple #4
0
 public ActionResult GetColumnTreeList()
 {
     if (!TomeltServices.Authorizer.Authorize(ArticleManagePermissions.ViewContent, T("无权限")))
     {
         return(new HttpUnauthorizedResult());
     }
     return(Json(ColumnService.GetTreeColumns(VersionOptions.Latest)));
 }
Exemple #5
0
        public void SortByDueDate(string userName)
        {
            UserService        serv    = new UserService();
            InterfaceLayerUser user    = serv.GetUser(userName);
            ColumnService      colserv = new ColumnService();

            colserv.SortByDueDate(userName);
            ShowTheard(user);
        }
        public ActionResult Edit()
        {
            int id         = CECRequest.GetQueryInt("id", 0);
            var columnInfo = ColumnService.GetById(id);

            if (columnInfo.Id <= 0)
            {
                return(RedirectToAction("List"));
            }
            return(View(columnInfo));
        }
Exemple #7
0
        /* ------------------------------- Constructor ------------------------------ */

        public ApiHandler()
        {
            _client = new HttpClient();

            // Connect to services
            cardService      = new CardService(baseUrl);
            columnService    = new ColumnService(baseUrl);
            boardService     = new BoardService(baseUrl);
            userService      = new UserService(baseUrl);
            moveLogicService = new MoveLogicService(baseUrl);
        }
Exemple #8
0
        private void Button_Click_Limit(object sender, RoutedEventArgs e)
        {
            string        x       = Interaction.InputBox("Limit tasks number", "Add number", "THANK YOU", -1, -1);
            int           n       = Int32.Parse(x);
            ColumnService service = new ColumnService();
            bool          b       = service.SetMaxNumOfTaskInColumn(n, email);

            if (!b)
            {
                MessageBox.Show("something went wrong");
            }
        }
 public ActionResult Edit(ColumnInfo oldModel)
 {
     if (oldModel.Id == 0)
     {
         return(RedirectToAction("List"));
     }
     if (ModelState.IsValid)
     {
         ColumnService.Create(oldModel);
         ViewBag.Msg = "更新成功,<a href=\"list\">返回</a>";
     }
     return(View());
 }
Exemple #10
0
        public async Task DeleteColumn_Test()
        {
            // Arrange
            var board  = CreateBoard();
            var column = AddColumn(board);

            // Act
            var response = await Client.DeleteAsync($"/boards/{board.Id}/columns/{column.Id}");

            // Assert
            await AssertResponse.NoContentSuccessAsync(response);

            Assert.Empty(ColumnService.GetColumns(board.Id));
        }
Exemple #11
0
        public ActionResult List()
        {
            int catId     = CECRequest.GetQueryInt("catid", 0);
            int pageIndex = CECRequest.GetQueryInt("page", 1);

            ViewBag.CategoryInfo = ColumnService.GetById(catId);
            var articleList = ArticleService.List(new ArticleSearchSetting()
            {
                ColumnIds = new int[] { catId },
                PageIndex = pageIndex,
                IsDeleted = false
            });

            ViewBag.ArticleList = articleList;
            return(View());
        }
Exemple #12
0
        public async Task GetColumn_Test()
        {
            // Arrange
            var board = CreateBoard();

            ColumnService.AddColumn(board.Id, new Column {
                Id = "Start", Name = "Start"
            });

            // Act
            var response = await Client.GetAsync($"/boards/{board.Id}/columns/start");

            // Assert
            var data = await AssertResponse.SuccessAsync(response);

            var column = JsonSerializer.Deserialize <Column>(data, new JsonSerializerOptions());

            Assert.Equal(board.Id, column.BoardId);
            Assert.Equal("Start", column.Id);
        }
Exemple #13
0
        public async Task DeleteBoard_Test()
        {
            // Arrange
            var board  = CreateBoard();
            var column = AddColumn(board);

            AddColumn(board);
            AddColumn(board);
            AddCard(column);
            AddCard(column);
            AddCard(column);

            // Act
            var response = await Client.DeleteAsync($"/boards/{board.Id}");

            await AssertResponse.NoContentSuccessAsync(response);

            Assert.Throws <BoardNotFoundException>(() => BoardService.GetBoard(board.Id));
            Assert.Throws <BoardNotFoundException>(() => ColumnService.GetColumns(board.Id));
            Assert.Throws <BoardNotFoundException>(() => CardService.GetCards(board.Id, column.Id));
        }
Exemple #14
0
        //
        // GET: /Article/Home/
        /// <summary>
        /// 列表
        /// </summary>
        /// <returns></returns>
        public ActionResult List()
        {
            int pageIndex = CECRequest.GetQueryInt("page", 1);
            int catId     = CECRequest.GetQueryInt("catid", 0);

            //初始化栏目类别
            var allColumnList = ColumnService.List().ToList();
            var dropdownList  = new List <ColumnInfo>();

            ColumnService.BuildListForTree(dropdownList, allColumnList, 0);
            ViewBag.ColumnDropDownList = dropdownList;

            var articleList = ArticleService.List(new ArticleSearchSetting()
            {
                PageIndex = pageIndex,
                ColumnIds = new int[] { catId }
            });

            ViewBag.ArticleList = articleList;
            return(View());
        }
Exemple #15
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult Show()
        {
            Regex  r        = new Regex(@"/(\d+).html", RegexOptions.IgnoreCase);
            Match  m        = r.Match(Request.Url.LocalPath);
            string timespan = string.Empty;

            if (m.Success)
            {
                timespan = m.Groups[1].Value;
            }
            var model = ArticleService.GetByTimespan(timespan);

            ViewBag.CategoryInfo = ColumnService.GetById(model.CategoryId);

            //获得10条相关文章
            ViewBag.RelatedArticleList = ArticleService.GetRelatedArticleList(10, model.Id, model.Tags);

            //更新文章浏览量
            ArticleService.UpdateViewCount(model.Id);

            return(View(model));
        }
Exemple #16
0
        public ActionResult GetColumnList()
        {
            if (!TomeltServices.Authorizer.Authorize(ArticleManagePermissions.ViewContent, T("无权限")))
            {
                return(new HttpUnauthorizedResult());
            }
            var rows = ColumnService.GetColumns(VersionOptions.Latest).OrderBy <ColumnPartRecord>(d => d.Sort).List();

            return(Json(new
            {
                total = rows.Count(),
                rows = rows.Select(d => new
                {
                    d.Id,
                    d.As <ColumnPart>().ParentId,
                    HasPublished = d.HasPublished(),
                    d.As <ColumnPart>().Sort,
                    d.As <TitlePart>().Title,
                    Count = ArticleService.GetArticlesCountByColumnId(d.Id),
                    _parentId = d.As <ColumnPart>().ParentId == 0 ? null : d.As <ColumnPart>().ParentId.ToString()
                })
            }));
        }
Exemple #17
0
        public ActionResult Add(ArticleInfo oldModel, FormCollection fc)
        {
            bool isAdd = true;

            if (oldModel.Id > 0)
            {
                isAdd = false;
            }
            if (ModelState.IsValid)
            {
                //TODO
                //在这,最好检查一下标题是否重复,目前没做
                oldModel.AddUserName        = User.Identity.Name;
                oldModel.LastModifyUserName = User.Identity.Name;
                oldModel.CategoryId         = Utils.StrToInt(fc["select_column"], 0);

                //改变URL
                oldModel.Url = oldModel.QuickLinkUrl;
                if (string.IsNullOrEmpty(oldModel.Url))
                {
                    oldModel.Url = string.Format("/article/show/{0}.html", oldModel.TimeSpan);
                }

                oldModel = ArticleService.Create(oldModel);

                //插入到Article2Category表中
                //1,技术分类
                var        requestTechListArray = CECRequest.GetFormString("cbtechlist").Split(',');
                List <int> techList             = new List <int>();
                foreach (string item in requestTechListArray)
                {
                    int id = Utils.StrToInt(item, 0);
                    if (id > 0)
                    {
                        techList.Add(id);
                    }
                }
                ArticleService.InsertArticle2Category(oldModel.Id, CatType.Tech, techList);
                //2,行业分类
                var        requestIndustryList = CECRequest.GetFormString("cbindustrylist").Split(',');
                List <int> industryList        = new List <int>();
                foreach (string item in requestIndustryList)
                {
                    int id = Utils.StrToInt(item, 0);
                    if (id > 0)
                    {
                        industryList.Add(id);
                    }
                }
                ArticleService.InsertArticle2Category(oldModel.Id, CatType.Industry, industryList);


                //完成,提示信息
                if (isAdd)
                {
                    ViewBag.Msg = "添加成功!<a href=\"add\">继续?</a><span class=\"ml10\">或</span><a href=\"list\" class=\"ml10\">返回</a>";
                }
                else
                {
                    ViewBag.Msg = "修改成功!<a href=\"add\">添加新文章?</a><span class=\"ml10\">或</span><a href=\"list\" class=\"ml10\">返回</a>";
                }
            }

            //初始化栏目类别
            //初始化栏目类别
            var allColumnList = ColumnService.List().ToList();
            var dropdownList  = new List <ColumnInfo>();

            ColumnService.BuildListForTree(dropdownList, allColumnList, 0);
            ViewBag.ColumnDropDownList = dropdownList;

            //输出技术分类
            ViewBag.TechList = TechService.List().Where(m => m.IsDeleted == false);
            //输出行业分类
            ViewBag.IndustryList = IndustryService.List().Where(m => m.IsDeleted == false);

            //已选择的技术分类和行业分类
            ViewBag.SelectTechList     = ArticleService.Article2CategoryListByArticleIdAndType(oldModel.Id, CatType.Tech);
            ViewBag.SelectIndustryList = ArticleService.Article2CategoryListByArticleIdAndType(oldModel.Id, CatType.Industry);

            string companyName = string.Empty;

            if (oldModel.CompanyId > 0)
            {
                //对CompanyName进行赋值
                //数据库中只保存CompanyId,没有保存CompanyName,只能在这里处理一下
                companyName = MemberService.GetBaseCompanyInfo(oldModel.CompanyId).CompanyName;
            }
            ViewBag.CompanyName = companyName;

            return(View(oldModel));
        }
        public ActionResult List()
        {
            if (Request.HttpMethod.ToUpper() == "POST")
            {
                //POST
                var action = CECRequest.GetFormString("action").ToLower();
                if (action == "addparent")
                {
                    //添加父节点
                    string name = CECRequest.GetFormString("txtParentName");
                    if (string.IsNullOrEmpty(name))
                    {
                        ModelState.AddModelError("PNAMEEMPTY", "根栏目名称不能为空");
                    }
                    if (ModelState.IsValid)
                    {
                        //Insert
                        ColumnService.Create(new ColumnInfo()
                        {
                            Name      = name,
                            Alias     = string.Empty,
                            ParentId  = 0,
                            RootId    = 0,
                            IsDeleted = false,
                            ParentIds = "0",
                            Sort      = 999999
                        });
                        ViewBag.Msg = "根栏目添加成功";
                    }
                }
                if (action == "addchild")
                {
                    //添加子节点
                    string name = CECRequest.GetFormString("txtChildName");
                    if (string.IsNullOrEmpty(name))
                    {
                        ModelState.AddModelError("CNAMEEMPTY", "子栏目名称不能为空");
                    }
                    if (ModelState.IsValid)
                    {
                        //保存
                        int parentId         = Utils.StrToInt(CECRequest.GetFormString("select_column"), 0);
                        var parentColumnInfo = ColumnService.GetById(parentId);
                        if (parentColumnInfo.Id > 0)
                        {
                            //RootId
                            int rootId = parentColumnInfo.RootId;
                            if (parentColumnInfo.ParentId == 0)
                            {
                                //说明是根分类
                                rootId = parentColumnInfo.Id;
                            }
                            //ParentIds
                            string parentIds = string.Format("{0},{1}", parentColumnInfo.ParentIds, parentColumnInfo.Id);

                            ColumnService.Create(new ColumnInfo()
                            {
                                Alias     = string.Empty,
                                IsDeleted = false,
                                Name      = name,
                                ParentId  = parentId,
                                ParentIds = parentIds,
                                RootId    = rootId,
                                Sort      = 999999
                            });
                            ViewBag.Msg = "子栏目添加成功";
                        }
                    }
                }
            }

            //创建下拉列表
            var allColumn    = ColumnService.List().ToList();
            var dropdownList = new List <ColumnInfo>();

            ColumnService.BuildListForTree(dropdownList, allColumn, 0);
            ViewBag.DropDownList = dropdownList;

            ViewBag.ColumnListHtml = _BuildColumnList(allColumn, 0);


            return(View());
        }
 public HomeController()
 {
     columnService = new ColumnService();
     ticketService = new TicketService();
 }