示例#1
0
        public static bool CreateAccessFileForContents(string filePath, SiteInfo siteInfo, ChannelInfo nodeInfo, List <int> contentIdList, List <string> displayAttributes, bool isPeriods, string dateFrom, string dateTo, ETriState checkedState)
        {
            DirectoryUtils.CreateDirectoryIfNotExists(DirectoryUtils.GetDirectoryPath(filePath));
            FileUtils.DeleteFileIfExists(filePath);

            var sourceFilePath = SiteServerAssets.GetPath(SiteServerAssets.Default.AccessMdb);

            FileUtils.CopyFile(sourceFilePath, filePath);

            var tableName     = ChannelManager.GetTableName(siteInfo, nodeInfo);
            var styleInfoList = TableStyleManager.GetContentStyleInfoList(siteInfo, nodeInfo);

            styleInfoList = ContentUtility.GetAllTableStyleInfoList(styleInfoList);

            var accessDao = new AccessDao(filePath);

            var createTableSqlString = accessDao.GetCreateTableSqlString(nodeInfo.ChannelName, styleInfoList, displayAttributes);

            accessDao.ExecuteSqlString(createTableSqlString);

            bool isExport;

            var insertSqlList = accessDao.GetInsertSqlStringList(nodeInfo.ChannelName, siteInfo.Id, nodeInfo.Id, tableName, styleInfoList, displayAttributes, contentIdList, isPeriods, dateFrom, dateTo, checkedState, out isExport);

            foreach (var insertSql in insertSqlList)
            {
                accessDao.ExecuteSqlString(insertSql);
            }

            return(isExport);
        }
示例#2
0
        public static bool CreateAccessFileForContents(string filePath, PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo, List <int> contentIDArrayList, List <string> displayAttributes, bool isPeriods, string dateFrom, string dateTo, ETriState checkedState)
        {
            DirectoryUtils.CreateDirectoryIfNotExists(DirectoryUtils.GetDirectoryPath(filePath));
            FileUtils.DeleteFileIfExists(filePath);

            var sourceFilePath = SiteServerAssets.GetPath(SiteServerAssets.Default.AccessMdb);

            FileUtils.CopyFile(sourceFilePath, filePath);

            var relatedidentityes = RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId);

            var modelInfo     = ContentModelManager.GetContentModelInfo(publishmentSystemInfo, nodeInfo.ContentModelId);
            var tableStyle    = NodeManager.GetTableStyle(publishmentSystemInfo, nodeInfo);
            var styleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, modelInfo.TableName, relatedidentityes);

            styleInfoList = ContentUtility.GetAllTableStyleInfoList(publishmentSystemInfo, tableStyle, styleInfoList);
            var tableName = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo);

            var accessDAO = new AccessDao(filePath);

            var createTableSqlString = accessDAO.GetCreateTableSqlString(nodeInfo.NodeName, styleInfoList, displayAttributes);

            accessDAO.ExecuteSqlString(createTableSqlString);

            bool isExport;

            var insertSqlArrayList = accessDAO.GetInsertSqlStringArrayList(nodeInfo.NodeName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, tableStyle, tableName, styleInfoList, displayAttributes, contentIDArrayList, isPeriods, dateFrom, dateTo, checkedState, out isExport);

            foreach (string insertSql in insertSqlArrayList)
            {
                accessDAO.ExecuteSqlString(insertSql);
            }

            return(isExport);
        }
示例#3
0
        public static List <ContentInfo> GetContentsByAccessFile(string filePath, SiteInfo siteInfo, ChannelInfo nodeInfo)
        {
            var contentInfoList = new List <ContentInfo>();

            var accessDao  = new AccessDao(filePath);
            var tableNames = accessDao.GetTableNames();

            if (tableNames != null && tableNames.Length > 0)
            {
                foreach (var tableName in tableNames)
                {
                    var sqlString = $"SELECT * FROM [{tableName}]";
                    var dataset   = accessDao.ReturnDataSet(sqlString);

                    var oleDt = dataset.Tables[0];

                    if (oleDt.Rows.Count > 0)
                    {
                        var tableStyleInfoList = TableStyleManager.GetContentStyleInfoList(siteInfo, nodeInfo);

                        var nameValueCollection = new NameValueCollection();

                        foreach (var styleInfo in tableStyleInfoList)
                        {
                            nameValueCollection[styleInfo.DisplayName] = styleInfo.AttributeName.ToLower();
                        }

                        //var attributeNames = new ArrayList();
                        //for (var i = 0; i < oleDt.Columns.Count; i++)
                        //{
                        //    var columnName = oleDt.Columns[i].ColumnName;
                        //    attributeNames.Add(!string.IsNullOrEmpty(nameValueCollection[columnName])
                        //        ? nameValueCollection[columnName]
                        //        : columnName);
                        //}

                        foreach (DataRow row in oleDt.Rows)
                        {
                            var contentInfo = new ContentInfo(row);

                            if (!string.IsNullOrEmpty(contentInfo.Title))
                            {
                                contentInfo.SiteId       = siteInfo.Id;
                                contentInfo.ChannelId    = nodeInfo.Id;
                                contentInfo.LastEditDate = DateTime.Now;

                                contentInfoList.Add(contentInfo);
                            }
                        }
                    }
                }
            }

            return(contentInfoList);
        }
示例#4
0
        public static ArrayList GetContentsByAccessFile(string filePath, PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo)
        {
            var contentInfoArrayList = new ArrayList();

            var accessDao  = new AccessDao(filePath);
            var tableNames = accessDao.GetTableNames();

            if (tableNames != null && tableNames.Length > 0)
            {
                foreach (var tableName in tableNames)
                {
                    string sqlString = $"SELECT * FROM [{tableName}]";
                    var    dataset   = accessDao.ReturnDataSet(sqlString);

                    var oleDt = dataset.Tables[0];

                    if (oleDt.Rows.Count > 0)
                    {
                        var relatedidentityes = RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId);

                        var modelInfo  = ContentModelManager.GetContentModelInfo(publishmentSystemInfo, nodeInfo.ContentModelId);
                        var tableStyle = EAuxiliaryTableTypeUtils.GetTableStyle(modelInfo.TableType);

                        var tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, modelInfo.TableName, relatedidentityes);

                        var nameValueCollection = new NameValueCollection();

                        foreach (var styleInfo in tableStyleInfoList)
                        {
                            nameValueCollection[styleInfo.DisplayName] = styleInfo.AttributeName.ToLower();
                        }

                        var attributeNames = new ArrayList();
                        for (var i = 0; i < oleDt.Columns.Count; i++)
                        {
                            var columnName = oleDt.Columns[i].ColumnName;
                            if (!string.IsNullOrEmpty(nameValueCollection[columnName]))
                            {
                                attributeNames.Add(nameValueCollection[columnName]);
                            }
                            else
                            {
                                attributeNames.Add(columnName);
                            }
                        }

                        foreach (DataRow row in oleDt.Rows)
                        {
                            var contentInfo = new BackgroundContentInfo();

                            for (var i = 0; i < oleDt.Columns.Count; i++)
                            {
                                var attributeName = attributeNames[i] as string;
                                if (!string.IsNullOrEmpty(attributeName))
                                {
                                    var value = row[i].ToString();
                                    contentInfo.SetExtendedAttribute(attributeName, value);
                                }
                            }

                            if (!string.IsNullOrEmpty(contentInfo.Title))
                            {
                                contentInfo.PublishmentSystemId = publishmentSystemInfo.PublishmentSystemId;
                                contentInfo.NodeId       = nodeInfo.NodeId;
                                contentInfo.LastEditDate = DateTime.Now;

                                contentInfoArrayList.Add(contentInfo);
                            }
                        }
                    }
                }
            }

            return(contentInfoArrayList);
        }