public void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            try
            {
                var switchToDepartmentID = Utils.ToInt(Request.Form["switchToDepartmentID"]);
                if (switchToDepartmentID == 0)
                {
                    LtlMessage.Text = Utils.GetMessageHtml("转办失败,必须选择转办部门!", false);
                    return;
                }
                var switchToDepartmentName = DepartmentManager.GetDepartmentName(switchToDepartmentID);

                foreach (int contentID in _idArrayList)
                {
                    var contentInfo = Main.ContentApi.GetContentInfo(SiteId, _channelId, contentID);
                    var state       = EStateUtils.GetEnumType(contentInfo.GetString(ContentAttribute.State));

                    if (state != EState.Denied && state != EState.Checked)
                    {
                        contentInfo.Set(ContentAttribute.DepartmentId, switchToDepartmentID.ToString());
                        Main.ContentApi.Update(SiteId, contentInfo.ChannelId, contentInfo);

                        if (!string.IsNullOrEmpty(tbSwitchToRemark.Text))
                        {
                            var remarkInfo = new RemarkInfo(0, SiteId, contentInfo.ChannelId, contentID, ERemarkTypeUtils.GetValue(ERemarkType.SwitchTo), tbSwitchToRemark.Text, _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now);
                            RemarkDao.Insert(remarkInfo);
                        }

                        ApplyManager.LogSwitchTo(SiteId, contentInfo.ChannelId, contentID, switchToDepartmentName, AuthRequest.AdminName, _adminInfo.DepartmentId);
                    }
                }

                isChanged = true;
            }
            catch (Exception ex)
            {
                LtlMessage.Text = Utils.GetMessageHtml(ex.Message, false);
                isChanged       = false;
            }

            if (isChanged)
            {
                LayerUtils.Close(Page);
            }
        }
示例#2
0
        public void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            try
            {
                if (string.IsNullOrEmpty(tbRedoRemark.Text))
                {
                    LtlMessage.Text = Utils.GetMessageHtml("要求返工失败,必须填写意见!", false);
                    return;
                }

                foreach (int contentID in _idArrayList)
                {
                    var contentInfo = Main.ContentApi.GetContentInfo(SiteId, _channelId, contentID);
                    var state       = EStateUtils.GetEnumType(contentInfo.GetString(ContentAttribute.State));

                    if (state == EState.Replied || state == EState.Redo)
                    {
                        var remarkInfo = new RemarkInfo(0, SiteId, contentInfo.ChannelId, contentInfo.Id, ERemarkTypeUtils.GetValue(ERemarkType.Redo), tbRedoRemark.Text, _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now);
                        RemarkDao.Insert(remarkInfo);

                        ApplyManager.Log(SiteId, contentInfo.ChannelId, contentID, ELogTypeUtils.GetValue(ELogType.Redo), AuthRequest.AdminName, _adminInfo.DepartmentId);
                        contentInfo.Set(ContentAttribute.State, EStateUtils.GetValue(EState.Redo));
                        Main.ContentApi.Update(SiteId, contentInfo.ChannelId, contentInfo);
                    }
                }

                isChanged = true;
            }
            catch (Exception ex)
            {
                LtlMessage.Text = Utils.GetMessageHtml(ex.Message, false);
                isChanged       = false;
            }

            if (isChanged)
            {
                LayerUtils.Close(Page);
            }
        }
示例#3
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            ChannelId = Utils.ToInt(Request.QueryString["channelId"]);

            _isPermissionReply = InteractManager.IsPermission(SiteId, ChannelId, Permissions.Reply);
            _isPermissionEdit  = InteractManager.IsPermission(SiteId, ChannelId, Permissions.Edit);

            if (!string.IsNullOrEmpty(Request.QueryString["delete"]))
            {
                var list = Utils.StringCollectionToIntList(Request.QueryString["IDCollection"]);
                if (list.Count > 0)
                {
                    foreach (var contentId in list)
                    {
                        Main.ContentApi.Delete(SiteId, ChannelId, contentId);
                    }
                    LtlScript.Text = AlertUtils.Success("删除成功!", "");
                }
            }
            else if (!string.IsNullOrEmpty(Request.QueryString["accept"]))
            {
                var list = Utils.StringCollectionToIntList(Request.QueryString["IDCollection"]);
                foreach (var contentId in list)
                {
                    var contentInfo = Main.ContentApi.GetContentInfo(SiteId, ChannelId, contentId);
                    var state       = EStateUtils.GetEnumType(contentInfo.GetString(ContentAttribute.State));
                    if (state == EState.New || state == EState.Denied)
                    {
                        contentInfo.Set(ContentAttribute.State, EStateUtils.GetValue(EState.Accepted));
                        Main.ContentApi.Update(SiteId, ChannelId, contentInfo);
                    }
                }
                LtlScript.Text = AlertUtils.Success("受理申请成功!", "");
            }
            else if (!string.IsNullOrEmpty(Request.QueryString["deny"]))
            {
                var list = Utils.StringCollectionToIntList(Request.QueryString["IDCollection"]);
                foreach (var contentId in list)
                {
                    var contentInfo = Main.ContentApi.GetContentInfo(SiteId, ChannelId, contentId);
                    var state       = EStateUtils.GetEnumType(contentInfo.GetString(ContentAttribute.State));
                    if (state == EState.New || state == EState.Accepted)
                    {
                        contentInfo.Set(ContentAttribute.State, EStateUtils.GetValue(EState.Denied));
                        Main.ContentApi.Update(SiteId, ChannelId, contentInfo);
                    }
                }
                LtlScript.Text = AlertUtils.Success("拒绝受理申请成功!", "");
            }
            else if (!string.IsNullOrEmpty(Request.QueryString["check"]))
            {
                var list = Utils.StringCollectionToIntList(Request.QueryString["IDCollection"]);
                foreach (var contentId in list)
                {
                    var contentInfo = Main.ContentApi.GetContentInfo(SiteId, ChannelId, contentId);
                    var state       = EStateUtils.GetEnumType(contentInfo.GetString(ContentAttribute.State));
                    if (state == EState.Replied)
                    {
                        contentInfo.Set(ContentAttribute.State, EStateUtils.GetValue(EState.Checked));
                        Main.ContentApi.Update(SiteId, ChannelId, contentInfo);
                    }
                }
                LtlScript.Text = AlertUtils.Success("审核申请成功!", "");
            }

            SpContents.ControlToPaginate = RptContents;
            SpContents.ItemsPerPage      = 25;
            SpContents.SelectCommand     = GetSelectString();
            SpContents.SortField         = nameof(IContentInfo.Taxis);
            SpContents.SortMode          = "DESC";
            RptContents.ItemDataBound   += RptContents_ItemDataBound;

            if (!IsPostBack)
            {
                SpContents.DataBind();
                LtlTotalCount.Text = SpContents.TotalCount.ToString();

                if (PhAccept != null)
                {
                    PhAccept.Visible = InteractManager.IsPermission(SiteId, ChannelId, Permissions.Accept);
                    HlAccept?.Attributes.Add("onclick", Utils.GetRedirectStringWithCheckBoxValueAndAlert(PageUrl + "&Accept=True", "IDCollection", "IDCollection", "请选择需要受理的申请!", "此操作将受理所选申请,确定吗?"));
                    HlDeny?.Attributes.Add("onclick", Utils.GetRedirectStringWithCheckBoxValueAndAlert(PageUrl + "&Deny=True", "IDCollection", "IDCollection", "请选择需要拒绝的申请!", "此操作将拒绝受理所选申请,确定吗?"));
                }
                if (PhCheck != null)
                {
                    PhCheck.Visible = InteractManager.IsPermission(SiteId, ChannelId, Permissions.Check);
                    HlCheck?.Attributes.Add("onclick", Utils.GetRedirectStringWithCheckBoxValueAndAlert(PageUrl + "&Check=True", "IDCollection", "IDCollection", "请选择需要审核的申请!", "此操作将审核所选申请,确定吗?"));
                    HlRedo?.Attributes.Add("onclick", ModalApplyRedo.GetOpenWindowString(SiteId, ChannelId));
                }
                if (PhSwitchToTranslate != null)
                {
                    PhSwitchToTranslate.Visible = InteractManager.IsPermission(SiteId, ChannelId, Permissions.SwitchToTranslate);
                    HlSwitchTo?.Attributes.Add("onclick", ModalApplySwitchTo.GetOpenWindowString(SiteId, ChannelId));
                    HlTranslate?.Attributes.Add("onclick", ModalApplyTranslate.GetOpenWindowString(SiteId, ChannelId));
                }
                if (PhComment != null)
                {
                    PhComment.Visible = InteractManager.IsPermission(SiteId, ChannelId, Permissions.Comment);
                    HlComment.Attributes.Add("onclick", ModalApplyComment.GetOpenWindowString(SiteId, ChannelId));
                }
                if (PhDelete != null)
                {
                    PhDelete.Visible = InteractManager.IsPermission(SiteId, ChannelId, Permissions.Delete) && ConfigInfo.ApplyIsDeleteAllowed;
                    HlDelete.Attributes.Add("onclick", Utils.GetRedirectStringWithCheckBoxValueAndAlert(PageUrl + "&Delete=True", "IDCollection", "IDCollection", "请选择需要删除的申请!", "此操作将删除所选申请,确定吗?"));
                }
                //hlExport?.Attributes.Add("onclick", ModalContentExport.GetOpenWindowString(SiteId, _channelId));
            }
        }
示例#4
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var contentInfo = Main.ContentApi.NewInstance(SiteId, ChannelId);
            var rowView     = (DataRowView)e.Item.DataItem;

            contentInfo.Load(rowView.Row);

            var ltlTr         = (Literal)e.Item.FindControl("ltlTr");
            var ltlId         = (Literal)e.Item.FindControl("ltlID");
            var ltlTitle      = (Literal)e.Item.FindControl("ltlTitle");
            var ltlAddDate    = (Literal)e.Item.FindControl("ltlAddDate");
            var ltlRemark     = (Literal)e.Item.FindControl("ltlRemark");
            var ltlDepartment = (Literal)e.Item.FindControl("ltlDepartment");
            var ltlLimit      = (Literal)e.Item.FindControl("ltlLimit");
            var ltlState      = (Literal)e.Item.FindControl("ltlState");
            var ltlFlowUrl    = (Literal)e.Item.FindControl("ltlFlowUrl");
            var ltlViewUrl    = (Literal)e.Item.FindControl("ltlViewUrl");
            var ltlReplyUrl   = (Literal)e.Item.FindControl("ltlReplyUrl");
            var ltlEditUrl    = (Literal)e.Item.FindControl("ltlEditUrl");

            var limitType = ELimitType.Normal;

            ltlTr.Text = @"<tr>";
            var state = EStateUtils.GetEnumType(contentInfo.GetString(ContentAttribute.State));

            var textClass = string.Empty;

            if (state != EState.Denied && state != EState.Checked)
            {
                limitType = ApplyManager.GetLimitType(SiteId, contentInfo);
                if (limitType == ELimitType.Alert)
                {
                    ltlTr.Text = @"<tr class=""bg-info text-white"">";
                    textClass  = "text-white";
                }
                else if (limitType == ELimitType.Yellow)
                {
                    ltlTr.Text = @"<tr class=""bg-warning text-white"">";
                    textClass  = "text-white";
                }
                else if (limitType == ELimitType.Red)
                {
                    ltlTr.Text = @"<tr class=""bg-danger text-white"">";
                    textClass  = "text-white";
                }
            }

            ltlId.Text = contentInfo.Id.ToString();

            var title = contentInfo.Title;

            if (string.IsNullOrEmpty(title))
            {
                title = Utils.MaxLengthText(contentInfo.GetString(ContentAttribute.Content), 30);
            }
            if (string.IsNullOrEmpty(title))
            {
                title = contentInfo.GetString(ContentAttribute.QueryCode);
            }

            var target = ConfigInfo.ApplyIsOpenWindow ? @"target=""_blank""" : string.Empty;

            if (state == EState.Accepted || state == EState.Redo)
            {
                ltlTitle.Text =
                    $@"<a class=""{textClass}"" href=""{PageContentReply.GetRedirectUrl(SiteId,
                        contentInfo.ChannelId, contentInfo.Id, PageUrl)}"" {target}>{title}</a>";
            }
            else if (state == EState.Checked || state == EState.Replied)
            {
                ltlTitle.Text =
                    $@"<a class=""{textClass}"" href=""{PageContentCheck.GetRedirectUrl(SiteId,
                        contentInfo.ChannelId, contentInfo.Id, PageUrl)}"" {target}>{title}</a>";
            }
            else if (state == EState.Denied || state == EState.New)
            {
                ltlTitle.Text =
                    $@"<a class=""{textClass}"" href=""{PageContentAccept.GetRedirectUrl(SiteId,
                        contentInfo.ChannelId, contentInfo.Id, PageUrl)}"" {target}>{title}</a>";
            }

            var departmentId   = contentInfo.GetInt(ContentAttribute.DepartmentId);
            var departmentName = DepartmentManager.GetDepartmentName(departmentId);

            if (departmentId > 0 && departmentName != contentInfo.GetString(ContentAttribute.DepartmentName))
            {
                ltlTitle.Text += "【转办】";
            }
            else if (Utils.ToInt(contentInfo.GetString(ContentAttribute.TranslateFromChannelId)) > 0)
            {
                ltlTitle.Text += "【转移】";
            }
            ltlAddDate.Text    = Utils.GetDateString(contentInfo.AddDate, EDateFormatType.Day);
            ltlRemark.Text     = ApplyManager.GetApplyRemark(SiteId, contentInfo.Id);
            ltlDepartment.Text = departmentName;
            ltlLimit.Text      = ELimitTypeUtils.GetText(limitType);
            ltlState.Text      = EStateUtils.GetText(EStateUtils.GetEnumType(contentInfo.GetString(ContentAttribute.State)));
            ltlFlowUrl.Text    =
                $@"<a href=""javascript:;"" class=""{textClass}"" onclick=""{ModalApplyFlow.GetOpenWindowString(
                    SiteId, contentInfo.ChannelId, contentInfo.Id)}"">轨迹</a>";
            ltlViewUrl.Text =
                $@"<a href=""javascript:;"" class=""{textClass}"" onclick=""{ModalApplyView.GetOpenWindowString(
                    SiteId, contentInfo.ChannelId, contentInfo.Id)}"">查看</a>";
            if (_isPermissionReply)
            {
                ltlReplyUrl.Text =
                    $@"<a href=""javascript:;"" class=""{textClass}"" onclick=""{ModalApplyReply.GetOpenWindowString(
                        SiteId, contentInfo.ChannelId, contentInfo.Id)}"">办理</a>";
            }
            if (_isPermissionEdit)
            {
                ltlEditUrl.Text =
                    $@"<a class=""{textClass}"" href=""{Main.UtilsApi.GetAdminUrl(
                        $"cms/pageContentAdd.aspx?siteId={SiteId}&channelId={contentInfo.ChannelId}&id={contentInfo.Id}&returnUrl={HttpUtility.UrlEncode(Main.PluginApi.GetPluginUrl(Main.PluginId, PageUrl))}")}"">编辑</a>";
            }
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            var channelId = AuthRequest.GetQueryInt("channelId");
            var contentId = AuthRequest.GetQueryInt("contentId");

            _returnUrl = AuthRequest.GetQueryString("returnUrl");

            _contentInfo = Main.ContentApi.GetContentInfo(SiteId, channelId, contentId);
            _adminInfo   = Main.AdminApi.GetAdminInfoByUserId(AuthRequest.AdminId);
            var state = EStateUtils.GetEnumType(_contentInfo.GetString(ContentAttribute.State));

            if (IsPostBack)
            {
                return;
            }

            if (PhBtnAccept != null)
            {
                PhBtnAccept.Visible = InteractManager.IsPermission(SiteId, _contentInfo.ChannelId, Permissions.Accept);
            }
            if (PhBtnSwitchToTranslate != null)
            {
                PhBtnSwitchToTranslate.Visible = InteractManager.IsPermission(SiteId, _contentInfo.ChannelId, Permissions.SwitchToTranslate);
            }
            if (PhBtnReply != null)
            {
                PhBtnReply.Visible = InteractManager.IsPermission(SiteId, _contentInfo.ChannelId, Permissions.Reply);
            }
            if (PhBtnCheck != null)
            {
                PhBtnCheck.Visible = state != EState.Checked && InteractManager.IsPermission(SiteId, _contentInfo.ChannelId, Permissions.Check);
            }
            if (PhBtnComment != null)
            {
                PhBtnComment.Visible = state != EState.Checked && InteractManager.IsPermission(SiteId, _contentInfo.ChannelId, Permissions.Comment);
            }
            if (PhBtnReturn != null)
            {
                PhBtnReturn.Visible = !ConfigInfo.ApplyIsOpenWindow;
            }

            var tableColumns = Main.ContentApi.GetTableColumns(SiteId, _contentInfo.ChannelId);
            var isSingle     = true;

            var builder = new StringBuilder();

            foreach (var tableColumn in tableColumns)
            {
                if (tableColumn.InputStyle == null ||
                    Utils.EqualsIgnoreCase(tableColumn.AttributeName, nameof(IContentInfo.Title)) ||
                    Utils.EqualsIgnoreCase(tableColumn.AttributeName, nameof(IContentInfo.IsHot)) ||
                    Utils.EqualsIgnoreCase(tableColumn.AttributeName, nameof(IContentInfo.IsColor)) ||
                    Utils.EqualsIgnoreCase(tableColumn.AttributeName, nameof(IContentInfo.IsRecommend)) ||
                    Utils.EqualsIgnoreCase(tableColumn.AttributeName, nameof(IContentInfo.IsTop)) ||
                    Utils.EqualsIgnoreCase(tableColumn.AttributeName, ContentAttribute.DepartmentId) ||
                    Utils.EqualsIgnoreCase(tableColumn.AttributeName, ContentAttribute.Content))
                {
                    continue;
                }

                var value = _contentInfo.GetString(tableColumn.AttributeName);
                if (Utils.EqualsIgnoreCase(tableColumn.AttributeName, ContentAttribute.TypeId))
                {
                    value = InteractManager.GetTypeName(Utils.ToInt(value));
                }
                else if (Utils.EqualsIgnoreCase(tableColumn.AttributeName, ContentAttribute.IsPublic))
                {
                    value = Utils.ToBool(value) ? "公开" : "不公开";
                }
                else if (Utils.EqualsIgnoreCase(tableColumn.AttributeName, ContentAttribute.FileUrl))
                {
                    if (!string.IsNullOrEmpty(value))
                    {
                        value =
                            $@"<a href=""{value}"" target=""_blank"">{value}</a>";
                    }
                }
                else if (Utils.EqualsIgnoreCase(tableColumn.AttributeName, ContentAttribute.State))
                {
                    value = EStateUtils.GetText(state);
                }

                if (isSingle)
                {
                    builder.Append("<tr>");
                }

                builder.Append(
                    $@"<th>{tableColumn.InputStyle.DisplayName}</th><td>{value}</td>");

                if (!isSingle)
                {
                    builder.Append("</tr>");
                }

                isSingle = !isSingle;
            }
            if (!isSingle)
            {
                builder.Append("</tr>");
            }

            LtlTitle.Text           = _contentInfo.Title;
            LtlApplyAttributes.Text = builder.ToString();

            LtlContent.Text = _contentInfo.GetString(ContentAttribute.Content);

            if (PhReply != null)
            {
                if (state == EState.Denied || state == EState.Replied || state == EState.Redo || state == EState.Checked)
                {
                    var replyInfo = ReplyDao.GetReplyInfoByContentId(SiteId, _contentInfo.Id);
                    if (replyInfo != null)
                    {
                        PhReply.Visible = true;
                        LtlDepartmentAndUserName.Text =
                            $"{DepartmentManager.GetDepartmentName(replyInfo.DepartmentId)}({replyInfo.UserName})";
                        LtlReplyAddDate.Text = Utils.GetDateAndTimeString(replyInfo.AddDate);
                        LtlReply.Text        = replyInfo.Reply;
                        if (!string.IsNullOrEmpty(replyInfo.FileUrl))
                        {
                            LtlReplyFileUrl.Text =
                                $@"<a href=""{replyInfo.FileUrl}"" target=""_blank"">{replyInfo.FileUrl}</a>";
                        }
                    }
                }
            }

            if (BtnSwitchTo != null)
            {
                var departmentId = _contentInfo.GetInt(ContentAttribute.DepartmentId);
                BtnSwitchTo.Attributes.Add("onclick", ModalDepartmentSelectSingle.GetOpenWindowString(SiteId, _contentInfo.ChannelId));
                var scriptBuilder = new StringBuilder();
                if (departmentId > 0)
                {
                    var departmentName = DepartmentManager.GetDepartmentName(departmentId);
                    scriptBuilder.Append(
                        $@"<script>departmentSelect('{departmentName}', {departmentId});</script>");
                }
                LtlScript.Text = scriptBuilder.ToString();
            }

            if (DdlTranslateChannelId != null)
            {
                var nodeInfoList = InteractManager.GetInteractChannelInfoList(SiteId);
                foreach (var nodeInfo in nodeInfoList)
                {
                    if (nodeInfo.Id != _contentInfo.ChannelId)
                    {
                        var listItem = new ListItem(nodeInfo.ChannelName, nodeInfo.Id.ToString());
                        DdlTranslateChannelId.Items.Add(listItem);
                    }
                }
            }

            RptRemarks.DataSource     = RemarkDao.GetDataSourceByContentId(SiteId, _contentInfo.Id);
            RptRemarks.ItemDataBound += RptRemarks_ItemDataBound;
            RptRemarks.DataBind();

            if (RptLogs != null)
            {
                RptLogs.DataSource     = LogDao.GetDataSourceByContentId(SiteId, _contentInfo.Id);
                RptLogs.ItemDataBound += RptLogs_ItemDataBound;
                RptLogs.DataBind();
            }
        }