/// <summary>
 /// Copies the elements of the specified <see cref="MyAttachmentInfo">MyAttachmentInfo</see> array to the end of the collection.
 /// </summary>
 /// <param name="value">An array of type <see cref="MyAttachmentInfo">MyAttachmentInfo</see> containing the Components to add to the collection.</param>
 public void AddRange(MyAttachmentInfo[] value)
 {
     for (int i = 0;	(i < value.Length); i = (i + 1))
     {
         this.Add(value[i]);
     }
 }
 /// <summary>
 /// Gets a value indicating whether the collection contains the specified <see cref="MyAttachmentInfoCollection">MyAttachmentInfoCollection</see>.
 /// </summary>
 /// <param name="value">The <see cref="MyAttachmentInfoCollection">MyAttachmentInfoCollection</see> to search for in the collection.</param>
 /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns>
 public bool Contains(MyAttachmentInfo value)
 {
     return this.List.Contains(value);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MyAttachmentInfoCollection">MyAttachmentInfoCollection</see> class containing the specified array of <see cref="MyAttachmentInfo">MyAttachmentInfo</see> Components.
 /// </summary>
 /// <param name="value">An array of <see cref="MyAttachmentInfo">MyAttachmentInfo</see> Components with which to initialize the collection. </param>
 public MyAttachmentInfoCollection(MyAttachmentInfo[] value)
 {
     this.AddRange(value);
 }
 public int Add(MyAttachmentInfo value)
 {
     return this.List.Add(value);
 }
 public void Remove(MyAttachmentInfo value)
 {
     List.Remove(value);
 }
 public void Insert(int index, MyAttachmentInfo value)
 {
     List.Insert(index, value);
 }
 /// <summary>
 /// Gets the index in the collection of the specified <see cref="MyAttachmentInfoCollection">MyAttachmentInfoCollection</see>, if it exists in the collection.
 /// </summary>
 /// <param name="value">The <see cref="MyAttachmentInfoCollection">MyAttachmentInfoCollection</see> to locate in the collection.</param>
 /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns>
 public int IndexOf(MyAttachmentInfo value)
 {
     return this.List.IndexOf(value);
 }
 /// <summary>
 /// Copies the collection Components to a one-dimensional <see cref="T:System.Array">Array</see> instance beginning at the specified index.
 /// </summary>
 /// <param name="array">The one-dimensional <see cref="T:System.Array">Array</see> that is the destination of the values copied from the collection.</param>
 /// <param name="index">The index of the array at which to begin inserting.</param>
 public void CopyTo(MyAttachmentInfo[] array, int index)
 {
     this.List.CopyTo(array, index);
 }
示例#9
0
        /// <summary>
        /// 获取用户附件列表
        /// </summary>
        /// <param name="uid">用户ID</param>
        /// <param name="typeid">附件类型</param>
        /// <param name="pageIndex">当前页</param>
        /// <param name="pageSize">页面大小</param>
        /// <returns>用户附件列表</returns>
        public static List<MyAttachmentInfo> GetAttachmentByUid(int uid, int typeid, int pageIndex, int pageSize, string extNamelist)
        {
            List<MyAttachmentInfo> myattachment = new List<MyAttachmentInfo>();

            IDataReader reader;
            if (typeid == 0)
                reader = DatabaseProvider.GetInstance().GetAttachmentByUid(uid, pageIndex, pageSize);
            else
                reader = DatabaseProvider.GetInstance().GetAttachmentByUid(uid, extNamelist, pageIndex, pageSize);

            while (reader.Read())
            {
                MyAttachmentInfo info = new MyAttachmentInfo();

                info.Aid = TypeConverter.ObjectToInt(reader["aid"]);
                info.Postdatetime = reader["postdatetime"].ToString();
                info.Filename = reader["filename"].ToString().StartsWith("http://") ? reader["filename"].ToString() : "upload/" + reader["filename"].ToString().Replace("\\", "/");
                info.Description = reader["description"].ToString();
                info.Attachment = reader["attachment"].ToString();
                info.SimpleName = Utils.ConvertSimpleFileName(reader["attachment"].ToString(), "...", 6, 3, 15);
                info.Downloads = TypeConverter.ObjectToInt(reader["downloads"]);

                myattachment.Add(info);
            }
            reader.Close();
            return myattachment;
        }