示例#1
0
        private List <IAttachment> method_4(IObject iobject_0)
        {
            List <IAttachment> list   = new List <IAttachment>();
            IClass             class2 = iobject_0.Class;

            if (class2 is ITableAttachments)
            {
                ITableAttachments attachments = (ITableAttachments)class2;
                if (!attachments.HasAttachments)
                {
                    return(list);
                }
                IAttachmentManager attachmentManager = attachments.AttachmentManager;
                ILongArray         oids = new LongArrayClass();
                oids.Add(iobject_0.OID);
                IEnumAttachment attachmentsByParentIDs = attachmentManager.GetAttachmentsByParentIDs(oids, false);
                attachmentsByParentIDs.Reset();
                IAttachment item = null;
                while ((item = attachmentsByParentIDs.Next()) != null)
                {
                    list.Add(item);
                }
            }
            return(list);
        }
示例#2
0
 private void InitAttachment()
 {
     this.toolStripDropDownButton1.DropDownItems.Clear();
     if (this.m_pObject.Class is ITableAttachments)
     {
         ITableAttachments attachments = (ITableAttachments)this.m_pObject.Class;
         if (attachments.HasAttachments)
         {
             ToolStripItem      item;
             IAttachmentManager attachmentManager = attachments.AttachmentManager;
             ILongArray         oids = new LongArrayClass();
             oids.Add(this.m_pObject.OID);
             IEnumAttachment attachmentsByParentIDs = attachmentManager.GetAttachmentsByParentIDs(oids, false);
             attachmentsByParentIDs.Reset();
             IAttachment attachment2 = null;
             string[]    strArray    = new string[2];
             int         num         = 0;
             while ((attachment2 = attachmentsByParentIDs.Next()) != null)
             {
                 item = new ToolStripButton(attachment2.Name)
                 {
                     Tag = attachment2
                 };
                 this.toolStripDropDownButton1.DropDownItems.Add(item);
                 num++;
             }
             item = new ToolStripButton("打开附件管理器");
             this.toolStripDropDownButton1.DropDownItems.Add(item);
             this.toolAttachmentLabel.Text = string.Format("附件({0})", num);
         }
     }
 }
示例#3
0
        private void frmAttachment_Load(object sender, EventArgs e)
        {
            ListViewItem item;

            string[] strArray;
            if (this.Attachments != null)
            {
                this.btnAdd.Visible    = false;
                this.btnDelete.Visible = false;
                item     = null;
                strArray = new string[2];
                foreach (IAttachment attachment in this.Attachments)
                {
                    strArray[0] = attachment.Name;
                    strArray[1] = attachment.Size.ToString();
                    item        = new ListViewItem(strArray)
                    {
                        Tag = attachment
                    };
                    this.listView1.Items.Add(item);
                }
                this.btnAllSaveAs.Enabled = this.listView1.Items.Count > 0;
            }
            else
            {
                ITableAttachments  attachments       = (ITableAttachments)this.Object.Class;
                IAttachmentManager attachmentManager = attachments.AttachmentManager;
                ILongArray         oids = new LongArrayClass();
                oids.Add(this.Object.OID);
                IEnumAttachment attachmentsByParentIDs = attachmentManager.GetAttachmentsByParentIDs(oids, true);
                attachmentsByParentIDs.Reset();
                IAttachment attachment = null;
                item     = null;
                strArray = new string[2];
                while ((attachment = attachmentsByParentIDs.Next()) != null)
                {
                    strArray[0] = attachment.Name;
                    strArray[1] = attachment.Size.ToString();
                    item        = new ListViewItem(strArray)
                    {
                        Tag = attachment
                    };
                    this.listView1.Items.Add(item);
                }
                this.btnAllSaveAs.Enabled = this.listView1.Items.Count > 0;
            }
        }