public bool Contains(Categories value) { return(List.Contains(value)); }
public void Remove(Categories value) { List.Remove(value); }
public void Insert(int index, Categories value) { List.Insert(index, value); }
public int IndexOf(Categories value) { return(List.IndexOf(value)); }
public int Add(Categories value) { return(List.Add(value)); }
///<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); }