public override void Execute(BbicApi.BBIC bbicContext, IfbaApi.IFBA ifbaContext) { foreach (var s in ifbaContext.SliderTable) { var bbicNewsTable = new BbicApi.NewsTable() { NewsId = s.SliderID, Active = s.Active, Position = s.Position, ImageUrl = "", CreateBy = s.CreatedBy, CreatedDateTime = s.CreatedDateTime, }; var bbicNewsLanguageTable = new BbicApi.NewsLanguageTable() { NewsId = s.SliderID, ImageText = s.Description.Length > 20 ? s.Description.Substring(0, 20) : s.Description, Detail = s.Details, Title = s.Description, NewsTable = bbicNewsTable, CreateBy = s.CreatedBy, CreatedDateTime = s.CreatedDateTime, LanguageId = Language.English, UpdatedBy = s.UpdatedBy, UpdatedDateTime = s.UpdatedDateTime }; } }
public override void Execute(BbicApi.BBIC bbicContext, IfbaApi.IFBA ifbaContext) { logger.Info("Transfering Resources"); var s1 = CopyOrgFile(); var s = CopyFiles(); foreach (var res in ifbaContext.ResourceTable) { FileTable ft = GetFileTable(res); FileWorkingGroupTable fwgt = GetFileWorkingGroupTable(res, ft); FileLanguageTable flt = GetFileLanguageTable(res, ft); AttachmentTable at = GetAttachmentTable(res, ft); UpdateAttachmentURL(res, at); if (at.URL != "~/Uploads/Document/") { bbicContext.AttachmentTable.InsertOnSubmit(at); bbicContext.FileLanguageTable.InsertOnSubmit(flt); bbicContext.FileWorkingGroupTable.InsertOnSubmit(fwgt); } else { logger.WarnFormat("Attachment for {0} was invalid, and thus it was not inserted", ft.FileId); } bbicContext.SubmitChanges(); } logger.Info("Transfering Resources - Complete"); }
public override void Execute(BbicApi.BBIC bbicContext, IfbaApi.IFBA ifbaContext) { this.logger.Info("Transfering Organisations"); foreach (var org in ifbaContext.OrganizationTable) { OrganizationTable ot = new OrganizationTable() { OrganizationId = org.OrganizationID, ImageUrl = "~/Uploads/document/organizations/" + org.OrganizationID + "/Images/smallLogo.gif", Active = org.Active, AddressId = org.AddressID, CreatedBy = org.CreatedBy, UpdatedBy = org.UpdatedBy, UpdatedDateTime = org.UpdatedDateTime, CreatedDateTime = org.CreatedDateTime, Email1 = org.Email, FaxNumber = "", MobileNumber = "", OrganizationName = org.Name, PhoneNumber = "", Position = org.Position, TableRowVersion = org.TableRowVersion, Tags = "", Type = org.Type, Website = org.URL, WorkNumber = "", }; bbicContext.OrganizationTable.InsertOnSubmit(ot); bbicContext.SubmitChanges(); } this.logger.Info("Transfering Organisations - Complete"); }
public override void Execute(BbicApi.BBIC bbicContext, IfbaApi.IFBA ifbaContext) { foreach (var addr in ifbaContext.AddressTable) { var at = new BbicApi.AddressTable() { Active = addr.Active, City = addr.City, CreatedBy = addr.CreatedBy, UpdatedBy = addr.UpdatedBy, CreatedDateTime = addr.CreatedDateTime, UpdatedDateTime = addr.UpdatedDateTime, AddressID = addr.AddressID, CountryID = new Guid("00000000-0001-0001-0001-0000000000ED"), Latitude = addr.Latitude, Longitude = addr.Longitude, TableRowVersion = addr.TableRowVersion, Type = 1 }; var alt = new AddressLanguageTable() { Region = addr.Region, Street1 = addr.Street1, Street2 = addr.Street2, City = addr.City, CreatedBy = addr.CreatedBy, UpdatedBy = addr.UpdatedBy, CreatedDateTime = addr.CreatedDateTime, UpdatedDateTime = addr.UpdatedDateTime, LanguageId = Language.English, PostalCode = addr.PostalCode, AddressTable = at, TableRowVersion = addr.TableRowVersion }; bbicContext.AddressLanguageTable.InsertOnSubmit(alt); } bbicContext.SubmitChanges(); }
private void UpdateAttachmentURL(IfbaApi.ResourceTable ifbaResource, AttachmentTable at) { if (ifbaResource.Type == (int)IfbaApi.ResourceType.Link) { at.URL = ifbaResource.Filename; } else { string path = string.Format("{0}", BbicDir + "/Uploads"); string fullName = ifbaResource.Filename.ToLower(); var ifbaPath = OrgPaths + "/" + ifbaResource.MemberID.ToString() + "/Resources/" + ifbaResource.Path + "/" + ifbaResource.Filename; var files = Directory.GetFiles(path, ifbaResource.Filename, SearchOption.TopDirectoryOnly); if (files.Length == 0) { var result = this.CopyFile(ifbaResource.Filename, ifbaPath, path); if (string.IsNullOrEmpty(result) == true) { logger.WarnFormat("{0} file cannot be found", fullName); } else { at.URL = path.Replace(BbicDir, "~/"); } } else { at.URL = path.Replace(BbicDir, "~"); } } }
private FileWorkingGroupTable GetFileWorkingGroupTable(IfbaApi.ResourceTable res, FileTable ft) { return new FileWorkingGroupTable() { WorkingGroupID = new Guid("21F11EFB-4EDE-4F62-B231-687C349C6365"), FileTable = ft, CreatedBy = res.CreatedBy, UpdatedBy = res.UpdatedBy, CreatedDateTime = res.CreatedDateTime, UpdatedDateTime = res.UpdatedDateTime, }; }
private FileTable GetFileTable(IfbaApi.ResourceTable res) { return new FileTable() { FileId = res.ResourceID, Active = res.Active, CreatedBy = res.CreatedBy, UpdatedBy = res.UpdatedBy, TableRowVersion = res.TableRowVersion, CreatedDateTime = res.CreatedDateTime, UpdatedDateTime = res.UpdatedDateTime, VirtualPath = "", Location = "", Type = res.Type, Sensitivity = res.Sensitivity, }; }
private FileLanguageTable GetFileLanguageTable(IfbaApi.ResourceTable res, FileTable ft) { return new FileLanguageTable() { LanguageId = Language.English, Name = res.Description, Description = res.Description, FileTable = ft, CreatedBy = res.CreatedBy, UpdatedBy = res.UpdatedBy, TableRowVersion = res.TableRowVersion, CreatedDateTime = res.CreatedDateTime, UpdatedDateTime = res.UpdatedDateTime, Tags = res.Path.Replace("\\", ", "), }; }
private AttachmentTable GetAttachmentTable(IfbaApi.ResourceTable res, FileTable ft) { return new AttachmentTable() { AttachmentId = res.ResourceID, CreatedBy = res.CreatedBy, UpdatedBy = res.UpdatedBy, TableRowVersion = res.TableRowVersion, CreatedDateTime = res.CreatedDateTime, UpdatedDateTime = res.UpdatedDateTime, Name = res.Filename, URL = "~/Uploads/Document/", FileTable = ft, }; }