public Core.Business.AccountGroup Select(long id)
        {
            SqlServerUtility sql = new SqlServerUtility(SqlConnection);

            sql.AddParameter("@Id", SqlDbType.BigInt, id);
            SqlDataReader reader = sql.ExecuteSPReader("USP_AccountGroup_Select_By_Id");

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.AccountGroup accountGroup = new Core.Business.AccountGroup();

                if (!reader.IsDBNull(0)) accountGroup.Id = reader.GetInt64(0);
                if (!reader.IsDBNull(1)) accountGroup.AccountId = reader.GetInt64(1);
                if (!reader.IsDBNull(2)) accountGroup.GroupId = reader.GetInt32(2);
                if (!reader.IsDBNull(3)) accountGroup.DateCreated = reader.GetDateTime(3);
                if (!reader.IsDBNull(4)) accountGroup.Role = reader.GetInt32(4);
                if (!reader.IsDBNull(5)) accountGroup.LastVisitDate = reader.GetDateTime(5);
                if (!reader.IsDBNull(6)) accountGroup.Name = reader.GetString(6);

                reader.Close();
                return accountGroup;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }
        public IList<Core.Business.AccountGroup> GetAllAccountGroup()
        {
            IList<Core.Business.AccountGroup> accountGrouplist = new List<Core.Business.AccountGroup>();
            SqlServerUtility sql = new SqlServerUtility(SqlConnection);

            SqlDataReader reader = sql.ExecuteSPReader("[USP_AccountGroup_Select_All]");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.AccountGroup accountGroup = new Core.Business.AccountGroup();

                    if (!reader.IsDBNull(0)) accountGroup.Id = reader.GetInt64(0);
                    if (!reader.IsDBNull(1)) accountGroup.AccountId = reader.GetInt64(1);
                    if (!reader.IsDBNull(2)) accountGroup.GroupId = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) accountGroup.DateCreated = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) accountGroup.Role = reader.GetInt32(4);
                    if (!reader.IsDBNull(5)) accountGroup.LastVisitDate = reader.GetDateTime(5);
                    if (!reader.IsDBNull(6)) accountGroup.Name = reader.GetString(6);

                    accountGroup.MarkOld();
                    accountGrouplist.Add(accountGroup);
                }
                reader.Close();
            }
            return accountGrouplist;
        }