Example #1
0
        public GovInteractContentInfo GetContentInfo(PublishmentSystemInfo publishmentSystemInfo, int contentId)
        {
            GovInteractContentInfo info = null;

            if (contentId > 0)
            {
                if (!string.IsNullOrEmpty(publishmentSystemInfo.AuxiliaryTableForGovInteract))
                {
                    string sqlWhere  = $"WHERE ID = {contentId}";
                    var    sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(publishmentSystemInfo.AuxiliaryTableForGovInteract, SqlUtils.Asterisk, sqlWhere);

                    using (var rdr = ExecuteReader(sqlSelect))
                    {
                        if (rdr.Read())
                        {
                            info = new GovInteractContentInfo();
                            BaiRongDataProvider.DatabaseDao.ReadResultsToExtendedAttributes(rdr, info);
                        }
                        rdr.Close();
                    }
                }
            }

            if (info != null)
            {
                info.AfterExecuteReader();
            }
            return(info);
        }
Example #2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

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

            _contentInfo = DataProvider.GovInteractContentDao.GetContentInfo(PublishmentSystemInfo, TranslateUtils.ToInt(Request.QueryString["ContentID"]));

            if (!IsPostBack)
            {
                ltlDepartmentName.Text = DepartmentManager.GetDepartmentName(Body.AdministratorInfo.DepartmentId);
                ltlUserName.Text       = Body.AdministratorInfo.DisplayName;
            }
        }
Example #3
0
        public GovInteractContentInfo GetContentInfo(PublishmentSystemInfo publishmentSystemInfo, int nodeId, NameValueCollection form)
        {
            var queryCode      = GovInteractApplyManager.GetQueryCode();
            var departmentId   = TranslateUtils.ToInt(form[GovInteractContentAttribute.DepartmentId]);
            var departmentName = string.Empty;

            if (departmentId > 0)
            {
                departmentName = DepartmentManager.GetDepartmentName(departmentId);
            }

            var ipAddress = PageUtils.GetIpAddress();

            var contentInfo = new GovInteractContentInfo();

            contentInfo.PublishmentSystemId = publishmentSystemInfo.PublishmentSystemId;
            contentInfo.NodeId         = nodeId;
            contentInfo.DepartmentName = departmentName;
            contentInfo.QueryCode      = queryCode;
            contentInfo.State          = EGovInteractState.New;
            contentInfo.AddUserName    = string.Empty;
            contentInfo.IpAddress      = ipAddress;
            contentInfo.AddDate        = DateTime.Now;

            var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemInfo.PublishmentSystemId, nodeId);

            InputTypeParser.AddValuesToAttributes(ETableStyle.GovInteractContent, publishmentSystemInfo.AuxiliaryTableForGovInteract, publishmentSystemInfo, relatedIdentities, form, contentInfo.Attributes);

            //foreach (string name in form.AllKeys)
            //{
            //    if (!GovInteractContentAttribute.HiddenAttributes.Contains(name.ToLower()))
            //    {
            //        string value = form[name];
            //        if (!string.IsNullOrEmpty(value))
            //        {
            //            applyInfo.SetExtendedAttribute(name, value);
            //        }
            //    }
            //}

            return(contentInfo);
        }
Example #4
0
        public GovInteractContentInfo GetContentInfo(PublishmentSystemInfo publishmentSystemInfo, int nodeId, string queryCode)
        {
            GovInteractContentInfo info = null;
            string sqlWhere             =
                $"WHERE PublishmentSystemID = {publishmentSystemInfo.PublishmentSystemId} AND NodeID = {nodeId} AND QueryCode = '{queryCode}'";
            var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(publishmentSystemInfo.AuxiliaryTableForGovInteract, SqlUtils.Asterisk, sqlWhere);

            using (var rdr = ExecuteReader(sqlSelect))
            {
                if (rdr.Read())
                {
                    info = new GovInteractContentInfo();
                    BaiRongDataProvider.DatabaseDao.ReadResultsToExtendedAttributes(rdr, info);
                }
                rdr.Close();
            }

            if (info != null)
            {
                info.AfterExecuteReader();
            }
            return(info);
        }
        void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var contentInfo = new GovInteractContentInfo(e.Item.DataItem);

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

                var limitType = EGovInteractLimitType.Normal;
                ltlTr.Text = @"<tr>";
                if (contentInfo.State == EGovInteractState.Denied || contentInfo.State == EGovInteractState.Checked)
                {
                    ltlTr.Text = @"<tr class=""success"">";
                }
                else
                {
                    limitType = GovInteractApplyManager.GetLimitType(PublishmentSystemInfo, contentInfo);
                    if (limitType == EGovInteractLimitType.Alert)
                    {
                        ltlTr.Text = @"<tr class=""info"">";
                    }
                    else if (limitType == EGovInteractLimitType.Yellow)
                    {
                        ltlTr.Text = @"<tr class=""warning"">";
                    }
                    else if (limitType == EGovInteractLimitType.Red)
                    {
                        ltlTr.Text = @"<tr class=""error"">";
                    }
                }

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

                var title = contentInfo.Title;
                if (string.IsNullOrEmpty(title))
                {
                    title = StringUtils.MaxLengthText(contentInfo.Content, 30);
                }
                if (string.IsNullOrEmpty(title))
                {
                    title = contentInfo.QueryCode;
                }

                var target = PublishmentSystemInfo.Additional.GovInteractApplyIsOpenWindow ? @"target=""_blank""" : string.Empty;
                if (contentInfo.State == EGovInteractState.Accepted || contentInfo.State == EGovInteractState.Redo)
                {
                    ltlTitle.Text =
                        $@"<a href=""{PageGovInteractPageReply.GetRedirectUrl(PublishmentSystemId,
                            contentInfo.NodeId, contentInfo.Id, PageUrl)}"" {target}>{title}</a>";
                }
                else if (contentInfo.State == EGovInteractState.Checked || contentInfo.State == EGovInteractState.Replied)
                {
                    ltlTitle.Text =
                        $@"<a href=""{PageGovInteractPageCheck.GetRedirectUrl(PublishmentSystemId,
                            contentInfo.NodeId, contentInfo.Id, PageUrl)}"" {target}>{title}</a>";
                }
                else if (contentInfo.State == EGovInteractState.Denied || contentInfo.State == EGovInteractState.New)
                {
                    ltlTitle.Text =
                        $@"<a href=""{PageGovInteractPageAccept.GetRedirectUrl(PublishmentSystemId,
                            contentInfo.NodeId, contentInfo.Id, PageUrl)}"" {target}>{title}</a>";
                }
                var departmentName = DepartmentManager.GetDepartmentName(contentInfo.DepartmentId);
                if (contentInfo.DepartmentId > 0 && departmentName != contentInfo.DepartmentName)
                {
                    ltlTitle.Text += "<span style='color:red'>【转办】</span>";
                }
                else if (TranslateUtils.ToInt(contentInfo.GetExtendedAttribute(GovInteractContentAttribute.TranslateFromNodeId)) > 0)
                {
                    ltlTitle.Text += "<span style='color:red'>【转移】</span>";
                }
                ltlAddDate.Text    = DateUtils.GetDateAndTimeString(contentInfo.AddDate);
                ltlRemark.Text     = GovInteractApplyManager.GetApplyRemark(PublishmentSystemId, contentInfo.Id);
                ltlDepartment.Text = departmentName;
                ltlLimit.Text      = EGovInteractLimitTypeUtils.GetText(limitType);
                ltlState.Text      = EGovInteractStateUtils.GetText(contentInfo.State);
                if (contentInfo.State == EGovInteractState.New)
                {
                    ltlState.Text = $"<span style='color:red'>{ltlState.Text}</span>";
                }
                else if (contentInfo.State == EGovInteractState.Redo)
                {
                    ltlState.Text = $"<span style='color:red'>{ltlState.Text}</span>";
                }
                ltlFlowUrl.Text =
                    $@"<a href=""javascript:;"" onclick=""{ModalGovInteractApplyFlow.GetOpenWindowString(
                        PublishmentSystemId, contentInfo.NodeId, contentInfo.Id)}"">轨迹</a>";
                ltlViewUrl.Text =
                    $@"<a href=""javascript:;"" onclick=""{ModalGovInteractApplyView.GetOpenWindowString(
                        PublishmentSystemId, contentInfo.NodeId, contentInfo.Id)}"">查看</a>";
                if (isPermissionReply)
                {
                    ltlReplyUrl.Text =
                        $@"<a href=""javascript:;"" onclick=""{ModalGovInteractApplyReply.GetOpenWindowString(
                            PublishmentSystemId, contentInfo.NodeId, contentInfo.Id)}"">办理</a>";
                }
                if (isPermissionEdit)
                {
                    var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, contentInfo.NodeId);
                    ltlEditUrl.Text =
                        $@"<a href=""{WebUtils.GetContentAddEditUrl(PublishmentSystemId, nodeInfo, contentInfo.Id,
                            PageUrl)}"">编辑</a>";
                }
            }
        }
        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();
                }
            }
        }
Example #7
0
        public static EGovInteractLimitType GetLimitType(PublishmentSystemInfo publishmentSystemInfo, GovInteractContentInfo contentInfo)
        {
            var ts = new TimeSpan(DateTime.Now.Ticks - contentInfo.AddDate.Ticks);

            var alert  = publishmentSystemInfo.Additional.GovInteractApplyDateLimit + publishmentSystemInfo.Additional.GovInteractApplyAlertDate;
            var yellow = alert + publishmentSystemInfo.Additional.GovInteractApplyYellowAlertDate;
            var red    = yellow + publishmentSystemInfo.Additional.GovInteractApplyRedAlertDate;

            if (ts.Days >= red)
            {
                return(EGovInteractLimitType.Red);
            }
            else if (ts.Days >= yellow)
            {
                return(EGovInteractLimitType.Yellow);
            }
            else if (ts.Days >= alert)
            {
                return(EGovInteractLimitType.Alert);
            }

            return(EGovInteractLimitType.Normal);
        }
        public static string GetCallbackScript(PublishmentSystemInfo publishmentSystemInfo, bool isSuccess, GovInteractContentInfo contentInfo, string failureMessage)
        {
            var jsonAttributes = new NameValueCollection();

            jsonAttributes.Add("isSuccess", isSuccess.ToString().ToLower());
            if (isSuccess && contentInfo != null)
            {
                foreach (string attributeName in contentInfo.Attributes.Keys)
                {
                    jsonAttributes.Add(attributeName, contentInfo.GetExtendedAttribute(attributeName));
                }
                jsonAttributes.Add("replystate", EGovInteractStateUtils.GetFrontText(contentInfo.State));
                if (contentInfo.State == EGovInteractState.Checked || contentInfo.State == EGovInteractState.Denied)
                {
                    var replyInfo = DataProvider.GovInteractReplyDao.GetReplyInfoByContentId(publishmentSystemInfo.PublishmentSystemId, contentInfo.Id);
                    if (replyInfo != null)
                    {
                        jsonAttributes.Add("replycontent", replyInfo.Reply);
                        jsonAttributes.Add("replyfileurl", replyInfo.FileUrl);
                        jsonAttributes.Add("replydepartmentname", DepartmentManager.GetDepartmentName(replyInfo.DepartmentID));
                        jsonAttributes.Add("replyusername", replyInfo.UserName);
                        jsonAttributes.Add("replyadddate", DateUtils.GetDateAndTimeString(replyInfo.AddDate));
                    }
                }
            }
            jsonAttributes.Add("failureMessage", failureMessage);

            var jsonString = TranslateUtils.NameValueCollectionToJsonString(jsonAttributes);

            jsonString = StringUtils.ToJsString(jsonString);

            return($"<script>window.parent.stlQueryCallback('{jsonString}');</script>");
        }