Exemple #1
0
 public bool Contains(Categories value)
 {
     return(List.Contains(value));
 }
Exemple #2
0
 public void Remove(Categories value)
 {
     List.Remove(value);
 }
Exemple #3
0
 public void Insert(int index, Categories value)
 {
     List.Insert(index, value);
 }
Exemple #4
0
 public int IndexOf(Categories value)
 {
     return(List.IndexOf(value));
 }
Exemple #5
0
 public int Add(Categories value)
 {
     return(List.Add(value));
 }
Exemple #6
0
        ///<summary>
        /// Lấy tất cả đối tượng
        ///
        ///</summary>
        public CategoriesCollection GetAll(string sTextSearch, int TypeID)
        {
            Data objData;

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

            try
            {
                if (objData.GetConnection() == null || objData.GetConnection().State == ConnectionState.Closed)
                {
                    objData.Connect();
                }
                objData.CreateNewStoredProcedure("sproc_Categories_GetByTypeID");
                objData.AddParameter("@TextSearch", sTextSearch);
                objData.AddParameter("@TypeID", TypeID);
                IDataReader reader = objData.ExecStoreToDataReader();
                while (reader.Read())
                {
                    if (col == null)
                    {
                        col = new CategoriesCollection();
                    }
                    Categories obj = new Categories();

                    if (!Convert.IsDBNull(reader["CategoryID"]))
                    {
                        obj.CategoryID = Convert.ToInt32(reader["CategoryID"]);
                    }
                    if (!Convert.IsDBNull(reader["TypeID"]))
                    {
                        obj.TypeID = Convert.ToInt32(reader["TypeID"]);
                    }
                    if (!Convert.IsDBNull(reader["CategoryName"]))
                    {
                        obj.CategoryName = Convert.ToString(reader["CategoryName"]);
                    }
                    if (!Convert.IsDBNull(reader["Link"]))
                    {
                        obj.Links = Convert.ToString(reader["Link"]);
                    }
                    if (!Convert.IsDBNull(reader["Sort"]))
                    {
                        obj.Sort = Convert.ToString(reader["Sort"]);
                    }
                    if (!Convert.IsDBNull(reader["Status"]))
                    {
                        obj.IsActived = Convert.ToBoolean(reader["Status"]);
                    }
                    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);
        }