public void ContentFormSubmited(int siteId, int channelId, IContentInfo contentInfo, IDictionary <string, object> form)
        {
            var categoryChannelId    = TranslateUtils.Get <int>(form, "categoryChannelId");
            var categoryDepartmentId = TranslateUtils.Get <int>(form, "categoryDepartmentId");

            if (categoryChannelId == 0)
            {
                throw new Exception("请选择正确的主题分类");
            }
            contentInfo.ChannelId = categoryChannelId;
            if (categoryDepartmentId == 0)
            {
                throw new Exception("请选择正确的机构分类");
            }
            contentInfo.Set(ContentAttribute.DepartmentId, categoryDepartmentId.ToString());

            var classInfoList = Main.CategoryClassRepository.GetCategoryClassInfoList(siteId);

            foreach (var classInfo in classInfoList)
            {
                if (classInfo.IsSystem || !classInfo.IsEnabled)
                {
                    continue;
                }

                var attributeName  = PublicManager.GetCategoryContentAttributeName(classInfo.ClassCode);
                var attributeValue = TranslateUtils.Get <int>(form, attributeName);

                contentInfo.Set(attributeName, attributeValue.ToString());

                //if (attributeValue > 0)
                //{
                //    CategoryDao.UpdateContentNum(PublishmentSystemInfo, categoryClassInfo.ContentAttributeName, categoryId);
                //}
            }

            if (contentInfo.Id == 0)
            {
                var identifier = PublicManager.GetIdentifier(siteId, categoryChannelId,
                                                             categoryDepartmentId, contentInfo);
                contentInfo.Set(nameof(ContentAttribute.Identifier), identifier);
            }
            else
            {
                var effectDate = contentInfo.Get <DateTime>(ContentAttribute.EffectDate);
                if (string.IsNullOrEmpty(contentInfo.Get <string>(ContentAttribute.Identifier)) || PublicManager.IsIdentifierChanged(siteId, categoryChannelId, categoryDepartmentId, effectDate, contentInfo))
                {
                    var identifier = PublicManager.GetIdentifier(siteId, categoryChannelId,
                                                                 categoryDepartmentId, contentInfo);
                    contentInfo.Set(nameof(ContentAttribute.Identifier), identifier);
                }
            }
        }
        public void Translate_OnClick(object sender, EventArgs e)
        {
            var translateChannelId = Utils.ToInt(DdlTranslateChannelId.SelectedValue);

            if (translateChannelId == 0)
            {
                LtlMessage.Text = Utils.GetMessageHtml("转移失败,必须选择转移目标", false);
                return;
            }
            try
            {
                _contentInfo.Set(ContentAttribute.TranslateFromChannelId, _contentInfo.ChannelId.ToString());
                _contentInfo.ChannelId = translateChannelId;
                Main.ContentApi.Update(SiteId, _contentInfo.ChannelId, _contentInfo);

                if (!string.IsNullOrEmpty(TbTranslateRemark.Text))
                {
                    var remarkInfo = new RemarkInfo(0, SiteId, _contentInfo.ChannelId, _contentInfo.Id, ERemarkTypeUtils.GetValue(ERemarkType.Translate), TbTranslateRemark.Text, _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now);
                    RemarkDao.Insert(remarkInfo);
                }

                ApplyManager.LogTranslate(SiteId, _contentInfo.ChannelId, _contentInfo.Id, Main.ChannelApi.GetChannelName(SiteId, _contentInfo.ChannelId), AuthRequest.AdminName, _adminInfo.DepartmentId);

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

                if (!ConfigInfo.ApplyIsOpenWindow)
                {
                    Utils.SwalSuccess("办件转移成功", "", "确 认", $"location.href = '{ListPageUrl}'");
                }
            }
            catch (Exception ex)
            {
                LtlMessage.Text = Utils.GetMessageHtml(ex.Message, false);
            }
        }
Beispiel #3
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);
            }
        }