Exemplo n.º 1
0
        public override void Execute(BBIC bbicContext, IFBA ifbaContext)
        {
            IEnumerable<INewsTable> newsItems = new List<INewsTable>(ifbaContext.SliderTable.Cast<INewsTable>());

            newsItems = newsItems.Concat(ifbaContext.NewsTable.Cast<INewsTable>());

            foreach (INewsTable ifbaNewsTable in newsItems)
            {
                var bbicNewsTable = new BbicApi.NewsTable()
                {
                    NewsId = ifbaNewsTable.NewsID,
                    Active = ifbaNewsTable.Active,
                    CreateBy = ifbaNewsTable.CreatedBy,
                    CreatedDateTime = ifbaNewsTable.CreatedDateTime,
                    ImageUrl = "~/News/Images",
                    Position = null, //Remove all positions for non slider content
                };

                if (ifbaNewsTable is SliderTable)
                {
                    bbicNewsTable.Position = ifbaNewsTable.Position;
                }

                var bbicNewsLanguageTable = new NewsLanguageTable()
                {
                    NewsTable = bbicNewsTable,
                    Detail = ifbaNewsTable.Details,
                    CreatedDateTime = bbicNewsTable.CreatedDateTime,
                    UpdatedDateTime = ifbaNewsTable.UpdatedDateTime,
                    UpdatedBy = ifbaNewsTable.UpdatedBy,
                    CreateBy = ifbaNewsTable.UpdatedBy,
                    ImageText = ifbaNewsTable.Description.Length > 20 ? ifbaNewsTable.Description.Substring(0, 20) : ifbaNewsTable.Description,
                    Title = ifbaNewsTable.Description,
                    LanguageId = Language.English
                };

                if (ifbaNewsTable.Description.Length > 100)
                {
                    bbicNewsLanguageTable.Title = ifbaNewsTable.Description.Substring(0, 100);
                }

                bbicContext.NewsLanguageTable.InsertOnSubmit(bbicNewsLanguageTable);
                bbicContext.SubmitChanges();
            }
        }
Exemplo n.º 2
0
 partial void UpdateNewsTable(NewsTable instance);
Exemplo n.º 3
0
 partial void DeleteNewsTable(NewsTable instance);
Exemplo n.º 4
0
 partial void InsertNewsTable(NewsTable instance);