예제 #1
0
        public ActionResult Setting(long siteId, long menuId)
        {
            ViewBag.Menu = MenusDAO.GetInfo(siteId, menuId);

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

            ViewBag.Types = types;

            //ViewBag.ListCards = WorkV3.Models.DataAccess.MenusDAO.GetListCards("Article").Where(c => c.ID != menuId);
            ViewBag.ListCards    = WorkV3.Models.DataAccess.MenusDAO.GetListCards("Article"); // shan 20180102 依 CC 要求修改為本單元亦列入, 且預設勾選
            ViewBag.ListCards2   = WorkV3.Models.DataAccess.MenusDAO.GetListCards("Article"); // shan 20180102 依 CC 要求修改為本單元亦列入, 且預設勾選
            ViewBag.ListIdentity = CategoryDAO.GetIssueItems(IdentityType);

            ViewBag.SiteID    = siteId;
            ViewBag.MenuID    = menuId;
            ViewBag.UploadUrl = WorkV3.Golbal.UpdFileInfo.GetVPathByMenuID(siteId, menuId).TrimEnd('/') + "/";

            ViewBag.MemberRegSet = MemberShipRegSetDAO.GetItem(siteId);

            List <WorkV3.ViewModels.CommentType> ReplyItemList = WorkV3.ViewModels.CommentTypeLibs.GetCommitTypeList();

            ViewBag.ReplyItemList = ReplyItemList;

            WorkV3.Models.ArticleSettingModels item = WorkV3.Models.DataAccess.ArticleSettingDAO.GetItem(menuId);
            if (item.Types == "all")
            {
                item.Types = string.Join(",", types.Select(t => t.ID));
            }

            return(View(item));
        }
        public ActionResult UpdateMemberShipColumnSet(long SiteID, string ColumnName, bool IsOpen, bool IsNeedValue)
        {
            MemberShipRegSetModels model = MemberShipRegSetDAO.GetItem(SiteID);
            bool Result = MemberShipRegSetDAO.UpdateColumnItemSet(SiteID, ColumnName, IsOpen, IsNeedValue);

            if (Result)
            {
                return(Json("success"));
            }
            else
            {
                return(Json("fail"));
            }
        }
        public ActionResult UpdateMemberShipSet(long SiteID, string columnName, string columnValue)
        {
            MemberShipRegSetModels model = MemberShipRegSetDAO.GetItem(SiteID);
            bool Result = MemberShipRegSetDAO.UpdateItemSet(SiteID, columnName, columnValue);

            if (Result)
            {
                return(Json("success"));
            }
            else
            {
                return(Json("fail"));
            }
        }
예제 #4
0
        public ActionResult Setting(long siteId, WorkV3.Models.ArticleSettingModels item, string[] ExtendReadMenus, string[] ExtendReadMenus2, string[] ReadModeSet)
        {
            long menuId = item.MenuID;

            ViewBag.Menu  = MenusDAO.GetInfo(siteId, menuId);
            ViewBag.Types = ArticleTypesDAO.GetIssueItems(menuId);
            //ViewBag.ListCards = WorkV3.Models.DataAccess.MenusDAO.GetListCards("Article").Where(c => c.ID != menuId);
            ViewBag.ListCards    = WorkV3.Models.DataAccess.MenusDAO.GetListCards("Article"); // shan 20180102 依 CC 要求修改為本單元亦列入, 且預設勾選
            ViewBag.ListCards2   = WorkV3.Models.DataAccess.MenusDAO.GetListCards("Article"); // shan 20180102 依 CC 要求修改為本單元亦列入, 且預設勾選
            ViewBag.ListIdentity = CategoryDAO.GetIssueItems(IdentityType);

            ViewBag.SiteID    = siteId;
            ViewBag.MenuID    = menuId;
            ViewBag.UploadUrl = WorkV3.Golbal.UpdFileInfo.GetVPathByMenuID(siteId, menuId).TrimEnd('/');

            ViewBag.MemberRegSet = MemberShipRegSetDAO.GetItem(siteId);

            List <WorkV3.ViewModels.CommentType> ReplyItemList = WorkV3.ViewModels.CommentTypeLibs.GetCommitTypeList();

            ViewBag.ReplyItemList = ReplyItemList;

            if (item.SortMode == "隨機排序")
            {
                item.SortField = "NewID()";
            }
            if (ExtendReadMenus != null)
            {
                string eMenus = "";
                foreach (string ExtendReadMenu in ExtendReadMenus)
                {
                    if (!string.IsNullOrEmpty(ExtendReadMenu))
                    {
                        eMenus += ExtendReadMenu + ",";
                    }
                }
                eMenus = eMenus.Trim(',');
                item.ExtendReadMenus = eMenus;
            }
            else
            {
                item.ExtendReadMenus = string.Empty;
            }
            if (ExtendReadMenus2 != null)
            {
                string eMenus = "";
                foreach (string ExtendReadMenu in ExtendReadMenus2)
                {
                    if (!string.IsNullOrEmpty(ExtendReadMenu))
                    {
                        eMenus += ExtendReadMenu + ",";
                    }
                }
                eMenus = eMenus.Trim(',');
                item.ExtendReadMenus2 = eMenus;
            }
            else
            {
                item.ExtendReadMenus2 = string.Empty;
            }

            if (ReadModeSet != null)
            {
                string readModeSetStr = "";
                foreach (string readModeSet in ReadModeSet)
                {
                    if (!string.IsNullOrEmpty(readModeSet))
                    {
                        readModeSetStr += readModeSet + ",";
                    }
                }
                readModeSetStr   = readModeSetStr.Trim(',');
                item.ReadModeSet = readModeSetStr;
            }
            else
            {
                item.ReadModeSet = string.Empty;
            }

            if (!string.IsNullOrWhiteSpace(item.DefaultImg))
            {
                ResourceImagesModels imgModel = Newtonsoft.Json.JsonConvert.DeserializeObject <ResourceImagesModels>(item.DefaultImg);
                if (imgModel.ID == 0)
                { // 新上傳的圖片
                    HttpPostedFileBase postedFile               = Request.Files["fDefaultImg"];
                    string             fDefaultImgBase64        = Request.Form["fDefaultImgBase64"];
                    string             fDefaultImgBase64_Resize = Request.Form["fDefaultImgBase64_Resize"];
                    if (postedFile == null || postedFile.ContentLength == 0)
                    {
                        item.DefaultImg = string.Empty;
                    }
                    else
                    {
                        string saveName = WorkV3.Golbal.UpdFileInfo.SaveFilesByMenuID(postedFile, siteId, menuId, fDefaultImgBase64, fDefaultImgBase64_Resize);
                        imgModel.ID  = 1;
                        imgModel.Img = saveName;

                        item.DefaultImg = Newtonsoft.Json.JsonConvert.SerializeObject(imgModel);
                    }
                }
            }

            WorkV3.Models.DataAccess.ArticleSettingDAO.SetItem(item);

            ViewBag.Success = true;
            return(View(item));
        }
        public ActionResult GetMemberShipSet(long SiteID)
        {
            MemberShipRegSetModels model = MemberShipRegSetDAO.GetItem(SiteID);

            return(Json(model));
        }