public List <SYS_CategoryManager> SelectAllSYS_CategoryManager()
        {
            List <SYS_CategoryManager> sys_categorymanager = new List <SYS_CategoryManager>();
            DbDataReader reader = null;
            DbConnection conn   = _DbHelper.CreateConnection(Common.ConnectionString);

            conn.Open();
            try
            {
                reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_CategoryManager_SelectAll]", (DbParameter[])null);
                if (reader.HasRows)
                {
                    SYS_CategoryManagerDataAccess.SetListSYS_CategoryManagerInfoAddColumnCategory(ref reader, ref sys_categorymanager);
                }
                return(sys_categorymanager);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format(" SYS_CategoryManagerDataAccess.SelectAll: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }
        public SYS_CategoryManager SelectSYS_CategoryManager(int ID)
        {
            SYS_CategoryManager sys_categorymanager = new SYS_CategoryManager();
            DbDataReader        reader = null;
            DbConnection        conn   = _DbHelper.CreateConnection(Common.ConnectionString);

            conn.Open();
            try
            {
                List <DbParameter> para = new List <DbParameter>();
                para.Add(_DbHelper.CreateParameter(FIELD_ID, ID, false));

                reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_CategoryManager_SelectById]", para.ToArray());
                if (reader.HasRows && reader.Read())
                {
                    SYS_CategoryManagerDataAccess.SetSYS_CategoryManagerInfo(reader, ref sys_categorymanager);
                }
                return(sys_categorymanager);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("SYS_CategoryManagerDataAccess.SelectById: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }
        private static void SetListSYS_CategoryManagerInfo(ref DbDataReader reader, ref List <SYS_CategoryManager> sys_categorymanagers)
        {
            SYS_CategoryManager sys_categorymanager = null;

            while (reader.Read())
            {
                sys_categorymanager = new SYS_CategoryManager();
                SYS_CategoryManagerDataAccess.SetSYS_CategoryManagerInfo(reader, ref sys_categorymanager);
                sys_categorymanagers.Add(sys_categorymanager);
            }
        }
        private static void SetListSYS_CategoryManagerInfoAddColumnCategory(ref DbDataReader reader, ref List <SYS_CategoryManager> sys_categorymanagers)
        {
            SYS_CategoryManager          sys_categorymanager         = null;
            SYS_ColumnCategoryDataAccess sysColumnCategoryDataAccess = new SYS_ColumnCategoryDataAccess();

            while (reader.Read())
            {
                sys_categorymanager = new SYS_CategoryManager();
                SYS_CategoryManagerDataAccess.SetSYS_CategoryManagerInfo(reader, ref sys_categorymanager);
                sys_categorymanager.LstColumnCategory = sysColumnCategoryDataAccess.SelectAllSYS_ColumnCategoryByIDCategoryManager(sys_categorymanager.ID);
                sys_categorymanagers.Add(sys_categorymanager);
            }
        }