Ejemplo n.º 1
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID");
            nodeID = TranslateUtils.ToInt(Request.QueryString["NodeID"]);

            isPermissionReply = GovInteractManager.IsPermission(PublishmentSystemId, nodeID, AppManager.Wcm.Permission.GovInteract.GovInteractReply);
            isPermissionEdit  = GovInteractManager.IsPermission(PublishmentSystemId, nodeID, AppManager.Wcm.Permission.GovInteract.GovInteractEdit);

            if (Body.IsQueryExists("Delete"))
            {
                var arraylist = TranslateUtils.StringCollectionToIntList(Request.QueryString["IDCollection"]);
                if (arraylist.Count > 0)
                {
                    try
                    {
                        DataProvider.ContentDao.DeleteContents(PublishmentSystemId, PublishmentSystemInfo.AuxiliaryTableForGovInteract, arraylist, nodeID);
                        Body.AddSiteLog(PublishmentSystemId, "删除申请", Body.AdministratorName);
                        SuccessMessage("删除成功!");
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "删除失败!");
                    }
                }
            }
            else if (Body.IsQueryExists("Accept"))
            {
                var arraylist = TranslateUtils.StringCollectionToIntList(Request.QueryString["IDCollection"]);
                foreach (var contentId in arraylist)
                {
                    var contentInfo = DataProvider.GovInteractContentDao.GetContentInfo(PublishmentSystemInfo, contentId);
                    if (contentInfo.State == EGovInteractState.New || contentInfo.State == EGovInteractState.Denied)
                    {
                        GovInteractApplyManager.Log(PublishmentSystemId, contentInfo.NodeId, contentInfo.Id, EGovInteractLogType.Accept, Body.AdministratorName, Body.AdministratorInfo.DepartmentId);
                        DataProvider.GovInteractContentDao.UpdateState(PublishmentSystemInfo, contentInfo.Id, EGovInteractState.Accepted);
                    }
                }
                SuccessMessage("受理申请成功!");
            }
            else if (Body.IsQueryExists("Deny"))
            {
                var arraylist = TranslateUtils.StringCollectionToIntList(Request.QueryString["IDCollection"]);
                foreach (var contentId in arraylist)
                {
                    var contentInfo = DataProvider.GovInteractContentDao.GetContentInfo(PublishmentSystemInfo, contentId);
                    if (contentInfo.State == EGovInteractState.New || contentInfo.State == EGovInteractState.Accepted)
                    {
                        GovInteractApplyManager.Log(PublishmentSystemId, contentInfo.NodeId, contentInfo.Id, EGovInteractLogType.Deny, Body.AdministratorName, Body.AdministratorInfo.DepartmentId);
                        DataProvider.GovInteractContentDao.UpdateState(PublishmentSystemInfo, contentId, EGovInteractState.Denied);
                    }
                }
                SuccessMessage("拒绝受理申请成功!");
            }
            else if (Body.IsQueryExists("Check"))
            {
                var arraylist = TranslateUtils.StringCollectionToIntList(Request.QueryString["IDCollection"]);
                foreach (var contentId in arraylist)
                {
                    var contentInfo = DataProvider.GovInteractContentDao.GetContentInfo(PublishmentSystemInfo, contentId);
                    if (contentInfo.State == EGovInteractState.Replied)
                    {
                        GovInteractApplyManager.Log(PublishmentSystemId, contentInfo.NodeId, contentInfo.Id, EGovInteractLogType.Check, Body.AdministratorName, Body.AdministratorInfo.DepartmentId);
                        DataProvider.GovInteractContentDao.UpdateState(PublishmentSystemInfo, contentId, EGovInteractState.Checked);
                    }
                }
                SuccessMessage("审核申请成功!");
            }

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

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

                if (phAccept != null)
                {
                    phAccept.Visible = GovInteractManager.IsPermission(PublishmentSystemId, nodeID, AppManager.Wcm.Permission.GovInteract.GovInteractAccept);
                    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 (phCheck != null)
                {
                    phCheck.Visible = GovInteractManager.IsPermission(PublishmentSystemId, nodeID, AppManager.Wcm.Permission.GovInteract.GovInteractCheck);
                    if (hlCheck != null)
                    {
                        hlCheck.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(PageUrl + "&Check=True", "IDCollection", "IDCollection", "请选择需要审核的申请!", "此操作将审核所选申请,确定吗?"));
                    }
                    if (hlRedo != null)
                    {
                        hlRedo.Attributes.Add("onclick", ModalGovInteractApplyRedo.GetOpenWindowString(PublishmentSystemId));
                    }
                }
                if (phSwitchToTranslate != null)
                {
                    phSwitchToTranslate.Visible = GovInteractManager.IsPermission(PublishmentSystemId, nodeID, AppManager.Wcm.Permission.GovInteract.GovInteractSwitchToTranslate);
                    if (hlSwitchTo != null)
                    {
                        hlSwitchTo.Attributes.Add("onclick", ModalGovInteractApplySwitchTo.GetOpenWindowString(PublishmentSystemId, nodeID));
                    }
                    if (hlTranslate != null)
                    {
                        hlTranslate.Attributes.Add("onclick", ModalGovInteractApplyTranslate.GetOpenWindowString(PublishmentSystemId, nodeID));
                    }
                }
                if (phComment != null)
                {
                    phComment.Visible = GovInteractManager.IsPermission(PublishmentSystemId, nodeID, AppManager.Wcm.Permission.GovInteract.GovInteractComment);
                    hlComment.Attributes.Add("onclick", ModalGovInteractApplyComment.GetOpenWindowString(PublishmentSystemId));
                }
                if (phDelete != null)
                {
                    phDelete.Visible = GovInteractManager.IsPermission(PublishmentSystemId, nodeID, AppManager.Wcm.Permission.GovInteract.GovInteractDelete) && PublishmentSystemInfo.Additional.GovInteractApplyIsDeleteAllowed;
                    hlDelete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(PageUrl + "&Delete=True", "IDCollection", "IDCollection", "请选择需要删除的申请!", "此操作将删除所选申请,确定吗?"));
                }
                if (hlExport != null)
                {
                    hlExport.Attributes.Add("onclick", ModalContentExport.GetOpenWindowString(PublishmentSystemId, nodeID));
                }
            }
        }
Ejemplo n.º 2
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            PageUtils.CheckRequestParameter("ContentID", "ReturnUrl");

            contentInfo = DataProvider.GovInteractContentDao.GetContentInfo(PublishmentSystemInfo, TranslateUtils.ToInt(Request.QueryString["ContentID"]));
            returnUrl   = StringUtils.ValueFromUrl(Request.QueryString["ReturnUrl"]);

            if (!IsPostBack)
            {
                if (phBtnAccept != null)
                {
                    phBtnAccept.Visible = GovInteractManager.IsPermission(PublishmentSystemId, contentInfo.NodeId, AppManager.Wcm.Permission.GovInteract.GovInteractAccept);
                }
                if (phBtnSwitchToTranslate != null)
                {
                    phBtnSwitchToTranslate.Visible = GovInteractManager.IsPermission(PublishmentSystemId, contentInfo.NodeId, AppManager.Wcm.Permission.GovInteract.GovInteractSwitchToTranslate);
                }
                if (phBtnReply != null)
                {
                    phBtnReply.Visible = GovInteractManager.IsPermission(PublishmentSystemId, contentInfo.NodeId, AppManager.Wcm.Permission.GovInteract.GovInteractReply);
                }
                if (phBtnCheck != null)
                {
                    if (contentInfo.State == EGovInteractState.Checked)
                    {
                        phBtnCheck.Visible = false;
                    }
                    else
                    {
                        phBtnCheck.Visible = GovInteractManager.IsPermission(PublishmentSystemId, contentInfo.NodeId, AppManager.Wcm.Permission.GovInteract.GovInteractCheck);
                    }
                }
                if (phBtnComment != null)
                {
                    if (contentInfo.State == EGovInteractState.Checked)
                    {
                        phBtnComment.Visible = false;
                    }
                    else
                    {
                        phBtnComment.Visible = GovInteractManager.IsPermission(PublishmentSystemId, contentInfo.NodeId, AppManager.Wcm.Permission.GovInteract.GovInteractComment);
                    }
                }
                if (phBtnReturn != null)
                {
                    phBtnReturn.Visible = !PublishmentSystemInfo.Additional.GovInteractApplyIsOpenWindow;
                }

                var builder       = new StringBuilder();
                var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.GovInteractContent, PublishmentSystemInfo.AuxiliaryTableForGovInteract, RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, contentInfo.NodeId));

                var isPreviousSingleLine = true;
                var isPreviousLeftColumn = false;
                foreach (var styleInfo in styleInfoList)
                {
                    if (styleInfo.IsVisible && !StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, GovInteractContentAttribute.DepartmentId))
                    {
                        var value = contentInfo.GetExtendedAttribute(styleInfo.AttributeName);
                        if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, GovInteractContentAttribute.TypeId))
                        {
                            value = GovInteractManager.GetTypeName(TranslateUtils.ToInt(value));
                        }
                        else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, GovInteractContentAttribute.IsPublic))
                        {
                            value = TranslateUtils.ToBool(value) ? "公开" : "不公开";
                        }
                        else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, GovInteractContentAttribute.FileUrl))
                        {
                            if (!string.IsNullOrEmpty(value))
                            {
                                value =
                                    $@"<a href=""{PageUtility.ParseNavigationUrl(PublishmentSystemInfo, value)}"" target=""_blank"">{value}</a>";
                            }
                        }

                        if (builder.Length > 0)
                        {
                            if (isPreviousSingleLine)
                            {
                                builder.Append("</tr>");
                            }
                            else
                            {
                                if (!isPreviousLeftColumn)
                                {
                                    builder.Append("</tr>");
                                }
                                else if (styleInfo.IsSingleLine)
                                {
                                    builder.Append(@"<td bgcolor=""#f0f6fc"" class=""attribute""></td><td></td></tr>");
                                }
                            }
                        }

                        //this line

                        if (styleInfo.IsSingleLine || isPreviousSingleLine || !isPreviousLeftColumn)
                        {
                            builder.Append("<tr>");
                        }

                        builder.Append(
                            $@"<td bgcolor=""#f0f6fc"" class=""attribute"">{styleInfo.DisplayName}</td><td {(styleInfo
                                .IsSingleLine
                                ? @"colspan=""3"""
                                : string.Empty)} class=""tdBorder"">{value}</td>");


                        if (styleInfo.IsSingleLine)
                        {
                            isPreviousSingleLine = true;
                            isPreviousLeftColumn = false;
                        }
                        else
                        {
                            isPreviousSingleLine = false;
                            isPreviousLeftColumn = !isPreviousLeftColumn;
                        }
                    }
                }

                if (builder.Length > 0)
                {
                    if (isPreviousSingleLine || !isPreviousLeftColumn)
                    {
                        builder.Append("</tr>");
                    }
                    else
                    {
                        builder.Append(@"<td bgcolor=""#f0f6fc"" class=""attribute""></td><td></td></tr>");
                    }
                }
                ltlTitle.Text           = contentInfo.Title;
                ltlApplyAttributes.Text = builder.ToString();
                ltlAddDate.Text         = DateUtils.GetDateAndTimeString(contentInfo.AddDate);
                ltlQueryCode.Text       = contentInfo.QueryCode;
                ltlState.Text           = EGovInteractStateUtils.GetText(contentInfo.State);
                ltlDepartmentName.Text  = contentInfo.DepartmentName;

                if (phReply != null)
                {
                    if (contentInfo.State == EGovInteractState.Denied || contentInfo.State == EGovInteractState.Replied || contentInfo.State == EGovInteractState.Redo || contentInfo.State == EGovInteractState.Checked)
                    {
                        var replyInfo = DataProvider.GovInteractReplyDao.GetReplyInfoByContentId(PublishmentSystemId, contentInfo.Id);
                        if (replyInfo != null)
                        {
                            phReply.Visible = true;
                            ltlDepartmentAndUserName.Text =
                                $"{DepartmentManager.GetDepartmentName(replyInfo.DepartmentID)}({replyInfo.UserName})";
                            ltlReplyAddDate.Text = DateUtils.GetDateAndTimeString(replyInfo.AddDate);
                            ltlReply.Text        = replyInfo.Reply;
                            if (!string.IsNullOrEmpty(replyInfo.FileUrl))
                            {
                                ltlReplyFileUrl.Text =
                                    $@"<a href=""{PageUtility.ParseNavigationUrl(PublishmentSystemInfo,
                                        replyInfo.FileUrl)}"" target=""_blank"">{replyInfo.FileUrl}</a>";
                            }
                        }
                    }
                }

                if (divAddDepartment != null)
                {
                    divAddDepartment.Attributes.Add("onclick", ModalGovInteractDepartmentSelect.GetOpenWindowString(PublishmentSystemId, contentInfo.NodeId));
                    var scriptBuilder = new StringBuilder();
                    if (contentInfo.DepartmentId > 0)
                    {
                        var departmentName = DepartmentManager.GetDepartmentName(contentInfo.DepartmentId);
                        scriptBuilder.Append(
                            $@"<script>showCategoryDepartment('{departmentName}', '{contentInfo.DepartmentId}');</script>");
                    }
                    ltlScript.Text = scriptBuilder.ToString();
                }

                if (ddlTranslateNodeID != null)
                {
                    var nodeInfoList = GovInteractManager.GetNodeInfoList(PublishmentSystemInfo);
                    foreach (var nodeInfo in nodeInfoList)
                    {
                        if (nodeInfo.NodeId != contentInfo.NodeId)
                        {
                            var listItem = new ListItem(nodeInfo.NodeName, nodeInfo.NodeId.ToString());
                            ddlTranslateNodeID.Items.Add(listItem);
                        }
                    }
                }

                rptRemarks.DataSource     = DataProvider.GovInteractRemarkDao.GetDataSourceByContentId(PublishmentSystemId, contentInfo.Id);
                rptRemarks.ItemDataBound += rptRemarks_ItemDataBound;
                rptRemarks.DataBind();

                if (rptLogs != null)
                {
                    rptLogs.DataSource     = DataProvider.GovInteractLogDao.GetDataSourceByContentId(PublishmentSystemId, contentInfo.Id);
                    rptLogs.ItemDataBound += rptLogs_ItemDataBound;
                    rptLogs.DataBind();
                }
            }
        }