Esempio n. 1
0
        public string GetSelectCommend(ETriState successState, string keyword, string dateFrom, string dateTo)
        {
            var whereString = new StringBuilder("WHERE ");

            if (successState != ETriState.All)
            {
                whereString.AppendFormat("IsSuccess = '{0}'", ETriStateUtils.GetValue(successState));
            }
            else
            {
                whereString.Append("1 = 1");
            }

            if (!string.IsNullOrEmpty(keyword))
            {
                whereString.Append(" AND ");
                whereString.AppendFormat("(ErrorMessage LIKE '%{0}%')", PageUtils.FilterSql(keyword));
            }

            if (!string.IsNullOrEmpty(dateFrom))
            {
                whereString.Append(" AND ");
                whereString.AppendFormat("(AddDate >= '{0}')", dateFrom);
            }
            if (!string.IsNullOrEmpty(dateTo))
            {
                whereString.Append(" AND ");
                whereString.AppendFormat("(AddDate <= '{0}')", dateTo);
            }

            return("SELECT ID, CreateType, PublishmentSystemID, TaskName, TimeSpan, IsSuccess, ErrorMessage, AddDate FROM siteserver_CreateTaskLog " + whereString);
        }
Esempio n. 2
0
        public static void CreateExcelFileForContents(string filePath, PublishmentSystemInfo publishmentSystemInfo,
                                                      NodeInfo nodeInfo, List <int> contentIdList, List <string> displayAttributes, bool isPeriods, string startDate,
                                                      string endDate, ETriState checkedState)
        {
            DirectoryUtils.CreateDirectoryIfNotExists(DirectoryUtils.GetDirectoryPath(filePath));
            FileUtils.DeleteFileIfExists(filePath);

            var head = new List <string>();
            var rows = new List <List <string> >();

            var relatedidentityes =
                RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId);
            var modelInfo          = ContentModelManager.GetContentModelInfo(publishmentSystemInfo, nodeInfo.ContentModelId);
            var tableStyle         = NodeManager.GetTableStyle(publishmentSystemInfo, nodeInfo);
            var tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(tableStyle, modelInfo.TableName,
                                                                             relatedidentityes);

            tableStyleInfoList = ContentUtility.GetAllTableStyleInfoList(publishmentSystemInfo, tableStyle,
                                                                         tableStyleInfoList);

            var tableName = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo);

            foreach (var tableStyleInfo in tableStyleInfoList)
            {
                if (displayAttributes.Contains(tableStyleInfo.AttributeName))
                {
                    head.Add(tableStyleInfo.DisplayName);
                }
            }

            if (contentIdList == null || contentIdList.Count == 0)
            {
                contentIdList = BaiRongDataProvider.ContentDao.GetContentIdList(tableName, nodeInfo.NodeId, isPeriods,
                                                                                startDate, endDate, checkedState);
            }

            foreach (var contentId in contentIdList)
            {
                var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentId);
                if (contentInfo != null)
                {
                    var row = new List <string>();

                    foreach (var tableStyleInfo in tableStyleInfoList)
                    {
                        if (displayAttributes.Contains(tableStyleInfo.AttributeName))
                        {
                            var value = contentInfo.GetExtendedAttribute(tableStyleInfo.AttributeName);
                            row.Add(StringUtils.StripTags(value));
                        }
                    }

                    rows.Add(row);
                }
            }

            CsvUtils.Export(filePath, head, rows);
        }
Esempio n. 3
0
 public static string GetText(ETriState type, string allText, string trueText, string falseText)
 {
     if (type == ETriState.All)
     {
         return(allText);
     }
     if (type == ETriState.False)
     {
         return(falseText);
     }
     return(trueText);
 }
Esempio n. 4
0
 public static bool Equals(ETriState type, string typeStr)
 {
     if (string.IsNullOrEmpty(typeStr))
     {
         return(false);
     }
     if (string.Equals(GetValue(type).ToLower(), typeStr.ToLower()))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 5
0
        /// <summary>Cycle through the tri-states</summary>
        private static ETriState NextState(ETriState state)
        {
            switch (state)
            {
            default: throw new Exception("Unknown tri state");

            case ETriState.Unchecked: return(ETriState.Checked);

            case ETriState.Checked: return(ETriState.Unchecked);

            case ETriState.Indeterminate: return(ETriState.Checked);
            }
        }
        public ArrayList GetCategoryClassInfoArrayList(int publishmentSystemId, ETriState isSystem, ETriState isEnabled)
        {
            var arraylist = new ArrayList();

            var selectParms = new IDataParameter[]
            {
                GetParameter(ParmPublishmentsystemid, EDataType.Integer, publishmentSystemId)
            };

            using (var rdr = ExecuteReader(SqlSelectAll, selectParms))
            {
                while (rdr.Read())
                {
                    var i = 0;
                    var categoryClassInfo = new GovPublicCategoryClassInfo(GetString(rdr, i++), GetInt(rdr, i++), GetString(rdr, i++), GetBool(rdr, i++), GetBool(rdr, i++), GetString(rdr, i++), GetInt(rdr, i++), GetString(rdr, i));
                    if (isSystem == ETriState.False)
                    {
                        if (categoryClassInfo.IsSystem)
                        {
                            continue;
                        }
                    }
                    else if (isSystem == ETriState.True)
                    {
                        if (!categoryClassInfo.IsSystem)
                        {
                            continue;
                        }
                    }
                    if (isEnabled == ETriState.False)
                    {
                        if (categoryClassInfo.IsEnabled)
                        {
                            continue;
                        }
                    }
                    else if (isEnabled == ETriState.True)
                    {
                        if (!categoryClassInfo.IsEnabled)
                        {
                            continue;
                        }
                    }
                    arraylist.Add(categoryClassInfo);
                }
                rdr.Close();
            }

            return(arraylist);
        }
Esempio n. 7
0
        public static void CreateExcelFileForContents(string filePath, SiteInfo siteInfo,
                                                      ChannelInfo channelInfo, List <int> contentIdList, List <string> displayAttributes, bool isPeriods, string startDate,
                                                      string endDate, ETriState checkedState)
        {
            DirectoryUtils.CreateDirectoryIfNotExists(DirectoryUtils.GetDirectoryPath(filePath));
            FileUtils.DeleteFileIfExists(filePath);

            var head = new List <string>();
            var rows = new List <List <string> >();

            var tableName     = ChannelManager.GetTableName(siteInfo, channelInfo);
            var styleInfoList = ContentUtility.GetAllTableStyleInfoList(TableStyleManager.GetContentStyleInfoList(siteInfo, channelInfo));

            foreach (var styleInfo in styleInfoList)
            {
                if (displayAttributes.Contains(styleInfo.AttributeName))
                {
                    head.Add(styleInfo.DisplayName);
                }
            }

            if (contentIdList == null || contentIdList.Count == 0)
            {
                contentIdList = DataProvider.ContentDao.GetContentIdList(tableName, channelInfo.Id, isPeriods,
                                                                         startDate, endDate, checkedState);
            }

            foreach (var contentId in contentIdList)
            {
                var contentInfo = ContentManager.GetContentInfo(siteInfo, channelInfo, contentId);
                if (contentInfo != null)
                {
                    var row = new List <string>();

                    foreach (var styleInfo in styleInfoList)
                    {
                        if (displayAttributes.Contains(styleInfo.AttributeName))
                        {
                            var value = contentInfo.GetString(styleInfo.AttributeName);
                            row.Add(StringUtils.StripTags(value));
                        }
                    }

                    rows.Add(row);
                }
            }

            CsvUtils.Export(filePath, head, rows);
        }
Esempio n. 8
0
 public static string GetValue(ETriState type)
 {
     if (type == ETriState.All)
     {
         return("All");
     }
     if (type == ETriState.True)
     {
         return("True");
     }
     if (type == ETriState.False)
     {
         return("False");
     }
     throw new Exception();
 }
Esempio n. 9
0
        public static void CreateExcelFileForUsers(string filePath, ETriState checkedState)
        {
            DirectoryUtils.CreateDirectoryIfNotExists(DirectoryUtils.GetDirectoryPath(filePath));
            FileUtils.DeleteFileIfExists(filePath);

            var head = new List <string>
            {
                "用户名",
                "姓名",
                "邮箱",
                "手机",
                "用户组",
                "注册时间",
                "最后一次活动时间"
            };
            var rows = new List <List <string> >();

            var userIdList = BaiRongDataProvider.UserDao.GetUserIdList(checkedState != ETriState.False);

            if (checkedState == ETriState.All)
            {
                userIdList.AddRange(BaiRongDataProvider.UserDao.GetUserIdList(false));
            }

            foreach (var userId in userIdList)
            {
                var userInfo = BaiRongDataProvider.UserDao.GetUserInfo(userId);

                rows.Add(new List <string>
                {
                    userInfo.UserName,
                    userInfo.DisplayName,
                    userInfo.Email,
                    userInfo.Mobile,
                    UserGroupManager.GetGroupName(userInfo.GroupId),
                    DateUtils.GetDateAndTimeString(userInfo.CreateDate),
                    DateUtils.GetDateAndTimeString(userInfo.LastActivityDate)
                });
            }

            CsvUtils.Export(filePath, head, rows);
        }
Esempio n. 10
0
        private bool ExportContentZip(int channelId, List <int> contentIdArrayList, bool isPeriods, string dateFrom, string dateTo, ETriState checkedState, out string fileName)
        {
            var nodeInfo = ChannelManager.GetChannelInfo(SiteId, channelId);

            fileName = $"{nodeInfo.ChannelName}.zip";
            var filePath     = PathUtils.GetTemporaryFilesPath(fileName);
            var exportObject = new ExportObject(SiteId);

            return(exportObject.ExportContents(filePath, channelId, contentIdArrayList, isPeriods, dateFrom, dateTo, checkedState));
        }
Esempio n. 11
0
        public ArrayList GetInsertSqlStringArrayList(string nodeName, int publishmentSystemId, int nodeId, ETableStyle tableStyle, string tableName, List <TableStyleInfo> styleInfoList, List <string> displayAttributes, List <int> contentIdList, bool isPeriods, string dateFrom, string dateTo, ETriState checkedState, out bool isExport)
        {
            var insertSqlArrayList = new ArrayList();

            var preInsertBuilder = new StringBuilder();

            preInsertBuilder.Append($"INSERT INTO {nodeName} (");

            foreach (var tableStyleInfo in styleInfoList)
            {
                if (displayAttributes.Contains(tableStyleInfo.AttributeName))
                {
                    preInsertBuilder.Append($"[{tableStyleInfo.DisplayName}], ");
                }
            }

            preInsertBuilder.Length = preInsertBuilder.Length - 2;
            preInsertBuilder.Append(") VALUES (");

            if (contentIdList == null || contentIdList.Count == 0)
            {
                contentIdList = BaiRongDataProvider.ContentDao.GetContentIdList(tableName, nodeId, isPeriods, dateFrom, dateTo, checkedState);
            }

            isExport = contentIdList.Count > 0;

            foreach (var contentId in contentIdList)
            {
                var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentId);
                if (contentInfo != null)
                {
                    var insertBuilder = new StringBuilder();
                    insertBuilder.Append(preInsertBuilder);

                    foreach (var tableStyleInfo in styleInfoList)
                    {
                        if (displayAttributes.Contains(tableStyleInfo.AttributeName))
                        {
                            var value = contentInfo.GetExtendedAttribute(tableStyleInfo.AttributeName);
                            insertBuilder.Append($"'{SqlUtils.ToSqlString(StringUtils.StripTags(value))}', ");
                        }
                    }

                    insertBuilder.Length = insertBuilder.Length - 2;
                    insertBuilder.Append(") ");

                    insertSqlArrayList.Add(insertBuilder.ToString());
                }
            }
            return(insertSqlArrayList);
        }
Esempio n. 12
0
        public string GetSelectCommend(ETableStyle tableStyle, string tableName, int publishmentSystemId, int nodeId, bool isSystemAdministrator, List <int> owningNodeIdList, string searchType, string keyword, string dateFrom, string dateTo, bool isSearchChildren, ETriState checkedState, bool isNoDup, bool isTrashContent, bool isWritingOnly, string userNameOnly)
        {
            var nodeInfo   = NodeManager.GetNodeInfo(publishmentSystemId, nodeId);
            var nodeIdList = DataProvider.NodeDao.GetNodeIdListByScopeType(nodeInfo, isSearchChildren ? EScopeType.All : EScopeType.Self, string.Empty, string.Empty, nodeInfo.ContentModelId);

            var list = new List <int>();

            if (isSystemAdministrator)
            {
                list = nodeIdList;
            }
            else
            {
                foreach (int theNodeId in nodeIdList)
                {
                    if (owningNodeIdList.Contains(theNodeId))
                    {
                        list.Add(theNodeId);
                    }
                }
            }

            return(BaiRongDataProvider.ContentDao.GetSelectCommendByCondition(tableStyle, tableName, publishmentSystemId, list, searchType, keyword, dateFrom, dateTo, checkedState, isNoDup, isTrashContent, isWritingOnly, userNameOnly));
        }
Esempio n. 13
0
 public string GetSelectCommend(ETableStyle tableStyle, string tableName, int publishmentSystemId, int nodeId, bool isSystemAdministrator, List <int> owningNodeIdList, string searchType, string keyword, string dateFrom, string dateTo, bool isSearchChildren, ETriState checkedState)
 {
     return(GetSelectCommend(tableStyle, tableName, publishmentSystemId, nodeId, isSystemAdministrator, owningNodeIdList, searchType, keyword, dateFrom, dateTo, isSearchChildren, checkedState, false, false));
 }
Esempio n. 14
0
 public TreeNode(string text, ETriState state)
 {
     Name     = text.ToLowerInvariant();
     Text     = text;
     TriState = state;
 }
Esempio n. 15
0
        public static int GetCountOfContentAdd(string tableName, int siteId, int channelId, EScopeType scope,
                                               DateTime begin, DateTime end, string userName, ETriState checkedState)
        {
            var cacheKey = StlCacheUtils.GetCacheKey(nameof(Content), nameof(GetCountOfContentAdd),
                                                     siteId.ToString(), channelId.ToString(), EScopeTypeUtils.GetValue(scope),
                                                     DateUtils.GetDateString(begin), DateUtils.GetDateString(end), userName, ETriStateUtils.GetValue(checkedState));
            var retval = StlCacheUtils.GetIntCache(cacheKey);

            if (retval != -1)
            {
                return(retval);
            }

            lock (LockObject)
            {
                retval = StlCacheUtils.GetIntCache(cacheKey);
                if (retval == -1)
                {
                    retval = DataProvider.ContentDao.GetCountOfContentAdd(tableName, siteId, channelId, scope,
                                                                          begin, end, userName, checkedState);
                    StlCacheUtils.SetCache(cacheKey, retval);
                }
            }

            return(retval);
        }
Esempio n. 16
0
        public UserGroupInfoExtend(bool isAllowVisit, bool isAllowHide, bool isAllowSignature, ETriState searchType, int searchInterval, bool isAllowRead, bool isAllowPost, bool isAllowReply, bool isAllowPoll, int maxPostPerDay, int postInterval, ETriState uploadType, ETriState downloadType, bool isAllowSetAttachmentPermissions, int maxSize, int maxSizePerDay, int maxNumPerDay, string attachmentExtensions)
        {
            var nameValueCollection = new NameValueCollection();

            SetExtendedAttribute(nameValueCollection);

            IsAllowVisit     = isAllowVisit;
            IsAllowHide      = isAllowHide;
            IsAllowSignature = isAllowSignature;
            SearchType       = ETriStateUtils.GetValue(searchType);
            SearchInterval   = searchInterval;
            IsAllowRead      = isAllowRead;
            IsAllowPost      = isAllowPost;
            IsAllowReply     = isAllowReply;
            IsAllowPoll      = isAllowPoll;
            MaxPostPerDay    = maxPostPerDay;
            PostInterval     = postInterval;
            UploadType       = ETriStateUtils.GetValue(uploadType);
            DownloadType     = ETriStateUtils.GetValue(downloadType);
            IsAllowSetAttachmentPermissions = isAllowSetAttachmentPermissions;
            MaxSize              = maxSize;
            MaxSizePerDay        = maxSizePerDay;
            MaxNumPerDay         = maxNumPerDay;
            AttachmentExtensions = attachmentExtensions;
        }
Esempio n. 17
0
        public List <string> GetInsertSqlStringList(string nodeName, int siteId, int channelId, string tableName, List <TableStyleInfo> styleInfoList, List <string> displayAttributes, List <int> contentIdList, bool isPeriods, string dateFrom, string dateTo, ETriState checkedState, out bool isExport)
        {
            var siteInfo      = SiteManager.GetSiteInfo(siteId);
            var channelInfo   = ChannelManager.GetChannelInfo(siteId, channelId);
            var insertSqlList = new List <string>();

            var preInsertBuilder = new StringBuilder();

            preInsertBuilder.Append($"INSERT INTO {nodeName} (");

            foreach (var tableStyleInfo in styleInfoList)
            {
                if (displayAttributes.Contains(tableStyleInfo.AttributeName))
                {
                    preInsertBuilder.Append($"[{tableStyleInfo.DisplayName}], ");
                }
            }

            preInsertBuilder.Length = preInsertBuilder.Length - 2;
            preInsertBuilder.Append(") VALUES (");

            if (contentIdList == null || contentIdList.Count == 0)
            {
                contentIdList = DataProvider.ContentDao.GetContentIdList(tableName, channelId, isPeriods, dateFrom, dateTo, checkedState);
            }

            isExport = contentIdList.Count > 0;

            foreach (var contentId in contentIdList)
            {
                var contentInfo = ContentManager.GetContentInfo(siteInfo, channelInfo, contentId);
                if (contentInfo == null)
                {
                    continue;
                }

                var insertBuilder = new StringBuilder();
                insertBuilder.Append(preInsertBuilder);

                foreach (var tableStyleInfo in styleInfoList)
                {
                    if (displayAttributes.Contains(tableStyleInfo.AttributeName))
                    {
                        var value = contentInfo.GetString(tableStyleInfo.AttributeName);
                        insertBuilder.Append($"'{SqlUtils.ToSqlString(StringUtils.StripTags(value))}', ");
                    }
                }

                insertBuilder.Length = insertBuilder.Length - 2;
                insertBuilder.Append(") ");

                insertSqlList.Add(insertBuilder.ToString());
            }
            return(insertSqlList);
        }
Esempio n. 18
0
        private bool ExportContentZip(int nodeId, List <int> contentIdArrayList, bool isPeriods, string dateFrom, string dateTo, ETriState checkedState, out string fileName)
        {
            var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeId);

            fileName = $"{nodeInfo.NodeName}.zip";
            var filePath     = PathUtils.GetTemporaryFilesPath(fileName);
            var exportObject = new ExportObject(PublishmentSystemId);

            return(exportObject.ExportContents(filePath, nodeId, contentIdArrayList, isPeriods, dateFrom, dateTo, checkedState));
        }
Esempio n. 19
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);
        }
Esempio n. 20
0
        private bool ExportContentAccess(int channelId, List <int> contentIdArrayList, List <string> displayAttributes, bool isPeriods, string dateFrom, string dateTo, ETriState checkedState, out string fileName)
        {
            var nodeInfo = ChannelManager.GetChannelInfo(SiteId, channelId);

            fileName = $"{nodeInfo.ChannelName}.mdb";
            var filePath = PathUtils.GetTemporaryFilesPath(fileName);

            return(AccessObject.CreateAccessFileForContents(filePath, SiteInfo, nodeInfo, contentIdArrayList, displayAttributes, isPeriods, dateFrom, dateTo, checkedState));
        }
Esempio n. 21
0
        private void ExportContentExcel(int channelId, List <int> contentIdList, List <string> displayAttributes, bool isPeriods, string dateFrom, string dateTo, ETriState checkedState, out string fileName)
        {
            var nodeInfo = ChannelManager.GetChannelInfo(SiteId, channelId);

            fileName = $"{nodeInfo.ChannelName}.csv";
            var filePath = PathUtils.GetTemporaryFilesPath(fileName);

            ExcelObject.CreateExcelFileForContents(filePath, SiteInfo, nodeInfo, contentIdList, displayAttributes, isPeriods, dateFrom, dateTo, checkedState);
        }
Esempio n. 22
0
 public static bool Equals(string typeStr, ETriState type)
 {
     return(Equals(type, typeStr));
 }
Esempio n. 23
0
 public static string GetRedirectUrlStringToExportContent(int siteId, int channelId,
                                                          string exportType, string contentIdCollection, string displayAttributes, bool isPeriods,
                                                          string startDate, string endDate, ETriState checkedState)
 {
     return(PageUtils.GetCmsUrl(siteId, nameof(ModalExportMessage), new NameValueCollection
     {
         { "channelId", channelId.ToString() },
         { "ExportType", exportType },
         { "contentIdCollection", contentIdCollection },
         { "DisplayAttributes", displayAttributes },
         { "isPeriods", isPeriods.ToString() },
         { "startDate", startDate },
         { "endDate", endDate },
         { "checkedState", ETriStateUtils.GetValue(checkedState) }
     }));
 }
Esempio n. 24
0
 private void SetTriStateInternal(ETriState state)
 {
     m_tristate      = state;
     Checked         = state == ETriState.Checked;
     StateImageIndex = (int)state - 1;
 }
Esempio n. 25
0
        public bool ExportContents(string filePath, int channelId, List <int> contentIdArrayList, bool isPeriods, string dateFrom, string dateTo, ETriState checkedState)
        {
            var siteContentDirectoryPath = PathUtils.Combine(DirectoryUtils.GetDirectoryPath(filePath), PathUtils.GetFileNameWithoutExtension(filePath));

            FileUtils.DeleteFileIfExists(filePath);
            DirectoryUtils.DeleteDirectoryIfExists(siteContentDirectoryPath);
            DirectoryUtils.CreateDirectoryIfNotExists(siteContentDirectoryPath);

            var contentIe = new ContentIe(_siteInfo, siteContentDirectoryPath);
            var isExport  = contentIe.ExportContents(_siteInfo, channelId, contentIdArrayList, isPeriods, dateFrom, dateTo, checkedState);

            if (isExport)
            {
                ZipUtils.PackFiles(filePath, siteContentDirectoryPath);
                DirectoryUtils.DeleteDirectoryIfExists(siteContentDirectoryPath);
            }
            return(isExport);
        }
Esempio n. 26
0
        public bool ExportContents(SiteInfo siteInfo, int channelId, List <int> contentIdList, bool isPeriods, string dateFrom, string dateTo, ETriState checkedState)
        {
            var filePath    = _siteContentDirectoryPath + PathUtils.SeparatorChar + "contents.xml";
            var channelInfo = ChannelManager.GetChannelInfo(siteInfo.Id, channelId);
            var feed        = AtomUtility.GetEmptyFeed();

            if (contentIdList == null || contentIdList.Count == 0)
            {
                var tableName = ChannelManager.GetTableName(siteInfo, channelInfo);
                contentIdList = DataProvider.ContentDao.GetContentIdList(tableName, channelId, isPeriods, dateFrom, dateTo, checkedState);
            }
            if (contentIdList.Count == 0)
            {
                return(false);
            }

            var collection = new NameValueCollection();

            foreach (var contentId in contentIdList)
            {
                var contentInfo = ContentManager.GetContentInfo(siteInfo, channelInfo, contentId);
                try
                {
                    ContentUtility.PutImagePaths(siteInfo, contentInfo, collection);
                }
                catch
                {
                    // ignored
                }
                var entry = ExportContentInfo(contentInfo);
                feed.Entries.Add(entry);
            }
            feed.Save(filePath);

            foreach (string imageUrl in collection.Keys)
            {
                var sourceFilePath = collection[imageUrl];
                var destFilePath   = PathUtility.MapPath(_siteContentDirectoryPath, imageUrl);
                DirectoryUtils.CreateDirectoryIfNotExists(destFilePath);
                FileUtils.MoveFile(sourceFilePath, destFilePath, true);
            }

            return(true);
        }
Esempio n. 27
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);
        }