コード例 #1
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isSuccess = false;

            try
            {
                _channelInfo.Additional.TransType         = ECrossSiteTransTypeUtils.GetEnumType(DdlTransType.SelectedValue);
                _channelInfo.Additional.TransSiteId       = _channelInfo.Additional.TransType == ECrossSiteTransType.SpecifiedSite ? TranslateUtils.ToInt(DdlSiteId.SelectedValue) : 0;
                _channelInfo.Additional.TransChannelIds   = ControlUtils.GetSelectedListControlValueCollection(LbChannelId);
                _channelInfo.Additional.TransChannelNames = TbNodeNames.Text;

                _channelInfo.Additional.TransIsAutomatic = TranslateUtils.ToBool(DdlIsAutomatic.SelectedValue);

                var translateDoneType = ETranslateContentTypeUtils.GetEnumType(DdlTranslateDoneType.SelectedValue);
                _channelInfo.Additional.TransDoneType = translateDoneType;

                DataProvider.ChannelDao.Update(_channelInfo);

                AuthRequest.AddSiteLog(SiteId, "修改跨站转发设置");

                isSuccess = true;
            }
            catch (Exception ex)
            {
                FailMessage(ex, ex.Message);
            }

            if (isSuccess)
            {
                LayerUtils.Close(Page);
            }
        }
コード例 #2
0
ファイル: ModalFormAdd.cs プロジェクト: rzflybird/SS.Form
        public void Submit_OnClick(object sender, EventArgs e)
        {
            try
            {
                if (Main.Instance.FormDao.IsTitleExists(_siteId, TbTitle.Text))
                {
                    LtlMessage.Text = Utils.GetMessageHtml("表单添加失败,表单名称已存在!", false);
                    return;
                }

                var formInfo = new FormInfo
                {
                    Title       = TbTitle.Text,
                    Description = TbDescription.Text,
                    SiteId      = _siteId,
                    IsTimeout   = false,
                    TimeToStart = DateTime.Now,
                    TimeToEnd   = DateTime.Now.AddMonths(3)
                };

                Main.Instance.FormDao.Insert(formInfo);

                LayerUtils.Close(Page);
            }
            catch (Exception ex)
            {
                LtlMessage.Text = Utils.GetMessageHtml($"提交失败:{ex.Message}!", false);
            }
        }
コード例 #3
0
ファイル: ModalFormImport.cs プロジェクト: rzflybird/SS.Form
        public void Submit_OnClick(object sender, EventArgs e)
        {
            if (HifImport.PostedFile == null || "" == HifImport.PostedFile.FileName)
            {
                return;
            }

            var filePath = HifImport.PostedFile.FileName;

            if (!Utils.EqualsIgnoreCase(Path.GetExtension(filePath), ".zip"))
            {
                LtlMessage.Text = Utils.GetMessageHtml("表单导入失败,必须上传ZIP文件!", false);
                return;
            }

            try
            {
                var localFilePath = Main.Instance.FilesApi.GetTemporaryFilesPath(Path.GetFileName(filePath));

                HifImport.PostedFile.SaveAs(localFilePath);

                //Utils.ImportInput(_siteId, localFilePath);

                LayerUtils.Close(Page);
            }
            catch (Exception ex)
            {
                LtlMessage.Text = Utils.GetMessageHtml($"导入错误:{ex.Message}", false);
            }
        }
コード例 #4
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (HifMyFile.PostedFile != null && "" != HifMyFile.PostedFile.FileName)
            {
                var filePath = HifMyFile.PostedFile.FileName;
                if (!EFileSystemTypeUtils.IsZip(PathUtils.GetExtension(filePath)))
                {
                    FailMessage("必须上传Zip压缩文件");
                    return;
                }

                try
                {
                    var localFilePath = PathUtils.GetTemporaryFilesPath(PathUtils.GetFileName(filePath));

                    HifMyFile.PostedFile.SaveAs(localFilePath);

                    ImportObject.ImportTableStyleByZipFile(_tableName, _relatedIdentity, localFilePath);

                    AuthRequest.AddSiteLog(SiteId, "导入表单显示样式");

                    LayerUtils.Close(Page);
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "导入表样式失败!");
                }
            }
        }
コード例 #5
0
        public void Submit_OnClick(object sender, EventArgs e)
        {
            TypeInfo typeInfo = null;

            if (_id > 0)
            {
                try
                {
                    typeInfo = TypeDao.GetTypeInfo(_id);
                    if (typeInfo != null)
                    {
                        if (typeInfo.TypeName == TbTypeName.Text)
                        {
                            LtlMessage.Text = Utils.GetMessageHtml("办件类型名称不能与原来相同!", false);
                        }
                        else
                        {
                            var typeNameArrayList = TypeDao.GetTypeNameList(_channelId);
                            if (typeNameArrayList.IndexOf(TbTypeName.Text) != -1)
                            {
                                LtlMessage.Text = Utils.GetMessageHtml($"办件类型添加失败,办件类型名称已存在!", false);
                            }
                            else
                            {
                                typeInfo.TypeName = TbTypeName.Text;
                                TypeDao.Update(typeInfo);
                                LtlMessage.Text = Utils.GetMessageHtml("办件类型修改成功!", true);
                                LayerUtils.Close(Page);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    LtlMessage.Text = Utils.GetMessageHtml($"办件类型修改失败,{ex.Message}", false);
                }
            }
            else
            {
                var typeNameArrayList = TypeDao.GetTypeNameList(_channelId);
                if (typeNameArrayList.IndexOf(TbTypeName.Text) != -1)
                {
                    LtlMessage.Text = Utils.GetMessageHtml($"办件类型添加失败,办件类型名称已存在!", false);
                }
                else
                {
                    try
                    {
                        typeInfo = new TypeInfo(0, TbTypeName.Text, _channelId, SiteId, 0);
                        TypeDao.Insert(typeInfo);
                        LtlMessage.Text = Utils.GetMessageHtml("办件类型添加成功!", true);
                        LayerUtils.Close(Page);
                    }
                    catch (Exception ex)
                    {
                        LtlMessage.Text = Utils.GetMessageHtml($"办件类型添加失败,{ex.Message}", false);
                    }
                }
            }
        }
コード例 #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);
            }
        }
コード例 #7
0
ファイル: ModalImport.cs プロジェクト: ym1100/siteserver-cms
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (StringUtils.EqualsIgnoreCase(_type, TypeRelatedField))
            {
                if (HifMyFile.PostedFile != null && "" != HifMyFile.PostedFile.FileName)
                {
                    var filePath = HifMyFile.PostedFile.FileName;
                    if (EFileSystemTypeUtils.GetEnumType(Path.GetExtension(filePath)) != EFileSystemType.Zip)
                    {
                        FailMessage("必须上传ZIP文件");
                        return;
                    }

                    try
                    {
                        var localFilePath = PathUtils.GetTemporaryFilesPath(Path.GetFileName(filePath));

                        HifMyFile.PostedFile.SaveAs(localFilePath);

                        var importObject = new ImportObject(SiteId, AuthRequest.AdminName);
                        importObject.ImportRelatedFieldByZipFile(localFilePath, TranslateUtils.ToBool(DdlIsOverride.SelectedValue));

                        AuthRequest.AddSiteLog(SiteId, "导入联动字段");

                        LayerUtils.Close(Page);
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "导入联动字段失败!");
                    }
                }
            }
        }
コード例 #8
0
        public void BtnValidate_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            var fieldId   = Utils.ToInt(Request.QueryString["fieldId"]);
            var fieldInfo = Main.Instance.FieldDao.GetFieldInfo(fieldId, false);
            var settings  = new FieldSettings(fieldInfo.Settings)
            {
                IsRequired   = Convert.ToBoolean(DdlIsRequired.SelectedValue),
                MinNum       = Utils.ToInt(TbMinNum.Text),
                MaxNum       = Utils.ToInt(TbMaxNum.Text),
                ValidateType = ValidateTypeUtils.GetEnumType(DdlValidateType.SelectedValue)
            };

            fieldInfo.Settings = settings.ToString();

            try
            {
                Main.Instance.FieldDao.Update(fieldInfo);
                isChanged = true;
            }
            catch (Exception ex)
            {
                LtlMessage.Text = Utils.GetMessageHtml($"设置表单验证失败:{ex.Message}", false);
            }

            if (isChanged)
            {
                LayerUtils.Close(Page);
            }
        }
コード例 #9
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (HifFile.PostedFile != null && "" != HifFile.PostedFile.FileName)
            {
                var filePath = HifFile.PostedFile.FileName;
                if (!EFileSystemTypeUtils.IsZip(PathUtils.GetExtension(filePath)))
                {
                    FailMessage("必须上传Zip压缩文件");
                    return;
                }

                try
                {
                    var localFilePath = PathUtils.GetTemporaryFilesPath(PathUtils.GetFileName(filePath));

                    HifFile.PostedFile.SaveAs(localFilePath);

                    var importObject = new ImportObject(SiteId, AuthRequest.AdminName);
                    importObject.ImportChannelsAndContentsByZipFile(TranslateUtils.ToInt(DdlParentChannelId.SelectedValue), localFilePath, TranslateUtils.ToBool(DdlIsOverride.SelectedValue));

                    AuthRequest.AddSiteLog(SiteId, "导入栏目");

                    LayerUtils.Close(Page);
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "导入栏目失败!");
                }
            }
        }
コード例 #10
0
        public void Submit_OnClick(object sender, EventArgs e)
        {
            foreach (ListItem item in CblDisplayAttributes.Items)
            {
                foreach (var fieldInfo in _fieldInfoList)
                {
                    if (fieldInfo.Title != item.Value)
                    {
                        continue;
                    }

                    var settings = new FieldSettings(fieldInfo.Settings);
                    if (settings.IsVisibleInList != item.Selected)
                    {
                        settings.IsVisibleInList = item.Selected;
                        fieldInfo.Settings       = settings.ToString();
                        Main.Instance.FieldDao.Update(fieldInfo);
                    }

                    break;
                }
            }

            LayerUtils.Close(Page);
        }
コード例 #11
0
        public void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            try
            {
                if (string.IsNullOrEmpty(tbCommentRemark.Text))
                {
                    LtlMessage.Text = Utils.GetMessageHtml("批示失败,必须填写意见!", false);
                    return;
                }

                foreach (int contentID in _idArrayList)
                {
                    var remarkInfo = new RemarkInfo(0, SiteId, _channelId, contentID, ERemarkTypeUtils.GetValue(ERemarkType.Comment), tbCommentRemark.Text, _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now);
                    RemarkDao.Insert(remarkInfo);

                    ApplyManager.Log(SiteId, _channelId, contentID, ELogTypeUtils.GetValue(ELogType.Comment), AuthRequest.AdminName, _adminInfo.DepartmentId);
                }

                isChanged = true;
            }
            catch (Exception ex)
            {
                LtlMessage.Text = Utils.GetMessageHtml(ex.Message, false);
                isChanged       = false;
            }

            if (isChanged)
            {
                LayerUtils.Close(Page);
            }
        }
コード例 #12
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (_isHeadquarters)
            {
                var list = DataProvider.SiteDao.GetLowerSiteDirList(SiteInfo.ParentId);
                if (list.IndexOf(TbSiteDir.Text.Trim().ToLower()) != -1)
                {
                    FailMessage("操作失败,已存在相同的发布路径");
                    return;
                }
                if (!DirectoryUtils.IsDirectoryNameCompliant(TbSiteDir.Text))
                {
                    FailMessage("操作失败,文件夹名称不符合要求");
                    return;
                }
                var filesToSite = new ArrayList();
                foreach (ListItem item in CblFilesToSite.Items)
                {
                    if (item.Selected)
                    {
                        filesToSite.Add(item.Value);
                    }
                }
                DirectoryUtility.ChangeToSubSite(SiteInfo, TbSiteDir.Text, filesToSite);
            }
            else
            {
                DirectoryUtility.ChangeToHeadquarters(SiteInfo, TranslateUtils.ToBool(DdlIsMoveFiles.SelectedValue));
            }

            AuthRequest.AddAdminLog(_isHeadquarters ? "转移到子目录" : "转移到根目录",
                                    $"站点:{SiteInfo.SiteName}");
            LayerUtils.Close(Page);
        }
コード例 #13
0
        public void Add_OnClick(object sender, EventArgs e)
        {
            var fieldType = DdlFieldType.SelectedValue;

            if (Utils.IsSelectFieldType(fieldType))
            {
                var isRapid = Convert.ToBoolean(DdlIsRapid.SelectedValue);
                if (!isRapid)
                {
                    var itemCount = Utils.ToInt(TbItemCount.Text);
                    if (itemCount == 0)
                    {
                        LtlMessage.Text = Utils.GetMessageHtml("操作失败,选项数目必须大于0!", false);
                        return;
                    }
                }
            }

            var fieldId   = Utils.ToInt(Request.QueryString["fieldId"]);
            var fieldInfo = fieldId > 0
                ? Main.Instance.FieldDao.GetFieldInfo(fieldId, true)
                : new FieldInfo
            {
                FormId = FormInfo.Id
            };

            fieldInfo.FieldType = fieldType;

            var isChanged = InsertUpdateFieldInfo(fieldInfo);

            if (isChanged)
            {
                LayerUtils.Close(Page);
            }
        }
コード例 #14
0
ファイル: ModalAdminPassword.cs プロジェクト: yunxb/cms
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (!IsPostBack || !IsValid)
            {
                return;
            }

            try
            {
                var adminInfo = AdminManager.GetAdminInfoByUserName(_userName);
                if (!DataProvider.AdministratorDao.ChangePassword(adminInfo, TbPassword.Text, out string errorMessage))
                {
                    FailMessage(errorMessage);
                    return;
                }

                AuthRequest.AddAdminLog("重设管理员密码", $"管理员:{_userName}");

                SuccessMessage("重设密码成功!");

                LayerUtils.Close(Page);
            }
            catch (Exception ex)
            {
                FailMessage(ex, "重设密码失败!");
            }
        }
コード例 #15
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (!IsPostBack || !IsValid)
            {
                return;
            }

            try
            {
                string errorMessage;
                if (DataProvider.UserDao.ChangePassword(_userName, TbPassword.Text, out errorMessage))
                {
                    SuccessMessage("重设密码成功!");
                }
                else
                {
                    FailMessage(errorMessage);
                    return;
                }

                LayerUtils.Close(Page);
            }
            catch (Exception ex)
            {
                FailMessage(ex, "重设密码失败!");
            }
        }
コード例 #16
0
ファイル: ModalTaxis.cs プロジェクト: zhongqi013/cms
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (HifMyFile.PostedFile == null || HifMyFile.PostedFile.FileName == "")
            {
                return;
            }

            var filePath = HifMyFile.PostedFile.FileName;

            if (EFileSystemTypeUtils.GetEnumType(Path.GetExtension(filePath)) != EFileSystemType.Zip)
            {
                FailMessage("必须上传ZIP文件");
                return;
            }

            try
            {
                //var localFilePath = PathUtils.GetTemporaryFilesPath(Path.GetFileName(filePath));

                //HifMyFile.PostedFile.SaveAs(localFilePath);

                //var importObject = new ImportObject(SiteId);
                //importObject.ImportRelatedFieldByZipFile(localFilePath, TranslateUtils.ToBool(DdlIsOverride.SelectedValue));

                //Body.AddSiteLog(SiteId, "导入联动字段");

                LayerUtils.Close(Page);
            }
            catch (Exception ex)
            {
                FailMessage(ex, "导入联动字段失败!");
            }
        }
コード例 #17
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (!Page.IsPostBack || !Page.IsValid)
            {
                return;
            }

            var fileCount = TranslateUtils.ToInt(Request.Form["File_Count"]);

            if (fileCount == 1)
            {
                var fileName    = Request.Form["fileName_1"];
                var redirectUrl = WebUtils.GetContentAddUploadWordUrl(SiteId, _channelInfo, CbIsFirstLineTitle.Checked, CbIsFirstLineRemove.Checked, CbIsClearFormat.Checked, CbIsFirstLineIndent.Checked, CbIsClearFontSize.Checked, CbIsClearFontFamily.Checked, CbIsClearImages.Checked, TranslateUtils.ToIntWithNagetive(DdlContentLevel.SelectedValue), fileName, _returnUrl);
                LayerUtils.CloseAndRedirect(Page, redirectUrl);

                return;
            }
            if (fileCount > 1)
            {
                var tableName         = ChannelManager.GetTableName(SiteInfo, _channelInfo);
                var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelInfo.Id);
                var styleInfoList     = TableStyleManager.GetTableStyleInfoList(tableName, relatedIdentities);

                for (var index = 1; index <= fileCount; index++)
                {
                    var fileName = Request.Form["fileName_" + index];
                    if (!string.IsNullOrEmpty(fileName))
                    {
                        var formCollection = WordUtils.GetWordNameValueCollection(SiteId, CbIsFirstLineTitle.Checked, CbIsFirstLineRemove.Checked, CbIsClearFormat.Checked, CbIsFirstLineIndent.Checked, CbIsClearFontSize.Checked, CbIsClearFontFamily.Checked, CbIsClearImages.Checked, TranslateUtils.ToInt(DdlContentLevel.SelectedValue), fileName);

                        if (!string.IsNullOrEmpty(formCollection[ContentAttribute.Title]))
                        {
                            var contentInfo = new ContentInfo();

                            BackgroundInputTypeParser.SaveAttributes(contentInfo, SiteInfo, styleInfoList, formCollection, ContentAttribute.AllAttributesLowercase);

                            contentInfo.ChannelId        = _channelInfo.Id;
                            contentInfo.SiteId           = SiteId;
                            contentInfo.AddUserName      = Body.AdminName;
                            contentInfo.AddDate          = DateTime.Now;
                            contentInfo.LastEditUserName = contentInfo.AddUserName;
                            contentInfo.LastEditDate     = contentInfo.AddDate;

                            contentInfo.CheckedLevel = TranslateUtils.ToIntWithNagetive(DdlContentLevel.SelectedValue);
                            contentInfo.IsChecked    = contentInfo.CheckedLevel >= SiteInfo.Additional.CheckContentLevel;

                            contentInfo.Id = DataProvider.ContentDao.Insert(tableName, SiteInfo, contentInfo);

                            if (contentInfo.IsChecked)
                            {
                                CreateManager.CreateContentAndTrigger(SiteId, _channelInfo.Id, contentInfo.Id);
                            }
                        }
                    }
                }
            }

            LayerUtils.Close(Page);
        }
コード例 #18
0
ファイル: ModalUploadVideo.cs プロジェクト: zhangjingpu/cms-1
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (HifUpload.PostedFile == null || "" == HifUpload.PostedFile.FileName)
            {
                return;
            }

            var filePath = HifUpload.PostedFile.FileName;

            try
            {
                var fileExtName        = PathUtils.GetExtension(filePath).ToLower();
                var localDirectoryPath = PathUtility.GetUploadDirectoryPath(SiteInfo, fileExtName);
                if (!string.IsNullOrEmpty(_currentRootPath))
                {
                    localDirectoryPath = PathUtility.MapPath(SiteInfo, _currentRootPath);
                    DirectoryUtils.CreateDirectoryIfNotExists(localDirectoryPath);
                }
                var localFileName = PathUtility.GetUploadFileName(SiteInfo, filePath);
                var localFilePath = PathUtils.Combine(localDirectoryPath, localFileName);

                if (!PathUtility.IsVideoExtenstionAllowed(SiteInfo, fileExtName))
                {
                    FailMessage("上传失败,上传视频格式不正确!");
                    return;
                }
                if (!PathUtility.IsVideoSizeAllowed(SiteInfo, HifUpload.PostedFile.ContentLength))
                {
                    FailMessage("上传失败,上传视频超出规定文件大小!");
                    return;
                }

                HifUpload.PostedFile.SaveAs(localFilePath);

                var videoUrl   = PageUtility.GetSiteUrlByPhysicalPath(SiteInfo, localFilePath, true);
                var textBoxUrl = PageUtility.GetVirtualUrl(SiteInfo, videoUrl);

                if (string.IsNullOrEmpty(_textBoxClientId))
                {
                    LayerUtils.Close(Page);
                }
                else
                {
                    LtlScript.Text = $@"
<script type=""text/javascript"" language=""javascript"">
    if (parent.document.getElementById('{_textBoxClientId}') != null)
    {{
        parent.document.getElementById('{_textBoxClientId}').value = '{textBoxUrl}';
    }}
    {LayerUtils.CloseScript}
</script>";
                }
            }
            catch (Exception ex)
            {
                FailMessage(ex, "视频上传失败!");
            }
        }
コード例 #19
0
ファイル: ModalSelectColumns.cs プロジェクト: zhongqi013/cms
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var displayAttributes = ControlUtils.SelectedItemsValueToStringCollection(CblDisplayAttributes.Items);

            if (!_isContent)
            {
                if (!_isList)
                {
                    if (CblDisplayAttributes.Items.Count == 0)
                    {
                        FailMessage("必须至少选择一项!");
                        return;
                    }
                    SiteInfo.Additional.ChannelEditAttributes = displayAttributes;

                    Body.AddSiteLog(SiteId, "设置栏目编辑项", $"编辑项:{displayAttributes}");
                }
                else
                {
                    if (!CompareUtils.Contains(displayAttributes, ChannelAttribute.ChannelName))
                    {
                        FailMessage("必须选择栏目名称项!");
                        return;
                    }
                    if (!CompareUtils.Contains(displayAttributes, ChannelAttribute.ChannelIndex))
                    {
                        FailMessage("必须选择栏目索引项!");
                        return;
                    }
                    SiteInfo.Additional.ChannelDisplayAttributes = displayAttributes;

                    Body.AddSiteLog(SiteId, "设置栏目显示项", $"显示项:{displayAttributes}");
                }
                DataProvider.SiteDao.Update(SiteInfo);
            }
            else
            {
                var nodeInfo            = ChannelManager.GetChannelInfo(SiteId, _relatedIdentity);
                var attributesOfDisplay = ControlUtils.SelectedItemsValueToStringCollection(CblDisplayAttributes.Items);
                nodeInfo.Additional.ContentAttributesOfDisplay = attributesOfDisplay;

                DataProvider.ChannelDao.Update(nodeInfo);

                Body.AddSiteLog(SiteId, "设置内容显示项", $"显示项:{attributesOfDisplay}");
            }

            if (!_isList)
            {
                LayerUtils.CloseWithoutRefresh(Page);
            }
            else
            {
                LayerUtils.Close(Page);
            }
        }
コード例 #20
0
 public void Submit_OnClick(object sender, EventArgs e)
 {
     if (Page.IsPostBack && Page.IsValid)
     {
         channelId = Utils.ToInt(Request.QueryString["channelId"]);
         var channelInfo = ChannelDao.GetChannelInfo(SiteId, channelId);
         channelInfo.DepartmentIdCollection = Request.Form["DepartmentIDCollection"];
         ChannelDao.Update(channelInfo);
         LayerUtils.Close(Page);
     }
 }
コード例 #21
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            var contentGroupInfo = new ContentGroupInfo
            {
                GroupName   = PageUtils.FilterXss(TbContentGroupName.Text),
                SiteId      = SiteId,
                Description = TbDescription.Text
            };

            if (Body.IsQueryExists("GroupName"))
            {
                try
                {
                    DataProvider.ContentGroupDao.Update(contentGroupInfo);
                    Body.AddSiteLog(SiteId, "修改内容组", $"内容组:{contentGroupInfo.GroupName}");
                    isChanged = true;
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "内容组修改失败!");
                }
            }
            else
            {
                var contentGroupNameList = DataProvider.ContentGroupDao.GetGroupNameList(SiteId);
                if (contentGroupNameList.IndexOf(TbContentGroupName.Text) != -1)
                {
                    FailMessage("内容组添加失败,内容组名称已存在!");
                }
                else
                {
                    try
                    {
                        DataProvider.ContentGroupDao.Insert(contentGroupInfo);
                        Body.AddSiteLog(SiteId, "添加内容组",
                                        $"内容组:{contentGroupInfo.GroupName}");
                        isChanged = true;
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "内容组添加失败!");
                    }
                }
            }

            if (isChanged)
            {
                LayerUtils.Close(Page);
            }
        }
コード例 #22
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            if (_keywordId > 0)
            {
                try
                {
                    var keywordInfo = DataProvider.KeywordDao.GetKeywordInfo(_keywordId);
                    keywordInfo.Keyword     = TbKeyword.Text.Trim();
                    keywordInfo.Alternative = TbAlternative.Text.Trim();
                    keywordInfo.Grade       = EKeywordGradeUtils.GetEnumType(DdlGrade.SelectedValue);
                    DataProvider.KeywordDao.Update(keywordInfo);

                    isChanged = true;
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "修改敏感词失败!");
                }
            }
            else
            {
                if (DataProvider.KeywordDao.IsExists(TbKeyword.Text))
                {
                    FailMessage("敏感词添加失败,敏感词名称已存在!");
                }
                else
                {
                    try
                    {
                        var keywordInfo = new KeywordInfo
                        {
                            Keyword     = TbKeyword.Text.Trim(),
                            Alternative = TbAlternative.Text.Trim(),
                            Grade       = EKeywordGradeUtils.GetEnumType(DdlGrade.SelectedValue)
                        };
                        DataProvider.KeywordDao.Insert(keywordInfo);
                        isChanged = true;
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "添加敏感词失败!");
                    }
                }
            }

            if (isChanged)
            {
                LayerUtils.Close(Page);
            }
        }
コード例 #23
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var channelInfo         = ChannelManager.GetChannelInfo(SiteId, _channelId);
            var attributesOfDisplay = ControlUtils.SelectedItemsValueToStringCollection(CblDisplayAttributes.Items);

            channelInfo.Additional.ContentAttributesOfDisplay = attributesOfDisplay;

            DataProvider.ChannelDao.Update(channelInfo);

            AuthRequest.AddSiteLog(SiteId, "设置内容显示项", $"显示项:{attributesOfDisplay}");

            LayerUtils.Close(Page);
        }
コード例 #24
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            var nodeGroupInfo = new ChannelGroupInfo
            {
                GroupName   = TbNodeGroupName.Text,
                SiteId      = SiteId,
                Description = TbDescription.Text
            };

            if (AuthRequest.IsQueryExists("GroupName"))
            {
                try
                {
                    DataProvider.ChannelGroupDao.Update(nodeGroupInfo);
                    AuthRequest.AddSiteLog(SiteId, "修改栏目组", $"栏目组:{nodeGroupInfo.GroupName}");
                    isChanged = true;
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "栏目组修改失败!");
                }
            }
            else
            {
                var nodeGroupNameList = DataProvider.ChannelGroupDao.GetGroupNameList(SiteId);
                if (nodeGroupNameList.IndexOf(TbNodeGroupName.Text) != -1)
                {
                    FailMessage("栏目组添加失败,栏目组名称已存在!");
                }
                else
                {
                    try
                    {
                        DataProvider.ChannelGroupDao.Insert(nodeGroupInfo);
                        AuthRequest.AddSiteLog(SiteId, "添加栏目组", $"栏目组:{nodeGroupInfo.GroupName}");
                        isChanged = true;
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "栏目组添加失败!");
                    }
                }
            }

            if (isChanged)
            {
                LayerUtils.Close(Page);
            }
        }
コード例 #25
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (!Page.IsPostBack || !Page.IsValid)
            {
                return;
            }

            if (!string.IsNullOrEmpty(_tableName))
            {
                var info = DataProvider.TableDao.GetTableCollectionInfo(_tableName);
                info.DisplayName = TbDisplayName.Text;
                info.Description = TbDescription.Text;

                DataProvider.TableDao.Update(info);

                AuthRequest.AddAdminLog("修改内容表", $"内容表:{_tableName}");

                SuccessMessage("内容表修改成功!");
                LayerUtils.Close(Page);
            }
            else
            {
                var tableNameList = DataProvider.TableDao.GetTableNameList();
                if (tableNameList.IndexOf(TbTableName.Text) != -1)
                {
                    FailMessage("内容表添加失败,内容表标识已存在!");
                }
                else if (DataProvider.DatabaseDao.IsTableExists(TbTableName.Text))
                {
                    FailMessage("内容表添加失败,数据库中已存在此表!");
                }
                else
                {
                    var info = new TableInfo
                    {
                        TableName   = TbTableName.Text,
                        DisplayName = TbDisplayName.Text,
                        Description = TbDescription.Text
                    };

                    DataProvider.TableDao.Insert(info, DataProvider.TableMetadataDao.GetDefaultTableMetadataInfoList(info.TableName));

                    AuthRequest.AddAdminLog("添加内容表", $"内容表:{TbTableName.Text}");

                    SuccessMessage("内容表添加成功!");
                    LayerUtils.Close(Page);
                }
            }
        }
コード例 #26
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isSubtract = DdlTaxisType.SelectedValue == "Up";
            var taxisNum   = TranslateUtils.ToInt(TbTaxisNum.Text);

            foreach (var channelId in _channelIdList)
            {
                for (var num = 0; num < taxisNum; num++)
                {
                    DataProvider.ChannelDao.UpdateTaxis(SiteId, channelId, isSubtract);
                }

                AuthRequest.AddSiteLog(SiteId, channelId, 0, "栏目排序" + (isSubtract ? "上升" : "下降"), $"栏目:{ChannelManager.GetChannelName(SiteId, channelId)}");
            }
            LayerUtils.Close(Page);
        }
コード例 #27
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            try
            {
                var grade = EKeywordGradeUtils.GetEnumType(DdlGrade.SelectedValue);

                var keywordArray = TbKeywords.Text.Split(',');
                foreach (var item in keywordArray)
                {
                    if (!string.IsNullOrEmpty(item))
                    {
                        var    value = item.Trim();
                        string keyword;
                        var    alternative = string.Empty;

                        if (value.IndexOf('|') != -1)
                        {
                            keyword     = value.Split('|')[0];
                            alternative = value.Split('|')[1];
                        }
                        else
                        {
                            keyword = value;
                        }

                        if (!string.IsNullOrEmpty(keyword) && !DataProvider.KeywordDao.IsExists(keyword))
                        {
                            var keywordInfo = new KeywordInfo(0, keyword, alternative, grade);
                            DataProvider.KeywordDao.Insert(keywordInfo);
                        }
                    }
                }

                isChanged = true;
            }
            catch (Exception ex)
            {
                FailMessage(ex, "导入敏感词失败");
            }

            if (isChanged)
            {
                LayerUtils.Close(Page);
            }
        }
コード例 #28
0
        public void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            try
            {
                var switchToDepartmentID = Utils.ToInt(Request.Form["switchToDepartmentID"]);
                if (switchToDepartmentID == 0)
                {
                    LtlMessage.Text = Utils.GetMessageHtml("转办失败,必须选择转办部门!", false);
                    return;
                }
                var switchToDepartmentName = DepartmentManager.GetDepartmentName(switchToDepartmentID);

                foreach (int contentID in _idArrayList)
                {
                    var contentInfo = Main.ContentApi.GetContentInfo(SiteId, _channelId, contentID);
                    var state       = EStateUtils.GetEnumType(contentInfo.GetString(ContentAttribute.State));

                    if (state != EState.Denied && state != EState.Checked)
                    {
                        contentInfo.Set(ContentAttribute.DepartmentId, switchToDepartmentID.ToString());
                        Main.ContentApi.Update(SiteId, contentInfo.ChannelId, contentInfo);

                        if (!string.IsNullOrEmpty(tbSwitchToRemark.Text))
                        {
                            var remarkInfo = new RemarkInfo(0, SiteId, contentInfo.ChannelId, contentID, ERemarkTypeUtils.GetValue(ERemarkType.SwitchTo), tbSwitchToRemark.Text, _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now);
                            RemarkDao.Insert(remarkInfo);
                        }

                        ApplyManager.LogSwitchTo(SiteId, contentInfo.ChannelId, contentID, switchToDepartmentName, AuthRequest.AdminName, _adminInfo.DepartmentId);
                    }
                }

                isChanged = true;
            }
            catch (Exception ex)
            {
                LtlMessage.Text = Utils.GetMessageHtml(ex.Message, false);
                isChanged       = false;
            }

            if (isChanged)
            {
                LayerUtils.Close(Page);
            }
        }
コード例 #29
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (_isHeadquarters)
            {
                SiteInfo.DomainName = TbDomainName.Text;
                DirectoryUtility.ChangeToSubSite(SiteInfo);
            }
            else
            {
                SiteInfo.DomainName = String.Empty;
                DirectoryUtility.ChangeToHeadquarters(SiteInfo);
            }

            AuthRequest.AddAdminLog(_isHeadquarters ? "转为子站点" : "转为主站点",
                                    $"站点:{SiteInfo.SiteName}");
            LayerUtils.Close(Page);
        }
コード例 #30
0
        public void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            try
            {
                var translateNodeID = Utils.ToInt(ddlNodeID.SelectedValue);
                if (translateNodeID == 0)
                {
                    LtlMessage.Text = Utils.GetMessageHtml("转移失败,必须选择转移目标!", false);
                    return;
                }

                var chananelInfo = Main.ChannelApi.GetChannelInfo(SiteId, _channelId);

                foreach (int contentID in _idArrayList)
                {
                    var contentInfo = Main.ContentApi.GetContentInfo(SiteId, _channelId, contentID);
                    contentInfo.Set(ContentAttribute.TranslateFromChannelId, contentInfo.ChannelId.ToString());
                    contentInfo.ChannelId = translateNodeID;

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

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

                    ApplyManager.LogTranslate(SiteId, contentInfo.ChannelId, contentID, chananelInfo.ChannelName, AuthRequest.AdminName, _adminInfo.DepartmentId);
                }

                isChanged = true;
            }
            catch (Exception ex)
            {
                LtlMessage.Text = Utils.GetMessageHtml(ex.Message, false);
                isChanged       = false;
            }

            if (isChanged)
            {
                LayerUtils.Close(Page);
            }
        }