/// <summary> /// GetEListCount /// </summary> /// <param name="eListCategoryTitle"></param> /// <returns></returns> private Int32 GetCount(string eListCategoryTitle) { Int32 count = 0; List <StagingeListSubcategory> sharePointData = new MongoDBContext <StagingeListSubcategory>().MongoRepositoryInstance.GetCollectionByKey("eListCategory.LookupValue", eListCategoryTitle).ToList(); if (sharePointData.IsNotNull() && sharePointData.Any()) { sharePointData.ForEach(item => { count = count + GetElistsCount(item.Title); }); } return(count); }
private void PushInitialNewReleaseCalendar() { List <Existing_NewReleaseCalendar> sharePointPromotions = new MongoDBContext <Existing_NewReleaseCalendar>().MongoRepositoryInstance.GetAll().ToList(); List <NewReleaseCalendar> existing = new MongoDBContext <NewReleaseCalendar>().MongoRepositoryInstance.GetAll().ToList(); if (existing.IsNotNull() && existing.Any()) { return; } if (sharePointPromotions.IsNotNull() && sharePointPromotions.Any()) { Random rand = new Random(); int month = rand.Next(1, 20); sharePointPromotions.ForEach(item => { NewReleaseCalendar newReleaseCalendar = new NewReleaseCalendar { AdName = item.AdName, ApprovedDate = DateTime.Today.AddDays(-5), Approver = item.Approver, Comment = item.Comment, ContentOwner = item.ContentOwner, DisplayOrder = item.DisplayOrder, ExpirationDate = DateTime.Today.AddDays(-5), IsDefault = item.IsDefault, ItemStatus = item.ItemStatus, ItemType = item.ItemType, Metadata = item.Metadata, Path = item.Path, PublishedDate = DateTime.Today.AddDays(-5), StartDate = DateTime.Today.AddDays(-5), Title = item.Title, Version = item.Version, SPListId = item.SPListId, BTKeyList = item.BTKeyList.Split('|', ','), Description = item.Description, ModifiedBy = item.ModifiedBy, ReleaseDate = DateTime.Today.AddDays(month), TopRelease = item.TopRelease, }; new MongoDBContext <NewReleaseCalendar>().MongoRepositoryInstance.Insert(newReleaseCalendar); }); } }
private void PushPromotions() { List <StagingPromotion> sharePointPromotions = new MongoDBContext <StagingPromotion>().MongoRepositoryInstance.GetAll().ToList(); List <Promotion> existing = new MongoDBContext <Promotion>().MongoRepositoryInstance.GetAll().ToList(); if (existing.IsNotNull() && existing.Any()) { return; } if (sharePointPromotions.IsNotNull() && sharePointPromotions.Any()) { sharePointPromotions.ForEach(item => { Promotion promotion = new Promotion { 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, ButtonWebtrendsTag = Convert.ToString(item.ButtonWebtrendsTag), DetailText = item.DetailText, ImageUrl = Convert.ToString(item.ImageUrl), ImageWebtrendsTag = Convert.ToString(item.ImageWebtrendsTag), PromotionCode = Convert.ToString(item.PromotionCode), SummaryText = item.SummaryText, SPListId = item.ID }; new MongoDBContext <Promotion>().MongoRepositoryInstance.Insert(promotion); }); } }
private void PushFeaturedPromotions() { List <StagingFeaturedPromotion> sharePointPromotions = new MongoDBContext <StagingFeaturedPromotion>().MongoRepositoryInstance.GetAll().ToList(); List <FeaturedPromotion> existing = new MongoDBContext <FeaturedPromotion>().MongoRepositoryInstance.GetAll().ToList(); if (existing.IsNotNull() && existing.Any()) { return; } if (sharePointPromotions.IsNotNull() && sharePointPromotions.Any()) { sharePointPromotions.ForEach(item => { FeaturedPromotion featuredPromotion = new FeaturedPromotion { AdName = item.AdName, ApprovedDate = DateTime.Now, Approver = item.Approver, Comment = item.Comment, ContentOwner = item.ContentOwner, 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, BTKeys = item.BTKeys.IsNotNull() ? item.BTKeys.Split('|') : new string[] { }, FeaturedPromoBackground = Convert.ToString(item.FeaturedPromoBackg), FeaturedPromoImage = item.FeaturedPromoImage == null ? String.Empty : item.FeaturedPromoImage.Url, FeaturedPromoText = item.FeaturedPromoText, FeaturedPromotionURL = item.FeaturedPromotionURL, DisplayOrder = item.DisplayOrder, SPListId = item.ID }; new MongoDBContext <FeaturedPromotion>().MongoRepositoryInstance.Insert(featuredPromotion); }); } }
public void PushLibrariansCorner() { List <Existing_LibrariansCorner> sharePointData = new MongoDBContext <Existing_LibrariansCorner>().MongoRepositoryInstance.GetAll().ToList(); List <LibrariansCorner> existingMongoDBData = new MongoDBContext <LibrariansCorner>().MongoRepositoryInstance.GetAll().ToList(); if (existingMongoDBData.IsNotNull() && existingMongoDBData.Any()) { return; } if (sharePointData.IsNotNull() && sharePointData.Any()) { sharePointData.ForEach(item => { LibrariansCorner data = new LibrariansCorner { AdName = item.AdName, ApprovedDate = DateTime.Now, Approver = item.Approver, Comment = item.Comment, ContentOwner = item.ContentOwner, 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, ListCategory = item.ListCategory, ListName = item.ListName, ListSubCategory = item.ListSubCategory, DisplayOrder = item.DisplayOrder, SPListId = item.SPListId, EListId = GetEListIdByName(item.ListName) }; new MongoDBContext <LibrariansCorner>().MongoRepositoryInstance.Insert(data); }); } }
public void PushFeaturedBTeLists() { List <StagingFeaturedBTeLists> sharePointData = new MongoDBContext <StagingFeaturedBTeLists>().MongoRepositoryInstance.GetAll().ToList(); List <FeaturedBTeList> existingMongoDBData = new MongoDBContext <FeaturedBTeList>().MongoRepositoryInstance.GetAll().ToList(); if (existingMongoDBData.IsNotNull() && existingMongoDBData.Any()) { return; } if (sharePointData.IsNotNull() && sharePointData.Any()) { sharePointData.ForEach(item => { FeaturedBTeList data = new FeaturedBTeList { AdName = item.AdName, ApprovedDate = DateTime.Now, Approver = item.Approver, Comment = item.Comment, ContentOwner = item.ContentOwner, 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, ListCategory = item.BTListCategory == null ? String.Empty : item.BTListCategory.LookupValue, ListName = item.BTListName == null ? String.Empty : item.BTListName.LookupValue, ListSubCategory = item.BTListSubCategory == null ? String.Empty : item.BTListSubCategory.LookupValue, SPListId = item.ID, DisplayOrder = item.DisplayOrder, EListId = GetEListIdByName(item.BTListName.LookupValue), }; new MongoDBContext <FeaturedBTeList>().MongoRepositoryInstance.Insert(data); }); } }
private void PushInitialPublicationIssues() { List <StagingPublicationIssue> existing_PublicationIssues = new MongoDBContext <StagingPublicationIssue>().MongoRepositoryInstance.GetAll().ToList(); List <PublicationIssue> existing = new MongoDBContext <PublicationIssue>().MongoRepositoryInstance.GetAll().ToList(); if (existing.IsNotNull() && existing.Any()) { return; } PublicationIssue publicationIssue; foreach (StagingPublicationIssue item in existing_PublicationIssues) { publicationIssue = new PublicationIssue { AdName = item.AdName, ApprovedDate = DateTime.Now, Approver = item.Approver, Comment = item.Comment, ContentOwner = item.ContentOwner, CoverImageUrl = item.CoverImageUrl, DisplayOrder = item.DisplayOrder, ExpirationDate = DateTime.Now, IsDefault = item.IsDefault, ItemStatus = item.ItemStatus, ItemType = item.ItemType, Metadata = item.Metadata, Path = item.FileDirRef, PdfFileUrl = item.PdfFileUrl, Publication = item.Publication == null ? String.Empty : item.Publication.LookupValue, PublicationId = new MongoDBContext <Publication>().MongoRepositoryInstance.GetCollectionByKey("Title", item.Publication.LookupValue).FirstOrDefault().Id, PublishedDate = item.PublishedDate, StartDate = item.StartDate, Title = item.Title, Version = item.Version, SPListId = item.ID }; new MongoDBContext <PublicationIssue>().MongoRepositoryInstance.Insert(publicationIssue); } }
private void PushHolidays() { List <Existing_Holidays> sharePointList = new MongoDBContext <Existing_Holidays>().MongoRepositoryInstance.GetAll().ToList(); List <Holidays> existing = new MongoDBContext <Holidays>().MongoRepositoryInstance.GetAll().ToList(); if (existing.IsNotNull() && existing.Any()) { return; } if (sharePointList.IsNotNull() && sharePointList.Any()) { sharePointList.ForEach(item => { Holidays newItem = new Holidays { 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, SPListId = item.SPListId, Date = DateTime.Now, Holiday = item.Holiday, HolidayText = item.HolidayText, }; new MongoDBContext <Holidays>().MongoRepositoryInstance.Insert(newItem); }); } }
private void PushInitialPublicationCategories() { List <StagingPublicationCategory> spLists = new MongoDBContext <StagingPublicationCategory>().MongoRepositoryInstance.GetAll().ToList(); List <PublicationCategory> mongoDBLists = new MongoDBContext <PublicationCategory>().MongoRepositoryInstance.GetAll().ToList(); if (mongoDBLists.IsNotNull() && mongoDBLists.Any()) { return; } PublicationCategory insertItem; foreach (StagingPublicationCategory item in spLists) { insertItem = new PublicationCategory { 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, PublicationIssue = item.PublicationIssue == null ? String.Empty : item.PublicationIssue.LookupValue, SPListId = item.SPListId, PublicationSubCategories = GetPublicationSubCategories(item.Title), PublicationIssueId = GetPublicationIssueIdByIssueName(item.PublicationIssue.LookupValue), }; new MongoDBContext <PublicationCategory>().MongoRepositoryInstance.Insert(insertItem); } }
private void PushInitialELists() { List <StagingeListCategory> sharePointData = new MongoDBContext <StagingeListCategory>().MongoRepositoryInstance.GetAll().ToList(); List <EListCategory> existingMongoDBData = new MongoDBContext <EListCategory>().MongoRepositoryInstance.GetAll().ToList(); if (existingMongoDBData.IsNotNull() && existingMongoDBData.Any()) { return; } if (sharePointData.IsNotNull() && sharePointData.Any()) { sharePointData.ForEach(item => { EListCategory data = new EListCategory { 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, ItemCount = GetCount(item.Title), SPListId = item.ID }; new MongoDBContext <EListCategory>().MongoRepositoryInstance.Insert(data); }); } ; }
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); }
private List <PublicationSubCategory> GetPublicationSubCategories(string title) { List <PublicationSubCategory> result = new List <PublicationSubCategory>(); List <StagingPublicationSubCategory> existingSubCat = new MongoDBContext <StagingPublicationSubCategory>().MongoRepositoryInstance.GetCollectionByKey("PublicationCategory.LookupValue", title).ToList(); if (existingSubCat.IsNotNull() && existingSubCat.Any()) { existingSubCat = existingSubCat.DistinctBy(key => key.Title).ToList(); existingSubCat.ForEach(item => { result.Add(new PublicationSubCategory { AdName = item.AdName, ApprovedDate = DateTime.Now, Approver = item.Approver, Comment = item.Comment, ContentOwner = item.ContentOwner, 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, BTKeyList = item.BTKeyList.IsNotNull() ? item.BTKeyList.Split('|') : new string[] { }, DisplayOrder = item.DisplayOrder, PublicationCategory = item.PublicationCategory.LookupValue, SPListId = item.ID }); } ); } return(result); }