Example #1
0
 public FindingService(DBContext context)
 {
     userDao         = new UserDao(context);
     finderDao       = new FinderDao(context);
     replyDao        = new ReplyDao(context);
     replyCommentDao = new ReplyCommentDao(context);
 }
Example #2
0
        public string AddReply(Reply reply)
        {
            var mapper = Common.GetMapper();

            ReplyDao  replydao  = new ReplyDao(mapper);
            TopicDao  topicdao  = new TopicDao(mapper);
            NotifyDao notifydao = new NotifyDao(mapper);

            topicdao.UpdateReplyCount(new TopicQueryForm
            {
                ID            = reply.TopicID,
                LastReplierID = reply.OwnerID,
            });
            topicdao.Update(new TopicUpdateForm
            {
                QueryForm = new TopicQueryForm {
                    ID = reply.TopicID
                },
                Entity = new Topic {
                    LastReplierID = reply.OwnerID
                }
            });
            replydao.Add(reply);
            notifydao.Add(new Notify
            {
                TopicID = reply.TopicID,
                UserID  = reply.ReplyToID,
                ReplyID = reply.ID,
            });

            return(reply.ID);
        }
        public void Reply_OnClick(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(TbReply.Text))
            {
                LtlMessage.Text = Utils.GetMessageHtml("回复失败,必须填写答复内容", false);
                return;
            }
            try
            {
                ReplyDao.DeleteByContentId(SiteId, _contentInfo.Id);
                var fileUrl   = UploadFile(HifFileUrl.PostedFile);
                var replyInfo = new ReplyInfo(0, SiteId, _contentInfo.ChannelId, _contentInfo.Id, TbReply.Text, fileUrl, _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now);
                ReplyDao.Insert(replyInfo);

                ApplyManager.Log(SiteId, _contentInfo.ChannelId, _contentInfo.Id, ELogTypeUtils.GetValue(ELogType.Reply), AuthRequest.AdminName, _adminInfo.DepartmentId);
                if (_adminInfo.DepartmentId > 0)
                {
                    ContentDao.UpdateDepartmentId(SiteId, _contentInfo.ChannelId, _contentInfo.Id, _adminInfo.DepartmentId);
                }
                ContentDao.UpdateState(SiteId, _contentInfo.ChannelId, _contentInfo.Id, EState.Replied);

                LtlMessage.Text = Utils.GetMessageHtml("办件回复成功", true);

                if (!ConfigInfo.ApplyIsOpenWindow)
                {
                    Utils.SwalSuccess("办件回复成功", "", "确 认", $"location.href = '{ListPageUrl}'");
                }
            }
            catch (Exception ex)
            {
                LtlMessage.Text = Utils.GetMessageHtml(ex.Message, false);
            }
        }
Example #4
0
        public void Deny_OnClick(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(TbDenyReply.Text))
            {
                LtlMessage.Text = Utils.GetMessageHtml("拒绝失败,必须填写拒绝理由", false);
                return;
            }

            var contentInfo = Main.ContentApi.GetContentInfo(SiteId, _channelId, _contentId);

            ReplyDao.DeleteByContentId(SiteId, contentInfo.Id);

            var replyInfo = new ReplyInfo(0, SiteId, contentInfo.ChannelId, contentInfo.Id, TbDenyReply.Text,
                                          string.Empty, _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now);

            ReplyDao.Insert(replyInfo);

            ApplyManager.Log(SiteId, contentInfo.ChannelId, contentInfo.Id, ELogTypeUtils.GetValue(ELogType.Deny), AuthRequest.AdminName, _adminInfo.DepartmentId);

            contentInfo.Set(ContentAttribute.State, EStateUtils.GetValue(EState.Denied));
            Main.ContentApi.Update(SiteId, contentInfo.ChannelId, contentInfo);

            LtlMessage.Text = Utils.GetMessageHtml("拒绝申请成功", true);

            var configInfo = Main.GetConfigInfo(SiteId);

            if (!configInfo.ApplyIsOpenWindow)
            {
                Utils.Redirect(_returnUrl);
            }
        }
Example #5
0
        public int GetReplyCount(QueryNotifyReplyForm form)
        {
            var      mapper = Common.GetMapper();
            ReplyDao dao    = new ReplyDao(mapper);

            return(dao.QueryNotifyReplyCount(form));
        }
Example #6
0
        public void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            ReplyDao.DeleteByContentId(SiteId, _contentInfo.Id);
            var fileUrl = UploadFile(HtmlFileUrl.PostedFile);

            var replyInfo = new ReplyInfo(0, SiteId, _contentInfo.ChannelId, _contentInfo.Id, TbReply.Text, string.Empty,
                                          _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now);

            ReplyDao.Insert(replyInfo);

            ApplyManager.Log(SiteId, _contentInfo.ChannelId, _contentInfo.Id, ELogTypeUtils.GetValue(ELogType.Reply), AuthRequest.AdminName, _adminInfo.DepartmentId);

            _contentInfo.Set(ContentAttribute.State, EStateUtils.GetValue(EState.Replied));

            _contentInfo.Set(ContentAttribute.ReplyContent, replyInfo.Reply);
            _contentInfo.Set(ContentAttribute.ReplyFileUrl, replyInfo.FileUrl);
            if (_adminInfo.DepartmentId > 0)
            {
                _contentInfo.Set(ContentAttribute.DepartmentId, _adminInfo.DepartmentId.ToString());
                _contentInfo.Set(ContentAttribute.ReplyDepartmentName, DepartmentManager.GetDepartmentName(_adminInfo.DepartmentId));
            }
            _contentInfo.Set(ContentAttribute.ReplyUserName, _adminInfo.DisplayName);
            _contentInfo.Set(ContentAttribute.ReplyAddDate, replyInfo.AddDate);

            Main.ContentApi.Update(SiteId, _contentInfo.ChannelId, _contentInfo);

            isChanged = true;

            if (isChanged)
            {
                LayerUtils.Close(Page);
            }
        }
Example #7
0
 public MissingService(DBContext context)
 {
     userDao           = new UserDao(context);
     ownerDao          = new OwnerDao(context);
     replyDao          = new ReplyDao(context);
     replyCommentDao   = new ReplyCommentDao(context);
     privateMessageDao = new PrivateMessageDao(context);
 }
Example #8
0
        public bool DeleteReply(string replyID)
        {
            var      mapper = Common.GetMapper();
            ReplyDao dao    = new ReplyDao(mapper);

            return(dao.Delete(new ReplyQueryForm {
                ID = replyID
            }));
        }
Example #9
0
        public static ReplyInfo GetSubscribeReply(string wid)
        {
            IList <ReplyInfo> replies = new ReplyDao().GetReplies(ReplyType.Subscribe, wid);

            if ((replies != null) && (replies.Count > 0))
            {
                return(replies[0]);
            }
            return(null);
        }
Example #10
0
 public HomeService(DBContext context)
 {
     loseTypesDao      = new LoseTypesDao(context);
     userDao           = new UserDao(context);
     ownerDao          = new OwnerDao(context);
     finderDao         = new FinderDao(context);
     replyDao          = new ReplyDao(context);
     privateMessageDao = new PrivateMessageDao(context);
     attentionDao      = new AttentionDao(context);
 }
Example #11
0
        public PaginationEntity <FullReplyInfo> GetReplyList(QueryNotifyReplyForm form)
        {
            PaginationEntity <FullReplyInfo> result = new PaginationEntity <FullReplyInfo>();
            var      mapper = Common.GetMapper();
            ReplyDao dao    = new ReplyDao(mapper);

            result.List        = dao.QueryNotifyReply(form);
            result.RecordCount = form.RecordCount;
            return(result);
        }
Example #12
0
        public static ReplyInfo GetMismatchReply()
        {
            IList <ReplyInfo> replies = new ReplyDao().GetReplies(ReplyType.NoMatch);

            if (replies != null && replies.Count > 0)
            {
                return(replies[0]);
            }
            return(null);
        }
Example #13
0
        public static ReplyInfo GetSubscribeReply()
        {
            IList <ReplyInfo> replies = new ReplyDao().GetReplies(ReplyType.Subscribe);

            if (replies != null && replies.Count > 0)
            {
                return(replies[0]);
            }
            return(null);
        }
Example #14
0
        public static ReplyInfo GetMismatchReply(string wid)
        {
            IList <ReplyInfo> replies = new ReplyDao().GetReplies(ReplyType.NoMatch, wid);

            if ((replies != null) && (replies.Count > 0))
            {
                return(replies[0]);
            }
            return(null);
        }
Example #15
0
        public int AddReply(Reply reply)
        {
            int count = 0;

            reply.DateTime = DateTime.Now;
            try {
                count = ReplyDao.AddReply(reply, DataMapper.Instance);
            }
            catch (Exception) {
                throw;
            }
            return(count);
        }
Example #16
0
        public static ReplyInfo GetMismatchReply()
        {
            IList <ReplyInfo> replies = new ReplyDao().GetReplies(ReplyType.NoMatch);
            ReplyInfo         result;

            if (replies != null && replies.Count > 0)
            {
                result = replies[0];
            }
            else
            {
                result = null;
            }
            return(result);
        }
Example #17
0
        public FullReplyInfo GetReplyDetailList(string replyID)
        {
            var       mappper   = Common.GetMapper();
            ReplyDao  dao       = new ReplyDao(mappper);
            NotifyDao notifyDao = new NotifyDao(mappper);
            var       current   = dao.QueryFullReplyInfo(new ReplyQueryForm {
                ID = replyID
            }).FirstOrDefault();
            var replies = new List <ReplyWithChild>();

            if (current.ReplyID == "0")
            {
                replies = dao.QueryFullReplyInfo(new ReplyQueryForm {
                    ReplyID = replyID, OrderByColumn = "CreateTime", OrderBy = OrderBy.DESC
                });
            }
            else
            {
                current = dao.QueryFullReplyInfo(new ReplyQueryForm {
                    ID = current.ReplyID
                }).FirstOrDefault();
                replies = dao.QueryFullReplyInfo(new ReplyQueryForm {
                    ReplyID = current.ID, OrderByColumn = "CreateTime", OrderBy = OrderBy.DESC
                });
            }
            var replyids = (from r in replies
                            select r.ID).Distinct().ToList();

            notifyDao.Update(new NotifyUpdateForm
            {
                Entity = new Notify {
                    IsRead = 1
                },
                QueryForm = new NotifyQueryForm {
                    ReplyIDs = replyids
                },
            });
            if (current != null)
            {
                current.Children = new List <ReplyWithChild>();
                current.Children.AddRange(replies);
            }
            return(current);
        }
Example #18
0
        public void Page_Load(object sender, EventArgs e)
        {
            _channelId = Utils.ToInt(Request.QueryString["channelId"]);
            _contentId = Utils.ToInt(Request.QueryString["contentId"]);

            _contentInfo = Main.ContentApi.GetContentInfo(SiteId, _channelId, _contentId);
            _adminInfo   = Main.AdminApi.GetAdminInfoByUserId(AuthRequest.AdminId);

            if (!IsPostBack)
            {
                LtlDepartmentName.Text = DepartmentManager.GetDepartmentName(_adminInfo.DepartmentId);
                LtlUserName.Text       = _adminInfo.DisplayName;

                var replyInfo = ReplyDao.GetReplyInfoByContentId(SiteId, _contentId);
                if (replyInfo != null)
                {
                    TbReply.Text = replyInfo.Reply;
                }
            }
        }
Example #19
0
        public bool ReadReply(ReplyQueryForm form)
        {
            var       mapper    = Common.GetMapper();
            ReplyDao  replyDao  = new ReplyDao(mapper);
            NotifyDao notifyDao = new NotifyDao(mapper);
            var       replies   = replyDao.Query(form);
            var       ids       = (from r in replies
                                   select r.ID).ToList();

            notifyDao.Update(new NotifyUpdateForm
            {
                QueryForm = new NotifyQueryForm {
                    ReplyIDs = ids
                },
                Entity = new Notify {
                    IsRead = 1
                }
            });
            return(true);
        }
Example #20
0
        public static bool Createtopic(TopicInfo topic, out int id)
        {
            id = 0;
            bool result;

            if (null == topic)
            {
                result = false;
            }
            else
            {
                Globals.EntityCoding(topic, true);
                id = new TopicDao().AddTopic(topic);
                ReplyInfo replyInfo = new TextReplyInfo();
                replyInfo.Keys        = topic.Keys;
                replyInfo.MatchType   = MatchType.Equal;
                replyInfo.MessageType = MessageType.Text;
                replyInfo.ReplyType   = ReplyType.Topic;
                replyInfo.ActivityId  = id;
                result = new ReplyDao().SaveReply(replyInfo);
            }
            return(result);
        }
Example #21
0
        public TopicDetail GetTopicDetail(string topicID, int pageSize, int currentPageIndex)
        {
            var      mapper   = Common.GetMapper();
            TopicDao topicdao = new TopicDao(mapper);
            ReplyDao replydao = new ReplyDao(mapper);
            var      topic    = topicdao.QueryFullTopicInfo(new TopicQueryForm {
                ID = topicID, Enabled = true
            }).FirstOrDefault();
            var replies = GetReplies(new ReplyQueryForm
            {
                TopicID       = topicID,
                ReplyID       = "0",
                OrderBy       = OrderBy.ASC,
                OrderByColumn = "CreateTime",
                PageSize      = pageSize,
                CurrentIndex  = currentPageIndex,
                Enabled       = true,
            });

            return(new TopicDetail {
                Topic = topic, Replies = replies
            });
        }
Example #22
0
        public PaginationEntity <ReplyWithChild> GetReplies(ReplyQueryForm form)
        {
            PaginationEntity <ReplyWithChild> paging = new PaginationEntity <ReplyWithChild>();
            var      mapper       = Common.GetMapper();
            ReplyDao replydao     = new ReplyDao(mapper);
            var      firstReplies = replydao.QueryFullReplyInfo(form);

            var replyids = (from r in firstReplies
                            select r.ID).ToList();
            var chilren = replydao.QueryFullReplyInfo(new ReplyQueryForm {
                ReplyIDs = replyids, Enabled = true, OrderByColumn = "CreateTime", OrderBy = OrderBy.ASC
            });

            //chilren.Sort((l, r) =>
            //{
            //    return Convert.ToInt16(l.CreateTime < r.CreateTime);
            //});

            firstReplies.ForEach(t =>
            {
                t.Children = new List <ReplyWithChild>();
                for (int i = 0; i < chilren.Count; i++)
                {
                    var reply = chilren[i];
                    if (t.ID.Equals(reply.ReplyID))
                    {
                        t.Children.Add(reply);
                        chilren.Remove(reply);
                        i--;
                    }
                }
            });
            paging.List        = firstReplies;
            paging.RecordCount = form.RecordCount;

            return(paging);
        }
        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();
            }
        }