Exemplo n.º 1
0
        public void Insert(TableMetadataInfo info)
        {
            if (IsExists(info.TableName, info.AttributeName))
            {
                return;
            }

            const string sqlString = "INSERT INTO siteserver_TableMetadata (TableName, AttributeName, DataType, DataLength, Taxis, IsSystem) VALUES (@TableName, @AttributeName, @DataType, @DataLength, @Taxis, @IsSystem)";

            var parameters = new IDataParameter[]
            {
                GetParameter(ParmTableCollectionInfoEnname, DataType.VarChar, 50, info.TableName),
                GetParameter(ParmAttributeName, DataType.VarChar, 50, info.AttributeName),
                GetParameter(ParmDataType, DataType.VarChar, 50, info.DataType.Value),
                GetParameter(ParmDataLength, DataType.Integer, info.DataLength),
                GetParameter(ParmTaxis, DataType.Integer, GetMaxTaxis(info.TableName) + 1),
                GetParameter(ParmIsSystem, DataType.VarChar, 18, info.IsSystem.ToString())
            };

            ExecuteNonQuery(sqlString, parameters);

            DataProvider.TableDao.UpdateAttributeNum(info.TableName);
            DataProvider.TableDao.UpdateIsChangedAfterCreatedInDbToTrue(info.TableName);

            TableMetadataManager.ClearCache();
        }
Exemplo n.º 2
0
        internal void InsertWithTransaction(TableMetadataInfo info, int taxis, IDbTransaction trans)
        {
            if (IsExistsWithTransaction(info.TableName, info.AttributeName, trans))
            {
                return;
            }

            const string sqlString = "INSERT INTO siteserver_TableMetadata (TableName, AttributeName, DataType, DataLength, Taxis, IsSystem) VALUES (@TableName, @AttributeName, @DataType, @DataLength, @Taxis, @IsSystem)";

            var insertParms = new IDataParameter[]
            {
                GetParameter(ParmTableCollectionInfoEnname, DataType.VarChar, 50, info.TableName),
                GetParameter(ParmAttributeName, DataType.VarChar, 50, info.AttributeName),
                GetParameter(ParmDataType, DataType.VarChar, 50, info.DataType.Value),
                GetParameter(ParmDataLength, DataType.Integer, info.DataLength),
                GetParameter(ParmTaxis, DataType.Integer, taxis),
                GetParameter(ParmIsSystem, DataType.VarChar, 18, info.IsSystem.ToString())
            };

            ExecuteNonQuery(trans, sqlString, insertParms);
            if (info.StyleInfo != null)
            {
                info.StyleInfo.TableName     = info.TableName;
                info.StyleInfo.AttributeName = info.AttributeName;
                DataProvider.TableStyleDao.InsertWithTransaction(info.StyleInfo, trans);
                TableStyleManager.IsChanged = true;
            }

            TableMetadataManager.ClearCache();
        }
Exemplo n.º 3
0
        public void CreateDbTableOfArchive(string tableName)
        {
            var createTableSqlString = DataProvider.ContentDao.GetCreateTableCollectionInfoSqlString(tableName);

            var archiveTableName = TableMetadataManager.GetTableNameOfArchive(tableName);

            createTableSqlString = createTableSqlString.Replace(tableName, archiveTableName);

            using (var conn = GetConnection())
            {
                conn.Open();
                using (var trans = conn.BeginTransaction())
                {
                    try
                    {
                        var    reader = new System.IO.StringReader(createTableSqlString);
                        string sql;

                        while (null != (sql = SqlUtils.ReadNextStatementFromStream(reader)))
                        {
                            ExecuteNonQuery(trans, sql.Trim());
                        }

                        TableColumnManager.ClearCache();

                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        throw;
                    }
                }
            }
        }
Exemplo n.º 4
0
        private static void ContentTableUpdateMetadatas(string tableName, List <TableColumn> tableColumns)
        {
            var metadataInfoListToInsert = new List <TableMetadataInfo>();
            var metadataInfoListToUpdate = new List <TableMetadataInfo>();

            foreach (var tableColumn in tableColumns)
            {
                if (string.IsNullOrEmpty(tableColumn.AttributeName) ||
                    ContentAttribute.AllAttributesLowercase.Contains(tableColumn.AttributeName.ToLower()))
                {
                    continue;
                }

                if (!TableMetadataManager.IsAttributeNameExists(tableName, tableColumn.AttributeName))
                {
                    var metadataInfo = new TableMetadataInfo(0, tableName,
                                                             tableColumn.AttributeName, tableColumn.DataType,
                                                             tableColumn.DataLength, 0, true);
                    metadataInfoListToInsert.Add(metadataInfo);
                }
                else
                {
                    var isEquals = true;

                    var metadataInfo = TableMetadataManager.GetTableMetadataInfo(tableName, tableColumn.AttributeName);

                    if (metadataInfo.DataType != tableColumn.DataType)
                    {
                        isEquals = false;
                        metadataInfo.DataType = tableColumn.DataType;
                    }

                    if (metadataInfo.DataLength != tableColumn.DataLength)
                    {
                        isEquals = false;
                        metadataInfo.DataLength = tableColumn.DataLength;
                    }

                    if (isEquals)
                    {
                        continue;
                    }

                    metadataInfoListToUpdate.Add(metadataInfo);
                }
            }

            foreach (var metadataInfo in metadataInfoListToInsert)
            {
                DataProvider.TableMetadataDao.Insert(metadataInfo);
            }
            foreach (var metadataInfo in metadataInfoListToUpdate)
            {
                DataProvider.TableMetadataDao.Update(metadataInfo);
            }
        }
Exemplo n.º 5
0
        private void SetTaxis(int id, int taxis)
        {
            var parms = new IDataParameter[]
            {
                GetParameter(ParmTaxis, DataType.Integer, taxis),
                GetParameter(ParmId, DataType.Integer, id)
            };

            ExecuteNonQuery(SqlUpdateTableMetadataTaxis, parms);
            TableMetadataManager.ClearCache();
        }
Exemplo n.º 6
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var styleInfo = (TableStyleInfo)e.Item.DataItem;

            var ltlAttributeName = (Literal)e.Item.FindControl("ltlAttributeName");
            var ltlDisplayName   = (Literal)e.Item.FindControl("ltlDisplayName");
            var ltlInputType     = (Literal)e.Item.FindControl("ltlInputType");
            var ltlFieldType     = (Literal)e.Item.FindControl("ltlFieldType");
            var ltlValidate      = (Literal)e.Item.FindControl("ltlValidate");
            var ltlTaxis         = (Literal)e.Item.FindControl("ltlTaxis");
            var ltlEditStyle     = (Literal)e.Item.FindControl("ltlEditStyle");
            var ltlEditValidate  = (Literal)e.Item.FindControl("ltlEditValidate");

            ltlAttributeName.Text = styleInfo.AttributeName;

            ltlDisplayName.Text = styleInfo.DisplayName;
            ltlInputType.Text   = InputTypeUtils.GetText(styleInfo.InputType);
            ltlFieldType.Text   = TableMetadataManager.IsAttributeNameExists(_tableName, styleInfo.AttributeName) ? $"真实 {TableMetadataManager.GetTableMetadataDataType(_tableName, styleInfo.AttributeName)}" : "虚拟字段";

            ltlValidate.Text = TableStyleManager.GetValidateInfo(styleInfo);

            var showPopWinString = ModalTableStyleAdd.GetOpenWindowString(0, styleInfo.Id, new List <int> {
                0
            }, _tableName, styleInfo.AttributeName, _redirectUrl);
            var editText = styleInfo.Id != 0 ? "修改" : "添加";

            ltlEditStyle.Text = $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">{editText}</a>";

            showPopWinString = ModalTableStyleValidateAdd.GetOpenWindowString(0, styleInfo.Id, new List <int> {
                0
            }, _tableName, styleInfo.AttributeName, _redirectUrl);
            ltlEditValidate.Text = $@"<a href=""javascript:;"" onclick=""{showPopWinString}"">设置</a>";

            ltlTaxis.Text = styleInfo.Taxis.ToString();

            if (styleInfo.Id == 0)
            {
                return;
            }

            ltlEditStyle.Text +=
                $@"&nbsp;&nbsp;<a href=""{PageUtils.GetSettingsUrl(nameof(PageSiteTableStyle), new NameValueCollection
                {
                    {"tableName", _tableName},
                    {"DeleteStyle", true.ToString()},
                    {"AttributeName", styleInfo.AttributeName}
                })}"" onClick=""javascript:return confirm('此操作将删除对应显示样式,确认吗?');"">删除</a>";
        }
Exemplo n.º 7
0
        public void ExportAuxiliaryTable(string tableName)
        {
            var tableInfo = DataProvider.TableDao.GetTableCollectionInfo(tableName);

            if (tableInfo == null)
            {
                return;
            }

            var metaInfoList = TableMetadataManager.GetTableMetadataInfoList(tableInfo.TableName);
            var filePath     = _directoryPath + PathUtils.SeparatorChar + tableInfo.TableName + ".xml";

            var feed = AtomUtility.GetEmptyFeed();

            AtomUtility.AddDcElement(feed.AdditionalElements, new List <string> {
                nameof(TableInfo.TableName), "TableENName"
            }, tableInfo.TableName);
            AtomUtility.AddDcElement(feed.AdditionalElements, new List <string> {
                nameof(TableInfo.DisplayName), "TableCNName"
            }, tableInfo.DisplayName);
            AtomUtility.AddDcElement(feed.AdditionalElements, nameof(TableInfo.AttributeNum), tableInfo.AttributeNum.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, new List <string> {
                nameof(TableInfo.IsCreatedInDb), "IsCreatedInDB"
            }, tableInfo.IsCreatedInDb.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, new List <string> {
                nameof(TableInfo.IsChangedAfterCreatedInDb), "IsChangedAfterCreatedInDB"
            }, tableInfo.IsChangedAfterCreatedInDb.ToString());
            AtomUtility.AddDcElement(feed.AdditionalElements, nameof(TableInfo.Description), tableInfo.Description);
            AtomUtility.AddDcElement(feed.AdditionalElements, "SerializedString", TableMetadataManager.GetSerializedString(tableInfo.TableName));   //表唯一序列号

            foreach (var metaInfo in metaInfoList)
            {
                var entry = AtomUtility.GetEmptyEntry();

                AtomUtility.AddDcElement(entry.AdditionalElements, new List <string> {
                    nameof(TableMetadataInfo.Id), "TableMetadataID"
                }, metaInfo.Id.ToString());
                AtomUtility.AddDcElement(entry.AdditionalElements, new List <string> {
                    nameof(TableMetadataInfo.TableName), "AuxiliaryTableENName"
                }, metaInfo.TableName);
                AtomUtility.AddDcElement(entry.AdditionalElements, nameof(TableMetadataInfo.AttributeName), metaInfo.AttributeName);
                AtomUtility.AddDcElement(entry.AdditionalElements, nameof(TableMetadataInfo.DataType), metaInfo.DataType.Value);
                AtomUtility.AddDcElement(entry.AdditionalElements, nameof(TableMetadataInfo.DataLength), metaInfo.DataLength.ToString());
                AtomUtility.AddDcElement(entry.AdditionalElements, nameof(TableMetadataInfo.Taxis), metaInfo.Taxis.ToString());
                AtomUtility.AddDcElement(entry.AdditionalElements, nameof(TableMetadataInfo.IsSystem), metaInfo.IsSystem.ToString());

                feed.Entries.Add(entry);
            }
            feed.Save(filePath);
        }
Exemplo n.º 8
0
        public void Delete(int id)
        {
            var parms = new IDataParameter[]
            {
                GetParameter(ParmId, DataType.Integer, id)
            };

            var metadataInfo = GetTableMetadataInfo(id);

            ExecuteNonQuery(SqlDeleteTableMetadata, parms);

            DataProvider.TableDao.UpdateAttributeNum(metadataInfo.TableName);
            DataProvider.TableDao.UpdateIsChangedAfterCreatedInDbToTrue(metadataInfo.TableName);
            TableMetadataManager.ClearCache();
        }
Exemplo n.º 9
0
        public void Delete(string tableName, IDbTransaction trans)
        {
            var parms = new IDataParameter[]
            {
                GetParameter(ParmTableCollectionInfoEnname, DataType.VarChar, 50, tableName)
            };

            if (trans == null)
            {
                ExecuteNonQuery(SqlDeleteTableMetadataByTableName, parms);
                TableMetadataManager.ClearCache();
            }
            else
            {
                ExecuteNonQuery(trans, SqlDeleteTableMetadataByTableName, parms);
                TableMetadataManager.ClearCache();
            }
        }
Exemplo n.º 10
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var tableName = ChannelManager.GetTableName(SiteInfo, _channelId);

            ArchiveManager.CreateArchiveTableIfNotExists(SiteInfo, tableName);
            var tableNameOfArchive = TableMetadataManager.GetTableNameOfArchive(tableName);

            foreach (var contentId in _contentIdList)
            {
                var contentInfo = DataProvider.ContentDao.GetContentInfo(tableName, contentId);
                contentInfo.LastEditDate = DateTime.Now;
                DataProvider.ContentDao.Insert(tableNameOfArchive, SiteInfo, contentInfo);
            }

            DataProvider.ContentDao.DeleteContents(SiteId, tableName, _contentIdList, _channelId);

            CreateManager.CreateContentTrigger(SiteId, _channelId);

            Body.AddSiteLog(SiteId, _channelId, 0, "归档内容", string.Empty);

            LayerUtils.CloseAndRedirect(Page, _returnUrl);
        }
Exemplo n.º 11
0
        public void Update(TableMetadataInfo info)
        {
            var isSqlChanged = true;
            var originalInfo = GetTableMetadataInfo(info.Id);

            if (originalInfo != null)
            {
                if (StringUtils.EqualsIgnoreCase(info.TableName, originalInfo.TableName) &&
                    StringUtils.EqualsIgnoreCase(info.AttributeName, originalInfo.AttributeName) &&
                    info.DataType == originalInfo.DataType &&
                    info.DataLength == originalInfo.DataLength &&
                    info.IsSystem == originalInfo.IsSystem)
                {
                    isSqlChanged = false;
                }
            }

            if (!isSqlChanged)
            {
                return;
            }

            var updateParms = new IDataParameter[]
            {
                GetParameter(ParmTableCollectionInfoEnname, DataType.VarChar, 50, info.TableName),
                GetParameter(ParmAttributeName, DataType.VarChar, 50, info.AttributeName),
                GetParameter(ParmDataType, DataType.VarChar, 50, info.DataType.Value),
                GetParameter(ParmDataLength, DataType.Integer, info.DataLength),
                GetParameter(ParmIsSystem, DataType.VarChar, 18, info.IsSystem.ToString()),
                GetParameter(ParmId, DataType.Integer, info.Id)
            };

            ExecuteNonQuery(SqlUpdateTableMetadata, updateParms);

            DataProvider.TableDao.UpdateIsChangedAfterCreatedInDbToTrue(info.TableName);
            TableMetadataManager.ClearCache();
        }
Exemplo n.º 12
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _relatedIdentity   = string.IsNullOrEmpty(Body.GetQueryString("RelatedIdentity")) ? SiteId : Body.GetQueryInt("RelatedIdentity");
            _tableName         = DataProvider.SiteDao.TableName;
            _itemId            = Body.GetQueryInt("itemID");
            _relatedIdentities = RelatedIdentities.GetRelatedIdentities(SiteId, _relatedIdentity);
            _attributeNames    = TableMetadataManager.GetAttributeNameList(_tableName);
            _returnUrl         = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl"));

            if (IsPostBack)
            {
                return;
            }

            VerifySitePermissions(ConfigManager.Permissions.WebSite.Configration);

            //删除样式
            if (Body.IsQueryExists("DeleteStyle"))
            {
                var attributeName = Body.GetQueryString("AttributeName");
                if (TableStyleManager.IsExists(_relatedIdentity, _tableName, attributeName))
                {
                    try
                    {
                        TableStyleManager.Delete(_relatedIdentity, _tableName, attributeName);
                        Body.AddSiteLog(SiteId, "删除数据表单样式", $"表单:{_tableName},字段:{attributeName}");
                        SuccessDeleteMessage();
                    }
                    catch (Exception ex)
                    {
                        FailDeleteMessage(ex);
                    }
                }
            }

            if (!string.IsNullOrEmpty(_returnUrl))
            {
                BtnReturn.Attributes.Add("onclick", $"location.href='{_returnUrl}';return false;");
            }
            else
            {
                BtnReturn.Visible = false;
            }

            RptContents.DataSource     = TableStyleManager.GetTableStyleInfoList(_tableName, _relatedIdentities);
            RptContents.ItemDataBound += RptContents_ItemDataBound;
            RptContents.DataBind();

            var redirectUrl = GetRedirectUrl(SiteId, _relatedIdentity, _itemId, _returnUrl);

            BtnAddStyle.Attributes.Add("onclick", ModalTableStyleAdd.GetOpenWindowString(SiteId, 0, _relatedIdentities, _tableName, string.Empty, redirectUrl));
            BtnAddStyles.Attributes.Add("onclick", ModalTableStylesAdd.GetOpenWindowString(SiteId, _relatedIdentities, _tableName, redirectUrl));

            BtnImport.Attributes.Add("onclick", ModalTableStyleImport.GetOpenWindowString(_tableName, SiteId, _relatedIdentity));
            BtnExport.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToSingleTableStyle(_tableName, SiteId, _relatedIdentity));
        }
Exemplo n.º 13
0
        public void SyncDbTable(string tableName)
        {
            var metadataInfoList = TableMetadataManager.GetTableMetadataInfoList(tableName);
            var columnInfolist   = TableColumnManager.GetTableColumnInfoListLowercase(tableName, ContentAttribute.AllAttributesLowercase);

            var sqlList = new List <string>();

            //添加新增/修改字段SQL语句
            foreach (var metadataInfo in metadataInfoList)
            {
                var columnExists = false;
                foreach (var columnInfo in columnInfolist)
                {
                    if (!StringUtils.EqualsIgnoreCase(columnInfo.ColumnName, metadataInfo.AttributeName))
                    {
                        continue;
                    }

                    columnExists = true;

                    if (metadataInfo.DataType != columnInfo.DataType || metadataInfo.DataType == DataType.VarChar && metadataInfo.DataLength != columnInfo.Length)
                    {
                        var dropColumnsSqlList = DataProvider.DatabaseDao.GetDropColumnsSqlString(tableName, metadataInfo.AttributeName);
                        foreach (var sql in dropColumnsSqlList)
                        {
                            sqlList.Add(sql);
                        }
                        var addColumnsSqlList1 = DataProvider.TableMetadataDao.GetAddColumnsSqlString(tableName, metadataInfo);
                        foreach (var sql in addColumnsSqlList1)
                        {
                            sqlList.Add(sql);
                        }
                    }

                    break;
                }
                if (columnExists)
                {
                    continue;
                }

                var addColumnsSqlList2 = DataProvider.TableMetadataDao.GetAddColumnsSqlString(tableName, metadataInfo);
                foreach (var sql in addColumnsSqlList2)
                {
                    sqlList.Add(sql);
                }
            }

            //添加删除字段SQL语句
            foreach (var columnInfo in columnInfolist)
            {
                var isNeedDelete = true;
                foreach (var metadataInfo in metadataInfoList)
                {
                    if (StringUtils.EqualsIgnoreCase(columnInfo.ColumnName, metadataInfo.AttributeName))
                    {
                        isNeedDelete = false;
                        break;
                    }
                }
                if (isNeedDelete)
                {
                    var dropColumnsSqlList = DataProvider.DatabaseDao.GetDropColumnsSqlString(tableName, columnInfo.ColumnName);
                    foreach (var sql in dropColumnsSqlList)
                    {
                        sqlList.Add(sql);
                    }
                }
            }

            if (sqlList.Count <= 0)
            {
                return;
            }

            DataProvider.DatabaseDao.ExecuteSql(sqlList);
            DataProvider.TableDao.UpdateIsChangedAfterCreatedInDbToFalse(tableName);
            TableColumnManager.ClearCache();
        }
Exemplo n.º 14
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            if (Body.IsQueryExists("TableMetadataID"))
            {
                var tableMetadataId = Body.GetQueryInt("TableMetadataID");

                var info = DataProvider.TableMetadataDao.GetTableMetadataInfo(tableMetadataId);
                info.TableName     = _tableName;
                info.AttributeName = TbAttributeName.Text;
                info.DataType      = DataTypeUtils.GetEnumType(DdlDataType.SelectedValue);

                if (info.DataType == DataType.VarChar)
                {
                    info.DataLength = TranslateUtils.ToInt(TbDataLength.Text);
                    var maxLength = SqlUtils.GetMaxLengthForNVarChar();
                    if (info.DataLength <= 0 || info.DataLength > maxLength)
                    {
                        FailMessage($"字段修改失败,数据长度的值必须位于 1 和 {maxLength} 之间");
                        return;
                    }
                }

                try
                {
                    DataProvider.TableMetadataDao.Update(info);

                    Body.AddAdminLog("修改辅助表字段",
                                     $"辅助表:{_tableName},字段名:{info.AttributeName}");

                    isChanged = true;
                }
                catch (Exception ex)
                {
                    FailMessage(ex, ex.Message);
                }
            }
            else
            {
                var attributeNameList = TableMetadataManager.GetAttributeNameList(_tableName, true);

                var attributeNameLowercase = TbAttributeName.Text.Trim().ToLower();
                if (attributeNameList.Contains(attributeNameLowercase) || ContentAttribute.AllAttributesLowercase.Contains(attributeNameLowercase))
                {
                    FailMessage("字段添加失败,字段名已存在!");
                }
                else if (!SqlUtils.IsAttributeNameCompliant(TbAttributeName.Text))
                {
                    FailMessage("字段名不符合系统要求!");
                }
                else
                {
                    var info = new TableMetadataInfo
                    {
                        TableName     = _tableName,
                        AttributeName = TbAttributeName.Text,
                        DataType      = DataTypeUtils.GetEnumType(DdlDataType.SelectedValue)
                    };

                    if (info.DataType == DataType.VarChar)
                    {
                        info.DataLength = TranslateUtils.ToInt(TbDataLength.Text);
                        var maxLength = SqlUtils.GetMaxLengthForNVarChar();
                        if (info.DataLength <= 0 || info.DataLength > maxLength)
                        {
                            FailMessage($"字段修改失败,数据长度的值必须位于 1 和 {maxLength} 之间");
                            return;
                        }
                    }
                    info.IsSystem = false;

                    try
                    {
                        DataProvider.TableMetadataDao.Insert(info);

                        Body.AddAdminLog("添加辅助表字段",
                                         $"辅助表:{_tableName},字段名:{info.AttributeName}");

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

            if (isChanged)
            {
                LayerUtils.Close(Page);
            }
        }
Exemplo n.º 15
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId", "channelId");
            var channelId = AuthRequest.GetQueryInt("channelId");

            _relatedIdentities   = RelatedIdentities.GetChannelRelatedIdentities(SiteId, channelId);
            _channelInfo         = ChannelManager.GetChannelInfo(SiteId, channelId);
            _tableName           = ChannelManager.GetTableName(SiteInfo, _channelInfo);
            _styleInfoList       = TableStyleManager.GetTableStyleInfoList(_tableName, _relatedIdentities);
            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, channelId));
            _allStyleInfoList    = ContentUtility.GetAllTableStyleInfoList(_styleInfoList);

            _pluginLinks = PluginContentManager.GetContentLinks(_channelInfo);
            _isEdit      = TextUtility.IsEdit(SiteInfo, channelId, AuthRequest.AdminPermissions);

            if (_channelInfo.Additional.IsPreviewContents)
            {
                new Action(() =>
                {
                    DataProvider.ContentDao.DeletePreviewContents(SiteId, _tableName, _channelInfo);
                }).BeginInvoke(null, null);
            }

            if (!HasChannelPermissions(channelId, ConfigManager.ChannelPermissions.ContentView, ConfigManager.ChannelPermissions.ContentAdd, ConfigManager.ChannelPermissions.ContentEdit, ConfigManager.ChannelPermissions.ContentDelete, ConfigManager.ChannelPermissions.ContentTranslate))
            {
                if (!AuthRequest.IsAdminLoggin)
                {
                    PageUtils.RedirectToLoginPage();
                    return;
                }
                PageUtils.RedirectToErrorPage("您无此栏目的操作权限!");
                return;
            }

            RptContents.ItemDataBound += RptContents_ItemDataBound;

            var allLowerAttributeNameList = TableMetadataManager.GetAllLowerAttributeNameListExcludeText(_tableName);
            var pagerParam = new PagerParam
            {
                ControlToPaginate = RptContents,
                TableName         = _tableName,
                PageSize          = SiteInfo.Additional.PageSize,
                Page              = AuthRequest.GetQueryInt(Pager.QueryNamePage, 1),
                OrderSqlString    = DataProvider.ContentDao.GetPagerOrderSqlString(_channelInfo),
                ReturnColumnNames = TranslateUtils.ObjectCollectionToString(allLowerAttributeNameList)
            };

            var administratorName = AuthRequest.AdminPermissions.IsViewContentOnlySelf(SiteId, channelId) ? AuthRequest.AdminName : string.Empty;

            if (AuthRequest.IsQueryExists("searchType"))
            {
                pagerParam.WhereSqlString = DataProvider.ContentDao.GetPagerWhereSqlString(allLowerAttributeNameList,
                                                                                           SiteId, channelId, AuthRequest.AdminPermissions.IsSystemAdministrator, new List <int>
                {
                    channelId
                }, AuthRequest.GetQueryString("searchType"), AuthRequest.GetQueryString("keyword"),
                                                                                           AuthRequest.GetQueryString("dateFrom"), string.Empty, false, ETriState.All, false, false,
                                                                                           administratorName);
                pagerParam.TotalCount =
                    DataProvider.DatabaseDao.GetPageTotalCount(_tableName, pagerParam.WhereSqlString);
            }
            else
            {
                pagerParam.WhereSqlString = DataProvider.ContentDao.GetPagerWhereSqlString(channelId, ETriState.All, administratorName);
                pagerParam.TotalCount     = _channelInfo.ContentNum;
            }

            PgContents.Param = pagerParam;

            if (IsPostBack)
            {
                return;
            }

            LtlButtons.Text     = WebUtils.GetContentCommands(AuthRequest.AdminPermissions, SiteInfo, _channelInfo, PageUrl);
            LtlMoreButtons.Text = WebUtils.GetContentMoreCommands(AuthRequest.AdminPermissions, SiteInfo, _channelInfo, PageUrl);

            PgContents.DataBind();

            foreach (var styleInfo in _allStyleInfoList)
            {
                if (styleInfo.InputType == InputType.TextEditor)
                {
                    continue;
                }

                var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                DdlSearchType.Items.Add(listitem);
            }

            if (AuthRequest.IsQueryExists("searchType"))
            {
                TbDateFrom.Text = AuthRequest.GetQueryString("dateFrom");
                ControlUtils.SelectSingleItem(DdlSearchType, AuthRequest.GetQueryString("searchType"));
                TbKeyword.Text = AuthRequest.GetQueryString("keyword");
                if (!string.IsNullOrEmpty(AuthRequest.GetQueryString("searchType")) || !string.IsNullOrEmpty(TbDateFrom.Text) ||
                    !string.IsNullOrEmpty(TbKeyword.Text))
                {
                    LtlButtons.Text += @"
<script>
$(document).ready(function() {
	$('#contentSearch').show();
});
</script>
";
                }
            }
            else
            {
                ControlUtils.SelectSingleItem(DdlSearchType, ContentAttribute.Title);
            }

            LtlColumnsHead.Text = TextUtility.GetColumnsHeadHtml(_styleInfoList, _attributesOfDisplay, SiteInfo);
        }
Exemplo n.º 16
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("SiteId");
            _channelId = AuthRequest.IsQueryExists("ChannelId") ? AuthRequest.GetQueryInt("ChannelId") : SiteId;

            _isWritingOnly = AuthRequest.GetQueryBool("isWritingOnly");

            var administratorName = string.Empty;

            _isSelfOnly = AuthRequest.GetQueryBool("isSelfOnly");
            if (!_isSelfOnly)
            {
                administratorName = AuthRequest.AdminPermissions.IsViewContentOnlySelf(SiteId, _channelId) ? AuthRequest.AdminName : string.Empty;
            }

            _channelInfo = ChannelManager.GetChannelInfo(SiteId, _channelId);
            var tableName = ChannelManager.GetTableName(SiteInfo, _channelInfo);

            _relatedIdentities   = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId);
            _styleInfoList       = TableStyleManager.GetTableStyleInfoList(tableName, _relatedIdentities);
            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, _channelId));
            _allStyleInfoList    = ContentUtility.GetAllTableStyleInfoList(_styleInfoList);
            _pluginLinks         = PluginContentManager.GetContentLinks(_channelInfo);
            _isEdit = TextUtility.IsEdit(SiteInfo, _channelId, AuthRequest.AdminPermissions);

            var stateType  = AuthRequest.IsQueryExists("state") ? ETriStateUtils.GetEnumType(AuthRequest.GetQueryString("state")) : ETriState.All;
            var searchType = AuthRequest.IsQueryExists("searchType") ? AuthRequest.GetQueryString("searchType") : ContentAttribute.Title;
            var dateFrom   = AuthRequest.IsQueryExists("dateFrom") ? AuthRequest.GetQueryString("dateFrom") : string.Empty;
            var dateTo     = AuthRequest.IsQueryExists("dateTo") ? AuthRequest.GetQueryString("dateTo") : string.Empty;
            var keyword    = AuthRequest.IsQueryExists("keyword") ? AuthRequest.GetQueryString("keyword") : string.Empty;

            RptContents.ItemDataBound += RptContents_ItemDataBound;

            var allLowerAttributeNameList = TableMetadataManager.GetAllLowerAttributeNameListExcludeText(tableName);
            var pagerParam = new PagerParam
            {
                ControlToPaginate = RptContents,
                TableName         = tableName,
                PageSize          = SiteInfo.Additional.PageSize,
                Page              = AuthRequest.GetQueryInt(Pager.QueryNamePage, 1),
                OrderSqlString    = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByIdDesc),
                ReturnColumnNames = TranslateUtils.ObjectCollectionToString(allLowerAttributeNameList)
            };

            var channelIdList = ChannelManager.GetChannelIdList(_channelInfo, EScopeType.All, string.Empty, string.Empty, _channelInfo.ContentModelPluginId);

            var searchChannelIdList = new List <int>();

            if (AuthRequest.AdminPermissions.IsSystemAdministrator)
            {
                searchChannelIdList = channelIdList;
            }
            else
            {
                foreach (var theChannelId in channelIdList)
                {
                    if (AuthRequest.AdminPermissions.OwningChannelIdList.Contains(theChannelId))
                    {
                        searchChannelIdList.Add(theChannelId);
                    }
                }
            }

            pagerParam.WhereSqlString = DataProvider.ContentDao.GetPagerWhereSqlString(allLowerAttributeNameList,
                                                                                       SiteId, _channelInfo, AuthRequest.AdminPermissions.IsSystemAdministrator, searchChannelIdList, searchType, keyword,
                                                                                       dateFrom, dateTo, true, stateType, false, _isWritingOnly, administratorName);
            pagerParam.TotalCount =
                DataProvider.DatabaseDao.GetPageTotalCount(tableName, pagerParam.WhereSqlString);

            PgContents.Param = pagerParam;

            if (!IsPostBack)
            {
                ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, true, true, AuthRequest.AdminPermissions);

                foreach (var styleInfo in _allStyleInfoList)
                {
                    if (styleInfo.InputType == InputType.TextEditor)
                    {
                        continue;
                    }

                    var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                    DdlSearchType.Items.Add(listitem);
                }

                ETriStateUtils.AddListItems(DdlState, "全部", "已审核", "待审核");

                if (SiteId != _channelId)
                {
                    ControlUtils.SelectSingleItem(DdlChannelId, _channelId.ToString());
                }
                ControlUtils.SelectSingleItem(DdlState, AuthRequest.GetQueryString("State"));
                ControlUtils.SelectSingleItem(DdlSearchType, searchType);
                TbKeyword.Text  = keyword;
                TbDateFrom.Text = dateFrom;
                TbDateTo.Text   = dateTo;

                PgContents.DataBind();

                var showPopWinString = ModalAddToGroup.GetOpenWindowStringToContentForMultiChannels(SiteId);
                BtnAddToGroup.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalSelectColumns.GetOpenWindowString(SiteId, _channelId, true);
                BtnSelect.Attributes.Add("onclick", showPopWinString);

                if (HasChannelPermissions(SiteId, ConfigManager.ChannelPermissions.ContentCheck))
                {
                    showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(SiteId, PageUrl);
                    BtnCheck.Attributes.Add("onclick", showPopWinString);
                }
                else
                {
                    PhCheck.Visible = false;
                }

                LtlColumnsHead.Text = TextUtility.GetColumnsHeadHtml(_styleInfoList, _attributesOfDisplay, SiteInfo);
            }

            if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentAdd))
            {
                BtnAddContent.Visible = false;
            }
            if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentTranslate))
            {
                BtnTranslate.Visible = false;
            }
            else
            {
                BtnTranslate.Attributes.Add("onclick", PageContentTranslate.GetRedirectClickStringForMultiChannels(SiteId, PageUrl));
            }

            if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentDelete))
            {
                BtnDelete.Visible = false;
            }
            else
            {
                BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, false, PageUrl));
            }
        }
Exemplo n.º 17
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId");
            _channelId = AuthRequest.IsQueryExists("channelId") ? AuthRequest.GetQueryInt("channelId") : SiteId;

            _isCheckOnly   = AuthRequest.GetQueryBool("isCheckOnly");
            _isTrashOnly   = AuthRequest.GetQueryBool("isTrashOnly");
            _isWritingOnly = AuthRequest.GetQueryBool("isWritingOnly");
            _isAdminOnly   = AuthRequest.GetQueryBool("isAdminOnly");

            _channelInfo = ChannelManager.GetChannelInfo(SiteId, _channelId);
            var tableName = ChannelManager.GetTableName(SiteInfo, _channelInfo);

            _relatedIdentities   = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId);
            _styleInfoList       = TableStyleManager.GetTableStyleInfoList(tableName, _relatedIdentities);
            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, _channelId));
            _allStyleInfoList    = ContentUtility.GetAllTableStyleInfoList(_styleInfoList);
            _pluginMenus         = PluginContentManager.GetContentMenus(_channelInfo);
            _pluginColumns       = PluginContentManager.GetContentColumns(_channelInfo);
            _isEdit = TextUtility.IsEdit(SiteInfo, _channelId, AuthRequest.AdminPermissions);

            var state      = AuthRequest.IsQueryExists("state") ? AuthRequest.GetQueryInt("state") : CheckManager.LevelInt.All;
            var searchType = AuthRequest.IsQueryExists("searchType") ? AuthRequest.GetQueryString("searchType") : ContentAttribute.Title;
            var dateFrom   = AuthRequest.IsQueryExists("dateFrom") ? AuthRequest.GetQueryString("dateFrom") : string.Empty;
            var dateTo     = AuthRequest.IsQueryExists("dateTo") ? AuthRequest.GetQueryString("dateTo") : string.Empty;
            var keyword    = AuthRequest.IsQueryExists("keyword") ? AuthRequest.GetQueryString("keyword") : string.Empty;

            var checkedLevel = 5;
            var isChecked    = true;

            foreach (var owningChannelId in AuthRequest.AdminPermissions.OwningChannelIdList)
            {
                int checkedLevelByChannelId;
                var isCheckedByChannelId = CheckManager.GetUserCheckLevel(AuthRequest.AdminPermissions, SiteInfo, owningChannelId, out checkedLevelByChannelId);
                if (checkedLevel > checkedLevelByChannelId)
                {
                    checkedLevel = checkedLevelByChannelId;
                }
                if (!isCheckedByChannelId)
                {
                    isChecked = false;
                }
            }

            RptContents.ItemDataBound += RptContents_ItemDataBound;

            var allLowerAttributeNameList = TableMetadataManager.GetAllLowerAttributeNameListExcludeText(tableName);
            var whereString = DataProvider.ContentDao.GetPagerWhereSqlString(SiteInfo, _channelInfo,
                                                                             searchType, keyword,
                                                                             dateFrom, dateTo, state, _isCheckOnly, false, _isTrashOnly, _isWritingOnly, _isAdminOnly,
                                                                             AuthRequest.AdminPermissions,
                                                                             allLowerAttributeNameList);

            PgContents.Param = new PagerParam
            {
                ControlToPaginate = RptContents,
                TableName         = tableName,
                PageSize          = SiteInfo.Additional.PageSize,
                Page              = AuthRequest.GetQueryInt(Pager.QueryNamePage, 1),
                OrderSqlString    = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByIdDesc),
                ReturnColumnNames = TranslateUtils.ObjectCollectionToString(allLowerAttributeNameList),
                WhereSqlString    = whereString,
                TotalCount        = DataProvider.DatabaseDao.GetPageTotalCount(tableName, whereString)
            };

            if (IsPostBack)
            {
                return;
            }

            if (_isTrashOnly)
            {
                if (AuthRequest.IsQueryExists("IsDeleteAll"))
                {
                    DataProvider.ContentDao.DeleteContentsByTrash(SiteId, tableName);
                    AuthRequest.AddSiteLog(SiteId, "清空回收站");
                    SuccessMessage("成功清空回收站!");
                }
                else if (AuthRequest.IsQueryExists("IsRestore"))
                {
                    var idsDictionary = ContentUtility.GetIDsDictionary(Request.QueryString);
                    foreach (var channelId in idsDictionary.Keys)
                    {
                        var contentIdArrayList = idsDictionary[channelId];
                        DataProvider.ContentDao.TrashContents(SiteId, ChannelManager.GetTableName(SiteInfo, channelId), contentIdArrayList);
                    }
                    AuthRequest.AddSiteLog(SiteId, "从回收站还原内容");
                    SuccessMessage("成功还原内容!");
                }
                else if (AuthRequest.IsQueryExists("IsRestoreAll"))
                {
                    DataProvider.ContentDao.RestoreContentsByTrash(SiteId, tableName);
                    AuthRequest.AddSiteLog(SiteId, "从回收站还原所有内容");
                    SuccessMessage("成功还原所有内容!");
                }
            }

            ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, true, true, AuthRequest.AdminPermissions);

            CheckManager.LoadContentLevelToList(DdlState, SiteInfo, _isCheckOnly, isChecked, checkedLevel);
            ControlUtils.SelectSingleItem(DdlState, state.ToString());

            foreach (var styleInfo in _allStyleInfoList)
            {
                if (styleInfo.InputType == InputType.TextEditor)
                {
                    continue;
                }

                var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                DdlSearchType.Items.Add(listitem);
            }

            //ETriStateUtils.AddListItems(DdlState, "全部", "已审核", "待审核");

            if (SiteId != _channelId)
            {
                ControlUtils.SelectSingleItem(DdlChannelId, _channelId.ToString());
            }
            //ControlUtils.SelectSingleItem(DdlState, AuthRequest.GetQueryString("State"));
            ControlUtils.SelectSingleItem(DdlSearchType, searchType);
            TbKeyword.Text  = keyword;
            TbDateFrom.Text = dateFrom;
            TbDateTo.Text   = dateTo;

            PgContents.DataBind();

            LtlColumnsHead.Text += TextUtility.GetColumnsHeadHtml(_styleInfoList, _pluginColumns, _attributesOfDisplay);


            BtnSelect.Attributes.Add("onclick", ModalSelectColumns.GetOpenWindowString(SiteId, _channelId));

            if (_isTrashOnly)
            {
                LtlColumnsHead.Text  += @"<th class=""text-center text-nowrap"" width=""150"">删除时间</th>";
                BtnAddToGroup.Visible = BtnTranslate.Visible = BtnCheck.Visible = false;
                PhTrash.Visible       = true;
                if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentDelete))
                {
                    BtnDelete.Visible    = false;
                    BtnDeleteAll.Visible = false;
                }
                else
                {
                    BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, true, PageUrl));
                    BtnDeleteAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.AddQueryString(PageUrl, "IsDeleteAll", "True"), "确实要清空回收站吗?"));
                }
                BtnRestore.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValue(PageUtils.AddQueryString(PageUrl, "IsRestore", "True"), "IDsCollection", "IDsCollection", "请选择需要还原的内容!"));
                BtnRestoreAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.AddQueryString(PageUrl, "IsRestoreAll", "True"), "确实要还原所有内容吗?"));
            }
            else
            {
                LtlColumnsHead.Text += @"<th class=""text-center text-nowrap"" width=""100"">操作</th>";

                BtnAddToGroup.Attributes.Add("onclick", ModalAddToGroup.GetOpenWindowStringToContentForMultiChannels(SiteId));

                if (HasChannelPermissions(SiteId, ConfigManager.ChannelPermissions.ContentCheck))
                {
                    BtnCheck.Attributes.Add("onclick", ModalContentCheck.GetOpenWindowStringForMultiChannels(SiteId, PageUrl));
                    if (_isCheckOnly)
                    {
                        BtnCheck.CssClass = "btn m-r-5 btn-success";
                    }
                }
                else
                {
                    PhCheck.Visible = false;
                }

                if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentTranslate))
                {
                    BtnTranslate.Visible = false;
                }
                else
                {
                    BtnTranslate.Attributes.Add("onclick", PageContentTranslate.GetRedirectClickStringForMultiChannels(SiteId, PageUrl));
                }

                if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentDelete))
                {
                    BtnDelete.Visible = false;
                }
                else
                {
                    BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, false, PageUrl));
                }
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// 将频道模板中的辅助表导入发布系统中,返回修改了的表名对照
        /// 在导入辅助表的同时检查发布系统辅助表并替换对应表
        /// </summary>
        public NameValueCollection ImportAuxiliaryTables(int siteId, bool isUserTables)
        {
            if (!DirectoryUtils.IsDirectoryExists(_directoryPath))
            {
                return(null);
            }

            var siteInfo = SiteManager.GetSiteInfo(siteId);

            var nameValueCollection = new NameValueCollection();
            var tableNamePrefix     = siteInfo.SiteDir + "_";

            var filePaths = DirectoryUtils.GetFilePaths(_directoryPath);

            foreach (var filePath in filePaths)
            {
                var feed = AtomFeed.Load(FileUtils.GetFileStreamReadOnly(filePath));

                var tableName = AtomUtility.GetDcElementContent(feed.AdditionalElements, new List <string> {
                    nameof(TableInfo.TableName), "TableENName"
                });

                if (!isUserTables)
                {
                    nameValueCollection[tableName] = siteInfo.TableName;
                    continue;
                }

                var displayName = AtomUtility.GetDcElementContent(feed.AdditionalElements, new List <string> {
                    nameof(TableInfo.DisplayName), "TableCNName"
                });

                var serializedString = AtomUtility.GetDcElementContent(feed.AdditionalElements, "SerializedString");

                var tableNameToInsert = string.Empty;//需要增加的表名,空代表不需要添加辅助表

                var tableInfo = DataProvider.TableDao.GetTableCollectionInfo(tableName);
                if (tableInfo == null)//如果当前系统无此表名
                {
                    tableNameToInsert = tableName;
                }
                else
                {
                    var serializedStringForExistTable = TableMetadataManager.GetSerializedString(tableName);

                    if (!string.IsNullOrEmpty(serializedString))
                    {
                        if (serializedString != serializedStringForExistTable)//仅有此时,导入表需要修改表名
                        {
                            tableNameToInsert = tableNamePrefix + tableName;
                            displayName       = tableNamePrefix + displayName;
                            nameValueCollection[tableName] = tableNameToInsert;
                        }
                    }
                }

                if (!string.IsNullOrEmpty(tableNameToInsert))//需要添加
                {
                    if (!DataProvider.DatabaseDao.IsTableExists(tableNameToInsert))
                    {
                        tableInfo = new TableInfo
                        {
                            TableName                 = tableNameToInsert,
                            DisplayName               = displayName,
                            AttributeNum              = 0,
                            IsCreatedInDb             = false,
                            IsChangedAfterCreatedInDb = false,
                            Description               = AtomUtility.GetDcElementContent(feed.AdditionalElements, nameof(TableInfo.Description))
                        };

                        var metadataInfoList = new List <TableMetadataInfo>();
                        foreach (AtomEntry entry in feed.Entries)
                        {
                            var metaInfo = new TableMetadataInfo
                            {
                                TableName     = tableNameToInsert,
                                AttributeName = AtomUtility.GetDcElementContent(entry.AdditionalElements, nameof(TableMetadataInfo.AttributeName)),
                                DataType      = DataTypeUtils.GetEnumType(AtomUtility.GetDcElementContent(entry.AdditionalElements, nameof(TableMetadataInfo.DataType))),
                                DataLength    = TranslateUtils.ToInt(AtomUtility.GetDcElementContent(entry.AdditionalElements, nameof(TableMetadataInfo.DataLength))),
                                Taxis         = TranslateUtils.ToInt(AtomUtility.GetDcElementContent(entry.AdditionalElements, nameof(TableMetadataInfo.Taxis))),
                                IsSystem      = TranslateUtils.ToBool(AtomUtility.GetDcElementContent(entry.AdditionalElements, nameof(TableMetadataInfo.IsSystem)))
                            };

                            if (string.IsNullOrEmpty(metaInfo.AttributeName) ||
                                ContentAttribute.AllAttributesLowercase.Contains(metaInfo.AttributeName.ToLower()))
                            {
                                continue;
                            }

                            metadataInfoList.Add(metaInfo);
                        }

                        DataProvider.TableDao.Insert(tableInfo, metadataInfoList);

                        DataProvider.TableDao.CreateDbTable(tableNameToInsert);
                    }
                }

                var tableNameToChange = !string.IsNullOrEmpty(tableNameToInsert) ? tableNameToInsert : tableName;
                //更新发布系统后台内容表及栏目表
                siteInfo.TableName = tableNameToChange;
                DataProvider.SiteDao.Update(siteInfo);
            }

            return(nameValueCollection);
        }