コード例 #1
0
ファイル: ArticleController.cs プロジェクト: jim-deng-git/Ask
        public void Copy(long siteId, long menuId, long[] ArticleIds, long TargetMenuID)
        {
            ViewBag.SiteID     = siteId;
            ViewBag.MenuID     = menuId;
            ViewBag.ActionType = "copy";
            if (ArticleIds.Length == 0)
            {
                return;
            }

            var targetMenu = MenusDAO.GetInfo(TargetMenuID);

            foreach (long ArticleId in ArticleIds)
            {
                ArticleModels articleItem = ArticleDAO.GetItem(ArticleId);
                CardsModels   cardItem    = CardsDAO.GetByNo(articleItem.CardNo);
                ZonesModels   zoneItem    = ZonesDAO.GetByNo(cardItem.ZoneNo.Value);
                PagesModels   pageItem    = PagesDAO.GetPageInfo(zoneItem.PageNo);

                long newCardNo       = WorkV3.Golbal.PubFunc.CopyPage(pageItem, targetMenu.SiteID, targetMenu.ID);
                long newArticleId    = WorkLib.GetItem.NewSN();
                bool IsForceRelative = false;
                if (pageItem.SiteID == targetMenu.SiteID && pageItem.MenuID == targetMenu.ID)
                {
                    IsForceRelative = true;
                }
                ArticleDAO.CopyArticle(ArticleId, newArticleId, newCardNo, targetMenu.ID, targetMenu.SiteID, IsForceRelative);
                WorkV3.Golbal.PubFunc.CopyIcon(articleItem.Icon, siteId, menuId, targetMenu.SiteID, targetMenu.ID);
                WorkV3.Golbal.PubFunc.CopyParagraphPhotos(articleItem.ID, siteId, menuId, targetMenu.SiteID, targetMenu.ID);
            }
        }
コード例 #2
0
ファイル: PubFunc.cs プロジェクト: jim-deng-git/Ask
        /// <summary>
        /// 為一個主頁面增加相關的 Page、Zone、Card 信息
        /// </summary>
        /// <param name="sourcePage">原始頁面</param>
        /// <param name="targetSiteId">站點 ID</param>
        /// <param name="targetMenuId">選單 ID</param>
        /// <returns>返回 CardID</returns>
        public static long CopyPage(PagesModels sourcePage, long targetSiteId, long targetMenuId)
        {
            long CardNO = 0;

            long        PageNo    = WorkLib.GetItem.NewSN();
            var         sourceMnu = WorkV3.Models.DataAccess.MenusDAO.GetInfo(sourcePage.SiteID, sourcePage.MenuID);
            var         targetMnu = WorkV3.Models.DataAccess.MenusDAO.GetInfo(targetSiteId, targetMenuId);
            PagesModels newPage   = new PagesModels
            {
                No     = PageNo,
                SiteID = targetSiteId,
                MenuID = targetMenuId,
                SN     = targetMnu.SN,
                Title  = sourcePage.Title + "- (複製)"
            };

            newPage.SN += "_" + newPage.No;
            //WorkLib.WriteLog.Write(true, "newPage.No:" + newPage.No.ToString()+"/"+ newPage.Title);
            SysLog.SaveLog(SysActions.Add, SysMgrNo.Page, newPage.Title, targetSiteId, targetMenuId, PageNo);
            PagesDAO.SetPageInfo(newPage);

            var sourceZones = WorkV3.Models.DataAccess.ZonesDAO.GetPageData(sourcePage.SiteID, sourcePage.No);

            foreach (WorkV3.Models.ZonesModels sourceZone in sourceZones)
            {
                ZonesModels newZone = new ZonesModels
                {
                    No         = WorkLib.GetItem.NewSN(),
                    SiteID     = targetSiteId,
                    PageNo     = newPage.No,
                    StyleID    = sourceZone.StyleID,
                    Sort       = sourceZone.Sort,
                    ShowStatus = sourceZone.ShowStatus
                };
                ZonesDAO.SetZoneInfo(newZone);

                var sourceCards = WorkV3.Models.DataAccess.CardsDAO.GetZoneData(sourceZone.SiteID, sourceZone.No);
                foreach (WorkV3.Models.CardsModels sourceCard in sourceCards)
                {
                    CardsModels newCard = new CardsModels
                    {
                        No         = WorkLib.GetItem.NewSN(),
                        ZoneNo     = newZone.No,
                        CardsType  = sourceCard.CardsType,
                        ViewAction = sourceCard.ViewAction,
                        Status     = sourceCard.Status,
                        StylesID   = sourceCard.StylesID
                    };
                    CardsDAO.SetCardInfo(newCard);
                    if (newCard.CardsType == "Article" || newCard.CardsType == "Event")
                    {
                        CardNO = newCard.No;
                    }
                }
            }
            return(CardNO);
        }
コード例 #3
0
ファイル: PagesController.cs プロジェクト: jim-deng-git/Ask
        // GET: Pages

        public ActionResult Page(long SiteID, long PageNo)
        {
            ViewBag.SiteID = SiteID;
            ViewBag.PageNO = PageNo;

            //取得該Page底下的Zone集合
            List <ZonesModels> Zones = ZonesDAO.GetPageData(SiteID, PageNo);

            //廣告
            AdvertisementRenderDAO ad = new AdvertisementRenderDAO(SiteID, PageNo);

            Zones = ad.InsertAdsZones(Zones);

            return(PartialView("_Pages", Zones));
        }
コード例 #4
0
ファイル: SysLog.cs プロジェクト: jim-deng-git/Ask
        public static void SaveArticleDelLog(long ArticleID)
        {
            var articleInfo = ArticleDAO.GetItem(ArticleID);

            if (articleInfo != null)
            {
                var cardInfo = CardsDAO.GetByNo(articleInfo.CardNo);
                if (cardInfo != null && cardInfo.ZoneNo.HasValue)
                {
                    var zoneInfo = ZonesDAO.GetByNo(cardInfo.ZoneNo.Value);
                    if (zoneInfo != null)
                    {
                        SysLog.SaveLog(SysActions.Del, SysMgrNo.Page, articleInfo.Title, articleInfo.SiteID, articleInfo.MenuID, zoneInfo.PageNo);
                    }
                }
            }
        }
コード例 #5
0
        public ActionResult Index(string SiteSN, string PageSN, string type)
        {
            var mSites = SitesDAO.GetSiteInfo(SiteSN);

            if (mSites != null)
            {
                var mPages = PagesDAO.GetPageInfo(mSites.Id, PageSN);

                if (mPages != null)
                {
                    //取得該Page底下的Zone集合
                    var zones = ZonesDAO.GetPageData(mPages.SiteID, mPages.No);

                    foreach (var zone in zones)
                    {
                        var cards = CardsDAO.GetZoneData(zone.SiteID, zone.No);

                        var card = cards.Where(x => x.CardsType != "Header" && x.CardsType != "BreadCrumbs" && x.CardsType != "Footer").FirstOrDefault();

                        if (card != null)
                        {
                            ViewBag.Type     = type;
                            ViewBag.Title    = mPages.Title;
                            ViewBag.SiteName = mSites.Title;
                            return(View(card));
                        }
                    }
                }
            }

            string DefaultSiteSN = GetItem.appSet("DefaultSiteSN").ToString();

            if (DefaultSiteSN != "")
            {
                Response.Redirect("~/w/" + DefaultSiteSN + "/index");
            }

            return(RedirectToAction("EmptyPage", "Home"));
        }
コード例 #6
0
ファイル: ArticleController.cs プロジェクト: jim-deng-git/Ask
        public void Move(long siteId, long menuId, long[] ArticleIds, long TargetMenuID)
        {
            ViewBag.SiteID     = siteId;
            ViewBag.MenuID     = menuId;
            ViewBag.ActionType = "move";
            if (ArticleIds.Length == 0)
            {
                return;
            }
            foreach (long ArticleId in ArticleIds)
            {
                ArticleModels articleItem = ArticleDAO.GetItem(ArticleId);
                CardsModels   cardItem    = CardsDAO.GetByNo(articleItem.CardNo);
                ZonesModels   zoneItem    = ZonesDAO.GetByNo(cardItem.ZoneNo.Value);
                PagesModels   pageItem    = PagesDAO.GetPageInfo(zoneItem.PageNo);

                var targetMenu = MenusDAO.GetInfo(TargetMenuID);
                WorkV3.Golbal.PubFunc.MovePage(pageItem, targetMenu.SiteID, targetMenu.ID);
                ArticleDAO.Move(ArticleId, targetMenu.ID, targetMenu.SiteID);
                WorkV3.Golbal.PubFunc.CopyIcon(articleItem.Icon, siteId, menuId, targetMenu.SiteID, targetMenu.ID);
                WorkV3.Golbal.PubFunc.CopyParagraphPhotos(articleItem.ID, siteId, menuId, targetMenu.SiteID, targetMenu.ID);
            }
        }
コード例 #7
0
ファイル: PubFunc.cs プロジェクト: jim-deng-git/Ask
        /// <summary>
        /// 為一個主頁面增加相關的 Page、Zone、Card 信息
        /// </summary>
        /// <param name="siteId">站點 ID</param>
        /// <param name="menuId">選單 ID</param>
        /// <param name="name">頁面名稱</param>
        /// <param name="cardType">Card 类型(對應到 Controller)</param>
        /// <param name="viewAction">操作(對應到 Controller Action)</param>
        /// <param name="appendIdToName">是否將 ID 附加到頁面名稱後</param>
        /// <param name="title">頁面標題</param>
        /// <param name="styleId">指定樣式</param>
        /// <returns>返回 CardID</returns>
        public static long AddPage(long siteId, long menuId, string name, string cardType, string viewAction = null, bool appendIdToName = false, string title = null, int ZoneStyleId = 1, bool isMenuAdd = false, int CardStyleId = 1)
        {
            long CardNO = 0;

            long PageNo = WorkLib.GetItem.NewSN();

            if (isMenuAdd == true)
            {
                PageNo = menuId;
            }

            PagesModels page = new PagesModels
            {
                No     = PageNo,
                SiteID = siteId,
                MenuID = menuId,
                SN     = name,
                Title  = title
            };

            if (appendIdToName)
            {
                page.SN += "_" + page.No;
            }

            SysLog.SaveLog(SysActions.Add, SysMgrNo.Page, title, siteId, menuId, PageNo);
            PagesDAO.SetPageInfo(page);



            #region 增加動態 ZONE、CARD
            switch (cardType)
            {
            //例外的卡
            case "Intro":

                break;

            default:

                ZonesModels zone = new ZonesModels
                {
                    No         = WorkLib.GetItem.NewSN(),
                    SiteID     = siteId,
                    PageNo     = page.No,
                    StyleID    = ZoneStyleId,
                    Sort       = 10, //需排在固定項後
                    ShowStatus = 1
                };
                ZonesDAO.SetZoneInfo(zone);
                if (string.IsNullOrEmpty(viewAction) && cardType == "Form")
                {
                    viewAction = "Edit";
                }
                CardsModels card = new CardsModels
                {
                    No         = WorkLib.GetItem.NewSN(),
                    ZoneNo     = zone.No,
                    CardsType  = cardType,
                    StylesID   = CardStyleId,
                    ViewAction = viewAction,
                    Status     = 1
                };
                CardsDAO.SetCardInfo(card);
                CardNO = card.No;
                break;
            }


            #endregion

            if (cardType == "Reward")
            {
                return(CardNO);// wei 20180914 集點捨去固定ZONE內容
            }
            #region 固定ZONE
            //CardsType,Zones.Style,Zones.Sort,Cards.StyleID
            string[,] FixedItem = { { "Header", "1000", "1", WebInfo.StyleHeader }, { "BreadCrumbs", "1002", "5", "1" }, { "Footer", "1001", "20", WebInfo.StyleFooter } };

            if (FixedItem.Rank > 0)
            {
                for (int i = 0; i < FixedItem.GetLength(0); i++)
                {
                    if (page.SN.ToLower() == "index" && FixedItem[i, 0] == "BreadCrumbs")
                    {
                    }
                    else
                    {
                        ZonesModels NewZone = new ZonesModels
                        {
                            No         = WorkLib.GetItem.NewSN(),
                            SiteID     = siteId,
                            PageNo     = page.No,
                            StyleID    = int.Parse(FixedItem[i, 1]),
                            Sort       = byte.Parse(FixedItem[i, 2]),
                            ShowStatus = 1
                        };
                        ZonesDAO.SetZoneInfo(NewZone);
                        CardsModels NewCard = new CardsModels
                        {
                            No        = WorkLib.GetItem.NewSN(),
                            ZoneNo    = NewZone.No,
                            CardsType = FixedItem[i, 0],
                            Status    = 1,
                            StylesID  = int.Parse(FixedItem[i, 3])
                        };
                        CardsDAO.SetCardInfo(NewCard);
                    }
                }
            }

            #endregion

            return(CardNO);
        }