Exemple #1
0
        /// <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);
        }
Exemple #2
0
        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);
                });
            }
        }
Exemple #3
0
        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);
                });
            }
        }
Exemple #4
0
        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);
                });
            }
        }
Exemple #5
0
        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);
                });
            }
        }
Exemple #6
0
        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);
                });
            }
        }
Exemple #7
0
        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);
                });
            }
        }
Exemple #8
0
        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);
                });
            }
            ;
        }
Exemple #9
0
        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);
        }
Exemple #10
0
        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);
        }