public override void Execute(BBIC bbicContext, IFBA ifbaContext) { foreach (var cal in ifbaContext.EventTable) { CalendarTable cl = new CalendarTable() { StartDateTime = cal.StartDateTime, EndDateTime = cal.EndDateTime, Position = cal.Position, Sensitivity = cal.Sensitivity, Active = cal.Active, AddressID = cal.AddressID, CreatedBy = cal.CreatedBy, UpdatedBy = cal.UpdatedBy, CreatedDateTime = cal.CreatedDateTime, UpdatedDateTime = cal.UpdatedDateTime, Type = cal.Type, CalendarID = cal.EventID, WorkingGroupId = new Guid("21F11EFB-4EDE-4F62-B231-687C349C6365"), }; CalendarLanguageTable clt = new CalendarLanguageTable() { CalendarTable = cl, LanguageId = Language.English, CreatedBy = cl.CreatedBy, UpdatedBy = cl.UpdatedBy, CreatedDateTime = cl.CreatedDateTime, UpdatedDateTime = cl.UpdatedDateTime, Name = cal.Name, Description = cal.Description, Details = cal.Details, TimeZoneID = new Guid("00000000-0001-0001-0001-000000000055"), }; CalendarWorkingGroupTable cwg = new CalendarWorkingGroupTable() { CalendarTable = cl, WorkingGroupId = new Guid("21F11EFB-4EDE-4F62-B231-687C349C6365"), CreatedBy = cal.CreatedBy, UpdatedBy = cal.UpdatedBy, CreatedDateTime = cal.CreatedDateTime, UpdatedDateTime = cal.UpdatedDateTime }; bbicContext.CalendarLanguageTable.InsertOnSubmit(clt); bbicContext.SubmitChanges(); } }
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(); } }