Пример #1
0
        public static SortAttachmentObject AddAttachment(int sortMainId, string fileName, string description, AttachmentTypeEnum attachmentType, int?size)
        {
            var sao = new SortAttachmentObject()
            {
                SortMainId         = sortMainId,
                FileName           = fileName,
                Note               = description,
                AttachmentTypeEnum = attachmentType,
                IsDeleted          = false,
                Size               = CalcSize(size)
            };

            sao.Save();

            return(sao);
        }
Пример #2
0
        //public static SortAttachmentObject AddAttachment(int sortMainId, string fileName, string description, AttachmentTypeEnum attachmentType, int? size, byte[] contents)
        //{
        //    var sao = AddAttachment(sortMainId, fileName, description, attachmentType, size);
        //    repo.UploadFile(sao.SortAttachmentId, contents);

        //    return sao;
        //}

        public static SortAttachmentObject AddOstiAttachment(int sortMainId, string fileName, string employeeId, int?size, byte[] contents)
        {
            // There can be only one, so check to see if there already is one. If so, mark it as deleted.
            GetOstiAttachment(sortMainId)?.PerminateDelete();
            // Now add in a new one.
            var sao = new SortAttachmentObject()
            {
                SortMainId       = sortMainId,
                FileName         = fileName,
                Note             = "Transformed Final Document with cover sheet ready for OSTI",
                AttachmentType   = "OstiDoc",
                UploadEmployeeId = employeeId,
                IsDeleted        = false,
                Size             = "Unknown"
            };

            sao.Save(false);
            repo.UploadFile(sao.SortAttachmentId, contents);

            return(sao);
        }