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, "~"); } } }
partial void DeleteAttachmentTable(AttachmentTable instance);
partial void InsertAttachmentTable(AttachmentTable instance);
partial void UpdateAttachmentTable(AttachmentTable instance);
private void detach_AttachmentTable(AttachmentTable entity) { this.SendPropertyChanging(); entity.FileTable = null; }