Beispiel #1
0
 public bool Contains(Img value)
 {
     return(List.Contains(value));
 }
Beispiel #2
0
 public void Remove(Img value)
 {
     List.Remove(value);
 }
Beispiel #3
0
 public void Insert(int index, Img value)
 {
     List.Insert(index, value);
 }
Beispiel #4
0
 public int IndexOf(Img value)
 {
     return(List.IndexOf(value));
 }
Beispiel #5
0
 public int Add(Img value)
 {
     return(List.Add(value));
 }
Beispiel #6
0
        ///<summary>
        /// Lấy tất cả đối tượng
        ///
        ///</summary>
        public ImgCollection Getlist(int ProductID)
        {
            Data objData;

            if (objDataAccess == null)
            {
                objData = new Data();
            }
            else
            {
                objData = objDataAccess;
            }
            ImgCollection col = null;

            try
            {
                if (objData.GetConnection() == null || objData.GetConnection().State == ConnectionState.Closed)
                {
                    objData.Connect();
                }
                objData.CreateNewStoredProcedure("sproc_ProductImages_Getlist");
                objData.AddParameter("@ProductID", ProductID);
                IDataReader reader = objData.ExecStoreToDataReader();
                while (reader.Read())
                {
                    if (col == null)
                    {
                        col = new ImgCollection();
                    }
                    Img obj = new Img();

                    if (!Convert.IsDBNull(reader["ImageID"]))
                    {
                        obj.ImageID = Convert.ToInt32(reader["ImageID"]);
                    }
                    if (!Convert.IsDBNull(reader["ProductID"]))
                    {
                        obj.ProductID = Convert.ToInt32(reader["ProductID"]);
                    }
                    if (!Convert.IsDBNull(reader["Image"]))
                    {
                        obj.Images = Convert.ToString(reader["Image"]);
                    }
                    if (!Convert.IsDBNull(reader["Sort"]))
                    {
                        obj.Sort = Convert.ToInt32(reader["Sort"]);
                    }
                    col.Add(obj);
                }
                reader.Close();
                reader.Dispose();
            }
            catch (Exception objEx)
            {
                throw new Exception("GetAll() Error   " + objEx.Message.ToString());
            }
            finally
            {
                if (objDataAccess == null)
                {
                    objData.DeConnect();
                }
            }
            return(col);
        }