예제 #1
0
파일: Categories.cs 프로젝트: luuphat/TBHP
 public bool Contains(Categories value)
 {
     return(List.Contains(value));
 }
예제 #2
0
파일: Categories.cs 프로젝트: luuphat/TBHP
 public void Remove(Categories value)
 {
     List.Remove(value);
 }
예제 #3
0
파일: Categories.cs 프로젝트: luuphat/TBHP
 public void Insert(int index, Categories value)
 {
     List.Insert(index, value);
 }
예제 #4
0
파일: Categories.cs 프로젝트: luuphat/TBHP
 public int IndexOf(Categories value)
 {
     return(List.IndexOf(value));
 }
예제 #5
0
파일: Categories.cs 프로젝트: luuphat/TBHP
 public int Add(Categories value)
 {
     return(List.Add(value));
 }
예제 #6
0
파일: Categories.cs 프로젝트: luuphat/TBHP
        ///<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);
        }