Ejemplo n.º 1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            lotteryType = ELotteryTypeUtils.GetEnumType(Request.QueryString["lotteryType"]);
            var lotteryName = ELotteryTypeUtils.GetText(lotteryType);

            if (!string.IsNullOrEmpty(Request.QueryString["Delete"]))
            {
                var list = TranslateUtils.StringCollectionToIntList(Request.QueryString["IDCollection"]);
                if (list.Count > 0)
                {
                    try
                    {
                        DataProviderWX.LotteryDAO.Delete(PublishmentSystemID, list);

                        SuccessMessage(lotteryName + "删除成功!");
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, lotteryName + "删除失败!");
                    }
                }
            }

            spContents.ControlToPaginate = rptContents;
            spContents.ItemsPerPage      = 30;
            spContents.ConnectionString  = BaiRongDataProvider.ConnectionString;
            spContents.SelectCommand     = DataProviderWX.LotteryDAO.GetSelectString(PublishmentSystemID, lotteryType);
            spContents.SortField         = LotteryAttribute.ID;
            spContents.SortMode          = SortMode.ASC;
            rptContents.ItemDataBound   += new RepeaterItemEventHandler(rptContents_ItemDataBound);

            if (!IsPostBack)
            {
                if (lotteryType == ELotteryType.Scratch)
                {
                    BreadCrumb(AppManager.WeiXin.LeftMenu.ID_Function, AppManager.WeiXin.LeftMenu.Function.ID_Scratch, lotteryName, AppManager.WeiXin.Permission.WebSite.Scratch);
                }
                else if (lotteryType == ELotteryType.BigWheel)
                {
                    BreadCrumb(AppManager.WeiXin.LeftMenu.ID_Function, AppManager.WeiXin.LeftMenu.Function.ID_BigWheel, lotteryName, AppManager.WeiXin.Permission.WebSite.BigWheel);
                }
                else if (lotteryType == ELotteryType.GoldEgg)
                {
                    BreadCrumb(AppManager.WeiXin.LeftMenu.ID_Function, AppManager.WeiXin.LeftMenu.Function.ID_GoldEgg, lotteryName, AppManager.WeiXin.Permission.WebSite.GoldEgg);
                }
                else if (lotteryType == ELotteryType.Flap)
                {
                    BreadCrumb(AppManager.WeiXin.LeftMenu.ID_Function, AppManager.WeiXin.LeftMenu.Function.ID_Flap, lotteryName, AppManager.WeiXin.Permission.WebSite.Flap);
                }
                else if (lotteryType == ELotteryType.YaoYao)
                {
                    BreadCrumb(AppManager.WeiXin.LeftMenu.ID_Function, AppManager.WeiXin.LeftMenu.Function.ID_YaoYao, lotteryName, AppManager.WeiXin.Permission.WebSite.YaoYao);
                }

                spContents.DataBind();

                var urlAdd = string.Empty;
                if (lotteryType == ELotteryType.Scratch)
                {
                    urlAdd = BackgroundScratchAdd.GetRedirectUrl(PublishmentSystemID, 0);
                }
                else if (lotteryType == ELotteryType.BigWheel)
                {
                    urlAdd = BackgroundBigWheelAdd.GetRedirectUrl(PublishmentSystemID, 0);
                }
                else if (lotteryType == ELotteryType.GoldEgg)
                {
                    urlAdd = BackgroundGoldEggAdd.GetRedirectUrl(PublishmentSystemID, 0);
                }
                else if (lotteryType == ELotteryType.Flap)
                {
                    urlAdd = BackgroundFlapAdd.GetRedirectUrl(PublishmentSystemID, 0);
                }
                else if (lotteryType == ELotteryType.YaoYao)
                {
                    urlAdd = BackgroundYaoYaoAdd.GetRedirectUrl(PublishmentSystemID, 0);
                }
                btnAdd.Attributes.Add("onclick", $"location.href='{urlAdd}';return false");

                var urlDelete = PageUtils.AddQueryString(GetRedirectUrl(PublishmentSystemID, lotteryType), "Delete", "True");
                btnDelete.Attributes.Add("onclick", JsUtils.GetRedirectStringWithCheckBoxValueAndAlert(urlDelete, "IDCollection", "IDCollection", "请选择需要删除的" + lotteryName, "此操作将删除所选" + lotteryName + ",确认吗?"));
            }
        }
Ejemplo n.º 2
0
        public void Delete_OnClick(object sender, EventArgs e)
        {
            if (!Page.IsPostBack || !Page.IsValid)
            {
                return;
            }

            try
            {
                var channelIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ChannelIDCollection"));
                channelIdList.Sort();
                channelIdList.Reverse();

                var channelIdArrayList = new List <int>();
                foreach (var channelId in channelIdList)
                {
                    if (channelId == SiteId)
                    {
                        continue;
                    }
                    if (HasChannelPermissions(channelId, ConfigManager.Permissions.Channel.ChannelDelete))
                    {
                        channelIdArrayList.Add(channelId);
                    }
                }

                var builder = new StringBuilder();
                foreach (var channelId in channelIdArrayList)
                {
                    builder.Append(ChannelManager.GetChannelName(SiteId, channelId)).Append(",");
                }

                if (builder.Length > 0)
                {
                    builder.Length -= 1;
                }

                if (_deleteContents)
                {
                    SuccessMessage(bool.Parse(RblRetainFiles.SelectedValue) == false
                        ? "成功删除内容以及生成页面!"
                        : "成功删除内容,生成页面未被删除!");

                    foreach (var channelId in channelIdArrayList)
                    {
                        var tableName     = ChannelManager.GetTableName(SiteInfo, channelId);
                        var contentIdList = DataProvider.ContentDao.GetContentIdList(tableName, channelId);
                        DirectoryUtility.DeleteContents(SiteInfo, channelId, contentIdList);
                        DataProvider.ContentDao.TrashContents(SiteId, tableName, contentIdList);
                    }

                    Body.AddSiteLog(SiteId, "清空栏目下的内容", $"栏目:{builder}");
                }
                else
                {
                    if (bool.Parse(RblRetainFiles.SelectedValue) == false)
                    {
                        DirectoryUtility.DeleteChannels(SiteInfo, channelIdArrayList);
                        SuccessMessage("成功删除栏目以及相关生成页面!");
                    }
                    else
                    {
                        SuccessMessage("成功删除栏目,相关生成页面未被删除!");
                    }

                    foreach (var channelId in channelIdArrayList)
                    {
                        var tableName = ChannelManager.GetTableName(SiteInfo, channelId);
                        DataProvider.ContentDao.TrashContentsByChannelId(SiteId, tableName, channelId);
                        DataProvider.ChannelDao.Delete(SiteId, channelId);
                    }

                    Body.AddSiteLog(SiteId, "删除栏目", $"栏目:{builder}");
                }

                AddWaitAndRedirectScript(ReturnUrl);
            }
            catch (Exception ex)
            {
                FailMessage(ex, _deleteContents ? "删除内容失败!" : "删除栏目失败!");

                LogUtils.AddSystemErrorLog(ex);
            }
        }
Ejemplo n.º 3
0
        private static void AddAdvertisementsToContent(PageInfo pageInfo)
        {
            if (IsAdvertisementExists(pageInfo))
            {
                var advertisementNameArrayList = DataProvider.AdvertisementDao.GetAdvertisementNameArrayList(pageInfo.PublishmentSystemId);

                foreach (string advertisementName in advertisementNameArrayList)
                {
                    var adInfo = DataProvider.AdvertisementDao.GetAdvertisementInfo(advertisementName, pageInfo.PublishmentSystemId);
                    if (adInfo.IsDateLimited)
                    {
                        if (DateTime.Now < adInfo.StartDate || DateTime.Now > adInfo.EndDate)
                        {
                            continue;
                        }
                    }
                    var isToDo = false;
                    if (pageInfo.TemplateInfo.TemplateType == ETemplateType.IndexPageTemplate || pageInfo.TemplateInfo.TemplateType == ETemplateType.ChannelTemplate)
                    {
                        if (!string.IsNullOrEmpty(adInfo.NodeIDCollectionToChannel))
                        {
                            var nodeIdArrayList = TranslateUtils.StringCollectionToIntList(adInfo.NodeIDCollectionToChannel);
                            if (nodeIdArrayList.Contains(pageInfo.PageNodeId))
                            {
                                isToDo = true;
                            }
                        }
                    }
                    else if (pageInfo.TemplateInfo.TemplateType == ETemplateType.ContentTemplate)
                    {
                        if (!string.IsNullOrEmpty(adInfo.NodeIDCollectionToContent))
                        {
                            var nodeIdArrayList = TranslateUtils.StringCollectionToIntList(adInfo.NodeIDCollectionToContent);
                            if (nodeIdArrayList.Contains(pageInfo.PageContentId))
                            {
                                isToDo = true;
                            }
                        }
                    }
                    else if (pageInfo.TemplateInfo.TemplateType == ETemplateType.FileTemplate)
                    {
                        if (!string.IsNullOrEmpty(adInfo.FileTemplateIDCollection))
                        {
                            var fileTemplateIdArrayList = TranslateUtils.StringCollectionToIntList(adInfo.FileTemplateIDCollection);
                            if (fileTemplateIdArrayList.Contains(pageInfo.TemplateInfo.TemplateId))
                            {
                                isToDo = true;
                            }
                        }
                    }

                    if (isToDo)
                    {
                        var scripts = string.Empty;
                        if (adInfo.AdvertisementType == EAdvertisementType.FloatImage)
                        {
                            pageInfo.AddPageScriptsIfNotExists(PageInfo.JsStaticAdFloating);

                            var floatScript = new FloatingScript(pageInfo.PublishmentSystemInfo, pageInfo.UniqueId, adInfo);
                            scripts = floatScript.GetScript();
                        }
                        else if (adInfo.AdvertisementType == EAdvertisementType.ScreenDown)
                        {
                            pageInfo.AddPageScriptsIfNotExists(PageInfo.Components.Jquery);

                            var screenDownScript = new ScreenDownScript(pageInfo.PublishmentSystemInfo, pageInfo.UniqueId, adInfo);
                            scripts = screenDownScript.GetScript();
                        }
                        else if (adInfo.AdvertisementType == EAdvertisementType.OpenWindow)
                        {
                            var openWindowScript = new OpenWindowScript(pageInfo.PublishmentSystemInfo, pageInfo.UniqueId, adInfo);
                            scripts = openWindowScript.GetScript();
                        }

                        pageInfo.AddPageEndScriptsIfNotExists(EAdvertisementTypeUtils.GetValue(adInfo.AdvertisementType) + "_" + adInfo.AdvertisementName, scripts);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            spContents.ControlToPaginate = rptContents;
            spContents.ItemsPerPage      = StringUtils.Constants.PageSize;

            if (!Body.IsQueryExists("Keyword"))
            {
                spContents.SelectCommand = BaiRongDataProvider.UserLogDao.GetSelectCommend();
            }
            else
            {
                spContents.SelectCommand = BaiRongDataProvider.UserLogDao.GetSelectCommend(Body.GetQueryString("UserName"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo"));
            }

            spContents.SortField       = "ID";
            spContents.SortMode        = SortMode.DESC;
            rptContents.ItemDataBound += rptContents_ItemDataBound;

            if (!IsPostBack)
            {
                BreadCrumbAnalysis(AppManager.Analysis.LeftMenu.Log, "用户日志", AppManager.Analysis.Permission.AnalysisLog);

                if (Body.IsQueryExists("Keyword"))
                {
                    UserName.Text = Body.GetQueryString("UserName");
                    Keyword.Text  = Body.GetQueryString("Keyword");
                    DateFrom.Text = Body.GetQueryString("DateFrom");
                    DateTo.Text   = Body.GetQueryString("DateTo");
                }

                if (Body.IsQueryExists("Delete"))
                {
                    var arraylist = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("IDCollection"));
                    try
                    {
                        BaiRongDataProvider.UserLogDao.Delete(arraylist);
                        SuccessDeleteMessage();
                    }
                    catch (Exception ex)
                    {
                        FailDeleteMessage(ex);
                    }
                }
                else if (Body.IsQueryExists("DeleteAll"))
                {
                    try
                    {
                        BaiRongDataProvider.UserLogDao.DeleteAll();
                        SuccessDeleteMessage();
                    }
                    catch (Exception ex)
                    {
                        FailDeleteMessage(ex);
                    }
                }
                else if (Body.IsQueryExists("Setting"))
                {
                    try
                    {
                        ConfigManager.SystemConfigInfo.IsLogUser = !ConfigManager.SystemConfigInfo.IsLogUser;
                        BaiRongDataProvider.ConfigDao.Update(ConfigManager.Instance);
                        SuccessMessage($"成功{(ConfigManager.SystemConfigInfo.IsLogUser ? "启用" : "禁用")}日志记录");
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, $"{(ConfigManager.SystemConfigInfo.IsLogUser ? "启用" : "禁用")}日志记录失败");
                    }
                }

                Delete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(PageUtils.GetAnalysisUrl(nameof(PageLogUser), new NameValueCollection
                {
                    { "Delete", "True" }
                }), "IDCollection", "IDCollection", "请选择需要删除的日志!", "此操作将删除所选日志,确认吗?"));

                DeleteAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.GetAnalysisUrl(nameof(PageLogUser), new NameValueCollection
                {
                    { "DeleteAll", "True" }
                }), "此操作将删除所有日志信息,确定吗?"));

                if (ConfigManager.SystemConfigInfo.IsLogUser)
                {
                    Setting.Text = "禁用记录日志功能";
                    Setting.Attributes.Add("onclick",
                                           PageUtils.GetRedirectStringWithConfirm(
                                               PageUtils.GetAnalysisUrl(nameof(PageLogUser), new NameValueCollection
                    {
                        { "Setting", "True" }
                    }), "此操作将禁用用户日志记录功能,确定吗?"));
                }
                else
                {
                    ltlState.Text = " (用户日志当前处于禁用状态,将不会记录相关操作!)";
                    Setting.Text  = "启用记录日志功能";
                    Setting.Attributes.Add("onclick",
                                           PageUtils.GetRedirectStringWithConfirm(
                                               PageUtils.GetAnalysisUrl(nameof(PageLogUser), new NameValueCollection
                    {
                        { "Setting", "True" }
                    }), "此操作将启用用户日志记录功能,确定吗?"));
                }

                spContents.DataBind();
            }
        }
        public IHttpActionResult GetConfig()
        {
            try
            {
                var request = new AuthenticatedRequest();

                var siteId        = request.GetQueryInt("siteId");
                var channelId     = request.GetQueryInt("channelId");
                var contentIdList = TranslateUtils.StringCollectionToIntList(request.GetQueryString("contentIds"));

                if (!request.IsAdminLoggin ||
                    !request.AdminPermissionsImpl.HasChannelPermissions(siteId, channelId,
                                                                        ConfigManager.ChannelPermissions.ContentTranslate))
                {
                    return(Unauthorized());
                }

                var siteInfo = SiteManager.GetSiteInfo(siteId);
                if (siteInfo == null)
                {
                    return(BadRequest("无法确定内容对应的站点"));
                }

                var channelInfo = ChannelManager.GetChannelInfo(siteId, channelId);
                if (channelInfo == null)
                {
                    return(BadRequest("无法确定内容对应的栏目"));
                }

                var retval = new List <Dictionary <string, object> >();
                foreach (var contentId in contentIdList)
                {
                    var contentInfo = ContentManager.GetContentInfo(siteInfo, channelInfo, contentId);
                    if (contentInfo == null)
                    {
                        continue;
                    }

                    var dict = contentInfo.ToDictionary();
                    dict["checkState"] =
                        CheckManager.GetCheckState(siteInfo, contentInfo);
                    retval.Add(dict);
                }

                var sites    = new List <object>();
                var channels = new List <object>();

                var siteIdList = request.AdminPermissionsImpl.GetSiteIdList();
                foreach (var permissionSiteId in siteIdList)
                {
                    var permissionSiteInfo = SiteManager.GetSiteInfo(permissionSiteId);
                    sites.Add(new
                    {
                        permissionSiteInfo.Id,
                        permissionSiteInfo.SiteName
                    });
                }

                var channelIdList = request.AdminPermissionsImpl.GetChannelIdList(siteInfo.Id,
                                                                                  ConfigManager.ChannelPermissions.ContentAdd);
                foreach (var permissionChannelId in channelIdList)
                {
                    var permissionChannelInfo = ChannelManager.GetChannelInfo(siteInfo.Id, permissionChannelId);
                    channels.Add(new
                    {
                        permissionChannelInfo.Id,
                        ChannelName = ChannelManager.GetChannelNameNavigation(siteInfo.Id, permissionChannelId)
                    });
                }

                return(Ok(new
                {
                    Value = retval,
                    Sites = sites,
                    Channels = channels,
                    Site = siteInfo
                }));
            }
            catch (Exception ex)
            {
                LogUtils.AddErrorLog(ex);
                return(InternalServerError(ex));
            }
        }
Ejemplo n.º 6
0
        public IHttpActionResult Submit()
        {
            try
            {
                var request = new RequestImpl();

                var siteId        = request.GetPostInt("siteId");
                var channelId     = request.GetPostInt("channelId");
                var contentIdList = TranslateUtils.StringCollectionToIntList(request.GetPostString("contentIds"));
                var pageType      = request.GetPostString("pageType");
                var isRecommend   = request.GetPostBool("isRecommend");
                var isHot         = request.GetPostBool("isHot");
                var isColor       = request.GetPostBool("isColor");
                var isTop         = request.GetPostBool("isTop");
                var hits          = request.GetPostInt("hits");

                if (!request.IsUserLoggin ||
                    !request.UserPermissionsImpl.HasChannelPermissions(siteId, channelId,
                                                                       ConfigManager.ChannelPermissions.ContentEdit))
                {
                    return(Unauthorized());
                }

                var siteInfo = SiteManager.GetSiteInfo(siteId);
                if (siteInfo == null)
                {
                    return(BadRequest("无法确定内容对应的站点"));
                }

                var channelInfo = ChannelManager.GetChannelInfo(siteId, channelId);
                if (channelInfo == null)
                {
                    return(BadRequest("无法确定内容对应的栏目"));
                }

                if (pageType == "setAttributes")
                {
                    if (isRecommend || isHot || isColor || isTop)
                    {
                        foreach (var contentId in contentIdList)
                        {
                            var contentInfo = ContentManager.GetContentInfo(siteInfo, channelInfo, contentId);
                            if (contentInfo == null)
                            {
                                continue;
                            }

                            if (isRecommend)
                            {
                                contentInfo.IsRecommend = true;
                            }
                            if (isHot)
                            {
                                contentInfo.IsHot = true;
                            }
                            if (isColor)
                            {
                                contentInfo.IsColor = true;
                            }
                            if (isTop)
                            {
                                contentInfo.IsTop = true;
                            }
                            DataProvider.ContentDao.Update(siteInfo, channelInfo, contentInfo);
                        }

                        request.AddSiteLog(siteId, "设置内容属性");
                    }
                }
                else if (pageType == "cancelAttributes")
                {
                    if (isRecommend || isHot || isColor || isTop)
                    {
                        foreach (var contentId in contentIdList)
                        {
                            var contentInfo = ContentManager.GetContentInfo(siteInfo, channelInfo, contentId);
                            if (contentInfo == null)
                            {
                                continue;
                            }

                            if (isRecommend)
                            {
                                contentInfo.IsRecommend = false;
                            }
                            if (isHot)
                            {
                                contentInfo.IsHot = false;
                            }
                            if (isColor)
                            {
                                contentInfo.IsColor = false;
                            }
                            if (isTop)
                            {
                                contentInfo.IsTop = false;
                            }
                            DataProvider.ContentDao.Update(siteInfo, channelInfo, contentInfo);
                        }

                        request.AddSiteLog(siteId, "取消内容属性");
                    }
                }
                else if (pageType == "setHits")
                {
                    foreach (var contentId in contentIdList)
                    {
                        var contentInfo = ContentManager.GetContentInfo(siteInfo, channelInfo, contentId);
                        if (contentInfo == null)
                        {
                            continue;
                        }

                        contentInfo.Hits = hits;
                        DataProvider.ContentDao.Update(siteInfo, channelInfo, contentInfo);
                    }

                    request.AddSiteLog(siteId, "设置内容点击量");
                }

                return(Ok(new
                {
                    Value = contentIdList
                }));
            }
            catch (Exception ex)
            {
                LogUtils.AddErrorLog(ex);
                return(InternalServerError(ex));
            }
        }
Ejemplo n.º 7
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            SpContents.ControlToPaginate = RptContents;
            SpContents.ItemsPerPage      = StringUtils.Constants.PageSize;

            SpContents.SelectCommand = !Body.IsQueryExists("Keyword") ? DataProvider.UserLogDao.GetSelectCommend() : DataProvider.UserLogDao.GetSelectCommend(Body.GetQueryString("UserName"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo"));

            SpContents.SortField       = nameof(UserLogInfo.Id);
            SpContents.SortMode        = SortMode.DESC;
            RptContents.ItemDataBound += RptContents_ItemDataBound;

            if (IsPostBack)
            {
                return;
            }

            VerifyAdministratorPermissions(ConfigManager.Permissions.Settings.Log);

            if (Body.IsQueryExists("Keyword"))
            {
                TbUserName.Text = Body.GetQueryString("UserName");
                TbKeyword.Text  = Body.GetQueryString("Keyword");
                TbDateFrom.Text = Body.GetQueryString("DateFrom");
                TbDateTo.Text   = Body.GetQueryString("DateTo");
            }

            if (Body.IsQueryExists("Delete"))
            {
                var list = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("IDCollection"));
                DataProvider.UserLogDao.Delete(list);
                SuccessDeleteMessage();
            }
            else if (Body.IsQueryExists("DeleteAll"))
            {
                DataProvider.UserLogDao.DeleteAll();
                SuccessDeleteMessage();
            }
            else if (Body.IsQueryExists("Setting"))
            {
                ConfigManager.SystemConfigInfo.IsLogUser = !ConfigManager.SystemConfigInfo.IsLogUser;
                DataProvider.ConfigDao.Update(ConfigManager.Instance);
                SuccessMessage($"成功{(ConfigManager.SystemConfigInfo.IsLogUser ? "启用" : "禁用")}日志记录");
            }

            BtnDelete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(PageUtils.GetSettingsUrl(nameof(PageLogUser), new NameValueCollection
            {
                { "Delete", "True" }
            }), "IDCollection", "IDCollection", "请选择需要删除的日志!", "此操作将删除所选日志,确认吗?"));

            BtnDeleteAll.Attributes.Add("onclick",
                                        AlertUtils.ConfirmRedirect("删除所有日志", "此操作将删除所有日志信息,确定吗?", "删除全部",
                                                                   PageUtils.GetSettingsUrl(nameof(PageLogUser), new NameValueCollection
            {
                { "DeleteAll", "True" }
            })));

            if (ConfigManager.SystemConfigInfo.IsLogUser)
            {
                BtnSetting.Text = "禁用记录日志";
                BtnSetting.Attributes.Add("onclick",
                                          AlertUtils.ConfirmRedirect("禁用记录日志", "此操作将禁用用户日志记录功能,确定吗?", "禁 用",
                                                                     PageUtils.GetSettingsUrl(nameof(PageLogUser), new NameValueCollection
                {
                    { "Setting", "True" }
                })));
            }
            else
            {
                LtlState.Text   = @"<div class=""alert alert-danger m-t-10"">用户日志当前处于禁用状态,系统将不会记录用户操作日志!</div>";
                BtnSetting.Text = "启用记录日志";
                BtnSetting.Attributes.Add("onclick",
                                          AlertUtils.ConfirmRedirect("启用记录日志", "此操作将启用用户日志记录功能,确定吗?", "启 用",
                                                                     PageUtils.GetSettingsUrl(nameof(PageLogUser), new NameValueCollection
                {
                    { "Setting", "True" }
                })));
            }

            SpContents.DataBind();
        }
Ejemplo n.º 8
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (AuthRequest.IsQueryExists("Delete"))
            {
                var list = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("IDCollection"));
                try
                {
                    DataProvider.ErrorLogDao.Delete(list);
                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }
            else if (AuthRequest.IsQueryExists("DeleteAll"))
            {
                try
                {
                    DataProvider.ErrorLogDao.DeleteAll();
                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }
            else if (AuthRequest.IsQueryExists("Setting"))
            {
                ConfigManager.SystemConfigInfo.IsLogError = !ConfigManager.SystemConfigInfo.IsLogError;
                DataProvider.ConfigDao.Update(ConfigManager.Instance);
                SuccessMessage($"成功{(ConfigManager.SystemConfigInfo.IsLogError ? "启用" : "禁用")}日志记录");
            }

            SpContents.ControlToPaginate = RptContents;
            SpContents.ItemsPerPage      = StringUtils.Constants.PageSize;

            SpContents.SelectCommand = DataProvider.ErrorLogDao.GetSelectCommend(AuthRequest.GetQueryString("PluginId"), AuthRequest.GetQueryString("Keyword"),
                                                                                 AuthRequest.GetQueryString("DateFrom"), AuthRequest.GetQueryString("DateTo"));

            SpContents.SortField       = nameof(ErrorLogInfo.Id);
            SpContents.SortMode        = SortMode.DESC;
            RptContents.ItemDataBound += RptContents_ItemDataBound;

            if (IsPostBack)
            {
                return;
            }

            DdlPluginId.Items.Add(new ListItem("全部错误", string.Empty));
            foreach (var pluginInfo in PluginManager.AllPluginInfoList)
            {
                DdlPluginId.Items.Add(new ListItem(pluginInfo.Id, pluginInfo.Id));
            }

            VerifyAdministratorPermissions(ConfigManager.SettingsPermissions.Log);

            if (AuthRequest.IsQueryExists("Keyword"))
            {
                ControlUtils.SelectSingleItem(DdlPluginId, AuthRequest.GetQueryString("PluginId"));
                TbKeyword.Text  = AuthRequest.GetQueryString("Keyword");
                TbDateFrom.Text = AuthRequest.GetQueryString("DateFrom");
                TbDateTo.Text   = AuthRequest.GetQueryString("DateTo");
            }

            BtnDelete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(PageUtils.GetSettingsUrl(nameof(PageLogError), new NameValueCollection
            {
                { "Delete", "True" }
            }), "IDCollection", "IDCollection", "请选择需要删除的日志!", "此操作将删除所选日志,确认吗?"));

            BtnDeleteAll.Attributes.Add("onclick",
                                        AlertUtils.ConfirmRedirect("删除所有日志", "此操作将删除所有日志信息,确定吗?", "删除全部",
                                                                   PageUtils.GetSettingsUrl(nameof(PageLogError), new NameValueCollection
            {
                { "DeleteAll", "True" }
            })));

            if (ConfigManager.SystemConfigInfo.IsLogError)
            {
                BtnSetting.Text = "禁用系统错误日志";
                BtnSetting.Attributes.Add("onclick",
                                          AlertUtils.ConfirmRedirect("禁用系统错误日志", "此操作将禁用系统错误日志记录功能,确定吗?", "禁 用",
                                                                     PageUtils.GetSettingsUrl(nameof(PageLogError), new NameValueCollection
                {
                    { "Setting", "True" }
                })));
            }
            else
            {
                LtlState.Text   = @"<div class=""alert alert-danger m-t-10"">系统错误日志当前处于禁用状态,系统将不会记录系统错误日志!</div>";
                BtnSetting.Text = "启用系统错误日志";
                BtnSetting.Attributes.Add("onclick",
                                          AlertUtils.ConfirmRedirect("启用系统错误日志", "此操作将启用系统错误日志记录功能,确定吗?", "启 用",
                                                                     PageUtils.GetSettingsUrl(nameof(PageLogError), new NameValueCollection
                {
                    { "Setting", "True" }
                })));
            }

            SpContents.DataBind();
        }
        public static int GetChannelIdByParentIdAndChannelName(int siteId, int parentId, string channelName, bool recursive)
        {
            if (parentId <= 0 || string.IsNullOrEmpty(channelName))
            {
                return(0);
            }

            var dict            = ChannelManagerCache.GetChannelInfoDictionaryBySiteId(siteId);
            var channelInfoList = dict.Values.OrderBy(x => x.Taxis).ToList();

            ChannelInfo channelInfo;

            if (recursive)
            {
                if (siteId == parentId)
                {
                    channelInfo = channelInfoList.FirstOrDefault(x => x.ChannelName == channelName);

                    //sqlString = $"SELECT Id FROM siteserver_Channel WHERE (SiteId = {siteId} AND ChannelName = '{AttackUtils.FilterSql(channelName)}') ORDER BY Taxis";
                }
                else
                {
                    channelInfo = channelInfoList.FirstOrDefault(x => (x.ParentId == parentId || TranslateUtils.StringCollectionToIntList(x.ParentsPath).Contains(parentId)) && x.ChannelName == channelName);

//                    sqlString = $@"SELECT Id
//FROM siteserver_Channel
//WHERE ((ParentId = {parentId}) OR
//      (ParentsPath = '{parentId}') OR
//      (ParentsPath LIKE '{parentId},%') OR
//      (ParentsPath LIKE '%,{parentId},%') OR
//      (ParentsPath LIKE '%,{parentId}')) AND ChannelName = '{AttackUtils.FilterSql(channelName)}'
//ORDER BY Taxis";
                }
            }
            else
            {
                channelInfo = channelInfoList.FirstOrDefault(x => x.ParentId == parentId && x.ChannelName == channelName);

                //sqlString = $"SELECT Id FROM siteserver_Channel WHERE (ParentId = {parentId} AND ChannelName = '{AttackUtils.FilterSql(channelName)}') ORDER BY Taxis";
            }

            return(channelInfo?.Id ?? 0);
        }
Ejemplo n.º 10
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (Body.IsQueryExists("Delete"))
            {
                var userIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("UserIDCollection"));
                try
                {
                    foreach (var userId in userIdList)
                    {
                        BaiRongDataProvider.UserDao.Delete(userId);
                    }

                    Body.AddAdminLog("删除用户", string.Empty);

                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }
            else if (Body.IsQueryExists("Lock"))
            {
                var userIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("UserIDCollection"));
                try
                {
                    BaiRongDataProvider.UserDao.Lock(userIdList);

                    Body.AddAdminLog("锁定用户", string.Empty);

                    SuccessMessage("成功锁定所选会员!");
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "锁定所选会员失败!");
                }
            }
            else if (Body.IsQueryExists("UnLock"))
            {
                var userIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("UserIDCollection"));
                try
                {
                    BaiRongDataProvider.UserDao.UnLock(userIdList);

                    Body.AddAdminLog("解除锁定用户", string.Empty);

                    SuccessMessage("成功解除锁定所选会员!");
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "解除锁定所选会员失败!");
                }
            }

            SpContents.ControlToPaginate = RptContents;

            if (string.IsNullOrEmpty(Body.GetQueryString("GroupID")))
            {
                SpContents.ItemsPerPage = TranslateUtils.ToInt(DdlPageNum.SelectedValue) == 0 ? 25 : TranslateUtils.ToInt(DdlPageNum.SelectedValue);

                SpContents.SelectCommand = BaiRongDataProvider.UserDao.GetSelectCommand(true);
            }
            else
            {
                SpContents.ItemsPerPage  = Body.GetQueryInt("PageNum") == 0 ? StringUtils.Constants.PageSize : Body.GetQueryInt("PageNum");
                SpContents.SelectCommand = BaiRongDataProvider.UserDao.GetSelectCommand(Body.GetQueryString("Keyword"), Body.GetQueryInt("CreationDate"), Body.GetQueryInt("LastActivityDate"), true, Body.GetQueryInt("GroupID"), Body.GetQueryInt("LoginCount"), Body.GetQueryString("SearchType"));
            }

            RptContents.ItemDataBound += rptContents_ItemDataBound;
            SpContents.SortField       = BaiRongDataProvider.UserDao.GetSortFieldName();
            SpContents.SortMode        = SortMode.DESC;

            _lockType = EUserLockTypeUtils.GetEnumType(ConfigManager.UserConfigInfo.LoginLockingType);

            if (IsPostBack)
            {
                return;
            }

            BreadCrumbUser(AppManager.User.LeftMenu.UserManagement, "用户管理", AppManager.User.Permission.UserManagement);

            var theListItem = new ListItem("全部", "0")
            {
                Selected = true
            };

            DdlGroup.Items.Add(theListItem);
            var groupInfoList = UserGroupManager.GetGroupInfoList();

            foreach (var userGroupInfo in groupInfoList)
            {
                var listitem = new ListItem(userGroupInfo.GroupName, userGroupInfo.GroupId.ToString());
                DdlGroup.Items.Add(listitem);
            }

            //添加隐藏属性
            DdlSearchType.Items.Add(new ListItem("用户ID", "userID"));
            DdlSearchType.Items.Add(new ListItem("用户名", "userName"));
            DdlSearchType.Items.Add(new ListItem("邮箱", "email"));
            DdlSearchType.Items.Add(new ListItem("手机", "mobile"));

            //默认选择用户名
            DdlSearchType.SelectedValue = "userName";

            if (!string.IsNullOrEmpty(Body.GetQueryString("SearchType")))
            {
                ControlUtils.SelectListItems(DdlSearchType, Body.GetQueryString("SearchType"));
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("GroupID")))
            {
                ControlUtils.SelectListItems(DdlGroup, Body.GetQueryString("GroupID"));
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("PageNum")))
            {
                ControlUtils.SelectListItems(DdlPageNum, Body.GetQueryString("PageNum"));
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("LoginCount")))
            {
                ControlUtils.SelectListItems(DdlLoginCount, Body.GetQueryString("LoginCount"));
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("Keyword")))
            {
                TbKeyword.Text = Body.GetQueryString("Keyword");
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("CreationDate")))
            {
                ControlUtils.SelectListItems(DdlCreationDate, Body.GetQueryString("CreationDate"));
            }
            if (!string.IsNullOrEmpty(Body.GetQueryString("LastActivityDate")))
            {
                ControlUtils.SelectListItems(DdlLastActivityDate, Body.GetQueryString("LastActivityDate"));
            }

            var showPopWinString = ModalAddToUserGroup.GetOpenWindowString();

            BtnAddToGroup.Attributes.Add("onclick", showPopWinString);

            var backgroundUrl = GetRedirectUrl();

            BtnAdd.Attributes.Add("onclick",
                                  $"location.href='{PageUserAdd.GetRedirectUrlToAdd(PageUrl)}';return false;");

            BtnLock.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(
                                       $"{backgroundUrl}?Lock=True", "UserIDCollection", "UserIDCollection", "请选择需要锁定的会员!", "此操作将锁定所选会员,确认吗?"));

            BtnUnLock.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(
                                         $"{backgroundUrl}?UnLock=True", "UserIDCollection", "UserIDCollection", "请选择需要解除锁定的会员!", "此操作将解除锁定所选会员,确认吗?"));

            BtnDelete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(
                                         $"{backgroundUrl}?Delete=True", "UserIDCollection", "UserIDCollection", "请选择需要删除的会员!", "此操作将删除所选会员,确认吗?"));

            BtnImport.Attributes.Add("onclick", ModalUserImport.GetOpenWindowString());

            BtnExport.Attributes.Add("onclick", ModalUserExport.GetOpenWindowString());

            SpContents.DataBind();
        }
Ejemplo n.º 11
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            SpContents.ControlToPaginate = RptContents;
            SpContents.ItemsPerPage      = StringUtils.Constants.PageSize;

            SpContents.SelectCommand = !AuthRequest.IsQueryExists("LogType")
                ? DataProvider.SiteLogDao.GetSelectCommend()
                : DataProvider.SiteLogDao.GetSelectCommend(SiteId, AuthRequest.GetQueryString("LogType"),
                                                           AuthRequest.GetQueryString("UserName"), AuthRequest.GetQueryString("Keyword"), AuthRequest.GetQueryString("DateFrom"),
                                                           AuthRequest.GetQueryString("DateTo"));

            SpContents.SortField       = nameof(SiteLogInfo.Id);
            SpContents.SortMode        = SortMode.DESC;
            RptContents.ItemDataBound += RptContents_ItemDataBound;

            if (AuthRequest.IsQueryExists("Delete"))
            {
                var arraylist = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("IDCollection"));
                try
                {
                    DataProvider.SiteLogDao.Delete(arraylist);
                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }
            else if (AuthRequest.IsQueryExists("DeleteAll"))
            {
                try
                {
                    DataProvider.SiteLogDao.DeleteAll();
                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }

            if (IsPostBack)
            {
                return;
            }

            VerifyAdministratorPermissions(ConfigManager.SettingsPermissions.Log);

            if (SiteId == 0)
            {
                LtlSite.Text = @"<th align=""text-center text-nowrap"">站点名称</th>";
            }

            DdlSiteId.Items.Add(new ListItem("<<全部站点>>", "0"));

            var siteIdList = SiteManager.GetSiteIdListOrderByLevel();

            foreach (var psId in siteIdList)
            {
                DdlSiteId.Items.Add(new ListItem(SiteManager.GetSiteInfo(psId).SiteName, psId.ToString()));
            }

            DdlLogType.Items.Add(new ListItem("全部记录", "All"));
            DdlLogType.Items.Add(new ListItem("栏目相关记录", "Channel"));
            DdlLogType.Items.Add(new ListItem("内容相关记录", "Content"));

            if (AuthRequest.IsQueryExists("LogType"))
            {
                ControlUtils.SelectSingleItem(DdlSiteId, SiteId.ToString());
                ControlUtils.SelectSingleItem(DdlLogType, AuthRequest.GetQueryString("LogType"));
                TbUserName.Text = AuthRequest.GetQueryString("UserName");
                TbKeyword.Text  = AuthRequest.GetQueryString("Keyword");
                TbDateFrom.Text = AuthRequest.GetQueryString("DateFrom");
                TbDateTo.Text   = AuthRequest.GetQueryString("DateTo");
            }

            BtnDelete.Attributes.Add("onclick",
                                     PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(
                                         PageUtils.GetSettingsUrl(nameof(PageLogSite), new NameValueCollection
            {
                { "Delete", "True" }
            }), "IDCollection", "IDCollection", "请选择需要删除的日志!", "此操作将删除所选日志,确认吗?"));

            BtnDeleteAll.Attributes.Add("onclick",
                                        AlertUtils.ConfirmRedirect("删除所有日志", "此操作将删除所有日志信息,确定吗?", "删除全部",
                                                                   PageUtils.GetSettingsUrl(nameof(PageLogSite), new NameValueCollection
            {
                { "DeleteAll", "True" }
            })));

            SpContents.DataBind();
        }
Ejemplo n.º 12
0
        private static string ParseImplNotAjax(PageInfo pageInfo, ContextInfo contextInfo, string channelIndex, string channelName, int upLevel, int topLevel, string groupChannel, string groupChannelNot, string title, bool isShowContentNum, bool isShowTreeLine, string currentFormatString)
        {
            var channelId = StlDataUtility.GetChannelIdByLevel(pageInfo.SiteId, contextInfo.ChannelId, upLevel, topLevel);

            channelId = StlDataUtility.GetChannelIdByChannelIdOrChannelIndexOrChannelName(pageInfo.SiteId, channelId, channelIndex, channelName);

            var channel = ChannelManager.GetChannelInfo(pageInfo.SiteId, channelId);

            var target = "";

            var htmlBuilder = new StringBuilder();

            htmlBuilder.Append(@"<table border=""0"" cellpadding=""0"" cellspacing=""0"" style=""width:100%;"">");

            //var theChannelIdList = DataProvider.ChannelDao.GetIdListByScopeType(channel.ChannelId, channel.ChildrenCount, EScopeType.All, groupChannel, groupChannelNot);
            var theChannelIdList = Node.GetIdListByScopeType(channel.Id, channel.ChildrenCount, EScopeType.All, groupChannel, groupChannelNot);
            var isLastNodeArray  = new bool[theChannelIdList.Count];
            var channelIdList    = new List <int>();

            var currentChannelInfo = ChannelManager.GetChannelInfo(pageInfo.SiteId, pageInfo.PageChannelId);

            if (currentChannelInfo != null)
            {
                channelIdList = TranslateUtils.StringCollectionToIntList(currentChannelInfo.ParentsPath);
                channelIdList.Add(currentChannelInfo.Id);
            }

            foreach (var theChannelId in theChannelIdList)
            {
                var theChannelInfo = ChannelManager.GetChannelInfo(pageInfo.SiteId, theChannelId);
                var nodeInfo       = new ChannelInfo(theChannelInfo);
                if (theChannelId == pageInfo.SiteId && !string.IsNullOrEmpty(title))
                {
                    nodeInfo.ChannelName = title;
                }
                var isDisplay = channelIdList.Contains(theChannelId);
                if (!isDisplay)
                {
                    isDisplay = nodeInfo.ParentId == channelId || channelIdList.Contains(nodeInfo.ParentId);
                }

                var selected = theChannelId == channelId;
                if (!selected && channelIdList.Contains(nodeInfo.Id))
                {
                    selected = true;
                }
                var hasChildren = nodeInfo.ChildrenCount != 0;

                var linkUrl = PageUtility.GetChannelUrl(pageInfo.SiteInfo, theChannelInfo, pageInfo.IsLocal);
                var level   = theChannelInfo.ParentsCount - channel.ParentsCount;
                var item    = new StlTreeItemNotAjax(isDisplay, selected, pageInfo, nodeInfo, hasChildren, linkUrl, target, isShowTreeLine, isShowContentNum, isLastNodeArray, currentFormatString, channelId, level);

                htmlBuilder.Append(item.GetTrHtml());
            }

            htmlBuilder.Append("</table>");

            if (!pageInfo.BodyCodes.ContainsKey(PageInfo.Const.JsAgStlTreeNotAjax))
            {
                pageInfo.BodyCodes.Add(PageInfo.Const.JsAgStlTreeNotAjax, StlTreeItemNotAjax.GetNodeTreeScript(pageInfo));
            }

            return(htmlBuilder.ToString());
        }
        public IHttpActionResult Get()
        {
            try
            {
                var request = new AuthenticatedRequest();
                if (!request.IsAdminLoggin)
                {
                    return(Unauthorized());
                }

                var tableName         = request.GetQueryString("tableName");
                var attributeName     = request.GetQueryString("attributeName");
                var relatedIdentities = TranslateUtils.StringCollectionToIntList(request.GetQueryString("relatedIdentities"));

                var styleInfo = TableStyleManager.GetTableStyleInfo(tableName, attributeName, relatedIdentities) ?? new TableStyleInfo
                {
                    InputType = InputType.Text
                };
                if (styleInfo.StyleItems == null)
                {
                    styleInfo.StyleItems = new List <TableStyleItemInfo>();
                }

                var isRapid     = true;
                var rapidValues = string.Empty;
                if (styleInfo.StyleItems.Count == 0)
                {
                    styleInfo.StyleItems.Add(new TableStyleItemInfo
                    {
                        ItemTitle  = string.Empty,
                        ItemValue  = string.Empty,
                        IsSelected = false
                    });
                }
                else
                {
                    var isSelected  = false;
                    var isNotEquals = false;
                    var list        = new List <string>();
                    foreach (var item in styleInfo.StyleItems)
                    {
                        list.Add(item.ItemValue);
                        if (item.IsSelected)
                        {
                            isSelected = true;
                        }
                        if (item.ItemValue != item.ItemTitle)
                        {
                            isNotEquals = true;
                        }
                    }

                    isRapid     = !isSelected && !isNotEquals;
                    rapidValues = string.Join(",", list);
                }

                return(Ok(new
                {
                    Value = styleInfo,
                    InputTypes = InputTypeUtils.GetInputTypes(tableName),
                    IsRapid = isRapid,
                    RapidValues = rapidValues
                }));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Ejemplo n.º 14
0
        private object GetSitePermissionsObject(int roleId, int siteId, AuthenticatedRequest request)
        {
            SitePermissionsInfo sitePermissionsInfo = null;

            if (roleId > 0)
            {
                var roleInfo = DataProvider.RoleDao.GetRoleInfo(roleId);
                sitePermissionsInfo = DataProvider.SitePermissionsDao.GetSystemPermissionsInfo(roleInfo.RoleName, siteId);
            }
            if (sitePermissionsInfo == null)
            {
                sitePermissionsInfo = new SitePermissionsInfo();
            }

            var siteInfo           = SiteManager.GetSiteInfo(siteId);
            var sitePermissions    = new List <Permission>();
            var pluginPermissions  = new List <Permission>();
            var channelPermissions = new List <Permission>();

            if (request.AdminPermissionsImpl.IsSystemAdministrator)
            {
                foreach (var permission in PermissionConfigManager.Instance.WebsiteSysPermissions)
                {
                    sitePermissions.Add(new Permission
                    {
                        Name     = permission.Name,
                        Text     = permission.Text,
                        Selected = StringUtils.In(sitePermissionsInfo.WebsitePermissions, permission.Name)
                    });
                }

                foreach (var permission in PermissionConfigManager.Instance.WebsitePluginPermissions)
                {
                    pluginPermissions.Add(new Permission
                    {
                        Name     = permission.Name,
                        Text     = permission.Text,
                        Selected = StringUtils.In(sitePermissionsInfo.WebsitePermissions, permission.Name)
                    });
                }

                var channelPermissionList = PermissionConfigManager.Instance.ChannelPermissions;
                foreach (var permission in channelPermissionList)
                {
                    if (permission.Name == ConfigManager.ChannelPermissions.ContentCheckLevel1)
                    {
                        if (siteInfo.Additional.IsCheckContentLevel)
                        {
                            if (siteInfo.Additional.CheckContentLevel < 1)
                            {
                                continue;
                            }
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else if (permission.Name == ConfigManager.ChannelPermissions.ContentCheckLevel2)
                    {
                        if (siteInfo.Additional.IsCheckContentLevel)
                        {
                            if (siteInfo.Additional.CheckContentLevel < 2)
                            {
                                continue;
                            }
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else if (permission.Name == ConfigManager.ChannelPermissions.ContentCheckLevel3)
                    {
                        if (siteInfo.Additional.IsCheckContentLevel)
                        {
                            if (siteInfo.Additional.CheckContentLevel < 3)
                            {
                                continue;
                            }
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else if (permission.Name == ConfigManager.ChannelPermissions.ContentCheckLevel4)
                    {
                        if (siteInfo.Additional.IsCheckContentLevel)
                        {
                            if (siteInfo.Additional.CheckContentLevel < 4)
                            {
                                continue;
                            }
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else if (permission.Name == ConfigManager.ChannelPermissions.ContentCheckLevel5)
                    {
                        if (siteInfo.Additional.IsCheckContentLevel)
                        {
                            if (siteInfo.Additional.CheckContentLevel < 5)
                            {
                                continue;
                            }
                        }
                        else
                        {
                            continue;
                        }
                    }

                    channelPermissions.Add(new Permission
                    {
                        Name     = permission.Name,
                        Text     = permission.Text,
                        Selected = StringUtils.In(sitePermissionsInfo.ChannelPermissions, permission.Name)
                    });
                }
            }
            else
            {
                if (request.AdminPermissionsImpl.HasSitePermissions(siteId))
                {
                    var websitePermissionList = request.AdminPermissionsImpl.GetSitePermissions(siteId);
                    foreach (var websitePermission in websitePermissionList)
                    {
                        foreach (var permission in PermissionConfigManager.Instance.WebsiteSysPermissions)
                        {
                            if (permission.Name == websitePermission)
                            {
                                sitePermissions.Add(new Permission
                                {
                                    Name     = permission.Name,
                                    Text     = permission.Text,
                                    Selected = StringUtils.In(sitePermissionsInfo.WebsitePermissions, permission.Name)
                                });
                            }
                        }

                        foreach (var permission in PermissionConfigManager.Instance.WebsitePluginPermissions)
                        {
                            if (permission.Name == websitePermission)
                            {
                                pluginPermissions.Add(new Permission
                                {
                                    Name     = permission.Name,
                                    Text     = permission.Text,
                                    Selected = StringUtils.In(sitePermissionsInfo.WebsitePermissions, permission.Name)
                                });
                            }
                        }
                    }
                }

                var channelPermissionList = request.AdminPermissionsImpl.GetChannelPermissions(siteId);
                foreach (var channelPermission in channelPermissionList)
                {
                    foreach (var permission in PermissionConfigManager.Instance.ChannelPermissions)
                    {
                        if (permission.Name == channelPermission)
                        {
                            if (channelPermission == ConfigManager.ChannelPermissions.ContentCheck)
                            {
                                if (siteInfo.Additional.IsCheckContentLevel)
                                {
                                    continue;
                                }
                            }
                            else if (channelPermission == ConfigManager.ChannelPermissions.ContentCheckLevel1)
                            {
                                if (siteInfo.Additional.IsCheckContentLevel == false || siteInfo.Additional.CheckContentLevel < 1)
                                {
                                    continue;
                                }
                            }
                            else if (channelPermission == ConfigManager.ChannelPermissions.ContentCheckLevel2)
                            {
                                if (siteInfo.Additional.IsCheckContentLevel == false || siteInfo.Additional.CheckContentLevel < 2)
                                {
                                    continue;
                                }
                            }
                            else if (channelPermission == ConfigManager.ChannelPermissions.ContentCheckLevel3)
                            {
                                if (siteInfo.Additional.IsCheckContentLevel == false || siteInfo.Additional.CheckContentLevel < 3)
                                {
                                    continue;
                                }
                            }
                            else if (channelPermission == ConfigManager.ChannelPermissions.ContentCheckLevel4)
                            {
                                if (siteInfo.Additional.IsCheckContentLevel == false || siteInfo.Additional.CheckContentLevel < 4)
                                {
                                    continue;
                                }
                            }
                            else if (channelPermission == ConfigManager.ChannelPermissions.ContentCheckLevel5)
                            {
                                if (siteInfo.Additional.IsCheckContentLevel == false || siteInfo.Additional.CheckContentLevel < 5)
                                {
                                    continue;
                                }
                            }

                            channelPermissions.Add(new Permission
                            {
                                Name     = permission.Name,
                                Text     = permission.Text,
                                Selected = StringUtils.In(sitePermissionsInfo.ChannelPermissions, permission.Name)
                            });
                        }
                    }
                }
            }

            var channelInfo = ChannelManager.GetChannelInfo(siteId, siteId);

            channelInfo.Children = ChannelManager.GetChildren(siteId, siteId);
            var checkedChannelIdList = new List <int>();

            foreach (var i in TranslateUtils.StringCollectionToIntList(sitePermissionsInfo.ChannelIdCollection))
            {
                if (!checkedChannelIdList.Contains(i))
                {
                    checkedChannelIdList.Add(i);
                }
            }

            return(new
            {
                Value = siteId,
                SitePermissions = sitePermissions,
                PluginPermissions = pluginPermissions,
                ChannelPermissions = channelPermissions,
                ChannelInfo = channelInfo,
                CheckedChannelIdList = checkedChannelIdList
            });
        }
Ejemplo n.º 15
0
        public IHttpActionResult GetConfig()
        {
            try
            {
                var request = new AuthenticatedRequest();

                var siteId        = request.GetQueryInt("siteId");
                var channelId     = request.GetQueryInt("channelId");
                var contentIdList = TranslateUtils.StringCollectionToIntList(request.GetQueryString("contentIds"));

                if (!request.IsUserLoggin ||
                    !request.UserPermissionsImpl.HasChannelPermissions(siteId, channelId,
                                                                       ConfigManager.ChannelPermissions.ContentCheck))
                {
                    return(Unauthorized());
                }

                var siteInfo = SiteManager.GetSiteInfo(siteId);
                if (siteInfo == null)
                {
                    return(BadRequest("无法确定内容对应的站点"));
                }

                var channelInfo = ChannelManager.GetChannelInfo(siteId, channelId);
                if (channelInfo == null)
                {
                    return(BadRequest("无法确定内容对应的栏目"));
                }

                var retVal = new List <Dictionary <string, object> >();
                foreach (var contentId in contentIdList)
                {
                    var contentInfo = ContentManager.GetContentInfo(siteInfo, channelInfo, contentId);
                    if (contentInfo == null)
                    {
                        continue;
                    }

                    var dict = contentInfo.ToDictionary();
                    dict["checkState"] =
                        CheckManager.GetCheckState(siteInfo, contentInfo);
                    retVal.Add(dict);
                }

                var isChecked     = CheckManager.GetUserCheckLevel(request.AdminPermissionsImpl, siteInfo, channelId, out var checkedLevel);
                var checkedLevels = CheckManager.GetCheckedLevels(siteInfo, isChecked, checkedLevel, true);

                var allChannels =
                    ChannelManager.GetChannels(siteId, request.AdminPermissionsImpl, ConfigManager.ChannelPermissions.ContentAdd);

                return(Ok(new
                {
                    Value = retVal,
                    CheckedLevels = checkedLevels,
                    CheckedLevel = checkedLevel,
                    AllChannels = allChannels
                }));
            }
            catch (Exception ex)
            {
                LogUtils.AddErrorLog(ex);
                return(InternalServerError(ex));
            }
        }
Ejemplo n.º 16
0
        public IHttpActionResult Submit()
        {
            try
            {
                var request = new AuthenticatedRequest();

                var siteId        = request.GetPostInt("siteId");
                var channelId     = request.GetPostInt("channelId");
                var contentIdList = TranslateUtils.StringCollectionToIntList(request.GetPostString("contentIds"));
                var isUp          = request.GetPostBool("isUp");
                var taxis         = request.GetPostInt("taxis");

                if (!request.IsUserLoggin ||
                    !request.UserPermissionsImpl.HasChannelPermissions(siteId, channelId,
                                                                       ConfigManager.ChannelPermissions.ContentEdit))
                {
                    return(Unauthorized());
                }

                var siteInfo = SiteManager.GetSiteInfo(siteId);
                if (siteInfo == null)
                {
                    return(BadRequest("无法确定内容对应的站点"));
                }

                var channelInfo = ChannelManager.GetChannelInfo(siteId, channelId);
                if (channelInfo == null)
                {
                    return(BadRequest("无法确定内容对应的栏目"));
                }

                if (ETaxisTypeUtils.Equals(channelInfo.Additional.DefaultTaxisType, ETaxisType.OrderByTaxis))
                {
                    isUp = !isUp;
                }

                if (isUp == false)
                {
                    contentIdList.Reverse();
                }

                var tableName = ChannelManager.GetTableName(siteInfo, channelInfo);

                foreach (var contentId in contentIdList)
                {
                    var contentInfo = ContentManager.GetContentInfo(siteInfo, channelInfo, contentId);
                    if (contentInfo == null)
                    {
                        continue;
                    }

                    var isTop = contentInfo.IsTop;
                    for (var i = 1; i <= taxis; i++)
                    {
                        if (isUp)
                        {
                            if (DataProvider.ContentDao.SetTaxisToUp(tableName, channelId, contentId, isTop) == false)
                            {
                                break;
                            }
                        }
                        else
                        {
                            if (DataProvider.ContentDao.SetTaxisToDown(tableName, channelId, contentId, isTop) == false)
                            {
                                break;
                            }
                        }
                    }
                }

                CreateManager.TriggerContentChangedEvent(siteId, channelId);

                request.AddSiteLog(siteId, channelId, 0, "对内容排序", string.Empty);

                return(Ok(new
                {
                    Value = contentIdList
                }));
            }
            catch (Exception ex)
            {
                LogUtils.AddErrorLog(ex);
                return(InternalServerError(ex));
            }
        }
Ejemplo n.º 17
0
        public IHttpActionResult Submit()
        {
            try
            {
                var request = new AuthenticatedRequest();

                var siteId             = request.GetPostInt("siteId");
                var channelId          = request.GetPostInt("channelId");
                var contentIdList      = TranslateUtils.StringCollectionToIntList(request.GetPostString("contentIds"));
                var checkedLevel       = request.GetPostInt("checkedLevel");
                var isTranslate        = request.GetPostBool("isTranslate");
                var translateChannelId = request.GetPostInt("translateChannelId");
                var reasons            = request.GetPostString("reasons");

                if (!request.IsUserLoggin ||
                    !request.UserPermissionsImpl.HasChannelPermissions(siteId, channelId,
                                                                       ConfigManager.ChannelPermissions.ContentCheck))
                {
                    return(Unauthorized());
                }

                var siteInfo = SiteManager.GetSiteInfo(siteId);
                if (siteInfo == null)
                {
                    return(BadRequest("无法确定内容对应的站点"));
                }

                var channelInfo = ChannelManager.GetChannelInfo(siteId, channelId);
                if (channelInfo == null)
                {
                    return(BadRequest("无法确定内容对应的栏目"));
                }

                var isChecked = checkedLevel >= siteInfo.Additional.CheckContentLevel;
                if (isChecked)
                {
                    checkedLevel = 0;
                }
                var tableName = ChannelManager.GetTableName(siteInfo, channelInfo);

                var contentInfoList = new List <ContentInfo>();
                foreach (var contentId in contentIdList)
                {
                    var contentInfo = ContentManager.GetContentInfo(siteInfo, channelInfo, contentId);
                    if (contentInfo == null)
                    {
                        continue;
                    }

                    contentInfo.Set(ContentAttribute.CheckUserName, request.AdminName);
                    contentInfo.Set(ContentAttribute.CheckDate, DateTime.Now);
                    contentInfo.Set(ContentAttribute.CheckReasons, reasons);

                    contentInfo.IsChecked    = isChecked;
                    contentInfo.CheckedLevel = checkedLevel;

                    if (isTranslate && translateChannelId > 0)
                    {
                        var translateChannelInfo = ChannelManager.GetChannelInfo(siteId, translateChannelId);
                        contentInfo.ChannelId = translateChannelInfo.Id;
                        DataProvider.ContentDao.Update(siteInfo, translateChannelInfo, contentInfo);
                    }
                    else
                    {
                        DataProvider.ContentDao.Update(siteInfo, channelInfo, contentInfo);
                    }

                    contentInfoList.Add(contentInfo);

                    var checkInfo = new ContentCheckInfo(0, tableName, siteId, contentInfo.ChannelId, contentInfo.Id, request.AdminName, isChecked, checkedLevel, DateTime.Now, reasons);
                    DataProvider.ContentCheckDao.Insert(checkInfo);
                }

                if (isTranslate && translateChannelId > 0)
                {
                    ContentManager.RemoveCache(siteId, channelId, tableName);
                    var translateTableName = ChannelManager.GetTableName(siteInfo, translateChannelId);
                    ContentManager.RemoveCache(siteInfo.Id, translateChannelId, translateTableName);
                }

                request.AddSiteLog(siteId, "批量审核内容");

                foreach (var contentInfo in contentInfoList)
                {
                    CreateManager.CreateContent(siteId, contentInfo.ChannelId, contentInfo.Id);
                }
                CreateManager.TriggerContentChangedEvent(siteId, channelId);
                if (isTranslate && translateChannelId > 0)
                {
                    CreateManager.TriggerContentChangedEvent(siteId, translateChannelId);
                }

                return(Ok(new
                {
                    Value = contentIdList
                }));
            }
            catch (Exception ex)
            {
                LogUtils.AddErrorLog(ex);
                return(InternalServerError(ex));
            }
        }
Ejemplo n.º 18
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            if (Body.IsQueryExists("Delete"))
            {
                var arraylist = TranslateUtils.StringCollectionToIntList(Request.QueryString["IDCollection"]);
                if (arraylist.Count > 0)
                {
                    try
                    {
                        DataProvider.GovPublicApplyDao.Delete(arraylist);
                        Body.AddSiteLog(PublishmentSystemId, "删除申请");
                        SuccessMessage("删除成功!");
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "删除失败!");
                    }
                }
            }
            else if (Body.IsQueryExists("Accept"))
            {
                var arraylist = TranslateUtils.StringCollectionToIntList(Request.QueryString["IDCollection"]);
                foreach (var applyId in arraylist)
                {
                    var state = DataProvider.GovPublicApplyDao.GetState(applyId);
                    if (state == EGovPublicApplyState.New || state == EGovPublicApplyState.Denied)
                    {
                        GovPublicApplyManager.Log(PublishmentSystemId, applyId, EGovPublicApplyLogType.Accept, Body.AdministratorName, Body.AdministratorInfo.DepartmentId);
                        DataProvider.GovPublicApplyDao.UpdateState(applyId, EGovPublicApplyState.Accepted);
                    }
                }
                SuccessMessage("受理申请成功!");
            }
            else if (Body.IsQueryExists("Deny"))
            {
                var arraylist = TranslateUtils.StringCollectionToIntList(Request.QueryString["IDCollection"]);
                foreach (var applyId in arraylist)
                {
                    var state = DataProvider.GovPublicApplyDao.GetState(applyId);
                    if (state == EGovPublicApplyState.New || state == EGovPublicApplyState.Accepted)
                    {
                        GovPublicApplyManager.Log(PublishmentSystemId, applyId, EGovPublicApplyLogType.Deny, Body.AdministratorName, Body.AdministratorInfo.DepartmentId);
                        DataProvider.GovPublicApplyDao.UpdateState(applyId, EGovPublicApplyState.Denied);
                    }
                }
                SuccessMessage("拒绝受理申请成功!");
            }
            else if (Body.IsQueryExists("Check"))
            {
                var arraylist = TranslateUtils.StringCollectionToIntList(Request.QueryString["IDCollection"]);
                foreach (var applyId in arraylist)
                {
                    var state = DataProvider.GovPublicApplyDao.GetState(applyId);
                    if (state == EGovPublicApplyState.Replied)
                    {
                        GovPublicApplyManager.Log(PublishmentSystemId, applyId, EGovPublicApplyLogType.Check, Body.AdministratorName, Body.AdministratorInfo.DepartmentId);
                        DataProvider.GovPublicApplyDao.UpdateState(applyId, EGovPublicApplyState.Checked);
                    }
                }
                SuccessMessage("审核申请成功!");
            }

            spContents.ControlToPaginate = rptContents;
            spContents.ItemsPerPage      = PublishmentSystemInfo.Additional.PageSize;
            spContents.SelectCommand     = GetSelectString();
            spContents.SortField         = DataProvider.GovPublicApplyDao.GetSortFieldName();
            spContents.SortMode          = GetSortMode();
            rptContents.ItemDataBound   += rptContents_ItemDataBound;

            if (!IsPostBack)
            {
                spContents.DataBind();
                ltlTotalCount.Text = spContents.TotalCount.ToString();

                if (hlAccept != null)
                {
                    hlAccept.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(PageUrl + "&Accept=True", "IDCollection", "IDCollection", "请选择需要受理的申请!", "此操作将受理所选申请,确定吗?"));
                }
                if (hlDeny != null)
                {
                    hlDeny.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(PageUrl + "&Deny=True", "IDCollection", "IDCollection", "请选择需要拒绝的申请!", "此操作将拒绝受理所选申请,确定吗?"));
                }
                if (hlCheck != null)
                {
                    hlCheck.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(PageUrl + "&Check=True", "IDCollection", "IDCollection", "请选择需要审核的申请!", "此操作将审核所选申请,确定吗?"));
                }
                if (hlRedo != null)
                {
                    hlRedo.Attributes.Add("onclick", ModalGovPublicApplyRedo.GetOpenWindowString(PublishmentSystemId));
                }
                if (hlSwitchTo != null)
                {
                    hlSwitchTo.Attributes.Add("onclick", ModalGovPublicApplySwitchTo.GetOpenWindowString(PublishmentSystemId));
                }
                if (hlComment != null)
                {
                    hlComment.Attributes.Add("onclick", ModalGovPublicApplyComment.GetOpenWindowString(PublishmentSystemId));
                }
                if (phDelete != null)
                {
                    phDelete.Visible = PublishmentSystemInfo.Additional.GovPublicApplyIsDeleteAllowed;
                    hlDelete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(PageUrl + "&Delete=True", "IDCollection", "IDCollection", "请选择需要删除的申请!", "此操作将删除所选申请,确定吗?"));
                }
            }
        }
Ejemplo n.º 19
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            try
            {
                DataProviderWX.CouponSNDAO.UpdateStatus(ECouponStatusUtils.GetEnumType(ddlStatus.SelectedValue), TranslateUtils.StringCollectionToIntList(Request.QueryString["IDCollection"]));

                isChanged = true;
            }
            catch (Exception ex)
            {
                FailMessage(ex, "失败:" + ex.Message);
            }

            if (isChanged)
            {
                JsUtils.OpenWindow.CloseModalPage(Page);
            }
        }
Ejemplo n.º 20
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID");

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdContent, "评论审核", string.Empty);

                if (Body.GetQueryBool("Check"))
                {
                    var idList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("IDsCollection"));
                    try
                    {
                        DataProvider.CommentDao.Check(PublishmentSystemId, idList);
                        Body.AddSiteLog(PublishmentSystemId, 0, 0, "审核评论", string.Empty);
                        SuccessCheckMessage();
                    }
                    catch (Exception ex)
                    {
                        FailCheckMessage(ex);
                    }
                }
                else if (Body.GetQueryBool("Delete"))
                {
                    var idList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("IDsCollection"));
                    try
                    {
                        DataProvider.CommentDao.DeleteUnChecked(idList);
                        Body.AddSiteLog(PublishmentSystemId, 0, 0, "删除评论", string.Empty);
                        SuccessDeleteMessage();
                    }
                    catch (Exception ex)
                    {
                        FailDeleteMessage(ex);
                    }
                }

                SpContents.ControlToPaginate = RptContents;
                SpContents.ItemsPerPage      = PublishmentSystemInfo.Additional.PageSize;

                SpContents.SelectCommand = DataProvider.CommentDao.GetSelectedCommendByCheck(PublishmentSystemId);

                SpContents.SortField       = DataProvider.CommentDao.GetSortFieldName();
                SpContents.SortMode        = SortMode.DESC;
                RptContents.ItemDataBound += RptContents_ItemDataBound;

                SpContents.DataBind();

                BtnCheck.Attributes.Add("onclick",
                                        PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(
                                            PageUtils.GetCmsUrl(nameof(PageCommentCheck), new NameValueCollection
                {
                    { "PublishmentSystemID", PublishmentSystemId.ToString() },
                    { "Check", true.ToString() }
                }), "IDsCollection", "IDsCollection", "请选择需要审核的评论!", "此操作将审核所选评论,确认吗?"));

                if (HasChannelPermissions(PublishmentSystemId, AppManager.Cms.Permission.Channel.CommentDelete))
                {
                    BtnDelete.Attributes.Add("onclick",
                                             PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(
                                                 PageUtils.GetCmsUrl(nameof(PageCommentCheck), new NameValueCollection
                    {
                        { "PublishmentSystemID", PublishmentSystemId.ToString() },
                        { "Delete", true.ToString() }
                    }), "IDsCollection", "IDsCollection", "请选择需要删除的评论!", "此操作将删除所选评论,确认吗?"));
                }
                else
                {
                    BtnDelete.Visible = false;
                }
            }
        }
        public IHttpActionResult GetUnCheckedList()
        {
            try
            {
                var request = new AuthenticatedRequest();
                if (!request.IsAdminLoggin)
                {
                    return(Unauthorized());
                }

                var unCheckedList = new List <object>();

                if (request.AdminPermissionsImpl.IsConsoleAdministrator)
                {
                    foreach (var siteInfo in SiteManager.GetSiteInfoList())
                    {
                        var count = ContentManager.GetCount(siteInfo, false);
                        if (count > 0)
                        {
                            unCheckedList.Add(new
                            {
                                Url = PageContentSearch.GetRedirectUrlCheck(siteInfo.Id),
                                siteInfo.SiteName,
                                Count = count
                            });
                        }
                    }
                }
                else if (request.AdminPermissionsImpl.IsSystemAdministrator)
                {
                    foreach (var siteId in TranslateUtils.StringCollectionToIntList(request.AdminInfo.SiteIdCollection))
                    {
                        var siteInfo = SiteManager.GetSiteInfo(siteId);
                        if (siteInfo == null)
                        {
                            continue;
                        }

                        var count = ContentManager.GetCount(siteInfo, false);
                        if (count > 0)
                        {
                            unCheckedList.Add(new
                            {
                                Url = PageContentSearch.GetRedirectUrlCheck(siteInfo.Id),
                                siteInfo.SiteName,
                                Count = count
                            });
                        }
                    }
                }

                return(Ok(new
                {
                    Value = unCheckedList
                }));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Ejemplo n.º 22
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId", "ReturnUrl");
            ReturnUrl       = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("ReturnUrl"));
            _deleteContents = AuthRequest.GetQueryBool("DeleteContents");

            if (IsPostBack)
            {
                return;
            }

            var channelIdList = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("ChannelIDCollection"));

            channelIdList.Sort();
            channelIdList.Reverse();
            foreach (var channelId in channelIdList)
            {
                if (channelId == SiteId)
                {
                    continue;
                }
                if (!HasChannelPermissions(channelId, ConfigManager.ChannelPermissions.ChannelDelete))
                {
                    continue;
                }

                var channelInfo = ChannelManager.GetChannelInfo(SiteId, channelId);
                var displayName = channelInfo.ChannelName;
                var count       = ContentManager.GetCount(SiteInfo, channelInfo);
                if (count > 0)
                {
                    displayName += $"({count})";
                }
                _nodeNameList.Add(displayName);
            }

            if (_nodeNameList.Count == 0)
            {
                BtnDelete.Enabled = false;
            }
            else
            {
                if (_deleteContents)
                {
                    LtlPageTitle.Text = "删除内容";
                    InfoMessage(
                        $"此操作将会删除栏目“{TranslateUtils.ObjectCollectionToString(_nodeNameList)}”下的所有内容,确认吗?");
                }
                else
                {
                    LtlPageTitle.Text = "删除栏目";
                    InfoMessage(
                        $"此操作将会删除栏目“{TranslateUtils.ObjectCollectionToString(_nodeNameList)}”及包含的下级栏目,确认吗?");
                }
            }
        }
Ejemplo n.º 23
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                var selectedStep = 0;
                if (phStep1.Visible)
                {
                    selectedStep = 1;
                }
                else if (phStep2.Visible)
                {
                    selectedStep = 2;
                }
                else if (phStep3.Visible)
                {
                    selectedStep = 3;
                }
                else if (phStep4.Visible)
                {
                    selectedStep = 4;
                }
                else if (phStep5.Visible)
                {
                    selectedStep = 5;
                }

                phStep1.Visible = phStep2.Visible = phStep3.Visible = phStep4.Visible = phStep5.Visible = false;

                if (selectedStep == 1)
                {
                    var isConflict       = false;
                    var conflictKeywords = string.Empty;
                    if (!string.IsNullOrEmpty(tbKeywords.Text))
                    {
                        if (lotteryID > 0)
                        {
                            var lotteryInfo = DataProviderWX.LotteryDAO.GetLotteryInfo(lotteryID);
                            isConflict = KeywordManager.IsKeywordUpdateConflict(PublishmentSystemID, lotteryInfo.KeywordID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords);
                        }
                        else
                        {
                            isConflict = KeywordManager.IsKeywordInsertConflict(PublishmentSystemID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords);
                        }
                    }

                    if (isConflict)
                    {
                        FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词");
                        phStep1.Visible = true;
                    }
                    else
                    {
                        phStep2.Visible = true;
                    }
                }
                else if (selectedStep == 2)
                {
                    phStep3.Visible = true;
                }
                else if (selectedStep == 3)
                {
                    var isItemReady = true;

                    var awardMaxCount      = TranslateUtils.ToInt(tbAwardMaxCount.Text);
                    var awardMaxDailyCount = TranslateUtils.ToInt(tbAwardMaxDailyCount.Text);
                    if (awardMaxDailyCount > awardMaxCount)
                    {
                        FailMessage("砸金蛋保存失败,每人每天最多允许抽奖次数必须小于每人最多抽奖次数");
                        isItemReady = false;
                    }

                    if (isItemReady)
                    {
                        var itemCount = TranslateUtils.ToInt(Request.Form["itemCount"]);

                        if (itemCount < 1)
                        {
                            FailMessage("砸金蛋保存失败,至少需要设置一个奖项");
                            isItemReady = false;
                        }
                        else
                        {
                            var itemIDList      = TranslateUtils.StringCollectionToIntList(Request.Form["itemID"]);
                            var awardNameList   = TranslateUtils.StringCollectionToStringList(Request.Form["itemAwardName"]);
                            var titleList       = TranslateUtils.StringCollectionToStringList(Request.Form["itemTitle"]);
                            var totalNumList    = TranslateUtils.StringCollectionToIntList(Request.Form["itemTotalNum"]);
                            var probabilityList = TranslateUtils.StringCollectionToDecimalList(Request.Form["itemProbability"]);

                            decimal probabilityAll = 0;

                            var awardInfoList = new List <LotteryAwardInfo>();
                            for (var i = 0; i < itemCount; i++)
                            {
                                var awardInfo = new LotteryAwardInfo {
                                    ID = itemIDList[i], PublishmentSystemID = PublishmentSystemID, LotteryID = lotteryID, AwardName = awardNameList[i], Title = titleList[i], TotalNum = totalNumList[i], Probability = probabilityList[i]
                                };

                                if (string.IsNullOrEmpty(awardInfo.AwardName))
                                {
                                    FailMessage("保存失败,奖项名称为必填项");
                                    isItemReady = false;
                                }
                                if (string.IsNullOrEmpty(awardInfo.Title))
                                {
                                    FailMessage("保存失败,奖品名为必填项");
                                    isItemReady = false;
                                }
                                if (awardInfo.Probability < 0 || awardInfo.Probability > 100)
                                {
                                    FailMessage("保存失败,各项中奖概率总和不能超过100%");
                                    isItemReady = false;
                                }

                                probabilityAll += awardInfo.Probability;

                                awardInfoList.Add(awardInfo);
                            }

                            if (probabilityAll <= 0 || probabilityAll > 100)
                            {
                                FailMessage("砸金蛋保存失败,获奖概率之和必须在1%到100%之间");
                                isItemReady = false;
                            }

                            if (isItemReady)
                            {
                                DataProviderWX.LotteryAwardDAO.DeleteAllNotInIDList(PublishmentSystemID, lotteryID, itemIDList);

                                foreach (var awardInfo in awardInfoList)
                                {
                                    var newAwardInfo = DataProviderWX.LotteryAwardDAO.GetAwardInfo(awardInfo.ID);
                                    if (awardInfo.ID > 0)
                                    {
                                        var wonNum = DataProviderWX.LotteryWinnerDAO.GetTotalNum(awardInfo.ID);
                                        if (awardInfo.TotalNum < wonNum)
                                        {
                                            awardInfo.TotalNum = wonNum;
                                        }
                                        awardInfo.WonNum = newAwardInfo.WonNum;
                                        DataProviderWX.LotteryAwardDAO.Update(awardInfo);
                                    }
                                    else
                                    {
                                        DataProviderWX.LotteryAwardDAO.Insert(awardInfo);
                                    }
                                }
                            }
                        }
                    }

                    if (isItemReady)
                    {
                        phStep4.Visible = true;
                    }
                    else
                    {
                        phStep3.Visible = true;
                    }
                }
                else if (selectedStep == 4)
                {
                    phStep5.Visible = true;
                    btnSubmit.Text  = "确 认";
                }
                else if (selectedStep == 5)
                {
                    var lotteryInfo = new LotteryInfo();
                    if (lotteryID > 0)
                    {
                        lotteryInfo = DataProviderWX.LotteryDAO.GetLotteryInfo(lotteryID);
                    }
                    lotteryInfo.PublishmentSystemID = PublishmentSystemID;
                    lotteryInfo.LotteryType         = ELotteryTypeUtils.GetValue(ELotteryType.GoldEgg);

                    lotteryInfo.KeywordID  = DataProviderWX.KeywordDAO.GetKeywordID(PublishmentSystemID, lotteryID > 0, tbKeywords.Text, EKeywordType.GoldEgg, lotteryInfo.KeywordID);
                    lotteryInfo.IsDisabled = !cbIsEnabled.Checked;

                    lotteryInfo.StartDate       = dtbStartDate.DateTime;
                    lotteryInfo.EndDate         = dtbEndDate.DateTime;
                    lotteryInfo.Title           = PageUtils.FilterXSS(tbTitle.Text);
                    lotteryInfo.ImageUrl        = imageUrl.Value;;
                    lotteryInfo.Summary         = tbSummary.Text;
                    lotteryInfo.ContentImageUrl = contentImageUrl.Value;
                    lotteryInfo.ContentUsage    = tbContentUsage.Text;

                    lotteryInfo.AwardUsage         = tbAwardUsage.Text;
                    lotteryInfo.IsAwardTotalNum    = cbIsAwardTotalNum.Checked;
                    lotteryInfo.AwardMaxCount      = TranslateUtils.ToInt(tbAwardMaxCount.Text);
                    lotteryInfo.AwardMaxDailyCount = TranslateUtils.ToInt(tbAwardMaxDailyCount.Text);
                    lotteryInfo.AwardCode          = tbAwardCode.Text;
                    lotteryInfo.AwardImageUrl      = awardImageUrl.Value;

                    lotteryInfo.IsFormRealName    = cbIsFormRealName.Checked;
                    lotteryInfo.FormRealNameTitle = tbFormRealNameTitle.Text;
                    lotteryInfo.IsFormMobile      = cbIsFormMobile.Checked;
                    lotteryInfo.FormMobileTitle   = tbFormMobileTitle.Text;
                    lotteryInfo.IsFormEmail       = cbIsFormEmail.Checked;
                    lotteryInfo.FormEmailTitle    = tbFormEmailTitle.Text;
                    lotteryInfo.IsFormAddress     = cbIsFormAddress.Checked;
                    lotteryInfo.FormAddressTitle  = tbFormAddressTitle.Text;

                    lotteryInfo.EndTitle    = tbEndTitle.Text;
                    lotteryInfo.EndImageUrl = endImageUrl.Value;
                    lotteryInfo.EndSummary  = tbEndSummary.Text;

                    try
                    {
                        if (lotteryID > 0)
                        {
                            DataProviderWX.LotteryDAO.Update(lotteryInfo);

                            LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "修改砸金蛋",
                                            $"砸金蛋:{tbTitle.Text}");
                            SuccessMessage("修改砸金蛋成功!");
                        }
                        else
                        {
                            lotteryID = DataProviderWX.LotteryDAO.Insert(lotteryInfo);

                            DataProviderWX.LotteryAwardDAO.UpdateLotteryID(PublishmentSystemID, lotteryID);

                            LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "添加砸金蛋",
                                            $"砸金蛋:{tbTitle.Text}");
                            SuccessMessage("添加砸金蛋成功!");
                        }

                        var redirectUrl = BackgroundLottery.GetRedirectUrl(PublishmentSystemID, ELotteryType.GoldEgg);
                        AddWaitAndRedirectScript(redirectUrl);
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "砸金蛋设置失败!");
                    }
                }
            }
        }
Ejemplo n.º 24
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _tableStyleId      = AuthRequest.GetQueryInt("TableStyleID");
            _relatedIdentities = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("RelatedIdentities"));
            if (_relatedIdentities.Count == 0)
            {
                _relatedIdentities.Add(0);
            }
            _tableName     = AuthRequest.GetQueryString("TableName");
            _attributeName = AuthRequest.GetQueryString("AttributeName");
            _redirectUrl   = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("RedirectUrl"));

            _styleInfo = _tableStyleId != 0 ? DataProvider.TableStyleDao.GetTableStyleInfo(_tableStyleId) : TableStyleManager.GetTableStyleInfo(_tableName, _attributeName, _relatedIdentities);

            if (IsPostBack)
            {
                return;
            }

            InputTypeUtils.AddListItems(DdlInputType);

            var relatedFieldInfoList = DataProvider.RelatedFieldDao.GetRelatedFieldInfoList(SiteId);

            foreach (var rfInfo in relatedFieldInfoList)
            {
                var listItem = new ListItem(rfInfo.Title, rfInfo.Id.ToString());
                DdlRelatedFieldId.Items.Add(listItem);
            }

            ERelatedFieldStyleUtils.AddListItems(DdlRelatedFieldStyle);

            ControlUtils.SelectSingleItem(DdlIsRapid, _styleInfo.Id != 0 ? false.ToString() : true.ToString());

            TbAttributeName.Text = _styleInfo.AttributeName;
            TbDisplayName.Text   = _styleInfo.DisplayName;
            TbHelpText.Text      = _styleInfo.HelpText;
            ControlUtils.SelectSingleItem(DdlInputType, _styleInfo.InputType.Value);
            TbTaxis.Text = _styleInfo.Taxis.ToString();
            ControlUtils.SelectSingleItem(DdlIsFormatString, _styleInfo.Additional.IsFormatString.ToString());
            TbDefaultValue.Text           = _styleInfo.DefaultValue;
            DdlIsHorizontal.SelectedValue = _styleInfo.IsHorizontal.ToString();
            TbColumns.Text = _styleInfo.Additional.Columns.ToString();

            ControlUtils.SelectSingleItem(DdlRelatedFieldId, _styleInfo.Additional.RelatedFieldId.ToString());
            ControlUtils.SelectSingleItem(DdlRelatedFieldStyle, _styleInfo.Additional.RelatedFieldStyle);

            TbHeight.Text = _styleInfo.Additional.Height == 0 ? string.Empty : _styleInfo.Additional.Height.ToString();
            TbWidth.Text  = _styleInfo.Additional.Width;

            var styleItems = _styleInfo.StyleItems ?? DataProvider.TableStyleItemDao.GetStyleItemInfoList(_styleInfo.Id);

            TbItemCount.Text        = styleItems.Count.ToString();
            RptItems.DataSource     = GetDataSource(styleItems.Count, styleItems);
            RptItems.ItemDataBound += RptItems_ItemDataBound;
            RptItems.DataBind();

            var isSelected  = false;
            var isNotEquals = false;
            var list        = new List <string>();

            foreach (var item in styleItems)
            {
                list.Add(item.ItemValue);
                if (item.IsSelected)
                {
                    isSelected = true;
                }
                if (item.ItemValue != item.ItemTitle)
                {
                    isNotEquals = true;
                }
            }

            DdlIsRapid.SelectedValue = (!isSelected && !isNotEquals).ToString();
            TbRapidValues.Text       = string.Join(",", list);

            TbCustomizeLeft.Text  = _styleInfo.Additional.CustomizeLeft;
            TbCustomizeRight.Text = _styleInfo.Additional.CustomizeRight;

            ReFresh(null, EventArgs.Empty);
        }
Ejemplo n.º 25
0
        public void Create_OnClick(object sender, EventArgs e)
        {
            if (!Page.IsPostBack || !Page.IsValid)
            {
                return;
            }

            var channelIdList = new List <int>();
            var selectedChannelIdArrayList = ControlUtils.GetSelectedListControlValueArrayList(LbChannelIdList);

            var tableName = SiteInfo.TableName;

            if (DdlScope.SelectedValue == "Month")
            {
                var lastEditList = DataProvider.ContentDao.GetChannelIdListCheckedByLastEditDateHour(tableName, SiteId, 720);
                foreach (var channelId in lastEditList)
                {
                    if (selectedChannelIdArrayList.Contains(channelId.ToString()))
                    {
                        channelIdList.Add(channelId);
                    }
                }
            }
            else if (DdlScope.SelectedValue == "Day")
            {
                var lastEditList = DataProvider.ContentDao.GetChannelIdListCheckedByLastEditDateHour(tableName, SiteId, 24);
                foreach (var channelId in lastEditList)
                {
                    if (selectedChannelIdArrayList.Contains(channelId.ToString()))
                    {
                        channelIdList.Add(channelId);
                    }
                }
            }
            else if (DdlScope.SelectedValue == "2Hour")
            {
                var lastEditList = DataProvider.ContentDao.GetChannelIdListCheckedByLastEditDateHour(tableName, SiteId, 2);
                foreach (var channelId in lastEditList)
                {
                    if (selectedChannelIdArrayList.Contains(channelId.ToString()))
                    {
                        channelIdList.Add(channelId);
                    }
                }
            }
            else
            {
                channelIdList = TranslateUtils.StringCollectionToIntList(TranslateUtils.ObjectCollectionToString(selectedChannelIdArrayList));
            }


            if (channelIdList.Count == 0)
            {
                FailMessage("请首先选中希望生成内容页面的栏目!");
                return;
            }

            foreach (var channelId in channelIdList)
            {
                CreateManager.CreateAllContent(SiteId, channelId);
            }

            PageCreateStatus.Redirect(SiteId);
        }
Ejemplo n.º 26
0
        public string GetWhereStringByStlSearch(bool isAllSites, string siteName, string siteDir, string siteIds, string channelIndex, string channelName, string channelIds, string type, string word, string dateAttribute, string dateFrom, string dateTo, string since, int publishmentSystemId, List <string> excludeAttributes, NameValueCollection form, out bool isDefaultCondition)
        {
            isDefaultCondition = true;
            var whereBuilder = new StringBuilder();

            PublishmentSystemInfo publishmentSystemInfo = null;

            if (!string.IsNullOrEmpty(siteName))
            {
                publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfoBySiteName(siteName);
            }
            else if (!string.IsNullOrEmpty(siteDir))
            {
                publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfoByDirectory(siteDir);
            }
            if (publishmentSystemInfo == null)
            {
                publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);
            }

            var channelId = StlCacheManager.NodeId.GetNodeIdByChannelIdOrChannelIndexOrChannelName(publishmentSystemId, publishmentSystemId, channelIndex, channelName);
            var nodeInfo  = NodeManager.GetNodeInfo(publishmentSystemId, channelId);

            if (isAllSites)
            {
                whereBuilder.Append("(PublishmentSystemID > 0) ");
            }
            else if (!string.IsNullOrEmpty(siteIds))
            {
                whereBuilder.Append($"(PublishmentSystemID IN ({TranslateUtils.ToSqlInStringWithoutQuote(TranslateUtils.StringCollectionToIntList(siteIds))})) ");
            }
            else
            {
                whereBuilder.Append($"(PublishmentSystemID = {publishmentSystemInfo.PublishmentSystemId}) ");
            }

            if (!string.IsNullOrEmpty(channelIds))
            {
                whereBuilder.Append(" AND ");
                var nodeIdList = new List <int>();
                foreach (var nodeId in TranslateUtils.StringCollectionToIntList(channelIds))
                {
                    nodeIdList.Add(nodeId);
                    nodeIdList.AddRange(DataProvider.NodeDao.GetNodeIdListForDescendant(nodeId));
                }
                whereBuilder.Append(nodeIdList.Count == 1
                    ? $"(NodeID = {nodeIdList[0]}) "
                    : $"(NodeID IN ({TranslateUtils.ToSqlInStringWithoutQuote(nodeIdList)})) ");
            }
            else if (channelId != publishmentSystemId)
            {
                whereBuilder.Append(" AND ");
                var nodeIdList = DataProvider.NodeDao.GetNodeIdListForDescendant(channelId);
                nodeIdList.Add(channelId);
                whereBuilder.Append(nodeIdList.Count == 1
                    ? $"(NodeID = {nodeIdList[0]}) "
                    : $"(NodeID IN ({TranslateUtils.ToSqlInStringWithoutQuote(nodeIdList)})) ");
            }

            var typeList = new List <string>();

            if (string.IsNullOrEmpty(type))
            {
                typeList.Add(ContentAttribute.Title);
            }
            else
            {
                typeList = TranslateUtils.StringCollectionToStringList(type);
            }

            if (!string.IsNullOrEmpty(word))
            {
                whereBuilder.Append(" AND (");
                foreach (var attributeName in typeList)
                {
                    whereBuilder.Append($"[{attributeName}] LIKE '%{PageUtils.FilterSql(word)}%' OR ");
                }
                whereBuilder.Length = whereBuilder.Length - 3;
                whereBuilder.Append(")");
            }

            if (string.IsNullOrEmpty(dateAttribute))
            {
                dateAttribute = ContentAttribute.AddDate;
            }

            if (!string.IsNullOrEmpty(dateFrom))
            {
                whereBuilder.Append(" AND ");
                whereBuilder.Append($" {dateAttribute} >= '{dateFrom}' ");
            }
            if (!string.IsNullOrEmpty(dateTo))
            {
                whereBuilder.Append(" AND ");
                whereBuilder.Append($" {dateAttribute} <= '{dateTo}' ");
            }
            if (!string.IsNullOrEmpty(since))
            {
                var sinceDate = DateTime.Now.AddHours(-DateUtils.GetSinceHours(since));
                whereBuilder.Append($" AND {dateAttribute} BETWEEN '{DateUtils.GetDateAndTimeString(sinceDate)}' AND {SqlUtils.GetDefaultDateString()} ");
            }

            var tableStyle    = NodeManager.GetTableStyle(publishmentSystemInfo, nodeInfo);
            var tableName     = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo);
            var styleInfoList = RelatedIdentities.GetTableStyleInfoList(publishmentSystemInfo, tableStyle, nodeInfo.NodeId);

            foreach (string key in form.Keys)
            {
                if (excludeAttributes.Contains(key.ToLower()))
                {
                    continue;
                }
                if (string.IsNullOrEmpty(form[key]))
                {
                    continue;
                }

                var value = StringUtils.Trim(form[key]);
                if (string.IsNullOrEmpty(value))
                {
                    continue;
                }

                if (TableManager.IsAttributeNameExists(tableStyle, tableName, key))
                {
                    whereBuilder.Append(" AND ");
                    whereBuilder.Append($"({key} LIKE '%{value}%')");
                }
                else
                {
                    foreach (var tableStyleInfo in styleInfoList)
                    {
                        if (StringUtils.EqualsIgnoreCase(tableStyleInfo.AttributeName, key))
                        {
                            whereBuilder.Append(" AND ");
                            whereBuilder.Append($"({ContentAttribute.SettingsXml} LIKE '%{key}={value}%')");
                            break;
                        }
                    }
                }

                if (tableStyle == ETableStyle.GovPublicContent)
                {
                    if (StringUtils.EqualsIgnoreCase(key, GovPublicContentAttribute.DepartmentId))
                    {
                        whereBuilder.Append(" AND ");
                        whereBuilder.Append($"([{key}] = {TranslateUtils.ToInt(value)})");
                    }
                    else if (StringUtils.EqualsIgnoreCase(key, GovPublicContentAttribute.Category1Id))
                    {
                        whereBuilder.Append(" AND ");
                        whereBuilder.Append($"([{key}] = {TranslateUtils.ToInt(value)})");
                    }
                    else if (StringUtils.EqualsIgnoreCase(key, GovPublicContentAttribute.Category2Id))
                    {
                        whereBuilder.Append(" AND ");
                        whereBuilder.Append($"([{key}] = {TranslateUtils.ToInt(value)})");
                    }
                    else if (StringUtils.EqualsIgnoreCase(key, GovPublicContentAttribute.Category3Id))
                    {
                        whereBuilder.Append(" AND ");
                        whereBuilder.Append($"([{key}] = {TranslateUtils.ToInt(value)})");
                    }
                    else if (StringUtils.EqualsIgnoreCase(key, GovPublicContentAttribute.Category4Id))
                    {
                        whereBuilder.Append(" AND ");
                        whereBuilder.Append($"([{key}] = {TranslateUtils.ToInt(value)})");
                    }
                    else if (StringUtils.EqualsIgnoreCase(key, GovPublicContentAttribute.Category5Id))
                    {
                        whereBuilder.Append(" AND ");
                        whereBuilder.Append($"([{key}] = {TranslateUtils.ToInt(value)})");
                    }
                    else if (StringUtils.EqualsIgnoreCase(key, GovPublicContentAttribute.Category6Id))
                    {
                        whereBuilder.Append(" AND ");
                        whereBuilder.Append($"([{key}] = {TranslateUtils.ToInt(value)})");
                    }
                }
            }

            if (whereBuilder.ToString().Contains(" AND "))
            {
                isDefaultCondition = false;
            }

            return(whereBuilder.ToString());
        }
Ejemplo n.º 27
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _exportType = Body.GetQueryString("ExportType");

            if (!IsPostBack)
            {
                var isExport = true;
                var fileName = string.Empty;
                try
                {
                    if (_exportType == ExportTypeTrackerHour)
                    {
                        fileName = ExportTrackingHours();
                    }
                    else if (_exportType == ExportTypeTrackerDay)
                    {
                        fileName = ExportTrackingDays();
                    }
                    else if (_exportType == ExportTypeTrackerMonth)
                    {
                        fileName = ExportTrackingMonths();
                    }
                    else if (_exportType == ExportTypeTrackerYear)
                    {
                        fileName = ExportTrackingYears();
                    }
                    else if (_exportType == ExportTypeTrackerContent)
                    {
                        var startDateString = Body.GetQueryString("StartDateString");
                        var endDateString   = Body.GetQueryString("EndDateString");
                        var nodeId          = Body.GetQueryInt("NodeID");
                        var contentId       = Body.GetQueryInt("ContentID");
                        var totalNum        = Body.GetQueryInt("TotalNum");
                        var isDelete        = Body.GetQueryBool("IsDelete");
                        fileName = ExportTrackingContents(startDateString, endDateString, nodeId, contentId, totalNum, isDelete);
                    }
                    else if (_exportType == ExportTypeInputContent)
                    {
                        var inputId = Body.GetQueryInt("InputID");
                        fileName = ExportInputContent(inputId);
                    }
                    else if (_exportType == ExportTypeComment)
                    {
                        var nodeId    = Body.GetQueryInt("NodeID");
                        var contentId = Body.GetQueryInt("ContentID");
                        fileName = ExportComment(nodeId, contentId);
                    }
                    else if (_exportType == ExportTypeGatherRule)
                    {
                        var gatherRuleNameArrayList = TranslateUtils.StringCollectionToStringList(Body.GetQueryString("GatherRuleNameCollection"));
                        fileName = ExportGatherRule(gatherRuleNameArrayList);
                    }
                    else if (_exportType == ExportTypeInput)
                    {
                        var inputId = Body.GetQueryInt("InputID");
                        fileName = ExportInput(inputId);
                    }
                    else if (_exportType == ExportTypeRelatedField)
                    {
                        var relatedFieldId = Body.GetQueryInt("RelatedFieldID");
                        fileName = ExportRelatedField(relatedFieldId);
                    }
                    else if (_exportType == ExportTypeTagStyle)
                    {
                        var styleId = Body.GetQueryInt("StyleID");
                        fileName = ExportTagStyle(styleId);
                    }
                    else if (_exportType == ExportTypeContentZip)
                    {
                        var nodeId = Body.GetQueryInt("NodeID");
                        var contentIdCollection = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection"));
                        var isPeriods           = Body.GetQueryBool("isPeriods");
                        var startDate           = Body.GetQueryString("startDate");
                        var endDate             = Body.GetQueryString("endDate");
                        var checkedState        = ETriStateUtils.GetEnumType(Body.GetQueryString("checkedState"));
                        isExport = ExportContentZip(nodeId, contentIdCollection, isPeriods, startDate, endDate, checkedState, out fileName);
                    }
                    else if (_exportType == ExportTypeContentAccess)
                    {
                        var nodeId = Body.GetQueryInt("NodeID");
                        var contentIdCollection = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection"));
                        var displayAttributes   = TranslateUtils.StringCollectionToStringList(Body.GetQueryString("DisplayAttributes"));
                        var isPeriods           = Body.GetQueryBool("isPeriods");
                        var startDate           = Body.GetQueryString("startDate");
                        var endDate             = Body.GetQueryString("endDate");
                        var checkedState        = ETriStateUtils.GetEnumType(Body.GetQueryString("checkedState"));
                        isExport = ExportContentAccess(nodeId, contentIdCollection, displayAttributes, isPeriods, startDate, endDate, checkedState, out fileName);
                    }
                    else if (_exportType == ExportTypeContentExcel)
                    {
                        var nodeId = Body.GetQueryInt("NodeID");
                        var contentIdCollection = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection"));
                        var displayAttributes   = TranslateUtils.StringCollectionToStringList(Body.GetQueryString("DisplayAttributes"));
                        var isPeriods           = Body.GetQueryBool("isPeriods");
                        var startDate           = Body.GetQueryString("startDate");
                        var endDate             = Body.GetQueryString("endDate");
                        var checkedState        = ETriStateUtils.GetEnumType(Body.GetQueryString("checkedState"));
                        ExportContentExcel(nodeId, contentIdCollection, displayAttributes, isPeriods, startDate, endDate, checkedState, out fileName);
                    }
                    else if (_exportType == ExportTypeChannel)
                    {
                        var nodeIdList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ChannelIDCollection"));
                        fileName = ExportChannel(nodeIdList);
                    }
                    else if (_exportType == ExportTypeSingleTableStyle)
                    {
                        var tableStyle      = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle"));
                        var tableName       = Body.GetQueryString("TableName");
                        var relatedIdentity = Body.GetQueryInt("RelatedIdentity");
                        fileName = ExportSingleTableStyle(tableStyle, tableName, relatedIdentity);
                    }

                    if (isExport)
                    {
                        var link     = new HyperLink();
                        var filePath = PathUtils.GetTemporaryFilesPath(fileName);
                        link.NavigateUrl = ActionsDownload.GetUrl(PublishmentSystemInfo.Additional.ApiUrl, filePath);
                        link.Text        = "下载";
                        var successMessage = "成功导出文件!&nbsp;&nbsp;" + ControlUtils.GetControlRenderHtml(link);
                        SuccessMessage(successMessage);
                    }
                    else
                    {
                        FailMessage("导出失败,所选条件没有匹配内容,请重新选择条件导出内容");
                    }
                }
                catch (Exception ex)
                {
                    var failedMessage = "文件导出失败!<br/><br/>原因为:" + ex.Message;
                    FailMessage(ex, failedMessage);
                }
            }
        }
Ejemplo n.º 28
0
        private static bool IsNumber(int number, string testOperate, string testValue)
        {
            var isSuccess = false;

            if (StringUtils.EqualsIgnoreCase(testOperate, OperateEquals))
            {
                if (number == TranslateUtils.ToInt(testValue))
                {
                    isSuccess = true;
                }
            }
            else if (StringUtils.EqualsIgnoreCase(testOperate, OperateNotEquals))
            {
                if (number != TranslateUtils.ToInt(testValue))
                {
                    isSuccess = true;
                }
            }
            else if (StringUtils.EqualsIgnoreCase(testOperate, OperateGreatThan))
            {
                if (number > TranslateUtils.ToInt(testValue))
                {
                    isSuccess = true;
                }
            }
            else if (StringUtils.EqualsIgnoreCase(testOperate, OperateLessThan))
            {
                if (number < TranslateUtils.ToInt(testValue))
                {
                    isSuccess = true;
                }
            }
            else if (StringUtils.EqualsIgnoreCase(testOperate, OperateIn))
            {
                var intArrayList = TranslateUtils.StringCollectionToIntList(testValue);
                foreach (int i in intArrayList)
                {
                    if (i == number)
                    {
                        isSuccess = true;
                        break;
                    }
                }
            }
            else if (StringUtils.EqualsIgnoreCase(testOperate, OperateIn))
            {
                var intArrayList = TranslateUtils.StringCollectionToIntList(testValue);
                var isIn         = false;
                foreach (int i in intArrayList)
                {
                    if (i == number)
                    {
                        isIn = true;
                        break;
                    }
                }
                if (!isIn)
                {
                    isSuccess = true;
                }
            }
            return(isSuccess);
        }
Ejemplo n.º 29
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden) return;

            Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);

            if (Body.IsQueryExists("CreateChannelsOneByOne") && Body.IsQueryExists("ChannelIDCollection"))
            {
                foreach (var channelId in TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ChannelIDCollection")))
                {
                    CreateManager.CreateChannel(SiteId, channelId);
                }

                LayerUtils.CloseAndOpenPageCreateStatus(Page);
                //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将栏目放入生成队列"));
            }
            else if (Body.IsQueryExists("CreateContentsOneByOne") && Body.IsQueryExists("channelId") &&
                     Body.IsQueryExists("contentIdCollection"))
            {
                foreach (var contentId in TranslateUtils.StringCollectionToIntList(Body.GetQueryString("contentIdCollection")))
                {
                    CreateManager.CreateContent(SiteId, Body.GetQueryInt("channelId"),
                        contentId);
                }

                LayerUtils.CloseAndOpenPageCreateStatus(Page);
                //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将内容放入生成队列"));
            }
            else if (Body.IsQueryExists("CreateByTemplate") && Body.IsQueryExists("templateID"))
            {
                CreateManager.CreateFile(SiteId, Body.GetQueryInt("templateID"));

                LayerUtils.CloseAndOpenPageCreateStatus(Page);
                //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将文件放入生成队列"));
            }
            else if (Body.IsQueryExists("CreateByIDsCollection") && Body.IsQueryExists("IDsCollection"))
            {
                foreach (var channelIdContentId in
                    TranslateUtils.StringCollectionToStringCollection(Body.GetQueryString("IDsCollection")))
                {
                    var pair = channelIdContentId.Split('_');
                    CreateManager.CreateContent(SiteId, TranslateUtils.ToInt(pair[0]),
                        TranslateUtils.ToInt(pair[1]));
                }

                LayerUtils.CloseAndOpenPageCreateStatus(Page);
                //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将文件放入生成队列"));
            }
            //---------------------------------------------------------------------------------------//
            else if (Body.IsQueryExists("SiteTemplateDownload"))
            {
                var userKeyPrefix = StringUtils.Guid();

                var downloadUrl = TranslateUtils.DecryptStringBySecretKey(Body.GetQueryString("DownloadUrl"));
                var directoryName = PathUtils.GetFileNameWithoutExtension(downloadUrl);

                var parameters = AjaxOtherService.GetSiteTemplateDownloadParameters(downloadUrl, directoryName, userKeyPrefix);
                LtlScripts.Text =
                    AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateDownloadUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl());
            }
            else if (Body.IsQueryExists("SiteTemplateZip"))
            {
                var userKeyPrefix = StringUtils.Guid();

                var parameters = AjaxOtherService.GetSiteTemplateZipParameters(Body.GetQueryString("DirectoryName"), userKeyPrefix);
                LtlScripts.Text =
                    AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateZipUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl());
            }
            else if (Body.IsQueryExists("SiteTemplateUnZip"))
            {
                var userKeyPrefix = StringUtils.Guid();

                var parameters = AjaxOtherService.GetSiteTemplateUnZipParameters(Body.GetQueryString("FileName"), userKeyPrefix);
                LtlScripts.Text =
                    AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateUnZipUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl());
            }
            //---------------------------------------------------------------------------------------//
            else if (Body.IsQueryExists("PluginDownload"))
            {
                var userKeyPrefix = StringUtils.Guid();

                var parameters = AjaxOtherService.GetPluginDownloadParameters(Body.GetQueryString("DownloadUrl"), userKeyPrefix);
                LtlScripts.Text =
                    AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetPluginDownloadUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl());
            }
        }
Ejemplo n.º 30
0
        public static string GetChannelRowHtml(SiteInfo siteInfo, ChannelInfo nodeInfo, bool enabled, ELoadingType loadingType, NameValueCollection additional, PermissionManager permissionManager)
        {
            var nodeTreeItem = ChannelTreeItem.CreateInstance(siteInfo, nodeInfo, enabled, permissionManager);
            var title        = nodeTreeItem.GetItemHtml(loadingType, PageChannel.GetRedirectUrl(siteInfo.Id, nodeInfo.Id), additional);

            var rowHtml = string.Empty;

            if (loadingType == ELoadingType.ContentTree)
            {
                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td nowrap>{title}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.Channel)
            {
                var upLink       = string.Empty;
                var downLink     = string.Empty;
                var editUrl      = string.Empty;
                var checkBoxHtml = string.Empty;

                if (enabled)
                {
                    if (permissionManager.HasChannelPermissions(nodeInfo.SiteId, nodeInfo.Id, ConfigManager.ChannelPermissions.ChannelEdit))
                    {
                        var urlEdit = PageChannelEdit.GetRedirectUrl(nodeInfo.SiteId, nodeInfo.Id, PageChannel.GetRedirectUrl(nodeInfo.SiteId, nodeInfo.Id));
                        editUrl = $"<a href=\"{urlEdit}\">编辑</a>";
                        var urlSubtract = PageUtils.GetCmsUrl(nodeInfo.SiteId, nameof(PageChannel), new NameValueCollection
                        {
                            { "Subtract", true.ToString() },
                            { "channelId", nodeInfo.Id.ToString() }
                        });
                        upLink =
                            $@"<a href=""{urlSubtract}""><img src=""../Pic/icon/up.gif"" border=""0"" alt=""上升"" /></a>";
                        var urlAdd = PageUtils.GetCmsUrl(nodeInfo.SiteId, nameof(PageChannel), new NameValueCollection
                        {
                            { "Add", true.ToString() },
                            { "channelId", nodeInfo.Id.ToString() }
                        });
                        downLink =
                            $@"<a href=""{urlAdd}""><img src=""../Pic/icon/down.gif"" border=""0"" alt=""下降"" /></a>";
                    }
                    checkBoxHtml = $"<input type='checkbox' name='ChannelIDCollection' value='{nodeInfo.Id}' />";
                }

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
    <td>{title}</td>
    <td class=""text-nowrap"">{nodeInfo.GroupNameCollection}</td>
    <td class=""text-nowrap"">{nodeInfo.IndexName}</td>
    <td class=""text-center"">{upLink}</td>
    <td class=""text-center"">{downLink}</td>
    <td class=""text-center"">{editUrl}</td>
    <td class=""text-center"">{checkBoxHtml}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.SiteAnalysis)
            {
                var startDate = TranslateUtils.ToDateTime(additional["StartDate"]);
                var endDate   = TranslateUtils.ToDateTime(additional["EndDate"]);

                var tableName     = ChannelManager.GetTableName(siteInfo, nodeInfo);
                var num           = DataProvider.ContentDao.GetCountOfContentAdd(tableName, siteInfo.Id, nodeInfo.Id, EScopeType.All, startDate, endDate, string.Empty, ETriState.All);
                var contentAddNum = num == 0 ? "0" : $"<strong>{num}</strong>";

                num = DataProvider.ContentDao.GetCountOfContentUpdate(tableName, siteInfo.Id, nodeInfo.Id, EScopeType.All, startDate, endDate, string.Empty);
                var contentUpdateNum = num == 0 ? "0" : $"<strong>{num}</strong>";

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
	<td class=""text-center"">{contentAddNum}</td>
	<td class=""text-center"">{contentUpdateNum}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.TemplateFilePathRule)
            {
                var editLink = string.Empty;

                if (enabled)
                {
                    var showPopWinString = ModalTemplateFilePathRule.GetOpenWindowString(nodeInfo.SiteId, nodeInfo.Id);
                    editLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">更改</a>";
                }
                var filePath = PageUtility.GetInputChannelUrl(siteInfo, nodeInfo, false);

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
	<td>{filePath}</td>
	<td class=""text-center"">{editLink}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.ConfigurationCreateDetails)
            {
                var editChannelLink = string.Empty;

                var nodeNames = string.Empty;

                if (enabled)
                {
                    var showPopWinString = ModalConfigurationCreateChannel.GetOpenWindowString(nodeInfo.SiteId, nodeInfo.Id);
                    editChannelLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">触发栏目</a>";
                }

                if (nodeInfo.Additional.ToNameValueCollection().Count > 0)
                {
                    var nodeNameBuilder = new StringBuilder();
                    var channelIdList   = TranslateUtils.StringCollectionToIntList(nodeInfo.Additional.CreateChannelIDsIfContentChanged);
                    foreach (var theChannelId in channelIdList)
                    {
                        var theNodeInfo = ChannelManager.GetChannelInfo(siteInfo.Id, theChannelId);
                        if (theNodeInfo != null)
                        {
                            nodeNameBuilder.Append(theNodeInfo.ChannelName).Append(",");
                        }
                    }
                    if (nodeNameBuilder.Length > 0)
                    {
                        nodeNameBuilder.Length--;
                        nodeNames = nodeNameBuilder.ToString();
                    }
                }

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
	<td>{nodeNames}</td>
	<td class=""text-center"">{editChannelLink}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.ConfigurationCrossSiteTrans)
            {
                var editLink = string.Empty;

                if (enabled)
                {
                    var showPopWinString = ModalCrossSiteTransEdit.GetOpenWindowString(nodeInfo.SiteId, nodeInfo.Id);
                    editLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">更改</a>";
                }

                var contribute = CrossSiteTransUtility.GetDescription(nodeInfo.SiteId, nodeInfo);

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
	<td>{contribute}</td>
	<td class=""text-center"">{editLink}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.ChannelSelect)
            {
                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
</tr>
";
            }

            return(rowHtml);
        }