コード例 #1
0
ファイル: ArticleController.cs プロジェクト: jim-deng-git/Ask
        public ActionResult SeriesEdit(long siteId, long menuId, ArticleSeriesModels item, HttpPostedFileBase fIcon, string fIconBase64, string fIconBase64_Resize)
        {
            ViewBag.SiteID      = siteId;
            ViewBag.MenuID      = menuId;
            ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(siteId, menuId);
            ViewBag.Exit        = true;
            if (string.IsNullOrEmpty(item.Icon))
            {
                item.Icon = string.Empty;
            }
            else
            {
                WorkV3.Models.ImageModel imgModel = JsonConvert.DeserializeObject <WorkV3.Models.ImageModel>(item.Icon);
                if (imgModel.ID == 0)
                {
                    if (fIcon == null || fIcon.ContentLength == 0)
                    {
                        item.Icon = string.Empty;
                    }
                    else
                    {
                        string fileName = Golbal.UpdFileInfo.SaveFilesByMenuID(fIcon, siteId, menuId, fIconBase64, fIconBase64_Resize);
                        imgModel.ID  = 1;
                        imgModel.Img = fileName;
                        item.Icon    = JsonConvert.SerializeObject(imgModel);
                    }
                }
            }
            ArticleSeriesDAO.SetItem(item);

            return(View(item));
        }
コード例 #2
0
ファイル: ArticleController.cs プロジェクト: jim-deng-git/Ask
        public ActionResult Para(long siteId, long menuId, string type)
        {
            ViewBag.SiteID    = siteId;
            ViewBag.MenuID    = menuId;
            ViewBag.Type      = type ?? "series";
            ViewBag.UploadUrl = WorkV3.Golbal.UpdFileInfo.GetVPathByMenuID(siteId, menuId);

            IEnumerable <ArticleSeriesModels> series = ArticleSeriesDAO.GetItems(menuId);

            if (series == null)
            {
                series = new List <ArticleSeriesModels>();
            }
            ViewBag.Series = series;

            IEnumerable <ArticleTypesModels> types = ArticleTypesDAO.GetItems(menuId);

            if (types == null)
            {
                types = new List <ArticleTypesModels>();
            }
            ViewBag.Types = types;

            IEnumerable <ArticlePosterModels> posters = ArticlePosterDAO.GetItems(menuId);

            if (posters == null)
            {
                posters = new List <ArticlePosterModels>();
            }
            ViewBag.Posters = posters;

            return(View());
        }
コード例 #3
0
ファイル: ArticleController.cs プロジェクト: jim-deng-git/Ask
        public ActionResult SeriesEdit(long siteId, long menuId, long?id)
        {
            ViewBag.SiteID      = siteId;
            ViewBag.MenuID      = menuId;
            ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(siteId, menuId);

            ArticleSeriesModels Series = null;

            if (id != null)
            {
                Series = ArticleSeriesDAO.GetItem((long)id);
            }
            if (Series == null)
            {
                Series = new ArticleSeriesModels {
                    ID = WorkLib.GetItem.NewSN(), IsIssue = true, Sort = int.MaxValue
                }
            }
            ;

            return(View(Series));
        }
コード例 #4
0
ファイル: ArticleController.cs プロジェクト: jim-deng-git/Ask
        public ActionResult Edit(long siteId, long menuId, string type, long?id, long?templateId)
        {
            ViewBag.SiteID       = siteId;
            ViewBag.MenuID       = menuId;
            ViewBag.Types        = ArticleTypesDAO.GetIssueItems(menuId);
            ViewBag.Series       = ArticleSeriesDAO.GetIssueItems(menuId);
            ViewBag.Categories   = CategoryDAO.GetItems(FavorityType);
            ViewBag.Sites        = WorkV3.Models.DataAccess.SitesDAO.GetDatas();
            ViewBag.UploadUrl    = WorkV3.Golbal.UpdFileInfo.GetVPathByMenuID(siteId, menuId);
            ViewBag.ListIdentity = CategoryDAO.GetIssueItems(IdentityType);

            int cardStyleID             = 1;
            List <CardsModels> cardItem = CardsDAO.GetPageData(siteId, menuId);

            foreach (var cards in cardItem)
            {
                if (cards.CardsType == "Article")
                {
                    cardStyleID = cards.StylesID;
                    break;
                }
            }

            ArticleModels item = null;

            if (id != null)
            {
                item = ArticleDAO.GetItem((long)id);
                SetLinkDetailViewBag(item.LinkDetail);
            }

            if (item == null && templateId != null)
            {
                MenusModels menu         = MenusDAO.GetInfo(siteId, menuId);
                long        newArticleId = WorkLib.GetItem.NewSN();
                long        cardNo       = WorkV3.Golbal.PubFunc.AddPage(siteId, menuId, menu.SN, "Article", "Content", true, CardStyleId: cardStyleID);
                ArticleDAO.Copy((long)templateId, newArticleId, cardNo, menuId, siteId, true);
                item                 = ArticleDAO.GetItem(newArticleId);
                item.VideoType       = "youtube";
                ViewBag.FromTemplate = true;
            }

            if (item == null)
            {
                item = new ArticleModels {
                    ID = WorkLib.GetItem.NewSN(), Type = type, IsIssue = true
                };
                ViewBag.ArticleTypes      = new long[] { };
                ViewBag.ArticleSeries     = new long[] { };
                ViewBag.ArticleCategories = new long[] { };
                ViewBag.ArticlePosters    = new ArticlePosterModels[] { };
            }
            else
            {
                ViewBag.ArticleTypes      = ArticleDAO.GetItemTypes(item.ID);
                ViewBag.ArticleSeries     = ArticleDAO.GetItemSeries(item.ID);
                ViewBag.ArticleCategories = ArticleDAO.GetItemCategories(item.ID);

                IEnumerable <ArticlePosterModels> posters = ArticleDAO.GetItemPosters(item.ID);
                foreach (ArticlePosterModels p in posters)
                {
                    if (!string.IsNullOrWhiteSpace(p.Photo))
                    {
                        ResourceImagesModels photo = Newtonsoft.Json.JsonConvert.DeserializeObject <ResourceImagesModels>(p.Photo);
                        if (photo.Img != string.Empty)
                        {
                            p.Photo = photo.Img;
                        }
                    }
                }
                ViewBag.ArticlePosters = posters;
            }
            ViewBag.showMainVideo = false;
            if (item.VideoID != "")
            {
                ViewBag.showMainVideo = true;
            }

            return(View(item));
        }
コード例 #5
0
ファイル: ArticleController.cs プロジェクト: jim-deng-git/Ask
 public void SeriesToggleIssue(long siteId, long menuId, long id)
 {
     ArticleSeriesDAO.ToggleIssue(id);
 }
コード例 #6
0
ファイル: ArticleController.cs プロジェクト: jim-deng-git/Ask
 public void SeriesDel(long siteId, long menuId, IEnumerable <long> ids)
 {
     ArticleSeriesDAO.Delete(ids);
 }
コード例 #7
0
ファイル: ArticleController.cs プロジェクト: jim-deng-git/Ask
 public void SeriesSort(long siteId, long menuId, IEnumerable <SortItem> items)
 {
     ArticleSeriesDAO.Sort(menuId, items);
 }
コード例 #8
0
ファイル: ArticleController.cs プロジェクト: jim-deng-git/Ask
        public ActionResult Edit(long siteId, long menuId, ArticleModels item, long[] types, long[] series, long[] categories, long[] sites, string posters, IEnumerable <ParagraphModels> paragraphs, string deletedParagraphs, bool saveTemplate,
                                 HttpPostedFileBase fVideoImg, string fVideoImgBase64, string fVideoImgBase64_Resize, string customVideo, string LinkSites, string[] Pages, string PageDetailID, long[] readModeCategories)
        {
            if (!Utility.CheckIsLogin())
            {
                Response.Redirect(Url.Action("Login", "Home"));
            }

            ViewBag.SiteID     = siteId;
            ViewBag.MenuID     = menuId;
            ViewBag.Types      = ArticleTypesDAO.GetIssueItems(menuId);
            ViewBag.Series     = ArticleSeriesDAO.GetIssueItems(menuId);
            ViewBag.Categories = CategoryDAO.GetItems(FavorityType);
            ViewBag.Sites      = WorkV3.Models.DataAccess.SitesDAO.GetDatas();
            ViewBag.UploadUrl  = WorkV3.Golbal.UpdFileInfo.GetVPathByMenuID(siteId, menuId).TrimEnd('/');

            SaveIconAndArchive(siteId, menuId, item);

            item.MenuID = menuId;

            if (sites?.Length > 0)
            {
                item.IsIssue = true;
            }

            if (item.VideoType == "custom")
            {
                item.VideoID = customVideo;
            }
            #region 影片截圖

            if (!string.IsNullOrWhiteSpace(item.VideoImg) && item.VideoImgIsCustom)
            {
                if (item.VideoImg[0] == '{')
                {
                    WorkV3.Models.ImageModel imgModel = JsonConvert.DeserializeObject <WorkV3.Models.ImageModel>(item.VideoImg);
                    if (imgModel.ID == 0)
                    {
                        if (fVideoImg == null || fVideoImg.ContentLength == 0)
                        {
                            item.VideoImg = string.Empty;
                        }
                        else
                        {
                            string fileName = Golbal.UpdFileInfo.SaveFilesByMenuID(fVideoImg, siteId, menuId, fVideoImgBase64, fVideoImgBase64_Resize);
                            imgModel.ID   = 1;
                            imgModel.Img  = fileName;
                            item.VideoImg = JsonConvert.SerializeObject(imgModel);
                        }
                    }
                }
                else
                {
                    item.VideoImg = string.Empty;
                }
            }

            #endregion

            int cardStyleID             = 1;
            List <CardsModels> cardItem = CardsDAO.GetPageData(siteId, menuId);
            foreach (var cards in cardItem)
            {
                if (cards.CardsType == "Article")
                {
                    cardStyleID = cards.StylesID;
                    break;
                }
            }
            if (Request["LinkType"].Contains("true"))
            {
                item.LinkType = ResourceLinkType.inLink;
                if (!string.IsNullOrEmpty(PageDetailID))
                {
                    item.LinkDetail = PageDetailID;
                    var pageInfo = WorkV3.Areas.Backend.Models.DataAccess.PagesDAO.GetPageInfo(long.Parse(PageDetailID));
                    if (pageInfo != null)
                    {
                        var siteInfo = WorkV3.Models.DataAccess.SitesDAO.GetInfo(pageInfo.SiteID);
                        item.Link = Url.RouteUrl("FrontSitePage", new { SiteSN = siteInfo.SN, PageSN = pageInfo.SN });
                    }
                }
                else if (Pages != null)
                {
                    for (int i = 0; i < Pages.Length; i++)
                    {
                        if (!string.IsNullOrEmpty(Pages[i]))
                        {
                            item.LinkDetail = Pages[i];
                        }
                    }
                    if (!string.IsNullOrEmpty(item.LinkDetail))
                    {
                        var pageInfo = WorkV3.Areas.Backend.Models.DataAccess.PagesDAO.GetPageInfo(long.Parse(item.LinkDetail));
                        if (pageInfo != null)
                        {
                            var siteInfo = WorkV3.Models.DataAccess.SitesDAO.GetInfo(pageInfo.SiteID);
                            item.Link = Url.RouteUrl("FrontSitePage", new { SiteSN = siteInfo.SN, PageSN = pageInfo.SN });
                        }
                    }
                }
                item.Link = item.Link;
            }
            else
            {
                item.LinkType = ResourceLinkType.outLink;
            }
            ArticleDAO.SetItem(item, cardStyleID);
            SysLog.SaveArticleEditLog(item.ID);
            ArticleDAO.SetItemTypes(item.ID, types);
            ArticleDAO.SetItemSeries(item.ID, series);
            ArticleDAO.SetItemCategories(item.ID, FavorityType, categories);
            ArticleDAO.SetItemCategories(item.ID, IdentityType, readModeCategories);
            ArticleDAO.SetItemPosters(item.ID, Newtonsoft.Json.JsonConvert.DeserializeObject <long[]>(posters));
            ArticleDAO.SetItemSites(item.ID, sites);

            SaveParagraph(item, paragraphs, deletedParagraphs);

            ViewBag.ArticleTypes      = types ?? (new long[] { });
            ViewBag.ArticleSeries     = series ?? (new long[] { });
            ViewBag.ArticlePosters    = GetPoster(item, posters);
            ViewBag.ArticleCategories = categories ?? (new long[] { });
            SetLinkDetailViewBag(item.LinkDetail);

            if (saveTemplate)
            {
                long tmplId = WorkLib.GetItem.NewSN();
                ArticleDAO.Copy(item.ID, tmplId, 0, -menuId, null, true);
                ViewBag.TemplateID = tmplId;
            }
            else
            {
                ViewBag.Exit = true;
            }
            return(View(item));
        }
コード例 #9
0
 public int GetArticleCount()
 {
     return(ArticleSeriesDAO.GetArticleCount(ID));
 }