Beispiel #1
0
        public static CustomList <Company_Entity> GetAllCompany_Entity()
        {
            ConnectionManager           conManager = new ConnectionManager(ConnectionName.SysMan);
            CustomList <Company_Entity> Company_EntityCollection = new CustomList <Company_Entity>();
            const String sql    = "Select *from Company";
            IDataReader  reader = null;;

            try
            {
                conManager.OpenDataReader(sql, out reader);
                while (reader.Read())
                {
                    Company_Entity newCompany_Entity = new Company_Entity();
                    newCompany_Entity.SetData(reader);
                    Company_EntityCollection.Add(newCompany_Entity);
                }
                reader.Close();
                Company_EntityCollection.SelectSpName = "spSelectCompany_Entity";
                Company_EntityCollection.InsertSpName = "spInsertCompany_Entity";
                Company_EntityCollection.UpdateSpName = "spUpdateCompany_Entity";
                Company_EntityCollection.SelectSpName = "spDeleteCompany_Entity";
                return(Company_EntityCollection);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
Beispiel #2
0
 public static CustomList<Company_Entity> GetAllCompany_Entity()
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan);
     CustomList<Company_Entity> Company_EntityCollection = new CustomList<Company_Entity>();
     const String sql = "Select *from Company";
     IDataReader reader = null; ;
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             Company_Entity newCompany_Entity = new Company_Entity();
             newCompany_Entity.SetData(reader);
             Company_EntityCollection.Add(newCompany_Entity);
         }
         reader.Close();
         Company_EntityCollection.SelectSpName = "spSelectCompany_Entity";
         Company_EntityCollection.InsertSpName = "spInsertCompany_Entity";
         Company_EntityCollection.UpdateSpName = "spUpdateCompany_Entity";
         Company_EntityCollection.SelectSpName = "spDeleteCompany_Entity";
         return Company_EntityCollection;
     }
     catch(Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }