Пример #1
0
 public bool Contains(Types value)
 {
     return(List.Contains(value));
 }
Пример #2
0
 public void Remove(Types value)
 {
     List.Remove(value);
 }
Пример #3
0
 public void Insert(int index, Types value)
 {
     List.Insert(index, value);
 }
Пример #4
0
 public int IndexOf(Types value)
 {
     return(List.IndexOf(value));
 }
Пример #5
0
 public int Add(Types value)
 {
     return(List.Add(value));
 }
Пример #6
0
        ///<summary>
        /// Lấy tất cả đối tượng
        ///
        ///</summary>
        public TypesCollection Getlist(string sTextSearch)
        {
            Data objData;

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

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

                    if (!Convert.IsDBNull(reader["TypeID"]))
                    {
                        obj.TypeID = Convert.ToInt32(reader["TypeID"]);
                    }
                    if (!Convert.IsDBNull(reader["TypeName"]))
                    {
                        obj.TypeName = Convert.ToString(reader["TypeName"]);
                    }
                    if (!Convert.IsDBNull(reader["Link"]))
                    {
                        obj.Link = 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("Getlist() Error   " + objEx.Message.ToString());
            }
            finally
            {
                if (objDataAccess == null)
                {
                    objData.DeConnect();
                }
            }
            return(col);
        }