public void PushEListSubcategory() { List <StagingeListSubcategory> sharePointData = new MongoDBContext <StagingeListSubcategory>().MongoRepositoryInstance.GetAll().ToList(); List <EListSubCategory> existingMongoDBData = new MongoDBContext <EListSubCategory>().MongoRepositoryInstance.GetAll().ToList(); if (existingMongoDBData.IsNotNull() && existingMongoDBData.Any()) { return; } if (sharePointData.IsNotNull() && sharePointData.Any()) { sharePointData.ForEach(item => { EListSubCategory insertItem = new EListSubCategory { AdName = item.AdName, ApprovedDate = DateTime.Now, Approver = item.Approver, Comment = item.Comment, ContentOwner = item.ContentOwner, DisplayOrder = item.DisplayOrder, ExpirationDate = DateTime.Now, IsDefault = item.IsDefault, ItemStatus = item.ItemStatus, ItemType = item.ItemType, Metadata = item.Metadata, Path = item.FileDirRef, PublishedDate = item.PublishedDate, StartDate = item.StartDate, Title = item.Title, Version = item.Version, EListCategory = item.eListCategory == null ? String.Empty : item.eListCategory.LookupValue, ELists = GetElists(item.Title), SPListId = item.SPListId, EListCategoryId = GetElistCategoryId(item), }; new MongoDBContext <EListSubCategory>().MongoRepositoryInstance.Insert(insertItem); }); } }
private List <EListSubCategory> GetEListSubcategory(string eListCategoryTitle) { List <Existing_EListSubcategory> sharePointData = new MongoDBContext <Existing_EListSubcategory>().MongoRepositoryInstance.GetCollectionByKey("eListCategory", eListCategoryTitle).ToList(); List <EListSubCategory> result = new List <EListSubCategory>(); if (sharePointData.IsNotNull() && sharePointData.Any()) { sharePointData.ForEach(item => { EListSubCategory data = new EListSubCategory { AdName = item.AdName, ApprovedDate = DateTime.Now, Approver = item.Approver, Comment = item.Comment, ContentOwner = item.ContentOwner, DisplayOrder = item.DisplayOrder, ExpirationDate = DateTime.Now, IsDefault = item.IsDefault, ItemStatus = item.ItemStatus, ItemType = item.ItemType, Metadata = item.Metadata, Path = item.Path, PublishedDate = item.PublishedDate, StartDate = item.StartDate, Title = item.Title, Version = item.Version, EListCategory = item.eListCategory, ELists = GetElists(item.Title), SPListId = item.SPListId, }; result.Add(data); }); } return(result); }