Ejemplo n.º 1
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                try
                {
                    var psInfo = PublishmentSystemManager.GetPublishmentSystemInfo(_nodeId);

                    var isRetainFiles = false;
                    if (!_isBackgroundDelete)
                    {
                        isRetainFiles = TranslateUtils.ToBool(RetainFiles.SelectedValue);
                    }

                    //if (isRetainFiles == false)
                    //{
                    //    DirectoryUtility.DeletePublishmentSystemFiles(psInfo);
                    //    SuccessMessage("成功删除站点以及相关文件!");
                    //}
                    //else
                    //{
                    //    SuccessMessage("成功删除站点,相关文件未被删除!");
                    //}
                    SuccessMessage("成功删除站点!");
                    if (!_isBackgroundDelete)
                    {
                        AddWaitAndRedirectScript(PagePublishmentSystem.GetRedirectUrl());
                    }
                    else
                    {
                        AddScript(
                            $@"setTimeout(""window.top.location.href='{PageMain.GetRedirectUrl()}'"", 1500);");
                    }

                    DataProvider.PublishmentSystemDao.Delete(_nodeId);

                    Body.AddAdminLog("删除站点", $"站点:{psInfo.PublishmentSystemName}");
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "删除系统失败!");
                }
            }
        }
Ejemplo n.º 2
0
 public string GetReturnUrl()
 {
     return(PagePublishmentSystem.GetRedirectUrl());
 }
Ejemplo n.º 3
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                PublishmentSystemInfo.PublishmentSystemName = PublishmentSystemName.Text;
                PublishmentSystemInfo.Taxis = TranslateUtils.ToInt(Taxis.Text);
                PublishmentSystemInfo.IsCheckContentUseLevel = TranslateUtils.ToBool(IsCheckContentUseLevel.SelectedValue);
                if (PublishmentSystemInfo.IsCheckContentUseLevel)
                {
                    PublishmentSystemInfo.CheckContentLevel = TranslateUtils.ToInt(CheckContentLevel.SelectedValue);
                }

                var isTableChanged = false;

                if (PublishmentSystemInfo.AuxiliaryTableForContent != AuxiliaryTableForContent.SelectedValue)
                {
                    isTableChanged = true;
                    PublishmentSystemInfo.AuxiliaryTableForContent = AuxiliaryTableForContent.SelectedValue;
                }
                if (PublishmentSystemInfo.AuxiliaryTableForVote != AuxiliaryTableForVote.SelectedValue)
                {
                    isTableChanged = true;
                    PublishmentSystemInfo.AuxiliaryTableForVote = AuxiliaryTableForVote.SelectedValue;
                }
                if (PublishmentSystemInfo.AuxiliaryTableForJob != AuxiliaryTableForJob.SelectedValue)
                {
                    isTableChanged = true;
                    PublishmentSystemInfo.AuxiliaryTableForJob = AuxiliaryTableForJob.SelectedValue;
                }

                if (PublishmentSystemInfo.IsHeadquarters == false)
                {
                    if (!StringUtils.EqualsIgnoreCase(PathUtils.GetDirectoryName(PublishmentSystemInfo.PublishmentSystemDir), PublishmentSystemDir.Text))
                    {
                        var list = DataProvider.NodeDao.GetLowerSystemDirList(PublishmentSystemInfo.ParentPublishmentSystemId);
                        if (list.IndexOf(PublishmentSystemDir.Text.ToLower()) != -1)
                        {
                            FailMessage("站点修改失败,已存在相同的发布路径!");
                            return;
                        }

                        try
                        {
                            var parentPSPath = WebConfigUtils.PhysicalApplicationPath;
                            if (PublishmentSystemInfo.ParentPublishmentSystemId > 0)
                            {
                                var parentPublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(PublishmentSystemInfo.ParentPublishmentSystemId);
                                parentPSPath = PathUtility.GetPublishmentSystemPath(parentPublishmentSystemInfo);
                            }
                            DirectoryUtility.ChangePublishmentSystemDir(parentPSPath, PublishmentSystemInfo.PublishmentSystemDir, PublishmentSystemDir.Text);
                        }
                        catch (Exception ex)
                        {
                            FailMessage(ex, "站点修改失败,发布路径文件夹已存在!");
                            return;
                        }
                    }

                    if (ParentPublishmentSystemIDRow.Visible && PublishmentSystemInfo.ParentPublishmentSystemId != TranslateUtils.ToInt(ParentPublishmentSystemID.SelectedValue))
                    {
                        var newParentPublishmentSystemID = TranslateUtils.ToInt(ParentPublishmentSystemID.SelectedValue);
                        var list = DataProvider.NodeDao.GetLowerSystemDirList(newParentPublishmentSystemID);
                        if (list.IndexOf(PublishmentSystemDir.Text.ToLower()) != -1)
                        {
                            FailMessage("站点修改失败,已存在相同的发布路径!");
                            return;
                        }

                        try
                        {
                            DirectoryUtility.ChangeParentPublishmentSystem(PublishmentSystemInfo.ParentPublishmentSystemId, TranslateUtils.ToInt(ParentPublishmentSystemID.SelectedValue), PublishmentSystemId, PublishmentSystemDir.Text);
                            PublishmentSystemInfo.ParentPublishmentSystemId = newParentPublishmentSystemID;
                        }
                        catch (Exception ex)
                        {
                            FailMessage(ex, "站点修改失败,发布路径文件夹已存在!");
                            return;
                        }
                    }

                    PublishmentSystemInfo.PublishmentSystemDir = PublishmentSystemDir.Text;
                }

                try
                {
                    DataProvider.PublishmentSystemDao.Update(PublishmentSystemInfo);
                    if (isTableChanged)
                    {
                        DataProvider.NodeDao.UpdateContentNum(PublishmentSystemInfo);
                    }

                    Body.AddAdminLog("修改站点属性", $"站点:{PublishmentSystemInfo.PublishmentSystemName}");

                    SuccessMessage("站点修改成功!");
                    AddWaitAndRedirectScript(PagePublishmentSystem.GetRedirectUrl());
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "站点修改失败!");
                }
            }
        }