Beispiel #1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _nodeId      = TranslateUtils.ToInt(Request.QueryString["NodeID"]);
            _idArrayList = TranslateUtils.StringCollectionToIntList(Request.QueryString["IDCollection"]);

            if (!IsPostBack)
            {
                divAddDepartment.Attributes.Add("onclick", ModalGovInteractDepartmentSelect.GetOpenWindowString(PublishmentSystemId, _nodeId));
                ltlDepartmentName.Text = DepartmentManager.GetDepartmentName(Body.AdministratorInfo.DepartmentId);
                ltlUserName.Text       = Body.AdministratorInfo.DisplayName;
            }
        }
        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();
                }
            }
        }